2019-06-11 09:13:04 +02:00
|
|
|
package tw.nekomimi.nekogram;
|
|
|
|
|
|
|
|
import android.app.Activity;
|
2019-07-29 17:22:59 +02:00
|
|
|
import android.content.Intent;
|
2019-06-11 09:13:04 +02:00
|
|
|
import android.content.SharedPreferences;
|
2020-07-19 09:44:11 +02:00
|
|
|
import android.content.pm.ApplicationInfo;
|
|
|
|
import android.content.pm.PackageManager;
|
2021-04-11 02:53:15 +02:00
|
|
|
import android.content.res.Configuration;
|
2021-01-08 10:09:16 +01:00
|
|
|
import android.graphics.Typeface;
|
2019-06-11 09:13:04 +02:00
|
|
|
|
2021-04-11 02:53:15 +02:00
|
|
|
import org.telegram.messenger.AndroidUtilities;
|
2019-06-11 09:13:04 +02:00
|
|
|
import org.telegram.messenger.ApplicationLoader;
|
2021-04-19 14:25:33 +02:00
|
|
|
import org.telegram.messenger.BuildVars;
|
2021-01-08 10:09:16 +01:00
|
|
|
import org.telegram.messenger.FileLog;
|
2020-06-25 17:25:17 +02:00
|
|
|
import org.telegram.messenger.LocaleController;
|
|
|
|
import org.telegram.messenger.NotificationCenter;
|
2020-02-25 10:04:26 +01:00
|
|
|
import org.telegram.messenger.NotificationsService;
|
2020-06-25 17:25:17 +02:00
|
|
|
import org.telegram.messenger.R;
|
2021-04-11 02:53:15 +02:00
|
|
|
import org.telegram.ui.ActionBar.Theme;
|
2020-06-25 17:25:17 +02:00
|
|
|
|
2021-01-08 10:09:16 +01:00
|
|
|
import java.io.BufferedReader;
|
|
|
|
import java.io.FileReader;
|
2021-01-11 12:22:07 +01:00
|
|
|
import java.util.Locale;
|
2021-01-08 10:09:16 +01:00
|
|
|
import java.util.regex.Matcher;
|
|
|
|
import java.util.regex.Pattern;
|
2019-06-11 09:13:04 +02:00
|
|
|
|
2021-01-11 12:22:07 +01:00
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
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;
|
|
|
|
|
2020-07-19 09:44:11 +02:00
|
|
|
public static SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
|
2020-06-25 17:25:17 +02:00
|
|
|
|
|
|
|
public static boolean useIPv6;
|
|
|
|
|
|
|
|
public static boolean useSystemEmoji;
|
|
|
|
public static boolean ignoreBlocked;
|
|
|
|
public static boolean hideProxySponsorChannel;
|
|
|
|
public static boolean disablePhotoSideAction;
|
|
|
|
public static boolean hideKeyboardOnChatScroll;
|
|
|
|
public static boolean rearVideoMessages;
|
|
|
|
public static boolean hideAllTab;
|
2021-04-23 18:40:35 +02:00
|
|
|
public static boolean pressTitleToOpenAllChats;
|
2020-06-25 17:25:17 +02:00
|
|
|
public static boolean confirmAVMessage;
|
|
|
|
public static boolean askBeforeCall;
|
|
|
|
public static boolean disableNumberRounding;
|
|
|
|
public static int mapPreviewProvider;
|
|
|
|
public static float stickerSize;
|
|
|
|
public static int translationProvider;
|
|
|
|
public static int tabsTitleType;
|
|
|
|
|
|
|
|
public static boolean showAddToSavedMessages;
|
|
|
|
public static boolean showReport;
|
|
|
|
public static boolean showViewHistory;
|
|
|
|
public static boolean showAdminActions;
|
|
|
|
public static boolean showChangePermissions;
|
|
|
|
public static boolean showDeleteDownloadedFile;
|
|
|
|
public static boolean showMessageDetails;
|
|
|
|
public static boolean showTranslate;
|
|
|
|
public static boolean showRepeat;
|
2021-04-13 06:51:17 +02:00
|
|
|
public static boolean showMessageHide;
|
2020-06-25 17:25:17 +02:00
|
|
|
|
|
|
|
public static boolean hidePhone;
|
|
|
|
public static int typeface;
|
|
|
|
public static boolean transparentStatusBar;
|
2021-01-11 12:22:07 +01:00
|
|
|
public static int tabletMode;
|
2020-06-25 17:25:17 +02:00
|
|
|
public static boolean openArchiveOnPull;
|
|
|
|
public static boolean avatarAsDrawerBackground;
|
|
|
|
public static boolean showTabsOnForward;
|
|
|
|
public static int nameOrder;
|
|
|
|
public static int eventType;
|
|
|
|
public static boolean newYear;
|
|
|
|
public static int actionBarDecoration;
|
|
|
|
public static boolean unlimitedFavedStickers;
|
|
|
|
public static boolean unlimitedPinnedDialogs;
|
|
|
|
public static boolean residentNotification;
|
|
|
|
|
|
|
|
public static boolean disableChatAction;
|
|
|
|
public static boolean sortByUnread;
|
|
|
|
public static boolean sortByUnmuted;
|
|
|
|
public static boolean sortByUser;
|
|
|
|
public static boolean sortByContacts;
|
|
|
|
|
|
|
|
public static boolean disableUndo;
|
|
|
|
|
|
|
|
public static boolean filterUsers;
|
|
|
|
public static boolean filterContacts;
|
|
|
|
public static boolean filterGroups;
|
|
|
|
public static boolean filterChannels;
|
|
|
|
public static boolean filterBots;
|
|
|
|
public static boolean filterAdmins;
|
|
|
|
public static boolean filterUnmuted;
|
|
|
|
public static boolean filterUnread;
|
|
|
|
public static boolean filterUnmutedAndUnread;
|
|
|
|
|
|
|
|
public static boolean ignoreMutedCount;
|
|
|
|
|
|
|
|
public static boolean disableSystemAccount;
|
|
|
|
public static boolean disableProxyWhenVpnEnabled;
|
|
|
|
public static boolean skipOpenLinkConfirm;
|
|
|
|
|
|
|
|
public static boolean useDefaultTheme;
|
|
|
|
public static boolean showIdAndDc;
|
|
|
|
|
|
|
|
public static String googleCloudTranslateKey;
|
|
|
|
|
|
|
|
public static String cachePath;
|
2021-01-08 10:09:16 +01:00
|
|
|
private static Typeface systemEmojiTypeface;
|
|
|
|
public static boolean loadSystemEmojiFailed = false;
|
2020-06-25 17:25:17 +02:00
|
|
|
|
|
|
|
public static String translateToLang;
|
|
|
|
public static String translateInputLang;
|
|
|
|
|
2020-12-17 18:32:45 +01:00
|
|
|
public static String ccToLang;
|
|
|
|
public static String ccInputLang;
|
2021-01-03 07:43:35 +01:00
|
|
|
public static boolean increaseVoiceMessageQuality;
|
2020-12-17 18:32:45 +01:00
|
|
|
|
2021-08-19 21:10:27 +02:00
|
|
|
public static boolean useSystemDNS;
|
|
|
|
public static String customDoH;
|
2020-06-25 17:25:17 +02:00
|
|
|
public static boolean hideProxyByDefault;
|
|
|
|
public static boolean useProxyItem;
|
|
|
|
|
|
|
|
public static boolean disableAppBarShadow;
|
|
|
|
public static boolean mediaPreview;
|
|
|
|
|
2020-06-27 07:36:00 +02:00
|
|
|
public static boolean proxyAutoSwitch;
|
2021-04-01 04:06:54 +02:00
|
|
|
|
|
|
|
public static int usePersianCalendar;
|
2021-04-02 07:56:28 +02:00
|
|
|
public static boolean displayPersianCalendarByLatin;
|
2020-06-27 07:36:00 +02:00
|
|
|
|
2020-07-19 09:44:11 +02:00
|
|
|
public static String openPGPApp;
|
|
|
|
public static long openPGPKeyId;
|
|
|
|
|
2020-07-26 18:07:20 +02:00
|
|
|
public static boolean disableVibration;
|
2020-07-31 17:47:36 +02:00
|
|
|
public static boolean autoPauseVideo;
|
|
|
|
public static boolean disableProximityEvents;
|
2020-07-26 18:07:20 +02:00
|
|
|
|
2020-10-11 11:30:08 +02:00
|
|
|
public static boolean ignoreContentRestrictions;
|
2020-11-07 15:07:19 +01:00
|
|
|
public static boolean useChatAttachMediaMenu;
|
|
|
|
public static boolean disableLinkPreviewByDefault;
|
2020-11-10 17:51:53 +01:00
|
|
|
public static boolean sendCommentAfterForward;
|
2021-01-03 07:43:35 +01:00
|
|
|
public static boolean acceptSecretChat;
|
2020-10-11 11:30:08 +02:00
|
|
|
|
2021-01-12 03:37:29 +01:00
|
|
|
public static boolean avatarBackgroundBlur;
|
|
|
|
public static boolean avatarBackgroundDarken;
|
2021-02-04 18:59:00 +01:00
|
|
|
public static boolean disableTrending;
|
2021-06-02 19:50:35 +02:00
|
|
|
public static boolean dontSendGreetingSticker;
|
2021-07-16 07:57:39 +02:00
|
|
|
public static boolean hideTimeForSticker;
|
2021-06-02 19:50:35 +02:00
|
|
|
public static boolean takeGIFasVideo;
|
2021-08-28 16:05:34 +02:00
|
|
|
public static int maxRecentStickerCount;
|
2021-09-02 04:53:37 +02:00
|
|
|
public static boolean disableSwipeToNext;
|
2021-09-20 15:30:57 +02:00
|
|
|
public static boolean disableRemoteEmojiInteractions;
|
|
|
|
public static boolean disableChoosingSticker;
|
2021-01-12 03:37:29 +01:00
|
|
|
|
2021-03-09 11:32:48 +01:00
|
|
|
public static boolean disableAutoDownloadingWin32Executable;
|
|
|
|
public static boolean disableAutoDownloadingArchive;
|
|
|
|
|
2021-06-27 15:32:12 +02:00
|
|
|
public static boolean enableStickerPin;
|
|
|
|
public static boolean useMediaStreamInVoip;
|
2021-08-20 22:23:27 +02:00
|
|
|
public static short customAudioBitrate = 320;
|
|
|
|
public static boolean disableGroupVoipAudioProcessing = false;
|
2021-06-02 12:05:07 +02:00
|
|
|
|
2020-07-19 09:44:11 +02:00
|
|
|
public static String getOpenPGPAppName() {
|
|
|
|
|
|
|
|
if (StrUtil.isNotBlank(openPGPApp)) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
PackageManager manager = ApplicationLoader.applicationContext.getPackageManager();
|
|
|
|
ApplicationInfo info = manager.getApplicationInfo(openPGPApp, PackageManager.GET_META_DATA);
|
|
|
|
return (String) manager.getApplicationLabel(info);
|
|
|
|
} catch (PackageManager.NameNotFoundException e) {
|
|
|
|
openPGPApp = "";
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-01-03 07:43:35 +01:00
|
|
|
return LocaleController.getString("None", R.string.None);
|
2020-07-19 09:44:11 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-06-25 17:25:17 +02:00
|
|
|
public static String formatLang(String name) {
|
|
|
|
|
|
|
|
if (name == null) {
|
|
|
|
|
|
|
|
return LocaleController.getString("Default", R.string.Default);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if (name.contains("-")) {
|
|
|
|
|
|
|
|
return new Locale(StrUtil.subBefore(name, "-", false), StrUtil.subAfter(name, "-", false)).getDisplayName(LocaleController.getInstance().currentLocale);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return new Locale(name).getDisplayName(LocaleController.getInstance().currentLocale);
|
2019-06-11 09:13:04 +02:00
|
|
|
|
|
|
|
}
|
2020-06-25 17:25:17 +02:00
|
|
|
|
2019-06-11 09:13:04 +02:00
|
|
|
}
|
2020-06-25 17:25:17 +02:00
|
|
|
|
2019-06-11 09:13:04 +02:00
|
|
|
}
|
|
|
|
|
2020-06-25 17:25:17 +02:00
|
|
|
static {
|
|
|
|
|
|
|
|
useIPv6 = preferences.getBoolean("useIPv6", false);
|
|
|
|
hidePhone = preferences.getBoolean("hidePhone", true);
|
|
|
|
ignoreBlocked = preferences.getBoolean("ignoreBlocked", false);
|
2021-01-11 12:22:07 +01:00
|
|
|
|
|
|
|
boolean forceTablet = preferences.getBoolean("forceTablet", false);
|
|
|
|
if (forceTablet) {
|
|
|
|
tabletMode = 1;
|
|
|
|
preferences.edit()
|
|
|
|
.remove("forceTablet")
|
|
|
|
.putInt("tabletMode", 1)
|
|
|
|
.apply();
|
|
|
|
} else {
|
|
|
|
tabletMode = preferences.getInt("tabletMode", 0);
|
|
|
|
}
|
|
|
|
|
2020-06-25 17:25:17 +02:00
|
|
|
typeface = preferences.getInt("typeface", 0);
|
|
|
|
nameOrder = preferences.getInt("nameOrder", 1);
|
|
|
|
mapPreviewProvider = preferences.getInt("mapPreviewProvider", 0);
|
|
|
|
transparentStatusBar = preferences.getBoolean("transparentStatusBar", false);
|
|
|
|
residentNotification = preferences.getBoolean("residentNotification", false);
|
|
|
|
hideProxySponsorChannel = preferences.getBoolean("hideProxySponsorChannel", false);
|
2021-02-07 15:41:06 +01:00
|
|
|
showAddToSavedMessages = preferences.getBoolean("showAddToSavedMessages", true);
|
|
|
|
showReport = preferences.getBoolean("showReport", true);
|
2020-06-25 17:25:17 +02:00
|
|
|
showViewHistory = preferences.getBoolean("showViewHistory", true);
|
|
|
|
showAdminActions = preferences.getBoolean("showAdminActions", true);
|
|
|
|
showChangePermissions = preferences.getBoolean("showChangePermissions", true);
|
|
|
|
showDeleteDownloadedFile = preferences.getBoolean("showDeleteDownloadedFile", true);
|
|
|
|
showMessageDetails = preferences.getBoolean("showMessageDetails", false);
|
|
|
|
showTranslate = preferences.getBoolean("showTranslate", true);
|
2021-02-07 15:41:06 +01:00
|
|
|
showRepeat = preferences.getBoolean("showRepeat", false);
|
2021-04-13 06:51:17 +02:00
|
|
|
showMessageHide = preferences.getBoolean("showMessageHide", false);
|
|
|
|
|
2020-06-25 17:25:17 +02:00
|
|
|
eventType = preferences.getInt("eventType", 0);
|
|
|
|
actionBarDecoration = preferences.getInt("actionBarDecoration", 0);
|
|
|
|
newYear = preferences.getBoolean("newYear", false);
|
|
|
|
stickerSize = preferences.getFloat("stickerSize", 14.0f);
|
|
|
|
unlimitedFavedStickers = preferences.getBoolean("unlimitedFavedStickers", false);
|
|
|
|
unlimitedPinnedDialogs = preferences.getBoolean("unlimitedPinnedDialogs", false);
|
|
|
|
translationProvider = preferences.getInt("translationProvider", 1);
|
|
|
|
disablePhotoSideAction = preferences.getBoolean("disablePhotoSideAction", true);
|
|
|
|
openArchiveOnPull = preferences.getBoolean("openArchiveOnPull", false);
|
|
|
|
//showHiddenFeature = preferences.getBoolean("showHiddenFeature", false);
|
|
|
|
hideKeyboardOnChatScroll = preferences.getBoolean("hideKeyboardOnChatScroll", false);
|
|
|
|
avatarAsDrawerBackground = preferences.getBoolean("avatarAsDrawerBackground", true);
|
2021-01-12 03:37:29 +01:00
|
|
|
avatarBackgroundBlur = preferences.getBoolean("avatarBackgroundBlur", false);
|
2021-03-09 11:32:48 +01:00
|
|
|
avatarBackgroundDarken = preferences.getBoolean("avatarBackgroundDarken", false);
|
|
|
|
useSystemEmoji = preferences.getBoolean("useSystemEmoji", false);
|
2020-06-26 10:48:53 +02:00
|
|
|
showTabsOnForward = preferences.getBoolean("showTabsOnForward", false);
|
2020-06-25 17:25:17 +02:00
|
|
|
rearVideoMessages = preferences.getBoolean("rearVideoMessages", false);
|
|
|
|
hideAllTab = preferences.getBoolean("hideAllTab", false);
|
2021-04-23 18:40:35 +02:00
|
|
|
pressTitleToOpenAllChats = preferences.getBoolean("pressTitleToOpenAllChats", false);
|
2020-06-25 17:25:17 +02:00
|
|
|
|
|
|
|
disableChatAction = preferences.getBoolean("disable_chat_action", false);
|
|
|
|
sortByUnread = preferences.getBoolean("sort_by_unread", false);
|
|
|
|
sortByUnmuted = preferences.getBoolean("sort_by_unmuted", true);
|
|
|
|
sortByUser = preferences.getBoolean("sort_by_user", true);
|
|
|
|
sortByContacts = preferences.getBoolean("sort_by_contacts", true);
|
|
|
|
|
|
|
|
disableUndo = preferences.getBoolean("disable_undo", false);
|
|
|
|
|
|
|
|
filterUsers = preferences.getBoolean("filter_users", true);
|
|
|
|
filterContacts = preferences.getBoolean("filter_contacts", true);
|
|
|
|
filterGroups = preferences.getBoolean("filter_groups", true);
|
|
|
|
filterChannels = preferences.getBoolean("filter_channels", true);
|
|
|
|
filterBots = preferences.getBoolean("filter_bots", true);
|
|
|
|
filterAdmins = preferences.getBoolean("filter_admins", true);
|
|
|
|
filterUnmuted = preferences.getBoolean("filter_unmuted", true);
|
|
|
|
filterUnread = preferences.getBoolean("filter_unread", true);
|
|
|
|
filterUnmutedAndUnread = preferences.getBoolean("filter_unmuted_and_unread", true);
|
|
|
|
|
|
|
|
disableSystemAccount = preferences.getBoolean("disable_system_account", false);
|
|
|
|
disableProxyWhenVpnEnabled = preferences.getBoolean("disable_proxy_when_vpn_enabled", false);
|
|
|
|
skipOpenLinkConfirm = preferences.getBoolean("skip_open_link_confirm", false);
|
|
|
|
|
|
|
|
ignoreMutedCount = preferences.getBoolean("ignore_muted_count", true);
|
|
|
|
useDefaultTheme = preferences.getBoolean("use_default_theme", false);
|
|
|
|
showIdAndDc = preferences.getBoolean("show_id_and_dc", false);
|
|
|
|
|
|
|
|
googleCloudTranslateKey = preferences.getString("google_cloud_translate_key", null);
|
|
|
|
cachePath = preferences.getString("cache_path", null);
|
|
|
|
|
|
|
|
translateToLang = preferences.getString("trans_to_lang", null);
|
|
|
|
translateInputLang = preferences.getString("trans_input_to_lang", "en");
|
|
|
|
|
2020-12-17 19:29:42 +01:00
|
|
|
ccToLang = preferences.getString("opencc_to_lang", null);
|
|
|
|
ccInputLang = preferences.getString("opencc_input_to_lang", null);
|
2020-12-17 18:32:45 +01:00
|
|
|
|
2020-06-25 17:25:17 +02:00
|
|
|
tabsTitleType = preferences.getInt("tabsTitleType", TITLE_TYPE_TEXT);
|
|
|
|
confirmAVMessage = preferences.getBoolean("confirmAVMessage", false);
|
|
|
|
askBeforeCall = preferences.getBoolean("askBeforeCall", false);
|
|
|
|
disableNumberRounding = preferences.getBoolean("disableNumberRounding", false);
|
|
|
|
|
2021-08-19 21:10:27 +02:00
|
|
|
useSystemDNS = preferences.getBoolean("useSystemDNS", false);
|
|
|
|
customDoH = preferences.getString("customDoH", "");
|
2020-06-26 05:10:18 +02:00
|
|
|
hideProxyByDefault = preferences.getBoolean("hide_proxy_by_default", false);
|
|
|
|
useProxyItem = preferences.getBoolean("use_proxy_item", true);
|
2020-06-25 17:25:17 +02:00
|
|
|
|
|
|
|
disableAppBarShadow = preferences.getBoolean("disableAppBarShadow", false);
|
2020-07-26 10:57:33 +02:00
|
|
|
mediaPreview = preferences.getBoolean("mediaPreview", true);
|
2019-06-11 09:13:04 +02:00
|
|
|
|
2020-06-27 07:36:00 +02:00
|
|
|
proxyAutoSwitch = preferences.getBoolean("proxy_auto_switch", false);
|
2021-04-01 04:06:54 +02:00
|
|
|
|
|
|
|
usePersianCalendar = preferences.getInt("persian_calendar", 0);
|
2021-04-02 16:25:34 +02:00
|
|
|
displayPersianCalendarByLatin = preferences.getBoolean("displayPersianCalendarByLatin", false);
|
2021-01-03 07:43:35 +01:00
|
|
|
openPGPApp = preferences.getString("openPGPApp", "");
|
|
|
|
openPGPKeyId = preferences.getLong("openPGPKeyId", 0L);
|
2020-06-27 07:36:00 +02:00
|
|
|
|
2020-07-26 18:07:20 +02:00
|
|
|
disableVibration = preferences.getBoolean("disableVibration", false);
|
2020-07-31 17:47:36 +02:00
|
|
|
autoPauseVideo = preferences.getBoolean("autoPauseVideo", false);
|
2020-10-18 06:28:53 +02:00
|
|
|
disableProximityEvents = preferences.getBoolean("disableProximityEvents", false);
|
2020-07-26 18:07:20 +02:00
|
|
|
|
2021-04-19 14:25:33 +02:00
|
|
|
ignoreContentRestrictions = preferences.getBoolean("ignoreContentRestrictions", !BuildVars.isPlay);
|
2020-11-07 15:07:19 +01:00
|
|
|
useChatAttachMediaMenu = preferences.getBoolean("useChatAttachMediaMenu", true);
|
|
|
|
disableLinkPreviewByDefault = preferences.getBoolean("disableLinkPreviewByDefault", false);
|
2020-11-10 17:51:53 +01:00
|
|
|
sendCommentAfterForward = preferences.getBoolean("sendCommentAfterForward", true);
|
2020-08-02 05:33:21 +02:00
|
|
|
increaseVoiceMessageQuality = preferences.getBoolean("increaseVoiceMessageQuality", true);
|
2021-01-03 07:43:35 +01:00
|
|
|
acceptSecretChat = preferences.getBoolean("acceptSecretChat", true);
|
2021-02-04 18:59:00 +01:00
|
|
|
disableTrending = preferences.getBoolean("disableTrending", true);
|
2021-06-02 19:50:35 +02:00
|
|
|
dontSendGreetingSticker = preferences.getBoolean("dontSendGreetingSticker", false);
|
2021-07-16 07:57:39 +02:00
|
|
|
hideTimeForSticker = preferences.getBoolean("hideTimeForSticker", false);
|
2021-06-02 19:50:35 +02:00
|
|
|
takeGIFasVideo = preferences.getBoolean("takeGIFasVideo", false);
|
2021-08-28 16:05:34 +02:00
|
|
|
maxRecentStickerCount = preferences.getInt("maxRecentStickerCount", 20);
|
2021-09-02 04:53:37 +02:00
|
|
|
disableSwipeToNext = preferences.getBoolean("disableSwipeToNext", false);
|
2021-09-20 15:30:57 +02:00
|
|
|
disableRemoteEmojiInteractions = preferences.getBoolean("disableRemoteEmojiInteractions", false);
|
|
|
|
disableChoosingSticker = preferences.getBoolean("disableChoosingSticker", false);
|
2020-10-11 11:30:08 +02:00
|
|
|
|
2021-03-09 11:32:48 +01:00
|
|
|
disableAutoDownloadingWin32Executable = preferences.getBoolean("disableAutoDownloadingWin32Executable", true);
|
|
|
|
disableAutoDownloadingArchive = preferences.getBoolean("disableAutoDownloadingArchive", true);
|
|
|
|
|
2021-06-27 15:32:12 +02:00
|
|
|
enableStickerPin = preferences.getBoolean("enableStickerPin", false);
|
|
|
|
useMediaStreamInVoip = preferences.getBoolean("useMediaStreamInVoip", false);
|
2021-08-20 22:23:27 +02:00
|
|
|
customAudioBitrate = (short) preferences.getInt("customAudioBitrate", 32);
|
|
|
|
disableGroupVoipAudioProcessing = preferences.getBoolean("disableGroupVoipAudioProcessing", false);
|
2021-06-27 15:32:12 +02:00
|
|
|
|
2019-06-11 09:13:04 +02:00
|
|
|
}
|
|
|
|
|
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);
|
2020-06-25 17:25:17 +02:00
|
|
|
editor.apply();
|
2019-12-07 07:35:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void toggleShowReport() {
|
|
|
|
showReport = !showReport;
|
|
|
|
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
|
|
|
|
SharedPreferences.Editor editor = preferences.edit();
|
|
|
|
editor.putBoolean("showReport", showReport);
|
2020-06-25 17:25:17 +02:00
|
|
|
editor.apply();
|
2019-12-07 07:35:27 +01:00
|
|
|
}
|
|
|
|
|
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);
|
2020-06-25 17:25:17 +02:00
|
|
|
editor.apply();
|
2019-12-07 07:35:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void toggleShowAdminActions() {
|
|
|
|
showAdminActions = !showAdminActions;
|
|
|
|
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
|
|
|
|
SharedPreferences.Editor editor = preferences.edit();
|
|
|
|
editor.putBoolean("showAdminActions", showAdminActions);
|
2020-06-25 17:25:17 +02:00
|
|
|
editor.apply();
|
2019-12-07 07:35:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void toggleShowChangePermissions() {
|
|
|
|
showChangePermissions = !showChangePermissions;
|
|
|
|
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
|
|
|
|
SharedPreferences.Editor editor = preferences.edit();
|
|
|
|
editor.putBoolean("showChangePermissions", showChangePermissions);
|
2020-06-25 17:25:17 +02:00
|
|
|
editor.apply();
|
2019-12-07 07:35:27 +01:00
|
|
|
}
|
|
|
|
|
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);
|
2020-06-25 17:25:17 +02:00
|
|
|
editor.apply();
|
2020-01-10 10:13:03 +01:00
|
|
|
}
|
|
|
|
|
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);
|
2020-06-25 17:25:17 +02:00
|
|
|
editor.apply();
|
2020-01-18 12:57:04 +01:00
|
|
|
}
|
2019-12-07 07:35:27 +01:00
|
|
|
|
2020-02-16 04:20: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);
|
2020-06-25 17:25:17 +02:00
|
|
|
editor.apply();
|
2020-02-16 04:20:27 +01:00
|
|
|
}
|
|
|
|
|
2021-04-13 06:51:17 +02:00
|
|
|
public static void toggleShowHide() {
|
|
|
|
showMessageHide = !showMessageHide;
|
|
|
|
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
|
|
|
|
SharedPreferences.Editor editor = preferences.edit();
|
|
|
|
editor.putBoolean("showMessageHide", showMessageHide);
|
|
|
|
editor.apply();
|
|
|
|
}
|
|
|
|
|
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);
|
2020-06-25 17:25:17 +02:00
|
|
|
editor.apply();
|
2019-06-11 09:13:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void toggleHidePhone() {
|
|
|
|
hidePhone = !hidePhone;
|
|
|
|
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
|
|
|
|
SharedPreferences.Editor editor = preferences.edit();
|
|
|
|
editor.putBoolean("hidePhone", hidePhone);
|
2020-06-25 17:25:17 +02:00
|
|
|
editor.apply();
|
2019-06-11 09:13:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void toggleIgnoreBlocked() {
|
|
|
|
ignoreBlocked = !ignoreBlocked;
|
|
|
|
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
|
|
|
|
SharedPreferences.Editor editor = preferences.edit();
|
|
|
|
editor.putBoolean("ignoreBlocked", ignoreBlocked);
|
2020-06-25 17:25:17 +02:00
|
|
|
editor.apply();
|
2019-06-11 09:13:04 +02:00
|
|
|
}
|
|
|
|
|
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);
|
2020-06-25 17:25:17 +02:00
|
|
|
editor.apply();
|
2019-12-14 05:19:38 +01:00
|
|
|
}
|
|
|
|
|
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);
|
2020-06-25 17:25:17 +02:00
|
|
|
editor.apply();
|
|
|
|
|
|
|
|
LocaleController.getInstance().recreateFormatters();
|
2019-06-11 09:13:04 +02:00
|
|
|
}
|
|
|
|
|
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);
|
2020-06-25 17:25:17 +02:00
|
|
|
editor.apply();
|
2019-12-17 09:06:28 +01:00
|
|
|
}
|
|
|
|
|
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);
|
2020-06-25 17:25:17 +02:00
|
|
|
editor.apply();
|
2019-07-07 07:31:28 +02:00
|
|
|
}
|
|
|
|
|
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);
|
2020-06-25 17:25:17 +02:00
|
|
|
editor.apply();
|
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);
|
2020-06-25 17:25:17 +02:00
|
|
|
editor.apply();
|
2020-01-11 13:32:11 +01:00
|
|
|
}
|
|
|
|
|
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);
|
2020-06-25 17:25:17 +02:00
|
|
|
editor.apply();
|
2019-12-30 06:43:49 +01:00
|
|
|
}
|
|
|
|
|
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);
|
2020-06-25 17:25:17 +02:00
|
|
|
editor.apply();
|
2019-12-30 14:00:42 +01:00
|
|
|
}
|
|
|
|
|
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);
|
2020-06-25 17:25:17 +02:00
|
|
|
editor.apply();
|
2020-01-18 07:35:06 +01:00
|
|
|
}
|
|
|
|
|
2019-09-05 19:23:29 +02:00
|
|
|
public static void toggleUnlimitedPinnedDialogs() {
|
|
|
|
unlimitedPinnedDialogs = !unlimitedPinnedDialogs;
|
|
|
|
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
|
|
|
|
SharedPreferences.Editor editor = preferences.edit();
|
|
|
|
editor.putBoolean("unlimitedPinnedDialogs", unlimitedPinnedDialogs);
|
2020-06-25 17:25:17 +02:00
|
|
|
editor.apply();
|
2019-09-05 19:23:29 +02:00
|
|
|
}
|
|
|
|
|
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);
|
2020-06-25 17:25:17 +02:00
|
|
|
editor.apply();
|
2020-01-29 10:02:51 +01:00
|
|
|
}
|
|
|
|
|
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);
|
2020-06-25 17:25:17 +02:00
|
|
|
editor.apply();
|
2020-01-16 17:10:29 +01:00
|
|
|
}
|
|
|
|
|
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);
|
2020-06-25 17:25:17 +02:00
|
|
|
editor.apply();
|
2020-02-11 06:26:46 +01:00
|
|
|
}
|
|
|
|
|
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);
|
2020-06-25 17:25:17 +02:00
|
|
|
editor.apply();
|
2020-02-17 15:02:50 +01:00
|
|
|
}
|
|
|
|
|
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);
|
2020-06-25 17:25:17 +02:00
|
|
|
editor.apply();
|
2020-02-20 13:35:34 +01:00
|
|
|
}
|
2020-02-21 04:11:15 +01:00
|
|
|
|
2020-03-01 16:09:48 +01:00
|
|
|
public static void toggleHideKeyboardOnChatScroll() {
|
2021-01-03 07:43:35 +01:00
|
|
|
preferences.edit().putBoolean("hideKeyboardOnChatScroll", hideKeyboardOnChatScroll = !hideKeyboardOnChatScroll).apply();
|
2020-03-01 16:09:48 +01:00
|
|
|
}
|
2020-03-26 10:02:35 +01:00
|
|
|
|
|
|
|
public static void toggleAvatarAsDrawerBackground() {
|
2021-01-03 07:43:35 +01:00
|
|
|
preferences.edit().putBoolean("avatarAsDrawerBackground", avatarAsDrawerBackground = !avatarAsDrawerBackground).apply();
|
2020-03-26 10:02:35 +01:00
|
|
|
}
|
2020-03-30 06:23:34 +02:00
|
|
|
|
2021-01-12 03:37:29 +01:00
|
|
|
public static void toggleAvatarBackgroundBlur() {
|
|
|
|
avatarBackgroundBlur = !avatarBackgroundBlur;
|
|
|
|
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
|
|
|
|
SharedPreferences.Editor editor = preferences.edit();
|
|
|
|
editor.putBoolean("avatarBackgroundBlur", avatarBackgroundBlur);
|
|
|
|
editor.commit();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void toggleAvatarBackgroundDarken() {
|
|
|
|
avatarBackgroundDarken = !avatarBackgroundDarken;
|
|
|
|
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
|
|
|
|
SharedPreferences.Editor editor = preferences.edit();
|
|
|
|
editor.putBoolean("avatarBackgroundDarken", avatarBackgroundDarken);
|
|
|
|
editor.commit();
|
|
|
|
}
|
|
|
|
|
2020-03-30 06:23:34 +02:00
|
|
|
public static void toggleUseSystemEmoji() {
|
2020-06-25 17:25:17 +02:00
|
|
|
preferences.edit().putBoolean("useSystemEmoji", useSystemEmoji = !useSystemEmoji).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void toggleDisableChatAction() {
|
|
|
|
preferences.edit().putBoolean("disable_chat_action", disableChatAction = !disableChatAction).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void toggleSortByUnread() {
|
|
|
|
preferences.edit().putBoolean("sort_by_unread", sortByUnread = !sortByUnread).apply();
|
2020-03-30 06:23:34 +02:00
|
|
|
}
|
2020-04-08 10:16:23 +02:00
|
|
|
|
|
|
|
public static void toggleShowTabsOnForward() {
|
2021-01-03 07:43:35 +01:00
|
|
|
preferences.edit().putBoolean("showTabsOnForward", showTabsOnForward = !showTabsOnForward).apply();
|
2020-04-08 10:16:23 +02:00
|
|
|
}
|
2020-04-17 04:13:43 +02:00
|
|
|
|
2020-04-17 04:38:01 +02:00
|
|
|
public static void toggleRearVideoMessages() {
|
2021-01-03 07:43:35 +01:00
|
|
|
preferences.edit().putBoolean("rearVideoMessages", rearVideoMessages = !rearVideoMessages).apply();
|
2020-04-17 04:38:01 +02:00
|
|
|
}
|
2020-04-17 05:27:50 +02:00
|
|
|
|
|
|
|
public static void toggleHideAllTab() {
|
2021-01-03 07:43:35 +01:00
|
|
|
preferences.edit().putBoolean("hideAllTab", hideAllTab = !hideAllTab).apply();
|
2020-06-25 17:25:17 +02:00
|
|
|
}
|
|
|
|
|
2021-04-23 18:40:35 +02:00
|
|
|
public static void togglePressTitleToOpenAllChats() {
|
|
|
|
preferences.edit().putBoolean("pressTitleToOpenAllChats", pressTitleToOpenAllChats = !pressTitleToOpenAllChats).apply();
|
|
|
|
}
|
|
|
|
|
2020-06-25 17:25:17 +02:00
|
|
|
public static void toggleSortByUnmuted() {
|
|
|
|
preferences.edit().putBoolean("sort_by_unmuted", sortByUnmuted = !sortByUnmuted).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void toggleSortByUser() {
|
|
|
|
preferences.edit().putBoolean("sort_by_user", sortByUser = !sortByUser).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void toggleSortByContacts() {
|
|
|
|
preferences.edit().putBoolean("sort_by_contacts", sortByContacts = !sortByContacts).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void toggleDisableUndo() {
|
|
|
|
preferences.edit().putBoolean("disable_undo", disableUndo = !disableUndo).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void toggleFilterUsers() {
|
|
|
|
preferences.edit().putBoolean("filter_users", filterUsers = !filterUsers).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void toggleFilterContacts() {
|
|
|
|
preferences.edit().putBoolean("filter_contacts", filterContacts = !filterContacts).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void toggleFilterGroups() {
|
|
|
|
preferences.edit().putBoolean("filterGroups", filterGroups = !filterGroups).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void toggleFilterChannels() {
|
|
|
|
preferences.edit().putBoolean("filter_channels", filterChannels = !filterChannels).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void toggleFilterBots() {
|
|
|
|
preferences.edit().putBoolean("filter_bots", filterBots = !filterBots).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void toggleFilterAdmins() {
|
|
|
|
preferences.edit().putBoolean("filter_admins", filterAdmins = !filterAdmins).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void toggleFilterUnmuted() {
|
|
|
|
preferences.edit().putBoolean("filter_unmuted", filterUnmuted = !filterUnmuted).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void toggleDisableFilterUnread() {
|
|
|
|
preferences.edit().putBoolean("filter_unread", filterUnread = !filterUnread).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void toggleFilterUnmutedAndUnread() {
|
|
|
|
preferences.edit().putBoolean("filter_unmuted_and_unread", filterUnmutedAndUnread = !filterUnmutedAndUnread).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void toggleDisableSystemAccount() {
|
|
|
|
preferences.edit().putBoolean("disable_system_account", disableSystemAccount = !disableSystemAccount).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void toggleDisableProxyWhenVpnEnabled() {
|
|
|
|
preferences.edit().putBoolean("disable_proxy_when_vpn_enabled", disableProxyWhenVpnEnabled = !disableProxyWhenVpnEnabled).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void toggleSkipOpenLinkConfirm() {
|
|
|
|
preferences.edit().putBoolean("skip_open_link_confirm", skipOpenLinkConfirm = !skipOpenLinkConfirm).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void toggleIgnoredMutedCount() {
|
|
|
|
preferences.edit().putBoolean("ignore_muted_count", ignoreMutedCount = !ignoreMutedCount).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void toggleUseDefaultTheme() {
|
|
|
|
preferences.edit().putBoolean("use_default_theme", useDefaultTheme = !useDefaultTheme).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void toggleShowIdAndDc() {
|
|
|
|
preferences.edit().putBoolean("show_id_and_dc", showIdAndDc = !showIdAndDc).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setGoogleTranslateKey(String key) {
|
|
|
|
preferences.edit().putString("google_cloud_translate_key", googleCloudTranslateKey = key).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setCachePath(String cachePath) {
|
|
|
|
preferences.edit().putString("cache_path", NekoConfig.cachePath = cachePath).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setTranslateToLang(String toLang) {
|
|
|
|
preferences.edit().putString("trans_to_lang", translateToLang = toLang).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setTranslateInputToLang(String toLang) {
|
|
|
|
preferences.edit().putString("trans_input_to_lang", translateInputLang = toLang).apply();
|
2020-04-17 05:27:50 +02:00
|
|
|
}
|
2020-04-26 08:50:44 +02:00
|
|
|
|
|
|
|
public static void setTabsTitleType(int type) {
|
2020-06-25 17:25:17 +02:00
|
|
|
preferences.edit().putInt("tabsTitleType", tabsTitleType = type).apply();
|
2020-04-26 08:50:44 +02:00
|
|
|
}
|
2020-05-07 07:44:06 +02:00
|
|
|
|
|
|
|
public static void toggleConfirmAVMessage() {
|
2020-06-25 17:25:17 +02:00
|
|
|
preferences.edit().putBoolean("confirmAVMessage", confirmAVMessage = !confirmAVMessage).apply();
|
2020-05-07 07:44:06 +02:00
|
|
|
}
|
2020-05-07 08:11:40 +02:00
|
|
|
|
|
|
|
public static void toggleAskBeforeCall() {
|
2020-06-25 17:25:17 +02:00
|
|
|
preferences.edit().putBoolean("askBeforeCall", askBeforeCall = !askBeforeCall).apply();
|
2020-05-07 08:11:40 +02:00
|
|
|
}
|
2020-05-12 13:35:15 +02:00
|
|
|
|
2021-08-19 21:10:27 +02:00
|
|
|
public static void toggleUseSystemDNS() {
|
|
|
|
preferences.edit().putBoolean("useSystemDNS", useSystemDNS = !useSystemDNS).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setCustomDoH(String doh) {
|
|
|
|
preferences.edit().putString("customDoH", customDoH = doh).apply();
|
|
|
|
}
|
|
|
|
|
2020-06-25 17:25:17 +02:00
|
|
|
public static void toggleHideProxyByDefault() {
|
|
|
|
preferences.edit().putBoolean("hide_proxy_by_default", hideProxyByDefault = !hideProxyByDefault).apply();
|
|
|
|
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.proxySettingsChanged);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void toggleUseProxyItem() {
|
2021-01-03 07:43:35 +01:00
|
|
|
preferences.edit().putBoolean("use_proxy_item", useProxyItem = !useProxyItem).apply();
|
2020-06-25 17:25:17 +02:00
|
|
|
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.proxySettingsChanged);
|
2020-05-12 13:35:15 +02:00
|
|
|
}
|
2020-05-12 14:01:59 +02:00
|
|
|
|
|
|
|
public static void toggleDisableNumberRounding() {
|
2021-01-03 07:43:35 +01:00
|
|
|
preferences.edit().putBoolean("disableNumberRounding", disableNumberRounding = !disableNumberRounding).apply();
|
2020-05-12 14:01:59 +02:00
|
|
|
}
|
2020-05-30 12:36:45 +02:00
|
|
|
|
|
|
|
public static void toggleDisableAppBarShadow() {
|
2021-01-03 07:43:35 +01:00
|
|
|
preferences.edit().putBoolean("disableAppBarShadow", disableAppBarShadow = !disableAppBarShadow).apply();
|
2020-05-30 12:36:45 +02:00
|
|
|
}
|
2020-06-08 14:05:26 +02:00
|
|
|
|
|
|
|
public static void toggleMediaPreview() {
|
2021-01-03 07:43:35 +01:00
|
|
|
preferences.edit().putBoolean("mediaPreview", mediaPreview = !mediaPreview).apply();
|
2020-06-08 14:05:26 +02:00
|
|
|
}
|
2020-06-27 07:36:00 +02:00
|
|
|
|
|
|
|
public static void toggleProxyAutoSwitch() {
|
2021-01-03 07:43:35 +01:00
|
|
|
preferences.edit().putBoolean("proxy_auto_switch", proxyAutoSwitch = !proxyAutoSwitch).apply();
|
2020-06-27 07:36:00 +02:00
|
|
|
}
|
|
|
|
|
2021-04-02 16:26:57 +02:00
|
|
|
public static void toggleUsePersiancalendar() {
|
2021-04-01 04:06:54 +02:00
|
|
|
preferences.edit().putInt("persian_calendar", usePersianCalendar = usePersianCalendar > 1 ? 1 : 2).apply();
|
2021-04-01 02:48:10 +02:00
|
|
|
}
|
|
|
|
|
2021-04-02 07:56:28 +02:00
|
|
|
public static void toggleDisplayPersianCalendarByLatin() {
|
2021-04-02 16:25:34 +02:00
|
|
|
preferences.edit().putBoolean("displayPersianCalendarByLatin", displayPersianCalendarByLatin = !displayPersianCalendarByLatin).apply();
|
2021-04-02 07:56:28 +02:00
|
|
|
}
|
|
|
|
|
2020-07-19 09:44:11 +02:00
|
|
|
public static void setOpenPGPApp(String packageName) {
|
2021-01-03 07:43:35 +01:00
|
|
|
preferences.edit().putString("openPGPApp", openPGPApp = packageName).apply();
|
2020-07-19 09:44:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void setOpenPGPKeyId(long keyId) {
|
2021-01-03 07:43:35 +01:00
|
|
|
preferences.edit().putLong("openPGPKeyId", openPGPKeyId = keyId).apply();
|
2020-07-19 09:44:11 +02:00
|
|
|
}
|
|
|
|
|
2020-07-26 18:07:20 +02:00
|
|
|
public static void toggleDisableVibration() {
|
2021-01-03 07:43:35 +01:00
|
|
|
preferences.edit().putBoolean("disableVibration", disableVibration = !disableVibration).apply();
|
2020-07-26 18:07:20 +02:00
|
|
|
}
|
2020-07-19 02:22:26 +02:00
|
|
|
|
2020-07-31 17:47:36 +02:00
|
|
|
public static void toggleAutoPauseVideo() {
|
2021-01-03 07:43:35 +01:00
|
|
|
preferences.edit().putBoolean("autoPauseVideo", autoPauseVideo = !autoPauseVideo).apply();
|
2020-07-31 17:47:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void toggleDisableProximityEvents() {
|
2021-01-03 07:43:35 +01:00
|
|
|
preferences.edit().putBoolean("disableProximityEvents", disableProximityEvents = !disableProximityEvents).apply();
|
2020-07-31 17:47:36 +02:00
|
|
|
}
|
|
|
|
|
2020-10-11 11:30:08 +02:00
|
|
|
public static void toggleIgnoreContentRestrictions() {
|
2021-01-03 07:43:35 +01:00
|
|
|
preferences.edit().putBoolean("ignoreContentRestrictions", ignoreContentRestrictions = !ignoreContentRestrictions).apply();
|
2020-10-11 11:30:08 +02:00
|
|
|
}
|
|
|
|
|
2020-11-07 15:07:19 +01:00
|
|
|
public static void toggleUseChatAttachMediaMenu() {
|
2021-01-03 07:43:35 +01:00
|
|
|
preferences.edit().putBoolean("useChatAttachMediaMenu", useChatAttachMediaMenu = !useChatAttachMediaMenu).apply();
|
2020-11-07 15:07:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void toggleDisableLinkPreviewByDefault() {
|
2020-12-17 18:32:45 +01:00
|
|
|
preferences.edit().putBoolean("disableLinkPreviewByDefault", disableLinkPreviewByDefault = !disableLinkPreviewByDefault).apply();
|
2020-11-07 15:07:19 +01:00
|
|
|
}
|
|
|
|
|
2020-11-10 17:51:53 +01:00
|
|
|
public static void toggleSendCommentAfterForward() {
|
2020-12-17 18:32:45 +01:00
|
|
|
preferences.edit().putBoolean("sendCommentAfterForward", sendCommentAfterForward = !sendCommentAfterForward).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setCCToLang(String toLang) {
|
|
|
|
preferences.edit().putString("opencc_to_lang", ccToLang = toLang).apply();
|
2020-11-10 17:51:53 +01:00
|
|
|
}
|
2020-12-17 18:32:45 +01:00
|
|
|
|
|
|
|
public static void setCCInputToLang(String toLang) {
|
|
|
|
preferences.edit().putString("opencc_input_to_lang", ccInputLang = toLang).apply();
|
|
|
|
}
|
|
|
|
|
2020-08-02 05:33:21 +02:00
|
|
|
public static void toggleIncreaseVoiceMessageQuality() {
|
2021-01-03 07:43:35 +01:00
|
|
|
preferences.edit().putBoolean("increaseVoiceMessageQuality", increaseVoiceMessageQuality = !increaseVoiceMessageQuality).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void toggleAcceptSecretChat() {
|
|
|
|
preferences.edit().putBoolean("acceptSecretChat", acceptSecretChat = !acceptSecretChat).apply();
|
2020-08-02 05:33:21 +02:00
|
|
|
}
|
2020-12-17 18:32:45 +01:00
|
|
|
|
2021-01-11 12:22:07 +01:00
|
|
|
public static void setTabletMode(int mode) {
|
|
|
|
preferences.edit().putInt("tabletMode", tabletMode = mode).apply();
|
|
|
|
}
|
|
|
|
|
2021-02-04 18:59:00 +01:00
|
|
|
public static void toggleDisableTrending() {
|
|
|
|
preferences.edit().putBoolean("disableTrending", disableTrending = !disableTrending).apply();
|
|
|
|
}
|
|
|
|
|
2021-03-09 11:32:48 +01:00
|
|
|
public static void toggleDisableAutoDownloadingWin32Executable() {
|
|
|
|
preferences.edit().putBoolean("disableAutoDownloadingWin32Executable", disableAutoDownloadingWin32Executable = !disableAutoDownloadingWin32Executable).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void toggleDisableAutoDownloadingArchive() {
|
|
|
|
preferences.edit().putBoolean("disableAutoDownloadingArchive", disableAutoDownloadingArchive = !disableAutoDownloadingArchive).apply();
|
|
|
|
}
|
|
|
|
|
2021-06-02 12:05:07 +02:00
|
|
|
public static void toggleDontSendGreetingSticker() {
|
|
|
|
preferences.edit().putBoolean("dontSendGreetingSticker", dontSendGreetingSticker = !dontSendGreetingSticker).apply();
|
|
|
|
}
|
|
|
|
|
2021-07-16 07:57:39 +02:00
|
|
|
public static void toggleHideTimeForSticker() {
|
|
|
|
preferences.edit().putBoolean("hideTimeForSticker", hideTimeForSticker = !hideTimeForSticker).apply();
|
|
|
|
}
|
|
|
|
|
2021-06-02 19:50:35 +02:00
|
|
|
public static void toggleTakeGIFasVideo() {
|
|
|
|
preferences.edit().putBoolean("takeGIFasVideo", takeGIFasVideo = !takeGIFasVideo).apply();
|
|
|
|
}
|
|
|
|
|
2021-08-28 16:05:34 +02:00
|
|
|
public static void setMaxRecentStickerCount(int count) {
|
|
|
|
preferences.edit().putInt("maxRecentStickerCount", maxRecentStickerCount = count).apply();
|
|
|
|
}
|
|
|
|
|
2021-09-02 04:53:37 +02:00
|
|
|
public static void toggleDisableSwipeToNext() {
|
|
|
|
preferences.edit().putBoolean("disableSwipeToNext", disableSwipeToNext = !disableSwipeToNext).apply();
|
|
|
|
}
|
|
|
|
|
2021-06-27 15:32:12 +02:00
|
|
|
public static void toggleEnableStickerPin() {
|
|
|
|
preferences.edit().putBoolean("enableStickerPin", enableStickerPin = !enableStickerPin).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void toggleUseMediaStreamInVoip() {
|
|
|
|
preferences.edit().putBoolean("useMediaStreamInVoip", useMediaStreamInVoip = !useMediaStreamInVoip).apply();
|
|
|
|
}
|
|
|
|
|
2021-08-20 22:23:27 +02:00
|
|
|
public static void setCustomAudioBitrate(int bitrate) {
|
|
|
|
preferences.edit().putInt("customAudioBitrate", customAudioBitrate = (short) bitrate).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void toggleDisableGroupVoipAudioProcessing() {
|
|
|
|
preferences.edit().putBoolean("disableGroupVoipAudioProcessing", disableGroupVoipAudioProcessing = !disableGroupVoipAudioProcessing).apply();
|
|
|
|
}
|
|
|
|
|
2021-09-20 15:30:57 +02:00
|
|
|
public static void toggleDisableRemoteEmojiInteractions() {
|
|
|
|
preferences.edit().putBoolean("disableRemoteEmojiInteractions", disableRemoteEmojiInteractions = !disableRemoteEmojiInteractions).apply();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void toggleDisableChoosingSticker() {
|
|
|
|
preferences.edit().putBoolean("disableChoosingSticker", disableChoosingSticker = !disableChoosingSticker).apply();
|
|
|
|
}
|
|
|
|
|
2021-01-08 10:09:16 +01:00
|
|
|
private static final String EMOJI_FONT_AOSP = "NotoColorEmoji.ttf";
|
|
|
|
|
|
|
|
public static Typeface getSystemEmojiTypeface() {
|
|
|
|
if (!loadSystemEmojiFailed && systemEmojiTypeface == null) {
|
|
|
|
try {
|
|
|
|
Pattern p = Pattern.compile(">(.*emoji.*)</font>", Pattern.CASE_INSENSITIVE);
|
|
|
|
BufferedReader br = new BufferedReader(new FileReader("/system/etc/fonts.xml"));
|
|
|
|
String line;
|
|
|
|
while ((line = br.readLine()) != null) {
|
|
|
|
Matcher m = p.matcher(line);
|
|
|
|
if (m.find()) {
|
|
|
|
systemEmojiTypeface = Typeface.createFromFile("/system/fonts/" + m.group(1));
|
|
|
|
FileLog.d("emoji font file fonts.xml = " + m.group(1));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
br.close();
|
|
|
|
} catch (Exception e) {
|
|
|
|
FileLog.e(e);
|
|
|
|
}
|
|
|
|
if (systemEmojiTypeface == null) {
|
|
|
|
try {
|
|
|
|
systemEmojiTypeface = Typeface.createFromFile("/system/fonts/" + EMOJI_FONT_AOSP);
|
|
|
|
FileLog.d("emoji font file = " + EMOJI_FONT_AOSP);
|
|
|
|
} catch (Exception e) {
|
|
|
|
FileLog.e(e);
|
|
|
|
loadSystemEmojiFailed = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return systemEmojiTypeface;
|
|
|
|
}
|
|
|
|
|
2021-04-11 02:53:15 +02:00
|
|
|
public static int getNotificationColor() {
|
|
|
|
int color = 0;
|
|
|
|
Configuration configuration = ApplicationLoader.applicationContext.getResources().getConfiguration();
|
|
|
|
boolean isDark = (configuration.uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;
|
|
|
|
if (isDark) {
|
|
|
|
color = 0xffffffff;
|
|
|
|
} else {
|
|
|
|
if (Theme.getActiveTheme().hasAccentColors()) {
|
|
|
|
color = Theme.getActiveTheme().getAccentColor(Theme.getActiveTheme().currentAccentId);
|
|
|
|
}
|
|
|
|
if (Theme.getActiveTheme().isDark() || color == 0) {
|
|
|
|
color = Theme.getColor(Theme.key_actionBarDefault);
|
|
|
|
}
|
|
|
|
// too bright
|
|
|
|
if (AndroidUtilities.computePerceivedBrightness(color) >= 0.721f) {
|
|
|
|
color = Theme.getColor(Theme.key_windowBackgroundWhiteBlueHeader) | 0xff000000;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return color;
|
|
|
|
}
|
|
|
|
|
2020-06-25 17:25:17 +02:00
|
|
|
}
|