mirror of
https://github.com/nextcloud/android.git
synced 2024-11-25 14:45:47 +03:00
Merge pull request #3886 from nextcloud/ezaquarii/rename-preference-manager
Rename PreferenceManager to AppPreferencesImpl
This commit is contained in:
commit
98a134f6ca
18 changed files with 52 additions and 50 deletions
|
@ -24,7 +24,7 @@ import android.content.Context;
|
|||
|
||||
import com.owncloud.android.MainApp;
|
||||
import com.owncloud.android.datamodel.SignatureVerification;
|
||||
import com.nextcloud.client.preferences.PreferenceManager;
|
||||
import com.nextcloud.client.preferences.AppPreferencesImpl;
|
||||
|
||||
import java.security.Key;
|
||||
|
||||
|
@ -40,7 +40,7 @@ public final class PushUtils {
|
|||
|
||||
public static void reinitKeys() {
|
||||
Context context = MainApp.getAppContext();
|
||||
PreferenceManager.fromContext(context).setKeysReInitEnabled();
|
||||
AppPreferencesImpl.fromContext(context).setKeysReInitEnabled();
|
||||
}
|
||||
|
||||
public static Key readKeyFromFile(boolean readPublicKey) {
|
||||
|
|
|
@ -24,7 +24,7 @@ import android.text.TextUtils;
|
|||
import com.google.firebase.iid.FirebaseInstanceId;
|
||||
import com.google.firebase.iid.FirebaseInstanceIdService;
|
||||
import com.nextcloud.client.preferences.AppPreferences;
|
||||
import com.nextcloud.client.preferences.PreferenceManager;
|
||||
import com.nextcloud.client.preferences.AppPreferencesImpl;
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.utils.PushUtils;
|
||||
|
||||
|
@ -35,7 +35,7 @@ public class NCFirebaseInstanceIDService extends FirebaseInstanceIdService {
|
|||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
preferences = PreferenceManager.fromContext(this);
|
||||
preferences = AppPreferencesImpl.fromContext(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -30,7 +30,7 @@ import android.util.Log;
|
|||
|
||||
import com.google.gson.Gson;
|
||||
import com.nextcloud.client.preferences.AppPreferences;
|
||||
import com.nextcloud.client.preferences.PreferenceManager;
|
||||
import com.nextcloud.client.preferences.AppPreferencesImpl;
|
||||
import com.owncloud.android.MainApp;
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.authentication.AccountUtils;
|
||||
|
@ -373,7 +373,7 @@ public final class PushUtils {
|
|||
FileUtils.deleteQuietly(privateKeyFile);
|
||||
FileUtils.deleteQuietly(publicKeyFile);
|
||||
|
||||
AppPreferences preferences = PreferenceManager.fromContext(context);
|
||||
AppPreferences preferences = AppPreferencesImpl.fromContext(context);
|
||||
String pushToken = preferences.getPushToken();
|
||||
pushRegistrationToServer(pushToken);
|
||||
preferences.setKeysReInitEnabled();
|
||||
|
@ -381,7 +381,7 @@ public final class PushUtils {
|
|||
|
||||
private static void migratePushKeys() {
|
||||
Context context = MainApp.getAppContext();
|
||||
AppPreferences preferences = PreferenceManager.fromContext(context);
|
||||
AppPreferences preferences = AppPreferencesImpl.fromContext(context);
|
||||
if (!preferences.isKeysMigrationEnabled()) {
|
||||
String oldKeyPath = MainApp.getStoragePath() + File.separator + MainApp.getDataFolder()
|
||||
+ File.separator + "nc-keypair";
|
||||
|
|
|
@ -24,7 +24,7 @@ import android.app.Application;
|
|||
import android.content.Context;
|
||||
|
||||
import com.nextcloud.client.preferences.AppPreferences;
|
||||
import com.nextcloud.client.preferences.PreferenceManager;
|
||||
import com.nextcloud.client.preferences.AppPreferencesImpl;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
|
@ -39,6 +39,6 @@ class AppModule {
|
|||
|
||||
@Provides
|
||||
AppPreferences preferences(Application application) {
|
||||
return PreferenceManager.fromContext(application);
|
||||
return AppPreferencesImpl.fromContext(application);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ import static com.owncloud.android.ui.fragment.OCFileListFragment.FOLDER_LAYOUT_
|
|||
/**
|
||||
* Helper to simplify reading of Preferences all around the app
|
||||
*/
|
||||
public final class PreferenceManager implements AppPreferences {
|
||||
public final class AppPreferencesImpl implements AppPreferences {
|
||||
/**
|
||||
* Constant to access value of last path selected by the user to upload a file shared from other app.
|
||||
* Value handled by the app without direct access in the UI.
|
||||
|
@ -74,14 +74,14 @@ public final class PreferenceManager implements AppPreferences {
|
|||
Context appContext = context.getApplicationContext();
|
||||
SharedPreferences prefs = getDefaultSharedPreferences(appContext);
|
||||
|
||||
return new PreferenceManager(appContext, prefs);
|
||||
return new AppPreferencesImpl(appContext, prefs);
|
||||
}
|
||||
|
||||
private static SharedPreferences getDefaultSharedPreferences(Context context) {
|
||||
return android.preference.PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext());
|
||||
}
|
||||
|
||||
PreferenceManager(Context appContext, SharedPreferences preferences) {
|
||||
AppPreferencesImpl(Context appContext, SharedPreferences preferences) {
|
||||
this.context = appContext;
|
||||
this.preferences = preferences;
|
||||
}
|
||||
|
@ -425,7 +425,7 @@ public final class PreferenceManager implements AppPreferences {
|
|||
@SuppressLint("ApplySharedPref")
|
||||
@Override
|
||||
public void removeKeysMigrationPreference() {
|
||||
preferences.edit().remove(PreferenceManager.PREF__KEYS_MIGRATION).commit(); // commit synchronously
|
||||
preferences.edit().remove(AppPreferencesImpl.PREF__KEYS_MIGRATION).commit(); // commit synchronously
|
||||
}
|
||||
|
||||
/**
|
|
@ -43,7 +43,7 @@ import com.evernote.android.job.JobRequest;
|
|||
import com.nextcloud.client.di.ActivityInjector;
|
||||
import com.nextcloud.client.di.DaggerAppComponent;
|
||||
import com.nextcloud.client.preferences.AppPreferences;
|
||||
import com.nextcloud.client.preferences.PreferenceManager;
|
||||
import com.nextcloud.client.preferences.AppPreferencesImpl;
|
||||
import com.owncloud.android.authentication.AccountUtils;
|
||||
import com.owncloud.android.authentication.PassCodeManager;
|
||||
import com.owncloud.android.datamodel.ArbitraryDataProvider;
|
||||
|
@ -330,7 +330,7 @@ public class MainApp extends MultiDexApplication implements
|
|||
Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
|
||||
splitOutAutoUploadEntries();
|
||||
} else {
|
||||
AppPreferences preferences = PreferenceManager.fromContext(getAppContext());
|
||||
AppPreferences preferences = AppPreferencesImpl.fromContext(getAppContext());
|
||||
preferences.setAutoUploadSplitEntriesEnabled(true);
|
||||
}
|
||||
}
|
||||
|
@ -537,7 +537,7 @@ public class MainApp extends MultiDexApplication implements
|
|||
|
||||
private static void updateToAutoUpload() {
|
||||
Context context = getAppContext();
|
||||
AppPreferences preferences = PreferenceManager.fromContext(context);
|
||||
AppPreferences preferences = AppPreferencesImpl.fromContext(context);
|
||||
if (preferences.instantPictureUploadEnabled() || preferences.instantVideoUploadEnabled()){
|
||||
preferences.removeLegacyPreferences();
|
||||
|
||||
|
@ -564,7 +564,7 @@ public class MainApp extends MultiDexApplication implements
|
|||
private static void updateAutoUploadEntries() {
|
||||
// updates entries to reflect their true paths
|
||||
Context context = getAppContext();
|
||||
AppPreferences preferences = PreferenceManager.fromContext(context);
|
||||
AppPreferences preferences = AppPreferencesImpl.fromContext(context);
|
||||
if (!preferences.isAutoUploadPathsUpdateEnabled()) {
|
||||
SyncedFolderProvider syncedFolderProvider =
|
||||
new SyncedFolderProvider(MainApp.getAppContext().getContentResolver(), preferences);
|
||||
|
@ -574,7 +574,7 @@ public class MainApp extends MultiDexApplication implements
|
|||
|
||||
private static void splitOutAutoUploadEntries() {
|
||||
Context context = getAppContext();
|
||||
AppPreferences preferences = PreferenceManager.fromContext(context);
|
||||
AppPreferences preferences = AppPreferencesImpl.fromContext(context);
|
||||
if (!preferences.isAutoUploadSplitEntriesEnabled()) {
|
||||
// magic to split out existing synced folders in two when needed
|
||||
// otherwise, we migrate them to their proper type (image or video)
|
||||
|
@ -629,7 +629,7 @@ public class MainApp extends MultiDexApplication implements
|
|||
|
||||
private static void initiateExistingAutoUploadEntries() {
|
||||
new Thread(() -> {
|
||||
AppPreferences preferences = PreferenceManager.fromContext(getAppContext());
|
||||
AppPreferences preferences = AppPreferencesImpl.fromContext(getAppContext());
|
||||
if (!preferences.isAutoUploadInitialized()) {
|
||||
SyncedFolderProvider syncedFolderProvider =
|
||||
new SyncedFolderProvider(MainApp.getAppContext().getContentResolver(), preferences);
|
||||
|
@ -651,7 +651,7 @@ public class MainApp extends MultiDexApplication implements
|
|||
// database, and this cleans all that and leaves 1 (newest) entry per synced folder
|
||||
|
||||
Context context = getAppContext();
|
||||
AppPreferences preferences = PreferenceManager.fromContext(context);
|
||||
AppPreferences preferences = AppPreferencesImpl.fromContext(context);
|
||||
|
||||
if (!preferences.isLegacyClean()) {
|
||||
SyncedFolderProvider syncedFolderProvider =
|
||||
|
|
|
@ -28,7 +28,7 @@ import android.view.Window;
|
|||
import android.view.WindowManager;
|
||||
|
||||
import com.nextcloud.client.preferences.AppPreferences;
|
||||
import com.nextcloud.client.preferences.PreferenceManager;
|
||||
import com.nextcloud.client.preferences.AppPreferencesImpl;
|
||||
import com.owncloud.android.MainApp;
|
||||
import com.owncloud.android.ui.activity.PassCodeActivity;
|
||||
import com.owncloud.android.ui.activity.RequestCredentialsActivity;
|
||||
|
@ -77,7 +77,7 @@ public final class PassCodeManager {
|
|||
}
|
||||
|
||||
public void onActivityStarted(Activity activity) {
|
||||
Long timestamp = PreferenceManager.fromContext(activity).getLockTimestamp();
|
||||
Long timestamp = AppPreferencesImpl.fromContext(activity).getLockTimestamp();
|
||||
if (!exemptOfPasscodeActivities.contains(activity.getClass()) && passCodeShouldBeRequested(timestamp)) {
|
||||
|
||||
Intent i = new Intent(MainApp.getAppContext(), PassCodeActivity.class);
|
||||
|
@ -109,7 +109,7 @@ public final class PassCodeManager {
|
|||
}
|
||||
|
||||
private void setUnlockTimestamp(Activity activity) {
|
||||
PreferenceManager.fromContext(activity).setLockTimestamp(System.currentTimeMillis());
|
||||
AppPreferencesImpl.fromContext(activity).setLockTimestamp(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
private boolean passCodeShouldBeRequested(Long timestamp) {
|
||||
|
|
|
@ -28,7 +28,7 @@ import android.database.Cursor;
|
|||
import android.net.Uri;
|
||||
|
||||
import com.nextcloud.client.preferences.AppPreferences;
|
||||
import com.nextcloud.client.preferences.PreferenceManager;
|
||||
import com.nextcloud.client.preferences.AppPreferencesImpl;
|
||||
import com.owncloud.android.db.ProviderMeta;
|
||||
import com.owncloud.android.lib.common.utils.Log_OC;
|
||||
|
||||
|
@ -265,7 +265,7 @@ public class SyncedFolderProvider extends Observable {
|
|||
}
|
||||
|
||||
if (context != null) {
|
||||
AppPreferences preferences = PreferenceManager.fromContext(context);
|
||||
AppPreferences preferences = AppPreferencesImpl.fromContext(context);
|
||||
preferences.setAutoUploadPathsUpdateEnabled(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ import android.content.Context;
|
|||
|
||||
import com.evernote.android.job.Job;
|
||||
import com.evernote.android.job.util.support.PersistableBundleCompat;
|
||||
import com.nextcloud.client.preferences.PreferenceManager;
|
||||
import com.nextcloud.client.preferences.AppPreferencesImpl;
|
||||
import com.owncloud.android.MainApp;
|
||||
import com.owncloud.android.authentication.AccountUtils;
|
||||
import com.owncloud.android.datamodel.ArbitraryDataProvider;
|
||||
|
@ -94,7 +94,7 @@ public class AccountRemovalJob extends Job implements AccountManagerCallback<Boo
|
|||
|
||||
// remove synced folders set for account
|
||||
SyncedFolderProvider syncedFolderProvider = new SyncedFolderProvider(context.getContentResolver(),
|
||||
PreferenceManager.fromContext(context));
|
||||
AppPreferencesImpl.fromContext(context));
|
||||
List<SyncedFolder> syncedFolders = syncedFolderProvider.getSyncedFolders();
|
||||
|
||||
List<Long> syncedFolderIds = new ArrayList<>();
|
||||
|
|
|
@ -31,7 +31,7 @@ import android.text.TextUtils;
|
|||
|
||||
import com.evernote.android.job.Job;
|
||||
import com.evernote.android.job.util.support.PersistableBundleCompat;
|
||||
import com.nextcloud.client.preferences.PreferenceManager;
|
||||
import com.nextcloud.client.preferences.AppPreferencesImpl;
|
||||
import com.owncloud.android.MainApp;
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.authentication.AccountUtils;
|
||||
|
@ -105,7 +105,7 @@ public class FilesSyncJob extends Job {
|
|||
final ContentResolver contentResolver = context.getContentResolver();
|
||||
final FilesystemDataProvider filesystemDataProvider = new FilesystemDataProvider(contentResolver);
|
||||
SyncedFolderProvider syncedFolderProvider = new SyncedFolderProvider(contentResolver,
|
||||
PreferenceManager.fromContext(context));
|
||||
AppPreferencesImpl.fromContext(context));
|
||||
|
||||
Locale currentLocale = context.getResources().getConfiguration().locale;
|
||||
SimpleDateFormat sFormatter = new SimpleDateFormat("yyyy:MM:dd HH:mm:ss", currentLocale);
|
||||
|
|
|
@ -37,6 +37,7 @@ import android.text.TextUtils;
|
|||
import com.evernote.android.job.Job;
|
||||
import com.google.gson.Gson;
|
||||
import com.nextcloud.client.preferences.AppPreferences;
|
||||
import com.nextcloud.client.preferences.AppPreferencesImpl;
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.authentication.AccountUtils;
|
||||
import com.owncloud.android.datamodel.ArbitraryDataProvider;
|
||||
|
@ -44,7 +45,6 @@ import com.owncloud.android.datamodel.MediaFolder;
|
|||
import com.owncloud.android.datamodel.MediaFoldersModel;
|
||||
import com.owncloud.android.datamodel.MediaProvider;
|
||||
import com.owncloud.android.datamodel.SyncedFolderProvider;
|
||||
import com.nextcloud.client.preferences.PreferenceManager;
|
||||
import com.owncloud.android.lib.common.utils.Log_OC;
|
||||
import com.owncloud.android.ui.activity.ManageAccountsActivity;
|
||||
import com.owncloud.android.ui.activity.SyncedFoldersActivity;
|
||||
|
@ -81,7 +81,7 @@ public class MediaFoldersDetectionJob extends Job {
|
|||
ContentResolver contentResolver = context.getContentResolver();
|
||||
ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProvider(contentResolver);
|
||||
SyncedFolderProvider syncedFolderProvider = new SyncedFolderProvider(contentResolver,
|
||||
PreferenceManager.fromContext(context));
|
||||
AppPreferencesImpl.fromContext(context));
|
||||
Gson gson = new Gson();
|
||||
String arbitraryDataString;
|
||||
MediaFoldersModel mediaFoldersModel;
|
||||
|
@ -108,7 +108,7 @@ public class MediaFoldersDetectionJob extends Job {
|
|||
arbitraryDataProvider.storeOrUpdateKeyValue(ACCOUNT_NAME_GLOBAL, KEY_MEDIA_FOLDERS, gson.toJson(new
|
||||
MediaFoldersModel(imageMediaFolderPaths, videoMediaFolderPaths)));
|
||||
|
||||
final AppPreferences preferences = PreferenceManager.fromContext(getContext());
|
||||
final AppPreferences preferences = AppPreferencesImpl.fromContext(getContext());
|
||||
if (preferences.isShowMediaScanNotifications()) {
|
||||
imageMediaFolderPaths.removeAll(mediaFoldersModel.getImageMediaFolders());
|
||||
videoMediaFolderPaths.removeAll(mediaFoldersModel.getVideoMediaFolders());
|
||||
|
@ -227,7 +227,7 @@ public class MediaFoldersDetectionJob extends Job {
|
|||
public void onReceive(Context context, Intent intent) {
|
||||
String action = intent.getAction();
|
||||
int notificationId = intent.getIntExtra(NOTIFICATION_ID, 0);
|
||||
final AppPreferences preferences = PreferenceManager.fromContext(context);
|
||||
final AppPreferences preferences = AppPreferencesImpl.fromContext(context);
|
||||
|
||||
if (DISABLE_DETECTION_CLICK.equals(action)) {
|
||||
Log_OC.d(this, "Disable media scan notifications");
|
||||
|
|
|
@ -27,7 +27,7 @@ import android.os.Build;
|
|||
|
||||
import com.evernote.android.job.JobRequest;
|
||||
import com.evernote.android.job.util.support.PersistableBundleCompat;
|
||||
import com.nextcloud.client.preferences.PreferenceManager;
|
||||
import com.nextcloud.client.preferences.AppPreferencesImpl;
|
||||
import com.owncloud.android.datamodel.SyncedFolderProvider;
|
||||
import com.owncloud.android.utils.FilesSyncHelper;
|
||||
import com.owncloud.android.utils.PowerUtils;
|
||||
|
@ -67,7 +67,7 @@ public class NContentObserverJob extends JobService {
|
|||
private void checkAndStartFileSyncJob() {
|
||||
if (!PowerUtils.isPowerSaveMode(getApplicationContext()) &&
|
||||
new SyncedFolderProvider(getContentResolver(),
|
||||
PreferenceManager.fromContext(getApplicationContext())).countEnabledSyncedFolders() > 0) {
|
||||
AppPreferencesImpl.fromContext(getApplicationContext())).countEnabledSyncedFolders() > 0) {
|
||||
PersistableBundleCompat persistableBundleCompat = new PersistableBundleCompat();
|
||||
persistableBundleCompat.putBoolean(FilesSyncJob.SKIP_CUSTOM, true);
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ import android.widget.Toast;
|
|||
import com.evernote.android.job.JobRequest;
|
||||
import com.evernote.android.job.util.Device;
|
||||
import com.nextcloud.client.preferences.AppPreferences;
|
||||
import com.nextcloud.client.preferences.AppPreferencesImpl;
|
||||
import com.owncloud.android.MainApp;
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.authentication.AccountUtils;
|
||||
|
@ -93,7 +94,7 @@ public class DocumentsStorageProvider extends DocumentsProvider {
|
|||
@Override
|
||||
public Cursor queryRoots(String[] projection) throws FileNotFoundException {
|
||||
Context context = MainApp.getAppContext();
|
||||
AppPreferences preferences = com.nextcloud.client.preferences.PreferenceManager.fromContext(context);
|
||||
AppPreferences preferences = AppPreferencesImpl.fromContext(context);
|
||||
if (SettingsActivity.LOCK_PASSCODE.equals(preferences.getLockPreference()) ||
|
||||
SettingsActivity.LOCK_DEVICE_CREDENTIALS.equals(preferences.getLockPreference())) {
|
||||
return new FileCursor();
|
||||
|
|
|
@ -64,7 +64,7 @@ import com.owncloud.android.datamodel.FileDataStorageManager;
|
|||
import com.owncloud.android.datamodel.OCFile;
|
||||
import com.owncloud.android.datamodel.VirtualFolderType;
|
||||
import com.nextcloud.client.preferences.AppPreferences;
|
||||
import com.nextcloud.client.preferences.PreferenceManager;
|
||||
import com.nextcloud.client.preferences.AppPreferencesImpl;
|
||||
import com.owncloud.android.files.services.FileDownloader;
|
||||
import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder;
|
||||
import com.owncloud.android.files.services.FileUploader;
|
||||
|
@ -353,7 +353,7 @@ public class FileDisplayActivity extends FileActivity
|
|||
ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProvider(getContentResolver());
|
||||
|
||||
int lastSeenVersion = arbitraryDataProvider.getIntegerValue(account,
|
||||
PreferenceManager.AUTO_PREF__LAST_SEEN_VERSION_CODE);
|
||||
AppPreferencesImpl.AUTO_PREF__LAST_SEEN_VERSION_CODE);
|
||||
|
||||
if (MainApp.getVersionCode() > lastSeenVersion) {
|
||||
OwnCloudVersion serverVersion = AccountUtils.getServerVersionForAccount(account, this);
|
||||
|
@ -366,7 +366,7 @@ public class FileDisplayActivity extends FileActivity
|
|||
DisplayUtils.showServerOutdatedSnackbar(this);
|
||||
}
|
||||
|
||||
arbitraryDataProvider.storeOrUpdateKeyValue(account.name, PreferenceManager.AUTO_PREF__LAST_SEEN_VERSION_CODE,
|
||||
arbitraryDataProvider.storeOrUpdateKeyValue(account.name, AppPreferencesImpl.AUTO_PREF__LAST_SEEN_VERSION_CODE,
|
||||
String.valueOf(MainApp.getVersionCode()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ import androidx.core.content.res.ResourcesCompat;
|
|||
|
||||
import com.nextcloud.client.di.Injectable;
|
||||
import com.nextcloud.client.preferences.AppPreferences;
|
||||
import com.nextcloud.client.preferences.AppPreferencesImpl;
|
||||
import com.owncloud.android.BuildConfig;
|
||||
import com.owncloud.android.MainApp;
|
||||
import com.owncloud.android.R;
|
||||
|
@ -663,7 +664,7 @@ public class SettingsActivity extends PreferenceActivity
|
|||
preferenceCategoryGeneral.setTitle(ThemeUtils.getColoredTitle(getString(R.string.prefs_category_general),
|
||||
accentColor));
|
||||
|
||||
prefStoragePath = (ListPreference) findPreference(com.nextcloud.client.preferences.PreferenceManager.STORAGE_PATH);
|
||||
prefStoragePath = (ListPreference) findPreference(AppPreferencesImpl.STORAGE_PATH);
|
||||
if (prefStoragePath != null) {
|
||||
StoragePoint[] storageOptions = DataStorageProvider.getInstance().getAvailableStoragePoints();
|
||||
String[] entries = new String[storageOptions.length];
|
||||
|
@ -967,7 +968,7 @@ public class SettingsActivity extends PreferenceActivity
|
|||
storagePath = newStoragePath;
|
||||
MainApp.setStoragePath(storagePath);
|
||||
SharedPreferences.Editor editor = appPrefs.edit();
|
||||
editor.putString(com.nextcloud.client.preferences.PreferenceManager.STORAGE_PATH, storagePath);
|
||||
editor.putString(AppPreferencesImpl.STORAGE_PATH, storagePath);
|
||||
editor.apply();
|
||||
String storageDescription = DataStorageProvider.getInstance().getStorageDescriptionByPath(storagePath);
|
||||
prefStoragePath.setSummary(storageDescription);
|
||||
|
@ -980,7 +981,7 @@ public class SettingsActivity extends PreferenceActivity
|
|||
private void loadStoragePath() {
|
||||
SharedPreferences appPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
||||
// Load storage path from shared preferences. Use private internal storage by default.
|
||||
storagePath = appPrefs.getString(com.nextcloud.client.preferences.PreferenceManager.STORAGE_PATH,
|
||||
storagePath = appPrefs.getString(AppPreferencesImpl.STORAGE_PATH,
|
||||
getApplicationContext().getFilesDir().getAbsolutePath());
|
||||
String storageDescription = DataStorageProvider.getInstance().getStorageDescriptionByPath(storagePath);
|
||||
prefStoragePath.setSummary(storageDescription);
|
||||
|
|
|
@ -36,7 +36,7 @@ import android.util.Log;
|
|||
import com.evernote.android.job.JobManager;
|
||||
import com.evernote.android.job.JobRequest;
|
||||
import com.evernote.android.job.util.Device;
|
||||
import com.nextcloud.client.preferences.PreferenceManager;
|
||||
import com.nextcloud.client.preferences.AppPreferencesImpl;
|
||||
import com.owncloud.android.MainApp;
|
||||
import com.owncloud.android.authentication.AccountUtils;
|
||||
import com.owncloud.android.datamodel.ArbitraryDataProvider;
|
||||
|
@ -159,7 +159,7 @@ public final class FilesSyncHelper {
|
|||
final Context context = MainApp.getAppContext();
|
||||
final ContentResolver contentResolver = context.getContentResolver();
|
||||
SyncedFolderProvider syncedFolderProvider = new SyncedFolderProvider(contentResolver,
|
||||
PreferenceManager.fromContext(context));
|
||||
AppPreferencesImpl.fromContext(context));
|
||||
|
||||
for (SyncedFolder syncedFolder : syncedFolderProvider.getSyncedFolders()) {
|
||||
if (syncedFolder.isEnabled() && (MediaFolderType.CUSTOM != syncedFolder.getType() || !skipCustom)) {
|
||||
|
|
|
@ -23,13 +23,13 @@ public class TestPreferenceManager {
|
|||
@Mock
|
||||
private SharedPreferences.Editor editor;
|
||||
|
||||
private PreferenceManager appPreferences;
|
||||
private AppPreferencesImpl appPreferences;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
when(editor.remove(anyString())).thenReturn(editor);
|
||||
when(sharedPreferences.edit()).thenReturn(editor);
|
||||
appPreferences = new PreferenceManager(testContext, sharedPreferences);
|
||||
appPreferences = new AppPreferencesImpl(testContext, sharedPreferences);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -24,7 +24,7 @@ import android.content.Context;
|
|||
|
||||
import com.owncloud.android.MainApp;
|
||||
import com.owncloud.android.datamodel.SignatureVerification;
|
||||
import com.nextcloud.client.preferences.PreferenceManager;
|
||||
import com.nextcloud.client.preferences.AppPreferencesImpl;
|
||||
|
||||
import java.security.Key;
|
||||
|
||||
|
@ -40,7 +40,7 @@ public final class PushUtils {
|
|||
|
||||
public static void reinitKeys() {
|
||||
Context context = MainApp.getAppContext();
|
||||
PreferenceManager.fromContext(context).setKeysReInitEnabled();
|
||||
AppPreferencesImpl.fromContext(context).setKeysReInitEnabled();
|
||||
}
|
||||
|
||||
public static Key readKeyFromFile(boolean readPublicKey) {
|
||||
|
|
Loading…
Reference in a new issue