add more restart tips

This commit is contained in:
arm64v8a 2021-11-12 12:38:06 +08:00
parent dd007a01e7
commit 4a12bad17c
3 changed files with 22 additions and 9 deletions

View File

@ -1842,6 +1842,13 @@ public class SharedConfig {
editor.commit(); editor.commit();
} }
public static void setInappCamera(boolean inappCamera) {
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("inappCamera", inappCamera);
editor.commit();
}
public static void toggleRoundCamera16to9() { public static void toggleRoundCamera16to9() {
roundCamera16to9 = !roundCamera16to9; roundCamera16to9 = !roundCamera16to9;
SharedPreferences preferences = MessagesController.getGlobalMainSettings(); SharedPreferences preferences = MessagesController.getGlobalMainSettings();

View File

@ -213,18 +213,21 @@ public class NekoExperimentalSettingsActivity extends BaseFragment {
tooltip.showWithAction(0, UndoView.ACTION_CACHE_WAS_CLEARED, null, null); tooltip.showWithAction(0, UndoView.ACTION_CACHE_WAS_CLEARED, null, null);
} }
} else if (key.equals(NekomuraConfig.mediaPreview.getKey())) { } else if (key.equals(NekomuraConfig.mediaPreview.getKey())) {
if (NekomuraConfig.mediaPreview.Bool()) { if ((boolean) newValue) {
tooltip.setInfoText(AndroidUtilities.replaceTags(LocaleController.formatString("BetaWarning", R.string.BetaWarning))); tooltip.setInfoText(AndroidUtilities.replaceTags(LocaleController.formatString("BetaWarning", R.string.BetaWarning)));
tooltip.showWithAction(0, UndoView.ACTION_CACHE_WAS_CLEARED, null, null); tooltip.showWithAction(0, UndoView.ACTION_CACHE_WAS_CLEARED, null, null);
} }
} else if (key.equals(NekomuraConfig.enableStickerPin.getKey())) { } else if (key.equals(NekomuraConfig.enableStickerPin.getKey())) {
if (NekomuraConfig.mediaPreview.Bool()) { if ((boolean) newValue) {
tooltip.setInfoText(AndroidUtilities.replaceTags(LocaleController.formatString("EnableStickerPinTip", R.string.EnableStickerPinTip))); tooltip.setInfoText(AndroidUtilities.replaceTags(LocaleController.formatString("EnableStickerPinTip", R.string.EnableStickerPinTip)));
tooltip.showWithAction(0, UndoView.ACTION_CACHE_WAS_CLEARED, null, null); tooltip.showWithAction(0, UndoView.ACTION_CACHE_WAS_CLEARED, null, null);
} }
} else if (key.equals(NekomuraConfig.useCustomEmoji.getKey())) { } else if (key.equals(NekomuraConfig.useCustomEmoji.getKey())) {
// Check // Check
if (!(boolean) newValue) return; if (!(boolean) newValue) {
tooltip.showWithAction(0, UndoView.ACTION_NEED_RESATRT, null, null);
return;
}
NekomuraConfig.useCustomEmoji.setConfigBool(false); NekomuraConfig.useCustomEmoji.setConfigBool(false);
// Open picker // Open picker
@ -265,16 +268,20 @@ public class NekoExperimentalSettingsActivity extends BaseFragment {
dir.mkdir(); dir.mkdir();
//process zip //process zip
ZipUtil.unzip(new FileInputStream(zipPath), dir); File zipFile = new File(zipPath);
ZipUtil.unzip(new FileInputStream(zipFile), dir);
zipFile.delete();
if (!new File(ApplicationLoader.applicationContext.getFilesDir(), "custom_emoji/emoji/0_0.png").exists()) { if (!new File(ApplicationLoader.applicationContext.getFilesDir(), "custom_emoji/emoji/0_0.png").exists()) {
throw new Exception(LocaleController.getString("useCustomEmojiInvalid")); throw new Exception(LocaleController.getString("useCustomEmojiInvalid"));
} }
NekomuraConfig.useCustomEmoji.setConfigBool(true); NekomuraConfig.useCustomEmoji.setConfigBool(true);
} catch (Exception e) { } catch (Exception e) {
FileLog.e(e); FileLog.e(e);
NekomuraConfig.useCustomEmoji.setConfigBool(false); NekomuraConfig.useCustomEmoji.setConfigBool(false);
Toast.makeText(ApplicationLoader.applicationContext, "Failed: " + e.toString(), Toast.LENGTH_LONG).show(); Toast.makeText(ApplicationLoader.applicationContext, "Failed: " + e.toString(), Toast.LENGTH_LONG).show();
} }
tooltip.showWithAction(0, UndoView.ACTION_NEED_RESATRT, null, null);
listAdapter.notifyItemChanged(cellGroup.rows.indexOf(useCustomEmojiRow)); listAdapter.notifyItemChanged(cellGroup.rows.indexOf(useCustomEmojiRow));
} }
} }

