diff options
author | Alex Ning <chineseperson5@gmail.com> | 2021-10-08 12:19:50 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2021-10-08 12:19:50 +0000 |
commit | f5a333e2ac3c3032f787d6b7f66b751aa70767ef (patch) | |
tree | 65c250dbfb953518b94454ce23dd42d0b2d83760 | |
parent | bac1dca855b80d842dc57da53d94dddc064719a7 (diff) | |
download | infinity-for-reddit-f5a333e2ac3c3032f787d6b7f66b751aa70767ef.tar infinity-for-reddit-f5a333e2ac3c3032f787d6b7f66b751aa70767ef.tar.gz infinity-for-reddit-f5a333e2ac3c3032f787d6b7f66b751aa70767ef.tar.bz2 infinity-for-reddit-f5a333e2ac3c3032f787d6b7f66b751aa70767ef.tar.lz infinity-for-reddit-f5a333e2ac3c3032f787d6b7f66b751aa70767ef.tar.xz infinity-for-reddit-f5a333e2ac3c3032f787d6b7f66b751aa70767ef.tar.zst infinity-for-reddit-f5a333e2ac3c3032f787d6b7f66b751aa70767ef.zip |
Show a dialog before closing CustomizeThemeActivity.
Diffstat (limited to '')
2 files changed, 14 insertions, 12 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizeThemeActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizeThemeActivity.java index 989eb34f..cadaa8d5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizeThemeActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizeThemeActivity.java @@ -15,6 +15,7 @@ import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.recyclerview.widget.RecyclerView; import com.google.android.material.appbar.AppBarLayout; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.snackbar.Snackbar; import org.greenrobot.eventbus.EventBus; @@ -27,6 +28,9 @@ import javax.inject.Named; import butterknife.BindView; import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; import ml.docilealligator.infinityforreddit.adapters.CustomizeThemeRecyclerViewAdapter; import ml.docilealligator.infinityforreddit.asynctasks.GetCustomTheme; import ml.docilealligator.infinityforreddit.asynctasks.InsertCustomTheme; @@ -34,9 +38,6 @@ import ml.docilealligator.infinityforreddit.customtheme.CustomTheme; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeSettingsItem; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.events.RecreateActivityEvent; -import ml.docilealligator.infinityforreddit.Infinity; -import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; import ml.docilealligator.infinityforreddit.utils.CustomThemeSharedPreferencesUtils; public class CustomizeThemeActivity extends BaseActivity { @@ -231,6 +232,16 @@ public class CustomizeThemeActivity extends BaseActivity { } @Override + public void onBackPressed() { + new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme) + .setTitle(R.string.discard) + .setPositiveButton(R.string.discard_dialog_button, (dialogInterface, i) + -> super.onBackPressed()) + .setNegativeButton(R.string.no, null) + .show(); + } + + @Override protected SharedPreferences getDefaultSharedPreferences() { return sharedPreferences; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/events/ChangeConfirmToExitEvent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/events/ChangeConfirmToExitEvent.java deleted file mode 100644 index fbfc4ae3..00000000 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/events/ChangeConfirmToExitEvent.java +++ /dev/null @@ -1,9 +0,0 @@ -package ml.docilealligator.infinityforreddit.events; - -public class ChangeConfirmToExitEvent { - public boolean confirmToExit; - - public ChangeConfirmToExitEvent(boolean confirmToExit) { - this.confirmToExit = confirmToExit; - } -} |