Add "Reset all warnings" menu item
This commit is contained in:
parent
474dbad1a8
commit
1d0c1e82fa
6 changed files with 18 additions and 2 deletions
|
@ -6,11 +6,13 @@ import android.view.Menu
|
|||
import android.view.MenuItem
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import eu.depau.etchdroid.R
|
||||
import eu.depau.etchdroid.kotlin_exts.toast
|
||||
import eu.depau.etchdroid.utils.NightModeHelper
|
||||
|
||||
|
||||
abstract class ActivityBase : AppCompatActivity() {
|
||||
protected lateinit var nightModeHelper: NightModeHelper
|
||||
val DISMISSED_DIALOGS_PREFS = "dismissed_dialogs"
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
@ -33,6 +35,12 @@ abstract class ActivityBase : AppCompatActivity() {
|
|||
startActivity(intent)
|
||||
return true
|
||||
}
|
||||
R.id.action_reset_warnings -> {
|
||||
getSharedPreferences(DISMISSED_DIALOGS_PREFS, 0)
|
||||
.edit().clear().apply()
|
||||
toast(getString(R.string.warnings_reset))
|
||||
return true
|
||||
}
|
||||
R.id.action_nightmode -> {
|
||||
nightModeHelper.toggle()
|
||||
return true
|
||||
|
|
|
@ -21,7 +21,6 @@ import java.io.IOException
|
|||
class ConfirmationActivity : ActivityBase() {
|
||||
var canContinue: Boolean = false
|
||||
var issuesFound: String? = null
|
||||
val DISMISSED_DIALOGS_PREFS = "dismissed_dialogs"
|
||||
|
||||
var shouldShowDataLossAlertDialog: Boolean
|
||||
get() {
|
||||
|
|
|
@ -25,7 +25,6 @@ class StartActivity : ActivityBase() {
|
|||
val TAG = "StartActivity"
|
||||
val READ_REQUEST_CODE = 42
|
||||
val READ_EXTERNAL_STORAGE_PERMISSION = 29
|
||||
val DISMISSED_DIALOGS_PREFS = "dismissed_dialogs"
|
||||
var delayedButtonClicked: Boolean = false
|
||||
|
||||
var shouldShowDMGAlertDialog: Boolean
|
||||
|
|
|
@ -13,4 +13,10 @@
|
|||
android:orderInCategory="100"
|
||||
android:title="@string/nightmode"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_reset_warnings"
|
||||
android:orderInCategory="100"
|
||||
android:title="@string/reset_warnings"
|
||||
app:showAsAction="never"/>
|
||||
</menu>
|
||||
|
|
|
@ -106,4 +106,6 @@
|
|||
<string name="nightmode">Attiva modalità notturna</string>
|
||||
<string name="android_pie_bug">Bug di Android Pie</string>
|
||||
<string name="android_pie_bug_dialog_text">A causa di un bug di Android 9, alcune scritture potrebbero fallire.\nSe appare un messaggio di errore \"Scrittura fallita\", riavvia il dispositivo e prova di nuovo.</string>
|
||||
<string name="reset_warnings">Reimposta tutti gli avvisi</string>
|
||||
<string name="warnings_reset">Tutti gli avvisi sono stati ripristinati</string>
|
||||
</resources>
|
|
@ -105,4 +105,6 @@
|
|||
<string name="nightmode">Enable night mode</string>
|
||||
<string name="android_pie_bug">Android Pie bug</string>
|
||||
<string name="android_pie_bug_dialog_text">There is a bug on Android 9 which causes some writes to fail.\nIf it says \"Write failed\", reboot your device and try again.</string>
|
||||
<string name="reset_warnings">Reset all warnings</string>
|
||||
<string name="warnings_reset">All warning dialogs restored</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue