Added message in subscription window when reaching the max number of sessions + strings update

csv
Laurent 6 years ago
parent 2c0a4c89a8
commit d357f8c8b4
  1. 26
      app/src/main/java/net/pokeranalytics/android/ui/activity/BillingActivity.kt
  2. 2
      app/src/main/java/net/pokeranalytics/android/ui/activity/ImportActivity.kt
  3. 2
      app/src/main/java/net/pokeranalytics/android/ui/fragment/FeedFragment.kt
  4. 2
      app/src/main/java/net/pokeranalytics/android/ui/fragment/SettingsFragment.kt
  5. 19
      app/src/main/java/net/pokeranalytics/android/ui/fragment/SubscriptionFragment.kt
  6. 17
      app/src/main/res/layout/activity_billing.xml
  7. 25
      app/src/main/res/layout/fragment_subscription.xml
  8. 4
      app/src/main/res/values/strings.xml

@ -7,18 +7,25 @@ import androidx.fragment.app.Fragment
import net.pokeranalytics.android.R import net.pokeranalytics.android.R
import net.pokeranalytics.android.ui.activity.components.PokerAnalyticsActivity import net.pokeranalytics.android.ui.activity.components.PokerAnalyticsActivity
import net.pokeranalytics.android.ui.activity.components.RequestCode import net.pokeranalytics.android.ui.activity.components.RequestCode
import net.pokeranalytics.android.ui.fragment.SubscriptionFragment
class BillingActivity : PokerAnalyticsActivity() { class BillingActivity : PokerAnalyticsActivity() {
private enum class IntentKey(val keyName: String) {
SHOW_MESSAGE("showMessage"),
}
companion object { companion object {
fun newInstanceForResult(activity: Activity) { fun newInstanceForResult(activity: Activity, showSessionMessage: Boolean) {
val intent = Intent(activity, BillingActivity::class.java) val intent = Intent(activity, BillingActivity::class.java)
intent.putExtra(IntentKey.SHOW_MESSAGE.keyName, showSessionMessage)
activity.startActivityForResult(intent, RequestCode.SUBSCRIPTION.value) activity.startActivityForResult(intent, RequestCode.SUBSCRIPTION.value)
} }
fun newInstanceForResult(fragment: Fragment) { fun newInstanceForResult(fragment: Fragment, showSessionMessage: Boolean) {
val intent = Intent(fragment.requireContext(), BillingActivity::class.java) val intent = Intent(fragment.requireContext(), BillingActivity::class.java)
intent.putExtra(IntentKey.SHOW_MESSAGE.keyName, showSessionMessage)
fragment.startActivityForResult(intent, RequestCode.SUBSCRIPTION.value) fragment.startActivityForResult(intent, RequestCode.SUBSCRIPTION.value)
} }
} }
@ -26,6 +33,21 @@ class BillingActivity : PokerAnalyticsActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_billing) setContentView(R.layout.activity_billing)
initUI()
}
private fun initUI() {
val fragmentManager = supportFragmentManager
val fragmentTransaction = fragmentManager.beginTransaction()
val fragment = SubscriptionFragment()
val showSessionMessage = intent.getBooleanExtra(IntentKey.SHOW_MESSAGE.keyName, false)
fragmentTransaction.add(R.id.container, fragment)
fragmentTransaction.commit()
fragment.setData(showSessionMessage)
} }
} }

@ -118,7 +118,7 @@ class ImportActivity : PokerAnalyticsActivity() {
if (!AppGuard.isProUser && sessionCount >= AppGuard.MAX_SESSIONS_BEFORE_REQUESTING_SUBSCRIPTION) { // && !BuildConfig.DEBUG if (!AppGuard.isProUser && sessionCount >= AppGuard.MAX_SESSIONS_BEFORE_REQUESTING_SUBSCRIPTION) { // && !BuildConfig.DEBUG
Toast.makeText(this, "Please subscribe!", Toast.LENGTH_LONG).show() Toast.makeText(this, "Please subscribe!", Toast.LENGTH_LONG).show()
BillingActivity.newInstanceForResult(this) BillingActivity.newInstanceForResult(this, true)
return return
} }

