mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 13:45:35 +03:00
Small code cleanups
This commit is contained in:
parent
9dc51a4880
commit
47f522d34e
3 changed files with 14 additions and 10 deletions
|
@ -76,7 +76,8 @@ import java.io.IOException;
|
|||
* It proxies the necessary calls via {@link android.support.v7.app.AppCompatDelegate} to be used
|
||||
* with AppCompat.
|
||||
*/
|
||||
public class Preferences extends PreferenceActivity {
|
||||
public class Preferences extends PreferenceActivity
|
||||
implements StorageMigration.StorageMigrationProgressListener {
|
||||
|
||||
private static final String TAG = Preferences.class.getSimpleName();
|
||||
|
||||
|
@ -120,6 +121,8 @@ public class Preferences extends PreferenceActivity {
|
|||
|
||||
public static class Keys {
|
||||
public static final String STORAGE_PATH = "storage_path";
|
||||
public static final String INSTANT_UPLOAD_PATH = "instant_upload_path";
|
||||
public static final String INSTANT_VIDEO_UPLOAD_PATH = "instant_video_upload_path";
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
|
@ -367,13 +370,13 @@ public class Preferences extends PreferenceActivity {
|
|||
|
||||
storageMigration.migrate();
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
mPrefInstantUploadPath = (PreferenceWithLongSummary)findPreference("instant_upload_path");
|
||||
mPrefInstantUploadPath = (PreferenceWithLongSummary)findPreference(Keys.INSTANT_UPLOAD_PATH);
|
||||
if (mPrefInstantUploadPath != null){
|
||||
|
||||
mPrefInstantUploadPath.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
||||
|
@ -412,7 +415,7 @@ public class Preferences extends PreferenceActivity {
|
|||
}
|
||||
});
|
||||
|
||||
mPrefInstantVideoUploadPath = findPreference("instant_video_upload_path");
|
||||
mPrefInstantVideoUploadPath = findPreference(Keys.INSTANT_VIDEO_UPLOAD_PATH);
|
||||
if (mPrefInstantVideoUploadPath != null){
|
||||
|
||||
mPrefInstantVideoUploadPath.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
||||
|
@ -746,7 +749,7 @@ public class Preferences extends PreferenceActivity {
|
|||
private void loadInstantUploadPath() {
|
||||
SharedPreferences appPrefs =
|
||||
PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
||||
mUploadPath = appPrefs.getString("instant_upload_path", getString(R.string.instant_upload_path));
|
||||
mUploadPath = appPrefs.getString(Keys.INSTANT_UPLOAD_PATH, getString(R.string.instant_upload_path));
|
||||
mPrefInstantUploadPath.setSummary(mUploadPath);
|
||||
}
|
||||
|
||||
|
@ -763,6 +766,7 @@ public class Preferences extends PreferenceActivity {
|
|||
editor.commit();
|
||||
String storageDescription = DataStorageUtils.getStorageDescriptionByPath(mStoragePath, this);
|
||||
mPrefStoragePath.setSummary(storageDescription);
|
||||
mPrefStoragePath.setValue(newStoragePath);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -784,7 +788,7 @@ public class Preferences extends PreferenceActivity {
|
|||
SharedPreferences appPrefs =
|
||||
PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
||||
SharedPreferences.Editor editor = appPrefs.edit();
|
||||
editor.putString("instant_upload_path", mUploadPath);
|
||||
editor.putString(Keys.INSTANT_UPLOAD_PATH, mUploadPath);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
|
@ -802,15 +806,14 @@ public class Preferences extends PreferenceActivity {
|
|||
SharedPreferences appPrefs =
|
||||
PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
||||
SharedPreferences.Editor editor = appPrefs.edit();
|
||||
editor.putString("instant_video_upload_path", mUploadVideoPath);
|
||||
editor.putString(Keys.INSTANT_VIDEO_UPLOAD_PATH, mUploadVideoPath);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStorageMigrationFinished(String storagePath, boolean succeed) {
|
||||
if (succeed) {
|
||||
if (succeed)
|
||||
saveStoragePath(storagePath);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -69,7 +69,7 @@ public class DataStorageUtils {
|
|||
storagePath = System.getenv("SECONDARY_STORAGE"); // : separated paths to sd cards
|
||||
list.addAll(getSDCardStorage(storagePath, context));
|
||||
|
||||
//list.add(new Storage("Costam", Environment.getExternalStorageDirectory().getAbsolutePath() + "/costam"));
|
||||
list.add(new Storage("Costam", Environment.getExternalStorageDirectory().getAbsolutePath() + "/costam"));
|
||||
|
||||
return list.toArray(new Storage[list.size()]);
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@ import java.util.Vector;
|
|||
|
||||
import third_parties.daveKoeller.AlphanumComparator;
|
||||
|
||||
import com.owncloud.android.ui.activity.Preferences;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.annotation.SuppressLint;
|
||||
|
|
Loading…
Reference in a new issue