add an About item for upgrading + upgrade Draw first

This commit is contained in:
tibbi 2018-11-04 11:29:05 +01:00
parent ba04919fc8
commit 720ec6a9a7
8 changed files with 35 additions and 8 deletions

View file

@ -7,7 +7,7 @@ buildscript {
propMinSdkVersion = 21
propTargetSdkVersion = propCompileSdkVersion
propVersionCode = 1
propVersionName = '5.3.2'
propVersionName = '5.3.4'
kotlin_version = '1.3.0'
}

View file

@ -37,6 +37,7 @@ class AboutActivity : BaseSimpleActivity() {
setupWebsite()
setupEmail()
setupFAQ()
setupUpgradeToPro()
setupMoreApps()
setupRateUs()
setupInvite()
@ -93,6 +94,16 @@ class AboutActivity : BaseSimpleActivity() {
about_faq.underlineText()
}
private fun setupUpgradeToPro() {
about_upgrade_to_pro.beVisibleIf(getCanAppBeUpgraded())
about_upgrade_to_pro.setOnClickListener {
launchViewIntent(getProUrl())
}
about_upgrade_to_pro.setTextColor(linkColor)
about_upgrade_to_pro.underlineText()
}
private fun openFAQ(faqItems: ArrayList<FAQItem>) {
Intent(applicationContext, FAQActivity::class.java).apply {
putExtra(APP_ICON_IDS, getAppIconIDs())

View file

@ -4,18 +4,19 @@ import android.app.Activity
import androidx.appcompat.app.AlertDialog
import com.simplemobiletools.commons.R
import com.simplemobiletools.commons.extensions.baseConfig
import com.simplemobiletools.commons.extensions.getProUrl
import com.simplemobiletools.commons.extensions.launchViewIntent
import com.simplemobiletools.commons.extensions.setupDialogStuff
import kotlinx.android.synthetic.main.dialog_upgrade_to_pro.view.*
class UpgradeToProDialog(val activity: Activity) {
val packageName = activity.baseConfig.appId.removeSuffix(".debug")
val GALLERY_FREE_TILL = 1543104000000L // November 25
val DRAW_FREE_TILL = 1543104000000L // November 25
val NOV_25 = "Nov 25 2018"
init {
var text = activity.getString(R.string.upgrade_to_pro)
if (packageName.endsWith("gallery") && System.currentTimeMillis() < GALLERY_FREE_TILL) {
if (packageName.endsWith("draw") && System.currentTimeMillis() < DRAW_FREE_TILL) {
val freeTill = String.format(activity.getString(R.string.it_is_free), NOV_25)
text += "\n$freeTill"
}
@ -34,7 +35,7 @@ class UpgradeToProDialog(val activity: Activity) {
}
private fun upgradeApp() {
activity.launchViewIntent("https://play.google.com/store/apps/details?id=com.simplemobiletools.gallery.pro")
activity.launchViewIntent(activity.getProUrl())
}
private fun moreInfo() {

View file

@ -114,8 +114,7 @@ fun Activity.appLaunched(appId: String) {
}
fun Activity.showDonateOrUpgradeDialog() {
val proPackages = arrayListOf("gallery")
if (proPackages.contains(baseConfig.appId.removeSuffix(".debug").removePrefix("com.simplemobiletools."))) {
if (getCanAppBeUpgraded()) {
UpgradeToProDialog(this)
} else if (!baseConfig.hadThankYouInstalled && !isThankYouInstalled()) {
DonateDialog(this)

View file

@ -569,3 +569,7 @@ fun Context.toggleAppIconColor(appId: String, colorIndex: Int, color: Int, enabl
fun Context.getAppIconColors() = resources.getIntArray(R.array.md_app_icon_colors).toCollection(ArrayList())
fun Context.getLaunchIntent() = packageManager.getLaunchIntentForPackage(baseConfig.appId)
fun Context.getCanAppBeUpgraded() = proPackages.contains(baseConfig.appId.removeSuffix(".debug").removePrefix("com.simplemobiletools."))
fun Context.getProUrl() = "https://play.google.com/store/apps/details?id=${baseConfig.appId.removeSuffix(".debug")}.pro"

View file

@ -248,3 +248,5 @@ fun getConflictResolution(resolutions: LinkedHashMap<String, Int>, path: String)
CONFLICT_SKIP
}
}
val proPackages = arrayListOf("draw")

View file

@ -47,12 +47,22 @@
android:textColor="@color/color_primary"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/about_more_apps"
android:id="@+id/about_upgrade_to_pro"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/about_faq"
android:paddingTop="@dimen/activity_margin"
android:paddingBottom="@dimen/activity_margin"
android:text="@string/upgrade_to_pro_underlined"
android:textColor="@color/color_primary"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/about_more_apps"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/about_upgrade_to_pro"
android:paddingTop="@dimen/activity_margin"
android:paddingBottom="@dimen/activity_margin"
android:text="@string/more_apps_underlined"
android:textColor="@color/color_primary"/>

View file

@ -500,7 +500,7 @@
<string name="about">Névjegy</string>
<string name="website_label">A forráskódok megtekintéséhez</string>
<string name="email_label">Küldje el visszajelzését vagy javaslatait</string>
<string name="upgrade_to_pro_underlined"><u>Upgrade to Pro</u></string>
<string name="upgrade_to_pro_underlined"><u>Frissítés Pro verzióra</u></string>
<string name="more_apps_underlined"><u>További alkalmazások</u></string>
<string name="third_party_licences_underlined"><u>Harmadik fél licencek</u></string>
<string name="invite_friends_underlined"><u>Barátok meghívása</u></string>