@ -275,7 +275,7 @@ class FeedFragment : FilterableFragment(), RowRepresentableDelegate {
val sessionCount = this.feedSessionAdapter.realmResults.size val sessionCount = this.feedSessionAdapter.realmResults.size
if (!AppGuard.isProUser && sessionCount >= AppGuard.MAX_SESSIONS_BEFORE_REQUESTING_SUBSCRIPTION) { // && !BuildConfig.DEBUG if (!AppGuard.isProUser && sessionCount >= AppGuard.MAX_SESSIONS_BEFORE_REQUESTING_SUBSCRIPTION) { // && !BuildConfig.DEBUG
// Toast.makeText(context, "Please subscribe!", Toast.LENGTH_LONG).show() // Toast.makeText(context, "Please subscribe!", Toast.LENGTH_LONG).show()
BillingActivity.newInstanceForResult(this) BillingActivity.newInstanceForResult(this, true)
return return
} }

@ -113,7 +113,7 @@ class SettingsFragment : PokerAnalyticsFragment(), RowRepresentableDelegate, Sta
when (row) { when (row) {
SettingRow.SUBSCRIPTION -> { SettingRow.SUBSCRIPTION -> {
if (!AppGuard.isProUser) { if (!AppGuard.isProUser) {
BillingActivity.newInstanceForResult(this) BillingActivity.newInstanceForResult(this, false)
} else { } else {
this.openPlaystoreAccount() this.openPlaystoreAccount()
} }

@ -43,6 +43,7 @@ class SubscriptionFragment : PokerAnalyticsFragment(), SkuDetailsResponseListene
private var pagerAdapter: ScreenSlidePagerAdapter? = null private var pagerAdapter: ScreenSlidePagerAdapter? = null
private var selectedProduct: SkuDetails? = null private var selectedProduct: SkuDetails? = null
private var showSessionMessage = false
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
@ -54,6 +55,10 @@ class SubscriptionFragment : PokerAnalyticsFragment(), SkuDetailsResponseListene
} }
} }
fun setData(showSessionMessage: Boolean) {
this.showSessionMessage = showSessionMessage
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_subscription, container, false) return inflater.inflate(R.layout.fragment_subscription, container, false)
} }
@ -89,6 +94,10 @@ class SubscriptionFragment : PokerAnalyticsFragment(), SkuDetailsResponseListene
this.title.text = upgradeString this.title.text = upgradeString
} }
if (showSessionMessage) {
this.message.text = getString(R.string.iap_session_message)
}
// Pager // Pager
// The pager adapter, which provides the pages to the view pager widget. // The pager adapter, which provides the pages to the view pager widget.
@ -110,7 +119,7 @@ class SubscriptionFragment : PokerAnalyticsFragment(), SkuDetailsResponseListene
for (i in 1..count) { for (i in 1..count) {
val view = View(requireContext()) val view = View(requireContext())
view.background = requireContext().getDrawable(R.drawable.circle_green) view.background = requireContext().getDrawable(R.drawable.circle_green)
val layoutParam = LinearLayout.LayoutParams(10.px, 10.px) val layoutParam = LinearLayout.LayoutParams(8.px, 8.px)
layoutParam.setMargins(6.px) layoutParam.setMargins(6.px)
this.pageIndicator.addView(view, layoutParam) this.pageIndicator.addView(view, layoutParam)
} }
@ -202,12 +211,8 @@ class SubscriptionFragment : PokerAnalyticsFragment(), SkuDetailsResponseListene
override fun onPageScrollStateChanged(state: Int) {} override fun onPageScrollStateChanged(state: Int) {}
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) { override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
pagerAdapter?.getFragment(position)?.let { pagerAdapter?.getFragment(position)?.updateViewsPosition(-positionOffset * parallax)
it.updateViewsPosition(-positionOffset * parallax) pagerAdapter?.getFragment(position + 1)?.updateViewsPosition((1 - positionOffset) * parallax)
}
pagerAdapter?.getFragment(position + 1)?.let {
it.updateViewsPosition((1 - positionOffset) * parallax)
}
} }
override fun onPageSelected(position: Int) { override fun onPageSelected(position: Int) {

@ -1,15 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical">
<fragment </FrameLayout>
android:id="@+id/subscriptionFragment"
android:name="net.pokeranalytics.android.ui.fragment.SubscriptionFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout="@layout/fragment_subscription" />
</LinearLayout>

@ -50,37 +50,50 @@
app:layout_constraintTop_toBottomOf="@id/title" app:layout_constraintTop_toBottomOf="@id/title"
tools:text="30 day free trial" /> tools:text="30 day free trial" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/message"
style="@style/PokerAnalyticsTheme.TextView.SubscriptionSubTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:minLines="1"
android:maxLines="5"
android:layout_margin="16dp"
app:layout_constraintTop_toBottomOf="@id/rectangle"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:text="You've reached the limit of free session! We hope you've enjoyed the app and will continue using it! You can contact us if you have any questions!" />
<androidx.viewpager.widget.ViewPager <androidx.viewpager.widget.ViewPager
android:id="@+id/pager" android:id="@+id/pager"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
app:layout_constraintBottom_toTopOf="@+id/price" app:layout_constraintTop_toBottomOf="@+id/message"
app:layout_constraintBottom_toTopOf="@+id/pageIndicator"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHeight_percent="0.6" app:layout_constraintHeight_percent="0.6"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/freetrial"
app:layout_constraintVertical_bias="0.4" /> app:layout_constraintVertical_bias="0.4" />
<LinearLayout <LinearLayout
android:id="@+id/pageIndicator" android:id="@+id/pageIndicator"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="8dp" android:layout_marginBottom="16dp"
android:orientation="horizontal" android:orientation="horizontal"
app:layout_constraintBottom_toTopOf="@+id/price" app:layout_constraintBottom_toTopOf="@+id/price"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5" app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent" />
app:layout_constraintTop_toBottomOf="@id/pager"
app:layout_constraintVertical_bias="0.6" />
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
android:id="@+id/price" android:id="@+id/price"
style="@style/PokerAnalyticsTheme.TextView.SubscriptionPrice" style="@style/PokerAnalyticsTheme.TextView.SubscriptionPrice"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:gravity="center" android:gravity="center"
app:layout_constraintBottom_toTopOf="@id/purchase" app:layout_constraintBottom_toTopOf="@id/purchase"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"

@ -18,7 +18,7 @@
<string name="f_unlimited">Unlimited</string> <string name="f_unlimited">Unlimited</string>
<string name="f_unlimited_desc">Track all your poker life by adding as many data as you want</string> <string name="f_unlimited_desc">Track all your poker life by adding as many data as you want</string>
<string name="f_offline">Offline first</string> <string name="f_offline">Offline first</string>
<string name="f_offline_desc">Poker Analytics is available at all times and the data is yours. Export it at any times. Note: You’re currently in charge of backups, but that will change soon!</string> <string name="f_offline_desc">Poker Analytics is available at all times and the data is yours. Note: We will soon add exporting capabilities and you’re currently in charge of backups. Thanks for your patience!</string>
<string name="f_privacy">Private</string> <string name="f_privacy">Private</string>
<string name="f_privacy_desc">We do not own servers. We do not know anything about your wins and losses.</string> <string name="f_privacy_desc">We do not own servers. We do not know anything about your wins and losses.</string>
<string name="f_support">Support</string> <string name="f_support">Support</string>
@ -38,6 +38,7 @@
<string name="custom_field">Custom field</string> <string name="custom_field">Custom field</string>
<string name="transaction_relationship_error">The item is used in one or more transactions&#8230;Please delete the linked transactions first</string> <string name="transaction_relationship_error">The item is used in one or more transactions&#8230;Please delete the linked transactions first</string>
<string name="imported">Imported</string> <string name="imported">Imported</string>
<string name="iap_session_message">You\'ve reached the maximum number of free sessions. Please subscribe for unlimited use and don\'t hesitate to tell us how you feel about your current experience!</string>
<string name="address">Address</string> <string name="address">Address</string>
<string name="suggestions">Naming suggestions</string> <string name="suggestions">Naming suggestions</string>
@ -285,7 +286,6 @@
<string name="hour_rate_without_pauses">Net hourly rate</string> <string name="hour_rate_without_pauses">Net hourly rate</string>
<string name="hour_slot">Range</string> <string name="hour_slot">Range</string>
<string name="how_to_switch_from_lite_to_full_version_icloud_version">Export your data to iCloud, get the Pro version, open it, import your data from iCloud.</string> <string name="how_to_switch_from_lite_to_full_version_icloud_version">Export your data to iCloud, get the Pro version, open it, import your data from iCloud.</string>
<string name="iap_session_message">You\'ve reached the maximum number of sessions. Get a new subscription to get more sessions!</string>
<string name="icloud">iCloud</string> <string name="icloud">iCloud</string>
<string name="icloud_account_availability_changed">iCloud settings were modified, please wait for synchronization.</string> <string name="icloud_account_availability_changed">iCloud settings were modified, please wait for synchronization.</string>
<string name="icloud_backup_available_to_import">A backup of your data was found on iCloud, do you want to use it on this device? If yes, the local data from this device will be replaced by the backup and if no, you will keep using the local data from this device and your iCloud account won\'t be modified.</string> <string name="icloud_backup_available_to_import">A backup of your data was found on iCloud, do you want to use it on this device? If yes, the local data from this device will be replaced by the backup and if no, you will keep using the local data from this device and your iCloud account won\'t be modified.</string>

Loading…
Cancel
Save