blob: 6212b2bee42bd00d9020f0ff4a2ca0e0ac38d259 (
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
|
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.exit)
content(R.string.exit_confirmation)
positiveText(android.R.string.yes)
negativeText(android.R.string.no)
onPositive { _, _ -> super.onBackPressed() }
checkBoxPromptRes(R.string.do_not_show_again, false, { _, b -> Prefs.exitConfirmation = !b })
}
} else super.onBackPressed()
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setFrostTheme()
}
}
|