|
|
|
@ -8,6 +8,7 @@ import android.widget.Toast |
|
|
|
import androidx.core.app.ActivityOptionsCompat |
|
|
|
import androidx.core.app.ActivityOptionsCompat |
|
|
|
import androidx.core.view.isVisible |
|
|
|
import androidx.core.view.isVisible |
|
|
|
import androidx.interpolator.view.animation.FastOutSlowInInterpolator |
|
|
|
import androidx.interpolator.view.animation.FastOutSlowInInterpolator |
|
|
|
|
|
|
|
import com.android.billingclient.api.Purchase |
|
|
|
import com.google.android.material.tabs.TabLayout |
|
|
|
import com.google.android.material.tabs.TabLayout |
|
|
|
import io.realm.RealmModel |
|
|
|
import io.realm.RealmModel |
|
|
|
import io.realm.RealmResults |
|
|
|
import io.realm.RealmResults |
|
|
|
@ -37,11 +38,12 @@ import net.pokeranalytics.android.ui.view.RowRepresentable |
|
|
|
import net.pokeranalytics.android.ui.view.SmoothScrollLinearLayoutManager |
|
|
|
import net.pokeranalytics.android.ui.view.SmoothScrollLinearLayoutManager |
|
|
|
import net.pokeranalytics.android.util.Preferences |
|
|
|
import net.pokeranalytics.android.util.Preferences |
|
|
|
import net.pokeranalytics.android.util.billing.AppGuard |
|
|
|
import net.pokeranalytics.android.util.billing.AppGuard |
|
|
|
|
|
|
|
import net.pokeranalytics.android.util.billing.PurchaseListener |
|
|
|
import net.pokeranalytics.android.util.extensions.count |
|
|
|
import net.pokeranalytics.android.util.extensions.count |
|
|
|
import timber.log.Timber |
|
|
|
import timber.log.Timber |
|
|
|
import java.util.* |
|
|
|
import java.util.* |
|
|
|
|
|
|
|
|
|
|
|
class FeedFragment : FilterableFragment(), RowRepresentableDelegate { |
|
|
|
class FeedFragment : FilterableFragment(), RowRepresentableDelegate, PurchaseListener { |
|
|
|
|
|
|
|
|
|
|
|
private enum class Tab { |
|
|
|
private enum class Tab { |
|
|
|
SESSIONS, |
|
|
|
SESSIONS, |
|
|
|
@ -104,6 +106,11 @@ class FeedFragment : FilterableFragment(), RowRepresentableDelegate { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?) { |
|
|
|
|
|
|
|
super.onCreate(savedInstanceState) |
|
|
|
|
|
|
|
AppGuard.registerListener(this) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun onCreateView( |
|
|
|
override fun onCreateView( |
|
|
|
inflater: LayoutInflater, |
|
|
|
inflater: LayoutInflater, |
|
|
|
container: ViewGroup?, |
|
|
|
container: ViewGroup?, |
|
|
|
@ -205,6 +212,11 @@ class FeedFragment : FilterableFragment(), RowRepresentableDelegate { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun onDestroy() { |
|
|
|
|
|
|
|
AppGuard.unregisterListener(this) |
|
|
|
|
|
|
|
super.onDestroy() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun onDestroyView() { |
|
|
|
override fun onDestroyView() { |
|
|
|
super.onDestroyView() |
|
|
|
super.onDestroyView() |
|
|
|
realmTransactions.removeAllChangeListeners() |
|
|
|
realmTransactions.removeAllChangeListeners() |
|
|
|
@ -313,7 +325,6 @@ class FeedFragment : FilterableFragment(), RowRepresentableDelegate { |
|
|
|
this.showSubscriptionButton() |
|
|
|
this.showSubscriptionButton() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
this.showSubscriptionButton() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -419,11 +430,7 @@ class FeedFragment : FilterableFragment(), RowRepresentableDelegate { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Create a new cash game |
|
|
|
* Create a new cash game |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private fun createNewSession( |
|
|
|
private fun createNewSession(isTournament: Boolean, sessionId: String? = null, duplicate: Boolean = false) { |
|
|
|
isTournament: Boolean, |
|
|
|
|
|
|
|
sessionId: String? = null, |
|
|
|
|
|
|
|
duplicate: Boolean = false |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val sessionCount = getRealm().count(Session::class.java) |
|
|
|
val sessionCount = getRealm().count(Session::class.java) |
|
|
|
if (!AppGuard.isProUser && sessionCount >= AppGuard.MAX_SESSIONS_BEFORE_REQUESTING_SUBSCRIPTION) { // && !BuildConfig.DEBUG |
|
|
|
if (!AppGuard.isProUser && sessionCount >= AppGuard.MAX_SESSIONS_BEFORE_REQUESTING_SUBSCRIPTION) { // && !BuildConfig.DEBUG |
|
|
|
@ -473,10 +480,6 @@ class FeedFragment : FilterableFragment(), RowRepresentableDelegate { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private fun createNewHandHistory() { |
|
|
|
private fun createNewHandHistory() { |
|
|
|
|
|
|
|
|
|
|
|
// val intent = Intent(requireContext(), TestActivity::class.java) |
|
|
|
|
|
|
|
// startActivity(intent) |
|
|
|
|
|
|
|
// return |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AppGuard.endOfUse?.let { endDate -> |
|
|
|
AppGuard.endOfUse?.let { endDate -> |
|
|
|
if (Date().after(endDate)) { |
|
|
|
if (Date().after(endDate)) { |
|
|
|
this.showEndOfUseMessage() |
|
|
|
this.showEndOfUseMessage() |
|
|
|
@ -577,4 +580,12 @@ class FeedFragment : FilterableFragment(), RowRepresentableDelegate { |
|
|
|
this.sessionAdapter.notifyDataSetChanged() // refreshes session durations |
|
|
|
this.sessionAdapter.notifyDataSetChanged() // refreshes session durations |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun purchaseDidSucceed(purchase: Purchase) { |
|
|
|
|
|
|
|
this.showSubscriptionButton() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun noPurchaseRetrieved() { |
|
|
|
|
|
|
|
this.showSubscriptionButton() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |