blob: c255112541333b21fba599294dfaaf59144d9748 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
package com.pitchedapps.frost
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import com.pitchedapps.frost.utils.Prefs
import com.pitchedapps.frost.utils.materialDialogThemed
import com.pitchedapps.frost.utils.setFrostTheme
/**
* Created by Allan Wang on 2017-06-12.
*/
open class BaseActivity : AppCompatActivity() {
override fun onBackPressed() {
if (isTaskRoot && Prefs.exitConfirmation) {
materialDialogThemed {
title(R.string.kau_exit)
content(R.string.kau_exit_confirmation)
positiveText(R.string.kau_yes)
negativeText(R.string.kau_no)
onPositive { _, _ -> super.onBackPressed() }
checkBoxPromptRes(R.string.kau_do_not_show_again, false, { _, b -> Prefs.exitConfirmation = !b })
}
} else super.onBackPressed()
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setFrostTheme()
}
}
|