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