| 1 | package tw.nekomimi.nekogram; |
| 2 | |
| 3 | import android.annotation.SuppressLint; |
| 4 | import android.app.Activity; |
| 5 | import android.content.Context; |
| 6 | import android.content.Intent; |
| 7 | import android.content.SharedPreferences; |
| 8 | import android.os.Build; |
| 9 | |
| 10 | import org.telegram.messenger.ApplicationLoader; |
| 11 | import org.telegram.messenger.FileLog; |
| 12 | import org.telegram.messenger.NotificationsService; |
| 13 | import org.telegram.messenger.SharedConfig; |
| 14 | |
| 15 | @SuppressLint("ApplySharedPref") |
| 16 | public class NekoConfig { |
| 17 | |
| 18 | public static final int TITLE_TYPE_TEXT = 0; |
| 19 | public static final int TITLE_TYPE_ICON = 1; |
| 20 | public static final int TITLE_TYPE_MIX = 2; |
| 21 | |
| 22 | private static final Object sync = new Object(); |
| 23 | public static boolean useIPv6 = false; |
| 24 | public static boolean showHiddenFeature = false; |
| 25 | |
| 26 | public static boolean useSystemEmoji = SharedConfig.useSystemEmoji; |
| 27 | public static boolean ignoreBlocked = false; |
| 28 | public static boolean hideProxySponsorChannel = false; |
| 29 | public static boolean saveCacheToPrivateDirectory = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N; |
| 30 | public static boolean disablePhotoSideAction = true; |
| 31 | public static boolean hideKeyboardOnChatScroll = false; |
| 32 | public static boolean rearVideoMessages = false; |
| 33 | public static boolean hideAllTab = false; |
| 34 | public static boolean confirmAVMessage = true; |
| 35 | public static boolean askBeforeCall = true; |
| 36 | public static boolean disableNumberRounding = false; |
| 37 | public static int mapPreviewProvider = 0; |
| 38 | public static float stickerSize = 14.0f; |
| 39 | public static int translationProvider = 1; |
| 40 | public static int tabsTitleType = TITLE_TYPE_TEXT; |
| 41 | |
| 42 | public static boolean showAddToSavedMessages = true; |
| 43 | public static boolean showReport = false; |
| 44 | public static boolean showPrPr = false; |
| 45 | public static boolean showViewHistory = true; |
| 46 | public static boolean showAdminActions = true; |
| 47 | public static boolean showChangePermissions = true; |
| 48 | public static boolean showDeleteDownloadedFile = true; |
| 49 | public static boolean showMessageDetails = false; |
| 50 | public static boolean showTranslate = true; |
| 51 | public static boolean showRepeat = true; |
| 52 | |
| 53 | public static boolean hidePhone = true; |
| 54 | public static int typeface = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? 1 : 0; |
| 55 | public static boolean transparentStatusBar = false; |
| 56 | public static boolean forceTablet = false; |
| 57 | public static boolean openArchiveOnPull = false; |
| 58 | public static boolean avatarAsDrawerBackground = false; |
| 59 | public static boolean showTabsOnForward = false; |
| 60 | public static int nameOrder = 1; |
| 61 | public static int eventType = 0; |
| 62 | public static boolean newYear = false; |
| 63 | public static int actionBarDecoration = 0; |
| 64 | public static boolean unlimitedFavedStickers = false; |
| 65 | public static boolean unlimitedPinnedDialogs = false; |
| 66 | public static boolean disableAppBarShadow = false; |
| 67 | |
| 68 | public static boolean residentNotification = false; |
| 69 | |
| 70 | public static boolean shouldNOTTrustMe = false; |
| 71 | |
| 72 | private static boolean configLoaded; |
| 73 | |
| 74 | static { |
| 75 | loadConfig(); |
| 76 | } |
| 77 | |
| 78 | public static void saveConfig() { |
| 79 | synchronized (sync) { |
| 80 | try { |
| 81 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfing", Context.MODE_PRIVATE); |
| 82 | SharedPreferences.Editor editor = preferences.edit(); |
| 83 | editor.putBoolean("useIPv6", useIPv6); |
| 84 | editor.putBoolean("hidePhone", hidePhone); |
| 85 | editor.putBoolean("ignoreBlocked", ignoreBlocked); |
| 86 | editor.putBoolean("forceTablet", forceTablet); |
| 87 | editor.putBoolean("transparentStatusBar", transparentStatusBar); |
| 88 | editor.putBoolean("residentNotification", residentNotification); |
| 89 | editor.putBoolean("hideProxySponsorChannel", hideProxySponsorChannel); |
| 90 | editor.putBoolean("saveCacheToPrivateDirectory", saveCacheToPrivateDirectory); |
| 91 | editor.putBoolean("showAddToSavedMessages", showAddToSavedMessages); |
| 92 | editor.putBoolean("showReport", showReport); |
| 93 | editor.putBoolean("showPrPr", showPrPr); |
| 94 | editor.putBoolean("showViewHistory", showViewHistory); |
| 95 | editor.putBoolean("showAdminActions", showAdminActions); |
| 96 | editor.putBoolean("showChangePermissions", showChangePermissions); |
| 97 | editor.putBoolean("showDeleteDownloadedFile", showDeleteDownloadedFile); |
| 98 | editor.putBoolean("showMessageDetails", showMessageDetails); |
| 99 | editor.putBoolean("showTranslate", showTranslate); |
| 100 | editor.putBoolean("showRepeat", showRepeat); |
| 101 | editor.putBoolean("newYear", newYear); |
| 102 | editor.putBoolean("unlimitedFavedStickers", unlimitedFavedStickers); |
| 103 | editor.putBoolean("unlimitedPinnedDialogs", unlimitedPinnedDialogs); |
| 104 | editor.putBoolean("disablePhotoSideAction", disablePhotoSideAction); |
| 105 | editor.putBoolean("hideKeyboardOnChatScroll", hideKeyboardOnChatScroll); |
| 106 | editor.putBoolean("openArchiveOnPull", openArchiveOnPull); |
| 107 | editor.putBoolean("showHiddenFeature", showHiddenFeature); |
| 108 | editor.putBoolean("avatarAsDrawerBackground", avatarAsDrawerBackground); |
| 109 | editor.putBoolean("useSystemEmoji", useSystemEmoji); |
| 110 | editor.putBoolean("showTabsOnForward", showTabsOnForward); |
| 111 | editor.putBoolean("rearVideoMessages", rearVideoMessages); |
| 112 | editor.putBoolean("hideAllTab", hideAllTab); |
| 113 | editor.putBoolean("confirmAVMessage", confirmAVMessage); |
| 114 | editor.putBoolean("askBeforeCall", askBeforeCall); |
| 115 | editor.putBoolean("shouldNOTTrustMe", shouldNOTTrustMe); |
| 116 | editor.putBoolean("disableNumberRounding", disableNumberRounding); |
| 117 | editor.putBoolean("disableAppBarShadow", disableAppBarShadow); |
| 118 | editor.putFloat("stickerSize", stickerSize); |
| 119 | editor.putInt("typeface", typeface); |
| 120 | editor.putInt("nameOrder", nameOrder); |
| 121 | editor.putInt("mapPreviewProvider", mapPreviewProvider); |
| 122 | editor.putInt("translationProvider", translationProvider); |
| 123 | editor.putInt("eventType", eventType); |
| 124 | editor.putInt("actionBarDecoration", actionBarDecoration); |
| 125 | editor.putInt("tabsTitleType", tabsTitleType); |
| 126 | editor.commit(); |
| 127 | } catch (Exception e) { |
| 128 | FileLog.e(e); |
| 129 | } |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | public static void loadConfig() { |
| 134 | synchronized (sync) { |
| 135 | if (configLoaded) { |
| 136 | return; |
| 137 | } |
| 138 | |
| 139 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 140 | useIPv6 = preferences.getBoolean("useIPv6", false); |
| 141 | hidePhone = preferences.getBoolean("hidePhone", true); |
| 142 | ignoreBlocked = preferences.getBoolean("ignoreBlocked", false); |
| 143 | forceTablet = preferences.getBoolean("forceTablet", false); |
| 144 | typeface = preferences.getInt("typeface", Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? 1 : 0); |
| 145 | nameOrder = preferences.getInt("nameOrder", 1); |
| 146 | mapPreviewProvider = preferences.getInt("mapPreviewProvider", 0); |
| 147 | transparentStatusBar = preferences.getBoolean("transparentStatusBar", false); |
| 148 | residentNotification = preferences.getBoolean("residentNotification", false); |
| 149 | hideProxySponsorChannel = preferences.getBoolean("hideProxySponsorChannel", false); |
| 150 | saveCacheToPrivateDirectory = preferences.getBoolean("saveCacheToPrivateDirectory", Build.VERSION.SDK_INT >= Build.VERSION_CODES.N); |
| 151 | showAddToSavedMessages = preferences.getBoolean("showAddToSavedMessages", true); |
| 152 | showReport = preferences.getBoolean("showReport", false); |
| 153 | showPrPr = preferences.getBoolean("showPrPr", false); |
| 154 | showViewHistory = preferences.getBoolean("showViewHistory", true); |
| 155 | showAdminActions = preferences.getBoolean("showAdminActions", true); |
| 156 | showChangePermissions = preferences.getBoolean("showChangePermissions", true); |
| 157 | showDeleteDownloadedFile = preferences.getBoolean("showDeleteDownloadedFile", true); |
| 158 | showMessageDetails = preferences.getBoolean("showMessageDetails", false); |
| 159 | showTranslate = preferences.getBoolean("showTranslate", true); |
| 160 | showRepeat = preferences.getBoolean("showRepeat", true); |
| 161 | eventType = preferences.getInt("eventType", 0); |
| 162 | actionBarDecoration = preferences.getInt("actionBarDecoration", 0); |
| 163 | newYear = preferences.getBoolean("newYear", false); |
| 164 | stickerSize = preferences.getFloat("stickerSize", 14.0f); |
| 165 | unlimitedFavedStickers = preferences.getBoolean("unlimitedFavedStickers", false); |
| 166 | unlimitedPinnedDialogs = preferences.getBoolean("unlimitedPinnedDialogs", false); |
| 167 | translationProvider = preferences.getInt("translationProvider", 1); |
| 168 | disablePhotoSideAction = preferences.getBoolean("disablePhotoSideAction", true); |
| 169 | openArchiveOnPull = preferences.getBoolean("openArchiveOnPull", false); |
| 170 | showHiddenFeature = preferences.getBoolean("showHiddenFeature", false); |
| 171 | hideKeyboardOnChatScroll = preferences.getBoolean("hideKeyboardOnChatScroll", false); |
| 172 | avatarAsDrawerBackground = preferences.getBoolean("avatarAsDrawerBackground", false); |
| 173 | useSystemEmoji = preferences.getBoolean("useSystemEmoji", SharedConfig.useSystemEmoji); |
| 174 | showTabsOnForward = preferences.getBoolean("showTabsOnForward", false); |
| 175 | rearVideoMessages = preferences.getBoolean("rearVideoMessages", false); |
| 176 | hideAllTab = preferences.getBoolean("hideAllTab", false); |
| 177 | tabsTitleType = preferences.getInt("tabsTitleType", TITLE_TYPE_TEXT); |
| 178 | confirmAVMessage = preferences.getBoolean("confirmAVMessage", true); |
| 179 | askBeforeCall = preferences.getBoolean("askBeforeCall", true); |
| 180 | shouldNOTTrustMe = preferences.getBoolean("shouldNOTTrustMe", false); |
| 181 | disableNumberRounding = preferences.getBoolean("disableNumberRounding", false); |
| 182 | disableAppBarShadow = preferences.getBoolean("disableAppBarShadow", false); |
| 183 | configLoaded = true; |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | public static void toggleShowAddToSavedMessages() { |
| 188 | showAddToSavedMessages = !showAddToSavedMessages; |
| 189 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 190 | SharedPreferences.Editor editor = preferences.edit(); |
| 191 | editor.putBoolean("showAddToSavedMessages", showAddToSavedMessages); |
| 192 | editor.commit(); |
| 193 | } |
| 194 | |
| 195 | public static void toggleShowReport() { |
| 196 | showReport = !showReport; |
| 197 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 198 | SharedPreferences.Editor editor = preferences.edit(); |
| 199 | editor.putBoolean("showReport", showReport); |
| 200 | editor.commit(); |
| 201 | } |
| 202 | |
| 203 | |
| 204 | public static void toggleShowViewHistory() { |
| 205 | showViewHistory = !showViewHistory; |
| 206 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 207 | SharedPreferences.Editor editor = preferences.edit(); |
| 208 | editor.putBoolean("showViewHistory", showViewHistory); |
| 209 | editor.commit(); |
| 210 | } |
| 211 | |
| 212 | public static void toggleShowPrPr() { |
| 213 | showPrPr = !showPrPr; |
| 214 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 215 | SharedPreferences.Editor editor = preferences.edit(); |
| 216 | editor.putBoolean("showPrPr", showPrPr); |
| 217 | editor.commit(); |
| 218 | } |
| 219 | |
| 220 | public static void toggleShowAdminActions() { |
| 221 | showAdminActions = !showAdminActions; |
| 222 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 223 | SharedPreferences.Editor editor = preferences.edit(); |
| 224 | editor.putBoolean("showAdminActions", showAdminActions); |
| 225 | editor.commit(); |
| 226 | } |
| 227 | |
| 228 | public static void toggleShowChangePermissions() { |
| 229 | showChangePermissions = !showChangePermissions; |
| 230 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 231 | SharedPreferences.Editor editor = preferences.edit(); |
| 232 | editor.putBoolean("showChangePermissions", showChangePermissions); |
| 233 | editor.commit(); |
| 234 | } |
| 235 | |
| 236 | public static void toggleShowDeleteDownloadedFile() { |
| 237 | showDeleteDownloadedFile = !showDeleteDownloadedFile; |
| 238 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 239 | SharedPreferences.Editor editor = preferences.edit(); |
| 240 | editor.putBoolean("showDeleteDownloadedFile", showDeleteDownloadedFile); |
| 241 | editor.commit(); |
| 242 | } |
| 243 | |
| 244 | public static void toggleShowMessageDetails() { |
| 245 | showMessageDetails = !showMessageDetails; |
| 246 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 247 | SharedPreferences.Editor editor = preferences.edit(); |
| 248 | editor.putBoolean("showMessageDetails", showMessageDetails); |
| 249 | editor.commit(); |
| 250 | } |
| 251 | |
| 252 | public static void toggleShowRepeat() { |
| 253 | showRepeat = !showRepeat; |
| 254 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 255 | SharedPreferences.Editor editor = preferences.edit(); |
| 256 | editor.putBoolean("showRepeat", showRepeat); |
| 257 | editor.commit(); |
| 258 | } |
| 259 | |
| 260 | public static void toggleIPv6() { |
| 261 | useIPv6 = !useIPv6; |
| 262 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 263 | SharedPreferences.Editor editor = preferences.edit(); |
| 264 | editor.putBoolean("useIPv6", useIPv6); |
| 265 | editor.commit(); |
| 266 | } |
| 267 | |
| 268 | public static void toggleHidePhone() { |
| 269 | hidePhone = !hidePhone; |
| 270 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 271 | SharedPreferences.Editor editor = preferences.edit(); |
| 272 | editor.putBoolean("hidePhone", hidePhone); |
| 273 | editor.commit(); |
| 274 | } |
| 275 | |
| 276 | public static void toggleIgnoreBlocked() { |
| 277 | ignoreBlocked = !ignoreBlocked; |
| 278 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 279 | SharedPreferences.Editor editor = preferences.edit(); |
| 280 | editor.putBoolean("ignoreBlocked", ignoreBlocked); |
| 281 | editor.commit(); |
| 282 | } |
| 283 | |
| 284 | public static void toggleForceTablet() { |
| 285 | forceTablet = !forceTablet; |
| 286 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 287 | SharedPreferences.Editor editor = preferences.edit(); |
| 288 | editor.putBoolean("forceTablet", forceTablet); |
| 289 | editor.commit(); |
| 290 | } |
| 291 | |
| 292 | public static void toggleTypeface() { |
| 293 | typeface = typeface == 0 ? 1 : 0; |
| 294 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 295 | SharedPreferences.Editor editor = preferences.edit(); |
| 296 | editor.putInt("typeface", typeface); |
| 297 | editor.commit(); |
| 298 | } |
| 299 | |
| 300 | public static void setNameOrder(int order) { |
| 301 | nameOrder = order; |
| 302 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 303 | SharedPreferences.Editor editor = preferences.edit(); |
| 304 | editor.putInt("nameOrder", nameOrder); |
| 305 | editor.commit(); |
| 306 | } |
| 307 | |
| 308 | public static void setMapPreviewProvider(int provider) { |
| 309 | mapPreviewProvider = provider; |
| 310 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 311 | SharedPreferences.Editor editor = preferences.edit(); |
| 312 | editor.putInt("mapPreviewProvider", mapPreviewProvider); |
| 313 | editor.commit(); |
| 314 | } |
| 315 | |
| 316 | public static void toggleTransparentStatusBar() { |
| 317 | transparentStatusBar = !transparentStatusBar; |
| 318 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 319 | SharedPreferences.Editor editor = preferences.edit(); |
| 320 | editor.putBoolean("transparentStatusBar", transparentStatusBar); |
| 321 | editor.commit(); |
| 322 | } |
| 323 | |
| 324 | public static void toggleResidentNotification() { |
| 325 | residentNotification = !residentNotification; |
| 326 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 327 | SharedPreferences.Editor editor = preferences.edit(); |
| 328 | editor.putBoolean("residentNotification", residentNotification); |
| 329 | editor.commit(); |
| 330 | ApplicationLoader.applicationContext.stopService(new Intent(ApplicationLoader.applicationContext, NotificationsService.class)); |
| 331 | ApplicationLoader.startPushService(); |
| 332 | } |
| 333 | |
| 334 | public static void toggleHideProxySponsorChannel() { |
| 335 | hideProxySponsorChannel = !hideProxySponsorChannel; |
| 336 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 337 | SharedPreferences.Editor editor = preferences.edit(); |
| 338 | editor.putBoolean("hideProxySponsorChannel", hideProxySponsorChannel); |
| 339 | editor.commit(); |
| 340 | } |
| 341 | |
| 342 | public static void toggleSaveCacheToPrivateDirectory() { |
| 343 | saveCacheToPrivateDirectory = !saveCacheToPrivateDirectory; |
| 344 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 345 | SharedPreferences.Editor editor = preferences.edit(); |
| 346 | editor.putBoolean("saveCacheToPrivateDirectory", saveCacheToPrivateDirectory); |
| 347 | editor.commit(); |
| 348 | } |
| 349 | |
| 350 | public static void setEventType(int type) { |
| 351 | eventType = type; |
| 352 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 353 | SharedPreferences.Editor editor = preferences.edit(); |
| 354 | editor.putInt("eventType", eventType); |
| 355 | editor.commit(); |
| 356 | } |
| 357 | |
| 358 | public static void setActionBarDecoration(int decoration) { |
| 359 | actionBarDecoration = decoration; |
| 360 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 361 | SharedPreferences.Editor editor = preferences.edit(); |
| 362 | editor.putInt("actionBarDecoration", actionBarDecoration); |
| 363 | editor.commit(); |
| 364 | } |
| 365 | |
| 366 | public static void toggleNewYear() { |
| 367 | newYear = !newYear; |
| 368 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 369 | SharedPreferences.Editor editor = preferences.edit(); |
| 370 | editor.putBoolean("newYear", newYear); |
| 371 | editor.commit(); |
| 372 | } |
| 373 | |
| 374 | public static void toggleUnlimitedFavedStickers() { |
| 375 | unlimitedFavedStickers = !unlimitedFavedStickers; |
| 376 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 377 | SharedPreferences.Editor editor = preferences.edit(); |
| 378 | editor.putBoolean("unlimitedFavedStickers", unlimitedFavedStickers); |
| 379 | editor.commit(); |
| 380 | } |
| 381 | |
| 382 | public static void toggleUnlimitedPinnedDialogs() { |
| 383 | unlimitedPinnedDialogs = !unlimitedPinnedDialogs; |
| 384 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 385 | SharedPreferences.Editor editor = preferences.edit(); |
| 386 | editor.putBoolean("unlimitedPinnedDialogs", unlimitedPinnedDialogs); |
| 387 | editor.commit(); |
| 388 | } |
| 389 | |
| 390 | public static void toggleShowTranslate() { |
| 391 | showTranslate = !showTranslate; |
| 392 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 393 | SharedPreferences.Editor editor = preferences.edit(); |
| 394 | editor.putBoolean("showTranslate", showTranslate); |
| 395 | editor.commit(); |
| 396 | } |
| 397 | |
| 398 | public static void setStickerSize(float size) { |
| 399 | stickerSize = size; |
| 400 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 401 | SharedPreferences.Editor editor = preferences.edit(); |
| 402 | editor.putFloat("stickerSize", stickerSize); |
| 403 | editor.commit(); |
| 404 | } |
| 405 | |
| 406 | public static void setTranslationProvider(int provider) { |
| 407 | translationProvider = provider; |
| 408 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 409 | SharedPreferences.Editor editor = preferences.edit(); |
| 410 | editor.putInt("translationProvider", translationProvider); |
| 411 | editor.commit(); |
| 412 | } |
| 413 | |
| 414 | public static void toggleDisablePhotoSideAction() { |
| 415 | disablePhotoSideAction = !disablePhotoSideAction; |
| 416 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 417 | SharedPreferences.Editor editor = preferences.edit(); |
| 418 | editor.putBoolean("disablePhotoSideAction", disablePhotoSideAction); |
| 419 | editor.commit(); |
| 420 | } |
| 421 | |
| 422 | public static void toggleOpenArchiveOnPull() { |
| 423 | openArchiveOnPull = !openArchiveOnPull; |
| 424 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 425 | SharedPreferences.Editor editor = preferences.edit(); |
| 426 | editor.putBoolean("openArchiveOnPull", openArchiveOnPull); |
| 427 | editor.commit(); |
| 428 | } |
| 429 | |
| 430 | public static void toggleShowHiddenFeature() { |
| 431 | showHiddenFeature = !showHiddenFeature; |
| 432 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 433 | SharedPreferences.Editor editor = preferences.edit(); |
| 434 | editor.putBoolean("showHiddenFeature", showHiddenFeature); |
| 435 | editor.commit(); |
| 436 | } |
| 437 | |
| 438 | public static void toggleHideKeyboardOnChatScroll() { |
| 439 | hideKeyboardOnChatScroll = !hideKeyboardOnChatScroll; |
| 440 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 441 | SharedPreferences.Editor editor = preferences.edit(); |
| 442 | editor.putBoolean("hideKeyboardOnChatScroll", hideKeyboardOnChatScroll); |
| 443 | editor.commit(); |
| 444 | } |
| 445 | |
| 446 | public static void toggleAvatarAsDrawerBackground() { |
| 447 | avatarAsDrawerBackground = !avatarAsDrawerBackground; |
| 448 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 449 | SharedPreferences.Editor editor = preferences.edit(); |
| 450 | editor.putBoolean("avatarAsDrawerBackground", avatarAsDrawerBackground); |
| 451 | editor.commit(); |
| 452 | } |
| 453 | |
| 454 | public static void toggleUseSystemEmoji() { |
| 455 | useSystemEmoji = !useSystemEmoji; |
| 456 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 457 | SharedPreferences.Editor editor = preferences.edit(); |
| 458 | editor.putBoolean("useSystemEmoji", useSystemEmoji); |
| 459 | editor.commit(); |
| 460 | } |
| 461 | |
| 462 | public static void toggleShowTabsOnForward() { |
| 463 | showTabsOnForward = !showTabsOnForward; |
| 464 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 465 | SharedPreferences.Editor editor = preferences.edit(); |
| 466 | editor.putBoolean("showTabsOnForward", showTabsOnForward); |
| 467 | editor.commit(); |
| 468 | } |
| 469 | |
| 470 | public static void toggleRearVideoMessages() { |
| 471 | rearVideoMessages = !rearVideoMessages; |
| 472 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 473 | SharedPreferences.Editor editor = preferences.edit(); |
| 474 | editor.putBoolean("rearVideoMessages", rearVideoMessages); |
| 475 | editor.commit(); |
| 476 | } |
| 477 | |
| 478 | public static void toggleHideAllTab() { |
| 479 | hideAllTab = !hideAllTab; |
| 480 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 481 | SharedPreferences.Editor editor = preferences.edit(); |
| 482 | editor.putBoolean("hideAllTab", hideAllTab); |
| 483 | editor.commit(); |
| 484 | } |
| 485 | |
| 486 | public static void setTabsTitleType(int type) { |
| 487 | tabsTitleType = type; |
| 488 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 489 | SharedPreferences.Editor editor = preferences.edit(); |
| 490 | editor.putInt("tabsTitleType", tabsTitleType); |
| 491 | editor.commit(); |
| 492 | } |
| 493 | |
| 494 | public static void toggleConfirmAVMessage() { |
| 495 | confirmAVMessage = !confirmAVMessage; |
| 496 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 497 | SharedPreferences.Editor editor = preferences.edit(); |
| 498 | editor.putBoolean("confirmAVMessage", confirmAVMessage); |
| 499 | editor.commit(); |
| 500 | } |
| 501 | |
| 502 | public static void toggleAskBeforeCall() { |
| 503 | askBeforeCall = !askBeforeCall; |
| 504 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 505 | SharedPreferences.Editor editor = preferences.edit(); |
| 506 | editor.putBoolean("askBeforeCall", askBeforeCall); |
| 507 | editor.commit(); |
| 508 | } |
| 509 | |
| 510 | public static void toggleShouldNOTTrustMe() { |
| 511 | shouldNOTTrustMe = !shouldNOTTrustMe; |
| 512 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 513 | SharedPreferences.Editor editor = preferences.edit(); |
| 514 | editor.putBoolean("shouldNOTTrustMe", shouldNOTTrustMe); |
| 515 | editor.commit(); |
| 516 | } |
| 517 | |
| 518 | public static void toggleDisableNumberRounding() { |
| 519 | disableNumberRounding = !disableNumberRounding; |
| 520 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 521 | SharedPreferences.Editor editor = preferences.edit(); |
| 522 | editor.putBoolean("disableNumberRounding", disableNumberRounding); |
| 523 | editor.commit(); |
| 524 | } |
| 525 | |
| 526 | public static void toggleDisableAppBarShadow() { |
| 527 | disableAppBarShadow = !disableAppBarShadow; |
| 528 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 529 | SharedPreferences.Editor editor = preferences.edit(); |
| 530 | editor.putBoolean("disableAppBarShadow", disableAppBarShadow); |
| 531 | editor.commit(); |
| 532 | } |
| 533 | } |
| 534 | |