| 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 | private static final Object sync = new Object(); |
| 19 | public static boolean useIPv6 = false; |
| 20 | public static boolean showHiddenFeature = false; |
| 21 | |
| 22 | public static boolean useSystemEmoji = SharedConfig.useSystemEmoji; |
| 23 | public static boolean ignoreBlocked = false; |
| 24 | public static boolean hideProxySponsorChannel = false; |
| 25 | public static boolean saveCacheToPrivateDirectory = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N; |
| 26 | public static boolean disablePhotoSideAction = true; |
| 27 | public static boolean hideKeyboardOnChatScroll = false; |
| 28 | public static int mapPreviewProvider = 0; |
| 29 | public static float stickerSize = 14.0f; |
| 30 | public static int translationProvider = 1; |
| 31 | |
| 32 | public static boolean showAddToSavedMessages = true; |
| 33 | public static boolean showReport = false; |
| 34 | public static boolean showPrPr = false; |
| 35 | public static boolean showViewHistory = true; |
| 36 | public static boolean showAdminActions = true; |
| 37 | public static boolean showChangePermissions = true; |
| 38 | public static boolean showDeleteDownloadedFile = true; |
| 39 | public static boolean showMessageDetails = false; |
| 40 | public static boolean showTranslate = true; |
| 41 | public static boolean showRepeat = true; |
| 42 | |
| 43 | public static boolean hidePhone = true; |
| 44 | public static int typeface = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? 1 : 0; |
| 45 | public static boolean transparentStatusBar = false; |
| 46 | public static boolean forceTablet = false; |
| 47 | public static boolean openArchiveOnPull = false; |
| 48 | public static boolean avatarAsDrawerBackground = false; |
| 49 | public static int nameOrder = 1; |
| 50 | public static int eventType = 0; |
| 51 | public static boolean newYear = false; |
| 52 | public static int actionBarDecoration = 0; |
| 53 | public static boolean unlimitedFavedStickers = false; |
| 54 | public static boolean unlimitedPinnedDialogs = false; |
| 55 | |
| 56 | public static boolean residentNotification = false; |
| 57 | |
| 58 | private static boolean configLoaded; |
| 59 | |
| 60 | static { |
| 61 | loadConfig(); |
| 62 | } |
| 63 | |
| 64 | public static void saveConfig() { |
| 65 | synchronized (sync) { |
| 66 | try { |
| 67 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfing", Context.MODE_PRIVATE); |
| 68 | SharedPreferences.Editor editor = preferences.edit(); |
| 69 | editor.putBoolean("useIPv6", useIPv6); |
| 70 | editor.putBoolean("hidePhone", hidePhone); |
| 71 | editor.putBoolean("ignoreBlocked", ignoreBlocked); |
| 72 | editor.putBoolean("forceTablet", forceTablet); |
| 73 | editor.putBoolean("transparentStatusBar", transparentStatusBar); |
| 74 | editor.putBoolean("residentNotification", residentNotification); |
| 75 | editor.putBoolean("hideProxySponsorChannel", hideProxySponsorChannel); |
| 76 | editor.putBoolean("saveCacheToPrivateDirectory", saveCacheToPrivateDirectory); |
| 77 | editor.putBoolean("showAddToSavedMessages", showAddToSavedMessages); |
| 78 | editor.putBoolean("showReport", showReport); |
| 79 | editor.putBoolean("showPrPr", showPrPr); |
| 80 | editor.putBoolean("showViewHistory", showViewHistory); |
| 81 | editor.putBoolean("showAdminActions", showAdminActions); |
| 82 | editor.putBoolean("showChangePermissions", showChangePermissions); |
| 83 | editor.putBoolean("showDeleteDownloadedFile", showDeleteDownloadedFile); |
| 84 | editor.putBoolean("showMessageDetails", showMessageDetails); |
| 85 | editor.putBoolean("showTranslate", showTranslate); |
| 86 | editor.putBoolean("showRepeat", showRepeat); |
| 87 | editor.putBoolean("newYear", newYear); |
| 88 | editor.putBoolean("unlimitedFavedStickers", unlimitedFavedStickers); |
| 89 | editor.putBoolean("unlimitedPinnedDialogs", unlimitedPinnedDialogs); |
| 90 | editor.putBoolean("disablePhotoSideAction", disablePhotoSideAction); |
| 91 | editor.putBoolean("hideKeyboardOnChatScroll", hideKeyboardOnChatScroll); |
| 92 | editor.putBoolean("openArchiveOnPull", openArchiveOnPull); |
| 93 | editor.putBoolean("showHiddenFeature", showHiddenFeature); |
| 94 | editor.putBoolean("avatarAsDrawerBackground", avatarAsDrawerBackground); |
| 95 | editor.putBoolean("useSystemEmoji", useSystemEmoji); |
| 96 | editor.putFloat("stickerSize", stickerSize); |
| 97 | editor.putInt("typeface", typeface); |
| 98 | editor.putInt("nameOrder", nameOrder); |
| 99 | editor.putInt("mapPreviewProvider", mapPreviewProvider); |
| 100 | editor.putInt("translationProvider", translationProvider); |
| 101 | editor.putInt("eventType", eventType); |
| 102 | editor.putInt("actionBarDecoration", actionBarDecoration); |
| 103 | editor.commit(); |
| 104 | } catch (Exception e) { |
| 105 | FileLog.e(e); |
| 106 | } |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | public static void loadConfig() { |
| 111 | synchronized (sync) { |
| 112 | if (configLoaded) { |
| 113 | return; |
| 114 | } |
| 115 | |
| 116 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 117 | useIPv6 = preferences.getBoolean("useIPv6", false); |
| 118 | hidePhone = preferences.getBoolean("hidePhone", true); |
| 119 | ignoreBlocked = preferences.getBoolean("ignoreBlocked", false); |
| 120 | forceTablet = preferences.getBoolean("forceTablet", false); |
| 121 | typeface = preferences.getInt("typeface", Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? 1 : 0); |
| 122 | nameOrder = preferences.getInt("nameOrder", 1); |
| 123 | mapPreviewProvider = preferences.getInt("mapPreviewProvider", 0); |
| 124 | transparentStatusBar = preferences.getBoolean("transparentStatusBar", false); |
| 125 | residentNotification = preferences.getBoolean("residentNotification", false); |
| 126 | hideProxySponsorChannel = preferences.getBoolean("hideProxySponsorChannel", false); |
| 127 | saveCacheToPrivateDirectory = preferences.getBoolean("saveCacheToPrivateDirectory", Build.VERSION.SDK_INT >= Build.VERSION_CODES.N); |
| 128 | showAddToSavedMessages = preferences.getBoolean("showAddToSavedMessages", true); |
| 129 | showReport = preferences.getBoolean("showReport", false); |
| 130 | showPrPr = preferences.getBoolean("showPrPr", false); |
| 131 | showViewHistory = preferences.getBoolean("showViewHistory", true); |
| 132 | showAdminActions = preferences.getBoolean("showAdminActions", true); |
| 133 | showChangePermissions = preferences.getBoolean("showChangePermissions", true); |
| 134 | showDeleteDownloadedFile = preferences.getBoolean("showDeleteDownloadedFile", true); |
| 135 | showMessageDetails = preferences.getBoolean("showMessageDetails", false); |
| 136 | showTranslate = preferences.getBoolean("showTranslate", true); |
| 137 | showRepeat = preferences.getBoolean("showRepeat", true); |
| 138 | eventType = preferences.getInt("eventType", 0); |
| 139 | actionBarDecoration = preferences.getInt("actionBarDecoration", 0); |
| 140 | newYear = preferences.getBoolean("newYear", false); |
| 141 | stickerSize = preferences.getFloat("stickerSize", 14.0f); |
| 142 | unlimitedFavedStickers = preferences.getBoolean("unlimitedFavedStickers", false); |
| 143 | unlimitedPinnedDialogs = preferences.getBoolean("unlimitedPinnedDialogs", false); |
| 144 | translationProvider = preferences.getInt("translationProvider", 1); |
| 145 | disablePhotoSideAction = preferences.getBoolean("disablePhotoSideAction", true); |
| 146 | openArchiveOnPull = preferences.getBoolean("openArchiveOnPull", false); |
| 147 | showHiddenFeature = preferences.getBoolean("showHiddenFeature", false); |
| 148 | hideKeyboardOnChatScroll = preferences.getBoolean("hideKeyboardOnChatScroll", false); |
| 149 | avatarAsDrawerBackground = preferences.getBoolean("avatarAsDrawerBackground", false); |
| 150 | useSystemEmoji = preferences.getBoolean("useSystemEmoji", SharedConfig.useSystemEmoji); |
| 151 | configLoaded = true; |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | public static void toggleShowAddToSavedMessages() { |
| 156 | showAddToSavedMessages = !showAddToSavedMessages; |
| 157 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 158 | SharedPreferences.Editor editor = preferences.edit(); |
| 159 | editor.putBoolean("showAddToSavedMessages", showAddToSavedMessages); |
| 160 | editor.commit(); |
| 161 | } |
| 162 | |
| 163 | public static void toggleShowReport() { |
| 164 | showReport = !showReport; |
| 165 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 166 | SharedPreferences.Editor editor = preferences.edit(); |
| 167 | editor.putBoolean("showReport", showReport); |
| 168 | editor.commit(); |
| 169 | } |
| 170 | |
| 171 | |
| 172 | public static void toggleShowViewHistory() { |
| 173 | showViewHistory = !showViewHistory; |
| 174 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 175 | SharedPreferences.Editor editor = preferences.edit(); |
| 176 | editor.putBoolean("showViewHistory", showViewHistory); |
| 177 | editor.commit(); |
| 178 | } |
| 179 | |
| 180 | public static void toggleShowPrPr() { |
| 181 | showPrPr = !showPrPr; |
| 182 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 183 | SharedPreferences.Editor editor = preferences.edit(); |
| 184 | editor.putBoolean("showPrPr", showPrPr); |
| 185 | editor.commit(); |
| 186 | } |
| 187 | |
| 188 | public static void toggleShowAdminActions() { |
| 189 | showAdminActions = !showAdminActions; |
| 190 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 191 | SharedPreferences.Editor editor = preferences.edit(); |
| 192 | editor.putBoolean("showAdminActions", showAdminActions); |
| 193 | editor.commit(); |
| 194 | } |
| 195 | |
| 196 | public static void toggleShowChangePermissions() { |
| 197 | showChangePermissions = !showChangePermissions; |
| 198 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 199 | SharedPreferences.Editor editor = preferences.edit(); |
| 200 | editor.putBoolean("showChangePermissions", showChangePermissions); |
| 201 | editor.commit(); |
| 202 | } |
| 203 | |
| 204 | public static void toggleShowDeleteDownloadedFile() { |
| 205 | showDeleteDownloadedFile = !showDeleteDownloadedFile; |
| 206 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 207 | SharedPreferences.Editor editor = preferences.edit(); |
| 208 | editor.putBoolean("showDeleteDownloadedFile", showDeleteDownloadedFile); |
| 209 | editor.commit(); |
| 210 | } |
| 211 | |
| 212 | public static void toggleShowMessageDetails() { |
| 213 | showMessageDetails = !showMessageDetails; |
| 214 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 215 | SharedPreferences.Editor editor = preferences.edit(); |
| 216 | editor.putBoolean("showMessageDetails", showMessageDetails); |
| 217 | editor.commit(); |
| 218 | } |
| 219 | |
| 220 | public static void toggleShowRepeat() { |
| 221 | showRepeat = !showRepeat; |
| 222 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 223 | SharedPreferences.Editor editor = preferences.edit(); |
| 224 | editor.putBoolean("showRepeat", showRepeat); |
| 225 | editor.commit(); |
| 226 | } |
| 227 | |
| 228 | public static void toggleIPv6() { |
| 229 | useIPv6 = !useIPv6; |
| 230 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 231 | SharedPreferences.Editor editor = preferences.edit(); |
| 232 | editor.putBoolean("useIPv6", useIPv6); |
| 233 | editor.commit(); |
| 234 | } |
| 235 | |
| 236 | public static void toggleHidePhone() { |
| 237 | hidePhone = !hidePhone; |
| 238 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 239 | SharedPreferences.Editor editor = preferences.edit(); |
| 240 | editor.putBoolean("hidePhone", hidePhone); |
| 241 | editor.commit(); |
| 242 | } |
| 243 | |
| 244 | public static void toggleIgnoreBlocked() { |
| 245 | ignoreBlocked = !ignoreBlocked; |
| 246 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 247 | SharedPreferences.Editor editor = preferences.edit(); |
| 248 | editor.putBoolean("ignoreBlocked", ignoreBlocked); |
| 249 | editor.commit(); |
| 250 | } |
| 251 | |
| 252 | public static void toggleForceTablet() { |
| 253 | forceTablet = !forceTablet; |
| 254 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 255 | SharedPreferences.Editor editor = preferences.edit(); |
| 256 | editor.putBoolean("forceTablet", forceTablet); |
| 257 | editor.commit(); |
| 258 | } |
| 259 | |
| 260 | public static void toggleTypeface() { |
| 261 | typeface = typeface == 0 ? 1 : 0; |
| 262 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 263 | SharedPreferences.Editor editor = preferences.edit(); |
| 264 | editor.putInt("typeface", typeface); |
| 265 | editor.commit(); |
| 266 | } |
| 267 | |
| 268 | public static void setNameOrder(int order) { |
| 269 | nameOrder = order; |
| 270 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 271 | SharedPreferences.Editor editor = preferences.edit(); |
| 272 | editor.putInt("nameOrder", nameOrder); |
| 273 | editor.commit(); |
| 274 | } |
| 275 | |
| 276 | public static void setMapPreviewProvider(int provider) { |
| 277 | mapPreviewProvider = provider; |
| 278 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 279 | SharedPreferences.Editor editor = preferences.edit(); |
| 280 | editor.putInt("mapPreviewProvider", mapPreviewProvider); |
| 281 | editor.commit(); |
| 282 | } |
| 283 | |
| 284 | public static void toggleTransparentStatusBar() { |
| 285 | transparentStatusBar = !transparentStatusBar; |
| 286 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 287 | SharedPreferences.Editor editor = preferences.edit(); |
| 288 | editor.putBoolean("transparentStatusBar", transparentStatusBar); |
| 289 | editor.commit(); |
| 290 | } |
| 291 | |
| 292 | public static void toggleResidentNotification() { |
| 293 | residentNotification = !residentNotification; |
| 294 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 295 | SharedPreferences.Editor editor = preferences.edit(); |
| 296 | editor.putBoolean("residentNotification", residentNotification); |
| 297 | editor.commit(); |
| 298 | ApplicationLoader.applicationContext.stopService(new Intent(ApplicationLoader.applicationContext, NotificationsService.class)); |
| 299 | ApplicationLoader.startPushService(); |
| 300 | } |
| 301 | |
| 302 | public static void toggleHideProxySponsorChannel() { |
| 303 | hideProxySponsorChannel = !hideProxySponsorChannel; |
| 304 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 305 | SharedPreferences.Editor editor = preferences.edit(); |
| 306 | editor.putBoolean("hideProxySponsorChannel", hideProxySponsorChannel); |
| 307 | editor.commit(); |
| 308 | } |
| 309 | |
| 310 | public static void toggleSaveCacheToPrivateDirectory() { |
| 311 | saveCacheToPrivateDirectory = !saveCacheToPrivateDirectory; |
| 312 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 313 | SharedPreferences.Editor editor = preferences.edit(); |
| 314 | editor.putBoolean("saveCacheToPrivateDirectory", saveCacheToPrivateDirectory); |
| 315 | editor.commit(); |
| 316 | } |
| 317 | |
| 318 | public static void setEventType(int type) { |
| 319 | eventType = type; |
| 320 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 321 | SharedPreferences.Editor editor = preferences.edit(); |
| 322 | editor.putInt("eventType", eventType); |
| 323 | editor.commit(); |
| 324 | } |
| 325 | |
| 326 | public static void setActionBarDecoration(int decoration) { |
| 327 | actionBarDecoration = decoration; |
| 328 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 329 | SharedPreferences.Editor editor = preferences.edit(); |
| 330 | editor.putInt("actionBarDecoration", actionBarDecoration); |
| 331 | editor.commit(); |
| 332 | } |
| 333 | |
| 334 | public static void toggleNewYear() { |
| 335 | newYear = !newYear; |
| 336 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 337 | SharedPreferences.Editor editor = preferences.edit(); |
| 338 | editor.putBoolean("newYear", newYear); |
| 339 | editor.commit(); |
| 340 | } |
| 341 | |
| 342 | public static void toggleUnlimitedFavedStickers() { |
| 343 | unlimitedFavedStickers = !unlimitedFavedStickers; |
| 344 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 345 | SharedPreferences.Editor editor = preferences.edit(); |
| 346 | editor.putBoolean("unlimitedFavedStickers", unlimitedFavedStickers); |
| 347 | editor.commit(); |
| 348 | } |
| 349 | |
| 350 | public static void toggleUnlimitedPinnedDialogs() { |
| 351 | unlimitedPinnedDialogs = !unlimitedPinnedDialogs; |
| 352 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 353 | SharedPreferences.Editor editor = preferences.edit(); |
| 354 | editor.putBoolean("unlimitedPinnedDialogs", unlimitedPinnedDialogs); |
| 355 | editor.commit(); |
| 356 | } |
| 357 | |
| 358 | public static void toggleShowTranslate() { |
| 359 | showTranslate = !showTranslate; |
| 360 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 361 | SharedPreferences.Editor editor = preferences.edit(); |
| 362 | editor.putBoolean("showTranslate", showTranslate); |
| 363 | editor.commit(); |
| 364 | } |
| 365 | |
| 366 | public static void setStickerSize(float size) { |
| 367 | stickerSize = size; |
| 368 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 369 | SharedPreferences.Editor editor = preferences.edit(); |
| 370 | editor.putFloat("stickerSize", stickerSize); |
| 371 | editor.commit(); |
| 372 | } |
| 373 | |
| 374 | public static void setTranslationProvider(int provider) { |
| 375 | translationProvider = provider; |
| 376 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 377 | SharedPreferences.Editor editor = preferences.edit(); |
| 378 | editor.putInt("translationProvider", translationProvider); |
| 379 | editor.commit(); |
| 380 | } |
| 381 | |
| 382 | public static void toggleDisablePhotoSideAction() { |
| 383 | disablePhotoSideAction = !disablePhotoSideAction; |
| 384 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 385 | SharedPreferences.Editor editor = preferences.edit(); |
| 386 | editor.putBoolean("disablePhotoSideAction", disablePhotoSideAction); |
| 387 | editor.commit(); |
| 388 | } |
| 389 | |
| 390 | public static void toggleOpenArchiveOnPull() { |
| 391 | openArchiveOnPull = !openArchiveOnPull; |
| 392 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 393 | SharedPreferences.Editor editor = preferences.edit(); |
| 394 | editor.putBoolean("openArchiveOnPull", openArchiveOnPull); |
| 395 | editor.commit(); |
| 396 | } |
| 397 | |
| 398 | public static void toggleShowHiddenFeature() { |
| 399 | showHiddenFeature = !showHiddenFeature; |
| 400 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 401 | SharedPreferences.Editor editor = preferences.edit(); |
| 402 | editor.putBoolean("showHiddenFeature", showHiddenFeature); |
| 403 | editor.commit(); |
| 404 | } |
| 405 | |
| 406 | public static void toggleHideKeyboardOnChatScroll() { |
| 407 | hideKeyboardOnChatScroll = !hideKeyboardOnChatScroll; |
| 408 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 409 | SharedPreferences.Editor editor = preferences.edit(); |
| 410 | editor.putBoolean("hideKeyboardOnChatScroll", hideKeyboardOnChatScroll); |
| 411 | editor.commit(); |
| 412 | } |
| 413 | |
| 414 | public static void toggleAvatarAsDrawerBackground() { |
| 415 | avatarAsDrawerBackground = !avatarAsDrawerBackground; |
| 416 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 417 | SharedPreferences.Editor editor = preferences.edit(); |
| 418 | editor.putBoolean("avatarAsDrawerBackground", avatarAsDrawerBackground); |
| 419 | editor.commit(); |
| 420 | } |
| 421 | |
| 422 | public static void toggleUseSystemEmoji() { |
| 423 | useSystemEmoji = !useSystemEmoji; |
| 424 | SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE); |
| 425 | SharedPreferences.Editor editor = preferences.edit(); |
| 426 | editor.putBoolean("useSystemEmoji", useSystemEmoji); |
| 427 | editor.commit(); |
| 428 | } |
| 429 | } |
| 430 | |