@Override public void run() { StorageEditor editor = preferences.createStorageEditor(); K9.save(editor); editor.commit(); } }).start();
public void save() throws MessagingException { StorageEditor editor = localStore.getPreferences().createStorageEditor(); save(editor); editor.commit(); }
public void setDefaultAccount(Account account) { createStorageEditor().putString("defaultAccountUuid", account.getUuid()).commit(); }
public void move(Account account, boolean mUp) { synchronized (accountLock) { StorageEditor storageEditor = createStorageEditor(); accountPreferenceSerializer.move(storageEditor, account, storage, mUp); storageEditor.commit(); loadAccounts(); } notifyListeners(); }
public static void from41MoveFolderPreferences(MigrationsHelper migrationsHelper) { try { LocalStore localStore = migrationsHelper.getLocalStore(); long startTime = SystemClock.elapsedRealtime(); StorageEditor editor = migrationsHelper.getPreferences().createStorageEditor(); List<? extends Folder > folders = localStore.getPersonalNamespaces(true); for (Folder folder : folders) { if (folder instanceof LocalFolder) { LocalFolder lFolder = (LocalFolder)folder; lFolder.save(editor); } } editor.commit(); long endTime = SystemClock.elapsedRealtime(); Timber.i("Putting folder preferences for %d folders back into Preferences took %d ms", folders.size(), endTime - startTime); } catch (Exception e) { Timber.e(e, "Could not replace Preferences in upgrade from DB_VERSION 41"); } } }
public void saveAccount(Account account) { ensureAssignedAccountNumber(account); processChangedValues(account); StorageEditor editor = createStorageEditor(); accountPreferenceSerializer.save(editor, storage, account); editor.commit(); notifyListeners(); }
editor.commit();
private Preferences(Context context, CoreResourceProvider resourceProvider, StoragePersister storagePersister, LocalStoreProvider localStoreProvider, LocalKeyStoreManager localKeyStoreManager, AccountPreferenceSerializer accountPreferenceSerializer) { this.storage = new Storage(); this.storagePersister = storagePersister; this.context = context; this.resourceProvider = resourceProvider; this.localStoreProvider = localStoreProvider; this.localKeyStoreManager = localKeyStoreManager; this.accountPreferenceSerializer = accountPreferenceSerializer; Map<String, String> persistedStorageValues = storagePersister.loadValues(); storage.replaceAll(persistedStorageValues); if (storage.isEmpty()) { Timber.i("Preferences storage is zero-size, importing from Android-style preferences"); StorageEditor editor = createStorageEditor(); editor.copy(context.getSharedPreferences("AndroidMail.Main", Context.MODE_PRIVATE)); editor.commit(); } }
public void deleteAccount(Account account) { synchronized (accountLock) { if (accounts != null) { accounts.remove(account.getUuid()); } if (accountsInOrder != null) { accountsInOrder.remove(account); } try { getBackendManager().removeBackend(account); } catch (Exception e) { Timber.e(e, "Failed to reset remote store for account %s", account.getUuid()); } LocalStore.removeAccount(account); StorageEditor storageEditor = createStorageEditor(); accountPreferenceSerializer.delete(storageEditor, storage, account); storageEditor.commit(); localKeyStoreManager.deleteCertificates(account); if (newAccount == account) { newAccount = null; } } notifyListeners(); }
private void deleteSettings() throws MessagingException { String id = getPrefId(); StorageEditor editor = localStore.getPreferences().createStorageEditor(); editor.remove(id + ".displayMode"); editor.remove(id + ".syncMode"); editor.remove(id + ".pushMode"); editor.remove(id + ".inTopGroup"); editor.remove(id + ".integrate"); editor.commit(); }
/** * Update the global FontSize object and permanently store the (possibly * changed) font size settings. */ private void saveSettings() { FontSizes fontSizes = K9.getFontSizes(); fontSizes.setAccountName(Integer.parseInt(mAccountName.getValue())); fontSizes.setAccountDescription(Integer.parseInt(mAccountDescription.getValue())); fontSizes.setFolderName(Integer.parseInt(mFolderName.getValue())); fontSizes.setFolderStatus(Integer.parseInt(mFolderStatus.getValue())); fontSizes.setMessageListSubject(Integer.parseInt(mMessageListSubject.getValue())); fontSizes.setMessageListSender(Integer.parseInt(mMessageListSender.getValue())); fontSizes.setMessageListDate(Integer.parseInt(mMessageListDate.getValue())); fontSizes.setMessageListPreview(Integer.parseInt(mMessageListPreview.getValue())); fontSizes.setMessageViewSender(Integer.parseInt(mMessageViewSender.getValue())); fontSizes.setMessageViewTo(Integer.parseInt(mMessageViewTo.getValue())); fontSizes.setMessageViewCC(Integer.parseInt(mMessageViewCC.getValue())); fontSizes.setMessageViewBCC(Integer.parseInt(mMessageViewBCC.getValue())); fontSizes.setMessageViewAdditionalHeaders(Integer.parseInt(mMessageViewAdditionalHeaders.getValue())); fontSizes.setMessageViewSubject(Integer.parseInt(mMessageViewSubject.getValue())); fontSizes.setMessageViewDate(Integer.parseInt(mMessageViewDate.getValue())); fontSizes.setMessageViewContentAsPercent(scaleToInt(mMessageViewContentSlider.getValue())); fontSizes.setMessageComposeInput(Integer.parseInt(mMessageComposeInput.getValue())); StorageEditor editor = Preferences.getPreferences(this).createStorageEditor(); fontSizes.save(editor); editor.commit(); }
Timber.w("Was asked to import global settings but none found."); if (editor.commit()) { Timber.v("Committed global settings to the preference storage."); globalSettingsImported = true; imported.contentVersion, account, overwrite); if (editor.commit()) { Timber.v("Committed settings for account \"%s\" to the settings database.", importResult.imported.name); if (!editor.commit()) { throw new SettingsImportExportException("Failed to set account UUID list"); if (!editor.commit()) { throw new SettingsImportExportException("Failed to set default account");
private static void migrateOpenPgpGlobalToAccountSettings() { Preferences preferences = DI.get(Preferences.class); Storage storage = preferences.getStorage(); String openPgpProvider = storage.getString("openPgpProvider", null); boolean openPgpSupportSignOnly = storage.getBoolean("openPgpSupportSignOnly", false); for (Account account : preferences.getAccounts()) { account.setOpenPgpProvider(openPgpProvider); account.setOpenPgpHideSignOnly(!openPgpSupportSignOnly); preferences.saveAccount(account); } preferences.createStorageEditor() .remove("openPgpProvider") .remove("openPgpSupportSignOnly") .commit(); }
editor.commit();