Skip to content

Commit

Permalink
调整部分弹窗
Browse files Browse the repository at this point in the history
  • Loading branch information
Vera-Firefly committed Nov 6, 2024
1 parent fda6a35 commit a3cfe02
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
import androidx.appcompat.app.AlertDialog;
import androidx.preference.ListPreference;

import com.firefly.ui.dialog.CustomDialog;
import com.firefly.utils.MesaUtils;

import net.kdt.pojavlaunch.R;
import net.kdt.pojavlaunch.Tools;
import net.kdt.pojavlaunch.utils.MesaUtils;

import java.util.Arrays;
import java.util.List;
Expand Down Expand Up @@ -133,19 +135,21 @@ public void setDownloadButton(String buttonText, View.OnClickListener listener)
}

private void showDeleteConfirmationDialog(String version) {
new AlertDialog.Builder(getContext())
.setTitle(R.string.preference_rendererexp_mesa_delete_title)
new CustomDialog.Builder(getContext())
.setTitle(getContext().getString(R.string.preference_rendererexp_mesa_delete_title))
.setMessage(getContext().getString(R.string.preference_rendererexp_mesa_delete_message, version))
.setPositiveButton(R.string.alertdialog_done, (dialog, which) -> {
.setConfirmListener(android.R.string.ok, customView -> {
boolean success = MesaUtils.INSTANCE.deleteMesaLib(version);
if (success) {
Toast.makeText(getContext(), R.string.preference_rendererexp_mesa_deleted, Toast.LENGTH_SHORT).show();
setEntriesAndValues();
} else {
Toast.makeText(getContext(), R.string.preference_rendererexp_mesa_delete_fail, Toast.LENGTH_SHORT).show();
}
return true;
})
.setNegativeButton(R.string.alertdialog_cancel, null)
.setCancelListener(android.R.string.cancel, customView -> true)
.build()
.show();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import net.kdt.pojavlaunch.R;
import net.kdt.pojavlaunch.Tools;
import com.firefly.ui.dialog.CustomDialog;
import com.firefly.utils.TurnipUtils;

import java.util.Arrays;
Expand Down Expand Up @@ -116,19 +117,21 @@ public void setImportButton(String buttonText, View.OnClickListener listener) {
}

private void showDeleteConfirmationDialog(String version) {
new AlertDialog.Builder(getContext())
.setTitle(R.string.pgw_settings_ctu_delete_title)
new CustomDialog.Builder(getContext())
.setTitle(getContext().getString(R.string.pgw_settings_ctu_delete_title))
.setMessage(getContext().getString(R.string.pgw_settings_ctu_delete_message, version))
.setPositiveButton(R.string.alertdialog_done, (dialog, which) -> {
.setConfirmListener(android.R.string.ok, customView -> {
boolean success = TurnipUtils.INSTANCE.deleteTurnipDriver(version);
if (success) {
Toast.makeText(getContext(), R.string.preference_rendererexp_mesa_deleted, Toast.LENGTH_SHORT).show();
setEntriesAndValues();
} else {
Toast.makeText(getContext(), R.string.preference_rendererexp_mesa_delete_fail, Toast.LENGTH_SHORT).show();
}
return true;
})
.setNegativeButton(R.string.alertdialog_cancel, null)
.setCancelListener(android.R.string.cancel, customView -> true)
.build()
.show();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.kdt.pojavlaunch.utils;
package com.firefly.utils;

import android.content.Context;
import android.net.Uri;
Expand All @@ -9,6 +9,8 @@
import com.google.gson.reflect.TypeToken;

import net.kdt.pojavlaunch.Tools;
import net.kdt.pojavlaunch.utils.DownloadUtils;
import net.kdt.pojavlaunch.utils.FileUtils;

import org.apache.commons.io.IOUtils;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;

import com.firefly.utils.MesaUtils;
import com.firefly.utils.TurnipUtils;

import com.google.gson.Gson;
Expand All @@ -67,7 +68,6 @@
import net.kdt.pojavlaunch.utils.FileUtils;
import net.kdt.pojavlaunch.utils.JREUtils;
import net.kdt.pojavlaunch.utils.JSONUtils;
import net.kdt.pojavlaunch.utils.MesaUtils;
import net.kdt.pojavlaunch.utils.OldVersionsUtils;
import net.kdt.pojavlaunch.value.DependentLibrary;
import net.kdt.pojavlaunch.value.MinecraftAccount;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import androidx.preference.ListPreference;
import androidx.preference.Preference.OnPreferenceChangeListener;

import com.firefly.utils.MesaUtils;
import com.firefly.utils.PGWTools;
import com.firefly.utils.TurnipUtils;
import com.firefly.ui.dialog.CustomDialog;
Expand All @@ -38,7 +39,6 @@
import net.kdt.pojavlaunch.Tools;
import net.kdt.pojavlaunch.prefs.CustomSeekBarPreference;
import net.kdt.pojavlaunch.prefs.LauncherPreferences;
import net.kdt.pojavlaunch.utils.MesaUtils;

import java.util.Set;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import android.util.Log;
import android.widget.Toast;

import com.firefly.utils.MesaUtils;
import com.firefly.utils.TurnipUtils;

import com.movtery.ui.subassembly.customprofilepath.ProfilePathHome;
Expand Down

0 comments on commit a3cfe02

Please sign in to comment.