View File

@ -312,14 +312,13 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
} }
} }
} else if (key.equals(NekomuraConfig.inappCamera.getKey())) { } else if (key.equals(NekomuraConfig.inappCamera.getKey())) {
if (SharedConfig.inappCamera != (boolean) newValue) SharedConfig.setInappCamera((boolean) newValue);
SharedConfig.toggleInappCamera();
} else if (key.equals(NekomuraConfig.hidePhone.getKey())) { } else if (key.equals(NekomuraConfig.hidePhone.getKey())) {
parentLayout.rebuildAllFragmentViews(false, false); parentLayout.rebuildAllFragmentViews(false, false);
getNotificationCenter().postNotificationName(NotificationCenter.mainUserInfoChanged); getNotificationCenter().postNotificationName(NotificationCenter.mainUserInfoChanged);
listAdapter.notifyItemChanged(cellGroup.rows.indexOf(profilePreviewRow)); listAdapter.notifyItemChanged(cellGroup.rows.indexOf(profilePreviewRow));
} else if (key.equals(NekomuraConfig.transparentStatusBar.getKey())) { } else if (key.equals(NekomuraConfig.transparentStatusBar.getKey())) {
AndroidUtilities.runOnUIThread(() -> NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.didSetNewTheme, false)); restartTooltip.showWithAction(0, UndoView.ACTION_NEED_RESATRT, null, null);
} else if (key.equals(NekomuraConfig.hideProxySponsorChannel.getKey())) { } else if (key.equals(NekomuraConfig.hideProxySponsorChannel.getKey())) {
for (int a : SharedConfig.activeAccounts) { for (int a : SharedConfig.activeAccounts) {
if (UserConfig.getInstance(a).isClientActivated()) { if (UserConfig.getInstance(a).isClientActivated()) {
@ -337,7 +336,7 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
} else if (key.equals(NekomuraConfig.displayPersianCalendarByLatin.getKey())) { } else if (key.equals(NekomuraConfig.displayPersianCalendarByLatin.getKey())) {
restartTooltip.showWithAction(0, UndoView.ACTION_NEED_RESATRT, null, null); restartTooltip.showWithAction(0, UndoView.ACTION_NEED_RESATRT, null, null);
} else if (key.equals(NekomuraConfig.disableSystemAccount.getKey())) { } else if (key.equals(NekomuraConfig.disableSystemAccount.getKey())) {
if (NekomuraConfig.disableSystemAccount.Bool()) { if ((boolean) newValue) {
getContactsController().deleteUnknownAppAccounts(); getContactsController().deleteUnknownAppAccounts();
} else { } else {
for (int a : SharedConfig.activeAccounts) { for (int a : SharedConfig.activeAccounts) {
@ -712,7 +711,7 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
} }
private void setCanNotChange() { private void setCanNotChange() {
if(!showCensoredFeatures) if (!showCensoredFeatures)
cellGroup.rows.remove(hideSponsoredMessageRow); cellGroup.rows.remove(hideSponsoredMessageRow);
boolean enabled; boolean enabled;