aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizeThemeActivity.java17
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/events/ChangeConfirmToExitEvent.java9
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;
- }
-}