Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9ae8bafa authored by tibbi's avatar tibbi
Browse files

show a "Read FAQ" dialog once before invoking the Send Mail intent

parent 80ce1116
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ buildscript {
        propMinSdkVersion = 16
        propTargetSdkVersion = propCompileSdkVersion
        propVersionCode = 1
        propVersionName = '4.5.10'
        propVersionName = '4.5.11'
        kotlin_version = '1.2.51'
        support_libs = '27.1.1'
    }
+14 −1
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ import android.text.Html
import android.text.method.LinkMovementMethod
import android.view.View
import com.simplemobiletools.commons.R
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.*
import com.simplemobiletools.commons.models.FAQItem
@@ -61,7 +62,19 @@ class AboutActivity : BaseSimpleActivity() {
        val body = "$appVersion$newline$deviceOS$newline$separator$newline$newline$newline"
        val href = "$label<br><a href=\"mailto:$email?subject=$appName&body=$body\">$email</a>"
        about_email.text = Html.fromHtml(href)

        if (baseConfig.wasBeforeAskingShown) {
            about_email.movementMethod = LinkMovementMethod.getInstance()
        } else {
            about_email.setOnClickListener {
                baseConfig.wasBeforeAskingShown = true
                about_email.movementMethod = LinkMovementMethod.getInstance()
                about_email.setOnClickListener(null)
                ConfirmationDialog(this, "", R.string.before_asking_question_read_faq, R.string.read_it, R.string.skip) {
                    about_faq_label.performClick()
                }
            }
        }
    }

    private fun setupFAQ() {
+1 −1
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ class ConfirmationDialog(activity: Activity, message: String = "", messageId: In
        view.message.text = if (message.isEmpty()) activity.resources.getString(messageId) else message

        val builder = AlertDialog.Builder(activity)
                .setPositiveButton(positive, { dialog, which -> dialogConfirmed() })
                .setPositiveButton(positive) { dialog, which -> dialogConfirmed() }

        if (negative != 0)
            builder.setNegativeButton(negative, null)
+2 −2
Original line number Diff line number Diff line
@@ -246,11 +246,11 @@ fun Context.scanPathsRecursively(paths: ArrayList<String>, callback: (() -> Unit

fun Context.rescanPaths(paths: ArrayList<String>, callback: (() -> Unit)? = null) {
    var cnt = paths.size
    MediaScannerConnection.scanFile(applicationContext, paths.toTypedArray(), null, { s, uri ->
    MediaScannerConnection.scanFile(applicationContext, paths.toTypedArray(), null) { s, uri ->
        if (--cnt == 0) {
            callback?.invoke()
        }
    })
    }
}

fun getPaths(file: File): ArrayList<String> {
+4 −0
Original line number Diff line number Diff line
@@ -262,4 +262,8 @@ open class BaseConfig(val context: Context) {
    var wasAppOnSDShown: Boolean
        get() = prefs.getBoolean(WAS_APP_ON_SD_SHOWN, false)
        set(wasAppOnSDShown) = prefs.edit().putBoolean(WAS_APP_ON_SD_SHOWN, wasAppOnSDShown).apply()

    var wasBeforeAskingShown: Boolean
        get() = prefs.getBoolean(WAS_BEFORE_ASKING_SHOWN, false)
        set(wasBeforeAskingShown) = prefs.edit().putBoolean(WAS_BEFORE_ASKING_SHOWN, wasBeforeAskingShown).apply()
}
Loading