1
0
mirror of https://github.com/NekoX-Dev/NekoX.git synced 2024-12-12 15:49:36 +01:00

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();
}
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() {
roundCamera16to9 = !roundCamera16to9;
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);
}
} 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.showWithAction(0, UndoView.ACTION_CACHE_WAS_CLEARED, null, null);
}
} 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.showWithAction(0, UndoView.ACTION_CACHE_WAS_CLEARED, null, null);
}
} else if (key.equals(NekomuraConfig.useCustomEmoji.getKey())) {
// Check
if (!(boolean) newValue) return;
if (!(boolean) newValue) {
tooltip.showWithAction(0, UndoView.ACTION_NEED_RESATRT, null, null);
return;
}
NekomuraConfig.useCustomEmoji.setConfigBool(false);
// Open picker
@ -265,16 +268,20 @@ public class NekoExperimentalSettingsActivity extends BaseFragment {
dir.mkdir();
//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()) {
throw new Exception(LocaleController.getString("useCustomEmojiInvalid"));
}
NekomuraConfig.useCustomEmoji.setConfigBool(true);
} catch (Exception e) {
FileLog.e(e);
NekomuraConfig.useCustomEmoji.setConfigBool(false);
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));
}
}

View File

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