mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-28 11:58:23 +01:00
Show a dialog before closing CustomizeThemeActivity.
This commit is contained in:
parent
bac1dca855
commit
f5a333e2ac
@ -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 {
|
||||
@ -230,6 +231,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;
|
||||
|
@ -1,9 +0,0 @@
|
||||
package ml.docilealligator.infinityforreddit.events;
|
||||
|
||||
public class ChangeConfirmToExitEvent {
|
||||
public boolean confirmToExit;
|
||||
|
||||
public ChangeConfirmToExitEvent(boolean confirmToExit) {
|
||||
this.confirmToExit = confirmToExit;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user