show a dialog about Simple Contacts under some circumstances

This commit is contained in:
tibbi 2018-03-02 19:23:26 +01:00
parent 1e3296fce1
commit 7dc0cb660c
4 changed files with 14 additions and 1 deletions

View File

@ -46,7 +46,7 @@ ext {
}
dependencies {
implementation 'com.simplemobiletools:commons:3.14.6'
implementation 'com.simplemobiletools:commons:3.14.7'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.google.code.gson:gson:2.8.2'

View File

@ -16,6 +16,7 @@ import android.widget.FrameLayout
import com.google.gson.Gson
import com.simplemobiletools.commons.dialogs.CreateNewFolderDialog
import com.simplemobiletools.commons.dialogs.FilePickerDialog
import com.simplemobiletools.commons.dialogs.NewAppDialog
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.PERMISSION_READ_STORAGE
@ -44,6 +45,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
private val PICK_MEDIA = 2
private val PICK_WALLPAPER = 3
private val LAST_MEDIA_CHECK_PERIOD = 3000L
private val CONTACTS_PACKAGE = "com.simplemobiletools.contacts"
lateinit var mDirs: ArrayList<Directory>
@ -99,6 +101,12 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
mIsPasswordProtectionPending = config.appPasswordProtectionOn
setupLatestMediaId()
// notify the users about the Contacts app
if (System.currentTimeMillis() < 1521015000000 && !config.wasNewAppShown && config.appRunCount > 100 && config.appRunCount % 50 != 0 && !isPackageInstalled(CONTACTS_PACKAGE)) {
config.wasNewAppShown = true
NewAppDialog(this, CONTACTS_PACKAGE, "Simple Contacts")
}
}
override fun onStart() {

View File

@ -316,4 +316,8 @@ class Config(context: Context) : BaseConfig(context) {
var doExtraCheck: Boolean
get() = prefs.getBoolean(DO_EXTRA_CHECK, false)
set(doExtraCheck) = prefs.edit().putBoolean(DO_EXTRA_CHECK, doExtraCheck).apply()
var wasNewAppShown: Boolean
get() = prefs.getBoolean(WAS_NEW_APP_SHOWN, false)
set(wasNewAppShown) = prefs.edit().putBoolean(WAS_NEW_APP_SHOWN, wasNewAppShown).apply()
}

View File

@ -46,6 +46,7 @@ const val ONE_FINGER_ZOOM = "one_finger_zoom"
const val ALLOW_INSTANT_CHANGE = "allow_instant_change"
const val REPLACE_ZOOMABLE_IMAGES = "replace_zoomable_images"
const val DO_EXTRA_CHECK = "do_extra_check"
const val WAS_NEW_APP_SHOWN = "was_new_app_shown"
// slideshow
const val SLIDESHOW_INTERVAL = "slideshow_interval"