NekoX/TMessagesProj/src/main/java/tw/nekomimi/nekogram/NekoConfig.java

545 lines
27 KiB
Java
Raw Normal View History

2019-06-11 09:13:04 +02:00
package tw.nekomimi.nekogram;
2020-03-30 06:23:34 +02:00
import android.annotation.SuppressLint;
2019-06-11 09:13:04 +02:00
import android.app.Activity;
import android.content.Context;
2019-07-29 17:22:59 +02:00
import android.content.Intent;
2019-06-11 09:13:04 +02:00
import android.content.SharedPreferences;
import android.os.Build;
2019-06-11 09:13:04 +02:00
import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.FileLog;
2020-02-25 10:04:26 +01:00
import org.telegram.messenger.NotificationsService;
2020-03-30 06:23:34 +02:00
import org.telegram.messenger.SharedConfig;
2019-06-11 09:13:04 +02:00
2020-03-30 06:23:34 +02:00
@SuppressLint("ApplySharedPref")
2019-06-11 09:13:04 +02:00
public class NekoConfig {
2020-04-26 08:50:44 +02:00
public static final int TITLE_TYPE_TEXT = 0;
public static final int TITLE_TYPE_ICON = 1;
public static final int TITLE_TYPE_MIX = 2;
2019-06-11 09:13:04 +02:00
private static final Object sync = new Object();
public static boolean useIPv6 = false;
2020-02-29 08:05:25 +01:00
public static boolean showHiddenFeature = false;
2020-02-25 10:04:26 +01:00
2020-03-30 06:23:34 +02:00
public static boolean useSystemEmoji = SharedConfig.useSystemEmoji;
2019-06-11 09:13:04 +02:00
public static boolean ignoreBlocked = false;
2020-01-11 04:03:24 +01:00
public static boolean hideProxySponsorChannel = false;
2020-02-29 08:05:25 +01:00
public static boolean saveCacheToPrivateDirectory = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N;
2020-02-17 15:02:50 +01:00
public static boolean disablePhotoSideAction = true;
2020-03-01 16:09:48 +01:00
public static boolean hideKeyboardOnChatScroll = false;
public static boolean rearVideoMessages = false;
2020-04-17 05:27:50 +02:00
public static boolean hideAllTab = false;
public static boolean confirmAVMessage = true;
2020-05-07 08:11:40 +02:00
public static boolean askBeforeCall = true;
public static boolean disableNumberRounding = false;
2020-02-25 10:04:26 +01:00
public static int mapPreviewProvider = 0;
public static float stickerSize = 14.0f;
public static int translationProvider = 1;
2020-04-26 08:50:44 +02:00
public static int tabsTitleType = TITLE_TYPE_TEXT;
2019-12-07 07:35:27 +01:00
public static boolean showAddToSavedMessages = true;
public static boolean showReport = false;
public static boolean showPrPr = false;
2020-01-11 04:50:05 +01:00
public static boolean showViewHistory = true;
2019-12-07 07:35:27 +01:00
public static boolean showAdminActions = true;
public static boolean showChangePermissions = true;
2020-01-10 10:13:03 +01:00
public static boolean showDeleteDownloadedFile = true;
2020-01-18 12:57:04 +01:00
public static boolean showMessageDetails = false;
2020-02-12 06:53:27 +01:00
public static boolean showTranslate = true;
public static boolean showRepeat = true;
2019-12-07 07:35:27 +01:00
2020-02-25 10:04:26 +01:00
public static boolean hidePhone = true;
2020-02-29 08:05:25 +01:00
public static int typeface = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? 1 : 0;
2020-02-25 10:04:26 +01:00
public static boolean transparentStatusBar = false;
public static boolean forceTablet = false;
public static boolean openArchiveOnPull = false;
2020-03-26 10:02:35 +01:00
public static boolean avatarAsDrawerBackground = false;
2020-04-08 10:16:23 +02:00
public static boolean showTabsOnForward = false;
2020-02-25 10:04:26 +01:00
public static int nameOrder = 1;
2020-02-16 05:30:15 +01:00
public static int eventType = 0;
2019-12-30 06:43:49 +01:00
public static boolean newYear = false;
2020-02-25 10:04:26 +01:00
public static int actionBarDecoration = 0;
2020-03-02 13:12:02 +01:00
public static boolean unlimitedFavedStickers = false;
public static boolean unlimitedPinnedDialogs = false;
2020-05-30 12:36:45 +02:00
public static boolean disableAppBarShadow = false;
public static boolean mediaPreview = false;
2019-12-30 06:43:49 +01:00
2020-02-25 10:04:26 +01:00
public static boolean residentNotification = false;
2020-02-21 05:08:57 +01:00
2020-05-12 13:35:15 +02:00
public static boolean shouldNOTTrustMe = false;
2019-06-11 09:13:04 +02:00
private static boolean configLoaded;
static {
loadConfig();
}
public static void saveConfig() {
synchronized (sync) {
try {
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfing", Context.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("useIPv6", useIPv6);
editor.putBoolean("hidePhone", hidePhone);
editor.putBoolean("ignoreBlocked", ignoreBlocked);
editor.putBoolean("forceTablet", forceTablet);
2019-07-07 07:31:28 +02:00
editor.putBoolean("transparentStatusBar", transparentStatusBar);
2019-07-29 17:22:59 +02:00
editor.putBoolean("residentNotification", residentNotification);
2020-01-11 04:03:24 +01:00
editor.putBoolean("hideProxySponsorChannel", hideProxySponsorChannel);
editor.putBoolean("saveCacheToPrivateDirectory", saveCacheToPrivateDirectory);
2019-12-07 07:35:27 +01:00
editor.putBoolean("showAddToSavedMessages", showAddToSavedMessages);
editor.putBoolean("showReport", showReport);
editor.putBoolean("showPrPr", showPrPr);
2020-01-11 04:50:05 +01:00
editor.putBoolean("showViewHistory", showViewHistory);
2019-12-07 07:35:27 +01:00
editor.putBoolean("showAdminActions", showAdminActions);
editor.putBoolean("showChangePermissions", showChangePermissions);
2020-01-10 10:13:03 +01:00
editor.putBoolean("showDeleteDownloadedFile", showDeleteDownloadedFile);
2020-01-18 12:57:04 +01:00
editor.putBoolean("showMessageDetails", showMessageDetails);
2020-01-29 10:02:51 +01:00
editor.putBoolean("showTranslate", showTranslate);
editor.putBoolean("showRepeat", showRepeat);
2019-12-30 06:43:49 +01:00
editor.putBoolean("newYear", newYear);
2020-01-18 07:35:06 +01:00
editor.putBoolean("unlimitedFavedStickers", unlimitedFavedStickers);
editor.putBoolean("unlimitedPinnedDialogs", unlimitedPinnedDialogs);
2020-02-17 15:02:50 +01:00
editor.putBoolean("disablePhotoSideAction", disablePhotoSideAction);
2020-03-01 16:09:48 +01:00
editor.putBoolean("hideKeyboardOnChatScroll", hideKeyboardOnChatScroll);
2020-02-20 13:35:34 +01:00
editor.putBoolean("openArchiveOnPull", openArchiveOnPull);
editor.putBoolean("showHiddenFeature2", showHiddenFeature);
2020-03-26 10:02:35 +01:00
editor.putBoolean("avatarAsDrawerBackground", avatarAsDrawerBackground);
2020-03-30 06:23:34 +02:00
editor.putBoolean("useSystemEmoji", useSystemEmoji);
2020-04-08 10:16:23 +02:00
editor.putBoolean("showTabsOnForward", showTabsOnForward);
editor.putBoolean("rearVideoMessages", rearVideoMessages);
2020-04-17 05:27:50 +02:00
editor.putBoolean("hideAllTab", hideAllTab);
editor.putBoolean("confirmAVMessage", confirmAVMessage);
2020-05-07 08:11:40 +02:00
editor.putBoolean("askBeforeCall", askBeforeCall);
2020-05-12 13:35:15 +02:00
editor.putBoolean("shouldNOTTrustMe", shouldNOTTrustMe);
editor.putBoolean("disableNumberRounding", disableNumberRounding);
2020-05-30 12:36:45 +02:00
editor.putBoolean("disableAppBarShadow", disableAppBarShadow);
editor.putBoolean("mediaPreview", mediaPreview);
2020-02-25 10:04:26 +01:00
editor.putFloat("stickerSize", stickerSize);
editor.putInt("typeface", typeface);
editor.putInt("nameOrder", nameOrder);
editor.putInt("mapPreviewProvider", mapPreviewProvider);
2020-02-11 06:26:46 +01:00
editor.putInt("translationProvider", translationProvider);
2020-02-16 05:30:15 +01:00
editor.putInt("eventType", eventType);
editor.putInt("actionBarDecoration", actionBarDecoration);
2020-04-26 08:50:44 +02:00
editor.putInt("tabsTitleType", tabsTitleType);
2019-06-11 09:13:04 +02:00
editor.commit();
} catch (Exception e) {
FileLog.e(e);
}
}
}
public static void loadConfig() {
synchronized (sync) {
if (configLoaded) {
return;
}
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
useIPv6 = preferences.getBoolean("useIPv6", false);
hidePhone = preferences.getBoolean("hidePhone", true);
ignoreBlocked = preferences.getBoolean("ignoreBlocked", false);
forceTablet = preferences.getBoolean("forceTablet", false);
2020-02-29 08:05:25 +01:00
typeface = preferences.getInt("typeface", Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? 1 : 0);
2019-06-11 09:13:04 +02:00
nameOrder = preferences.getInt("nameOrder", 1);
2019-12-17 09:06:28 +01:00
mapPreviewProvider = preferences.getInt("mapPreviewProvider", 0);
transparentStatusBar = preferences.getBoolean("transparentStatusBar", false);
2019-07-29 17:22:59 +02:00
residentNotification = preferences.getBoolean("residentNotification", false);
2020-01-11 04:03:24 +01:00
hideProxySponsorChannel = preferences.getBoolean("hideProxySponsorChannel", false);
2020-02-29 08:05:25 +01:00
saveCacheToPrivateDirectory = preferences.getBoolean("saveCacheToPrivateDirectory", Build.VERSION.SDK_INT >= Build.VERSION_CODES.N);
2019-12-07 07:35:27 +01:00
showAddToSavedMessages = preferences.getBoolean("showAddToSavedMessages", true);
showReport = preferences.getBoolean("showReport", false);
showPrPr = preferences.getBoolean("showPrPr", false);
2020-01-11 04:50:05 +01:00
showViewHistory = preferences.getBoolean("showViewHistory", true);
2019-12-07 07:35:27 +01:00
showAdminActions = preferences.getBoolean("showAdminActions", true);
showChangePermissions = preferences.getBoolean("showChangePermissions", true);
2020-01-10 10:13:03 +01:00
showDeleteDownloadedFile = preferences.getBoolean("showDeleteDownloadedFile", true);
2020-01-18 12:57:04 +01:00
showMessageDetails = preferences.getBoolean("showMessageDetails", false);
2020-02-12 06:53:27 +01:00
showTranslate = preferences.getBoolean("showTranslate", true);
showRepeat = preferences.getBoolean("showRepeat", true);
2020-02-16 05:30:15 +01:00
eventType = preferences.getInt("eventType", 0);
actionBarDecoration = preferences.getInt("actionBarDecoration", 0);
2019-12-30 06:43:49 +01:00
newYear = preferences.getBoolean("newYear", false);
2020-01-16 17:10:29 +01:00
stickerSize = preferences.getFloat("stickerSize", 14.0f);
2020-03-02 13:12:02 +01:00
unlimitedFavedStickers = preferences.getBoolean("unlimitedFavedStickers", false);
unlimitedPinnedDialogs = preferences.getBoolean("unlimitedPinnedDialogs", false);
2020-02-12 06:53:27 +01:00
translationProvider = preferences.getInt("translationProvider", 1);
2020-02-17 15:02:50 +01:00
disablePhotoSideAction = preferences.getBoolean("disablePhotoSideAction", true);
2020-02-20 13:35:34 +01:00
openArchiveOnPull = preferences.getBoolean("openArchiveOnPull", false);
showHiddenFeature = preferences.getBoolean("showHiddenFeature2", false);
2020-03-01 16:09:48 +01:00
hideKeyboardOnChatScroll = preferences.getBoolean("hideKeyboardOnChatScroll", false);
2020-03-26 10:02:35 +01:00
avatarAsDrawerBackground = preferences.getBoolean("avatarAsDrawerBackground", false);
2020-03-30 06:23:34 +02:00
useSystemEmoji = preferences.getBoolean("useSystemEmoji", SharedConfig.useSystemEmoji);
2020-04-17 04:13:43 +02:00
showTabsOnForward = preferences.getBoolean("showTabsOnForward", false);
rearVideoMessages = preferences.getBoolean("rearVideoMessages", false);
2020-04-17 05:27:50 +02:00
hideAllTab = preferences.getBoolean("hideAllTab", false);
2020-04-26 08:50:44 +02:00
tabsTitleType = preferences.getInt("tabsTitleType", TITLE_TYPE_TEXT);
confirmAVMessage = preferences.getBoolean("confirmAVMessage", true);
2020-05-07 08:11:40 +02:00
askBeforeCall = preferences.getBoolean("askBeforeCall", true);
2020-05-12 13:35:15 +02:00
shouldNOTTrustMe = preferences.getBoolean("shouldNOTTrustMe", false);
disableNumberRounding = preferences.getBoolean("disableNumberRounding", false);
2020-05-30 12:36:45 +02:00
disableAppBarShadow = preferences.getBoolean("disableAppBarShadow", false);
mediaPreview = preferences.getBoolean("mediaPreview", false);
2019-06-11 09:13:04 +02:00
configLoaded = true;
}
}
2019-12-07 07:35:27 +01:00
public static void toggleShowAddToSavedMessages() {
showAddToSavedMessages = !showAddToSavedMessages;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("showAddToSavedMessages", showAddToSavedMessages);
editor.commit();
}
public static void toggleShowReport() {
showReport = !showReport;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("showReport", showReport);
editor.commit();
}
2020-01-11 04:50:05 +01:00
public static void toggleShowViewHistory() {
showViewHistory = !showViewHistory;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("showViewHistory", showViewHistory);
editor.commit();
}
2019-12-07 07:35:27 +01:00
public static void toggleShowPrPr() {
showPrPr = !showPrPr;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("showPrPr", showPrPr);
editor.commit();
}
public static void toggleShowAdminActions() {
showAdminActions = !showAdminActions;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("showAdminActions", showAdminActions);
editor.commit();
}
public static void toggleShowChangePermissions() {
showChangePermissions = !showChangePermissions;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("showChangePermissions", showChangePermissions);
editor.commit();
}
2020-01-10 10:13:03 +01:00
public static void toggleShowDeleteDownloadedFile() {
showDeleteDownloadedFile = !showDeleteDownloadedFile;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("showDeleteDownloadedFile", showDeleteDownloadedFile);
editor.commit();
}
2020-01-18 12:57:04 +01:00
public static void toggleShowMessageDetails() {
showMessageDetails = !showMessageDetails;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("showMessageDetails", showMessageDetails);
editor.commit();
}
2019-12-07 07:35:27 +01:00
public static void toggleShowRepeat() {
showRepeat = !showRepeat;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("showRepeat", showRepeat);
editor.commit();
}
2019-06-11 09:13:04 +02:00
public static void toggleIPv6() {
useIPv6 = !useIPv6;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("useIPv6", useIPv6);
editor.commit();
}
public static void toggleHidePhone() {
hidePhone = !hidePhone;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("hidePhone", hidePhone);
editor.commit();
}
public static void toggleIgnoreBlocked() {
ignoreBlocked = !ignoreBlocked;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("ignoreBlocked", ignoreBlocked);
editor.commit();
}
public static void toggleForceTablet() {
forceTablet = !forceTablet;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("forceTablet", forceTablet);
editor.commit();
}
2019-12-30 06:43:49 +01:00
public static void toggleTypeface() {
2019-12-14 05:19:38 +01:00
typeface = typeface == 0 ? 1 : 0;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putInt("typeface", typeface);
editor.commit();
}
2019-06-11 09:13:04 +02:00
public static void setNameOrder(int order) {
nameOrder = order;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putInt("nameOrder", nameOrder);
editor.commit();
}
2019-12-17 09:06:28 +01:00
public static void setMapPreviewProvider(int provider) {
mapPreviewProvider = provider;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putInt("mapPreviewProvider", mapPreviewProvider);
editor.commit();
}
2019-07-07 07:31:28 +02:00
public static void toggleTransparentStatusBar() {
transparentStatusBar = !transparentStatusBar;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("transparentStatusBar", transparentStatusBar);
editor.commit();
}
2019-07-29 17:22:59 +02:00
public static void toggleResidentNotification() {
residentNotification = !residentNotification;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("residentNotification", residentNotification);
editor.commit();
2020-02-25 10:04:26 +01:00
ApplicationLoader.applicationContext.stopService(new Intent(ApplicationLoader.applicationContext, NotificationsService.class));
ApplicationLoader.startPushService();
2019-07-29 17:22:59 +02:00
}
2020-01-11 04:03:24 +01:00
public static void toggleHideProxySponsorChannel() {
hideProxySponsorChannel = !hideProxySponsorChannel;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("hideProxySponsorChannel", hideProxySponsorChannel);
editor.commit();
}
public static void toggleSaveCacheToPrivateDirectory() {
saveCacheToPrivateDirectory = !saveCacheToPrivateDirectory;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("saveCacheToPrivateDirectory", saveCacheToPrivateDirectory);
editor.commit();
}
2020-02-16 05:30:15 +01:00
public static void setEventType(int type) {
eventType = type;
2019-12-30 06:43:49 +01:00
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
2020-02-16 05:30:15 +01:00
editor.putInt("eventType", eventType);
2019-12-30 06:43:49 +01:00
editor.commit();
}
2020-02-16 05:30:15 +01:00
public static void setActionBarDecoration(int decoration) {
actionBarDecoration = decoration;
2019-12-30 06:43:49 +01:00
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
2020-02-16 05:30:15 +01:00
editor.putInt("actionBarDecoration", actionBarDecoration);
2019-12-30 06:43:49 +01:00
editor.commit();
}
2020-02-16 05:30:15 +01:00
public static void toggleNewYear() {
newYear = !newYear;
2019-12-30 14:00:42 +01:00
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
2020-02-16 05:30:15 +01:00
editor.putBoolean("newYear", newYear);
2019-12-30 14:00:42 +01:00
editor.commit();
}
2020-01-18 07:35:06 +01:00
public static void toggleUnlimitedFavedStickers() {
unlimitedFavedStickers = !unlimitedFavedStickers;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("unlimitedFavedStickers", unlimitedFavedStickers);
editor.commit();
}
public static void toggleUnlimitedPinnedDialogs() {
unlimitedPinnedDialogs = !unlimitedPinnedDialogs;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("unlimitedPinnedDialogs", unlimitedPinnedDialogs);
editor.commit();
}
2020-01-29 10:02:51 +01:00
public static void toggleShowTranslate() {
showTranslate = !showTranslate;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("showTranslate", showTranslate);
editor.commit();
}
2020-01-16 17:10:29 +01:00
public static void setStickerSize(float size) {
stickerSize = size;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putFloat("stickerSize", stickerSize);
editor.commit();
}
2020-02-11 06:26:46 +01:00
public static void setTranslationProvider(int provider) {
translationProvider = provider;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putInt("translationProvider", translationProvider);
editor.commit();
}
2020-02-17 15:02:50 +01:00
public static void toggleDisablePhotoSideAction() {
disablePhotoSideAction = !disablePhotoSideAction;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("disablePhotoSideAction", disablePhotoSideAction);
editor.commit();
}
2020-02-20 13:35:34 +01:00
public static void toggleOpenArchiveOnPull() {
openArchiveOnPull = !openArchiveOnPull;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("openArchiveOnPull", openArchiveOnPull);
editor.commit();
}
2020-02-29 08:05:25 +01:00
public static void toggleShowHiddenFeature() {
showHiddenFeature = !showHiddenFeature;
2020-02-21 05:08:57 +01:00
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("showHiddenFeature2", showHiddenFeature);
2020-02-21 05:08:57 +01:00
editor.commit();
}
2020-03-01 16:09:48 +01:00
public static void toggleHideKeyboardOnChatScroll() {
hideKeyboardOnChatScroll = !hideKeyboardOnChatScroll;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("hideKeyboardOnChatScroll", hideKeyboardOnChatScroll);
editor.commit();
}
2020-03-26 10:02:35 +01:00
public static void toggleAvatarAsDrawerBackground() {
avatarAsDrawerBackground = !avatarAsDrawerBackground;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("avatarAsDrawerBackground", avatarAsDrawerBackground);
editor.commit();
}
2020-03-30 06:23:34 +02:00
public static void toggleUseSystemEmoji() {
useSystemEmoji = !useSystemEmoji;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("useSystemEmoji", useSystemEmoji);
editor.commit();
}
2020-04-08 10:16:23 +02:00
public static void toggleShowTabsOnForward() {
showTabsOnForward = !showTabsOnForward;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("showTabsOnForward", showTabsOnForward);
editor.commit();
}
2020-04-17 04:13:43 +02:00
public static void toggleRearVideoMessages() {
rearVideoMessages = !rearVideoMessages;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("rearVideoMessages", rearVideoMessages);
editor.commit();
}
2020-04-17 05:27:50 +02:00
public static void toggleHideAllTab() {
hideAllTab = !hideAllTab;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("hideAllTab", hideAllTab);
editor.commit();
}
2020-04-26 08:50:44 +02:00
public static void setTabsTitleType(int type) {
tabsTitleType = type;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putInt("tabsTitleType", tabsTitleType);
editor.commit();
}
public static void toggleConfirmAVMessage() {
confirmAVMessage = !confirmAVMessage;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("confirmAVMessage", confirmAVMessage);
editor.commit();
}
2020-05-07 08:11:40 +02:00
public static void toggleAskBeforeCall() {
askBeforeCall = !askBeforeCall;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("askBeforeCall", askBeforeCall);
editor.commit();
}
2020-05-12 13:35:15 +02:00
public static void toggleShouldNOTTrustMe() {
shouldNOTTrustMe = !shouldNOTTrustMe;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("shouldNOTTrustMe", shouldNOTTrustMe);
editor.commit();
}
public static void toggleDisableNumberRounding() {
disableNumberRounding = !disableNumberRounding;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("disableNumberRounding", disableNumberRounding);
editor.commit();
}
2020-05-30 12:36:45 +02:00
public static void toggleDisableAppBarShadow() {
disableAppBarShadow = !disableAppBarShadow;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("disableAppBarShadow", disableAppBarShadow);
editor.commit();
}
public static void toggleMediaPreview() {
mediaPreview = !mediaPreview;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("mediaPreview", mediaPreview);
editor.commit();
}
2019-06-11 09:13:04 +02:00
}