Prevent crash

pull/212/head
M66B 1 year ago
parent 18926aeea5
commit 9b70485109

@ -639,6 +639,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
} }
private void setOptions() { private void setOptions() {
try {
if (view == null || getContext() == null) if (view == null || getContext() == null)
return; return;
@ -722,6 +723,9 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
swSwipeReply.setChecked(prefs.getBoolean("swipe_reply", false)); swSwipeReply.setChecked(prefs.getBoolean("swipe_reply", false));
swMoveThreadSent.setChecked(prefs.getBoolean("move_thread_sent", false)); swMoveThreadSent.setChecked(prefs.getBoolean("move_thread_sent", false));
tvDefaultFolder.setText(prefs.getString("default_folder", null)); tvDefaultFolder.setText(prefs.getString("default_folder", null));
} catch (Throwable ex) {
Log.e(ex);
}
} }
private void onDefaultFolder(Uri uri) { private void onDefaultFolder(Uri uri) {

@ -423,6 +423,7 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre
} }
private void setOptions() { private void setOptions() {
try {
if (view == null || getContext() == null) if (view == null || getContext() == null)
return; return;
@ -463,6 +464,9 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre
swSslHardenStrict.setEnabled(swSslHarden.isChecked()); swSslHardenStrict.setEnabled(swSslHarden.isChecked());
swCertStrict.setChecked(prefs.getBoolean("cert_strict", !BuildConfig.PLAY_STORE_RELEASE)); swCertStrict.setChecked(prefs.getBoolean("cert_strict", !BuildConfig.PLAY_STORE_RELEASE));
swOpenSafe.setChecked(prefs.getBoolean("open_safe", false)); swOpenSafe.setChecked(prefs.getBoolean("open_safe", false));
} catch (Throwable ex) {
Log.e(ex);
}
} }
private static Intent getIntentConnectivity() { private static Intent getIntentConnectivity() {

@ -1394,6 +1394,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
} }
private void setOptions() { private void setOptions() {
try {
if (view == null || getContext() == null) if (view == null || getContext() == null)
return; return;
@ -1595,6 +1596,9 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swAuthenticationIndicator.setEnabled(swAuthentication.isChecked()); swAuthenticationIndicator.setEnabled(swAuthentication.isChecked());
updateColor(); updateColor();
} catch (Throwable ex) {
Log.e(ex);
}
} }
private void setNavigationBarColor(int color) { private void setNavigationBarColor(int color) {

@ -634,6 +634,7 @@ public class FragmentOptionsEncryption extends FragmentBase
} }
private void setOptions() { private void setOptions() {
try {
if (view == null || getContext() == null) if (view == null || getContext() == null)
return; return;
@ -677,6 +678,9 @@ public class FragmentOptionsEncryption extends FragmentBase
} }
swCheckCertificate.setChecked(prefs.getBoolean("check_certificate", true)); swCheckCertificate.setChecked(prefs.getBoolean("check_certificate", true));
} catch (Throwable ex) {
Log.e(ex);
}
} }
private void testOpenPgp(String pkg) { private void testOpenPgp(String pkg) {

@ -1085,7 +1085,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
sbOpenAiTemperature.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { sbOpenAiTemperature.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override @Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
prefs.edit().putFloat("openai_temperature", progress / 10f).apply(); prefs.edit().putFloat("openai_temperature", (float) progress / 10f).apply();
} }
@Override @Override
@ -2320,6 +2320,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
} }
private void setOptions() { private void setOptions() {
try {
if (view == null || getContext() == null) if (view == null || getContext() == null)
return; return;
@ -2517,6 +2518,9 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
cursorWindowSize == null ? "?" : Helper.humanReadableByteCount(cursorWindowSize, false))); cursorWindowSize == null ? "?" : Helper.humanReadableByteCount(cursorWindowSize, false)));
cardDebug.setVisibility(swDebug.isChecked() || BuildConfig.DEBUG ? View.VISIBLE : View.GONE); cardDebug.setVisibility(swDebug.isChecked() || BuildConfig.DEBUG ? View.VISIBLE : View.GONE);
} catch (Throwable ex) {
Log.e(ex);
}
} }
private void updateUsage() { private void updateUsage() {

@ -801,6 +801,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
} }
private void setOptions() { private void setOptions() {
try {
if (view == null || getContext() == null) if (view == null || getContext() == null)
return; return;
@ -846,6 +847,9 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
swAlertOnce.setChecked(!prefs.getBoolean("alert_once", true)); swAlertOnce.setChecked(!prefs.getBoolean("alert_once", true));
enableOptions(); enableOptions();
} catch (Throwable ex) {
Log.e(ex);
}
} }
private void enableOptions() { private void enableOptions() {

@ -550,6 +550,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
} }
private void setOptions() { private void setOptions() {
try {
if (view == null || getContext() == null) if (view == null || getContext() == null)
return; return;
@ -613,5 +614,8 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
String mnemonic = prefs.getString("wipe_mnemonic", null); String mnemonic = prefs.getString("wipe_mnemonic", null);
swMnemonic.setChecked(mnemonic != null); swMnemonic.setChecked(mnemonic != null);
tvMnemonic.setText(mnemonic); tvMnemonic.setText(mnemonic);
} catch (Throwable ex) {
Log.e(ex);
}
} }
} }

@ -722,6 +722,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
} }
private void setOptions() { private void setOptions() {
try {
if (view == null || getContext() == null) if (view == null || getContext() == null)
return; return;
@ -823,6 +824,9 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
swReplyMove.setChecked(prefs.getBoolean("reply_move", false)); swReplyMove.setChecked(prefs.getBoolean("reply_move", false));
swReplyMoveInbox.setChecked(prefs.getBoolean("reply_move_inbox", true)); swReplyMoveInbox.setChecked(prefs.getBoolean("reply_move_inbox", true));
swReplyMoveInbox.setEnabled(swReplyMove.isChecked()); swReplyMoveInbox.setEnabled(swReplyMove.isChecked());
} catch (Throwable ex) {
Log.e(ex);
}
} }
@Override @Override

@ -594,6 +594,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
} }
private void setOptions() { private void setOptions() {
try {
if (view == null || getContext() == null) if (view == null || getContext() == null)
return; return;
@ -665,6 +666,9 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
swUseBlocklistPop.setChecked(prefs.getBoolean("use_blocklist_pop", false)); swUseBlocklistPop.setChecked(prefs.getBoolean("use_blocklist_pop", false));
swUseBlocklistPop.setEnabled(swCheckBlocklist.isChecked()); swUseBlocklistPop.setEnabled(swCheckBlocklist.isChecked());
rvBlocklist.setAlpha(swCheckBlocklist.isChecked() ? 1.0f : Helper.LOW_LIGHT); rvBlocklist.setAlpha(swCheckBlocklist.isChecked() ? 1.0f : Helper.LOW_LIGHT);
} catch (Throwable ex) {
Log.e(ex);
}
} }
public static class TimePickerFragment extends FragmentDialogBase implements TimePickerDialog.OnTimeSetListener { public static class TimePickerFragment extends FragmentDialogBase implements TimePickerDialog.OnTimeSetListener {

Loading…
Cancel
Save