mirror of
https://github.com/nextcloud/android.git
synced 2024-11-27 09:39:25 +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
|
* It proxies the necessary calls via {@link android.support.v7.app.AppCompatDelegate} to be used
|
||||||
* with AppCompat.
|
* with AppCompat.
|
||||||
*/
|
*/
|
||||||
public class Preferences extends PreferenceActivity {
|
public class Preferences extends PreferenceActivity
|
||||||
|
implements StorageMigration.StorageMigrationProgressListener {
|
||||||
|
|
||||||
private static final String TAG = Preferences.class.getSimpleName();
|
private static final String TAG = Preferences.class.getSimpleName();
|
||||||
|
|
||||||
|
@ -120,6 +121,8 @@ public class Preferences extends PreferenceActivity {
|
||||||
|
|
||||||
public static class Keys {
|
public static class Keys {
|
||||||
public static final String STORAGE_PATH = "storage_path";
|
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")
|
@SuppressWarnings("deprecation")
|
||||||
|
@ -367,13 +370,13 @@ public class Preferences extends PreferenceActivity {
|
||||||
|
|
||||||
storageMigration.migrate();
|
storageMigration.migrate();
|
||||||
|
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mPrefInstantUploadPath = (PreferenceWithLongSummary)findPreference("instant_upload_path");
|
mPrefInstantUploadPath = (PreferenceWithLongSummary)findPreference(Keys.INSTANT_UPLOAD_PATH);
|
||||||
if (mPrefInstantUploadPath != null){
|
if (mPrefInstantUploadPath != null){
|
||||||
|
|
||||||
mPrefInstantUploadPath.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
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){
|
if (mPrefInstantVideoUploadPath != null){
|
||||||
|
|
||||||
mPrefInstantVideoUploadPath.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
mPrefInstantVideoUploadPath.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
||||||
|
@ -746,7 +749,7 @@ public class Preferences extends PreferenceActivity {
|
||||||
private void loadInstantUploadPath() {
|
private void loadInstantUploadPath() {
|
||||||
SharedPreferences appPrefs =
|
SharedPreferences appPrefs =
|
||||||
PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
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);
|
mPrefInstantUploadPath.setSummary(mUploadPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -763,6 +766,7 @@ public class Preferences extends PreferenceActivity {
|
||||||
editor.commit();
|
editor.commit();
|
||||||
String storageDescription = DataStorageUtils.getStorageDescriptionByPath(mStoragePath, this);
|
String storageDescription = DataStorageUtils.getStorageDescriptionByPath(mStoragePath, this);
|
||||||
mPrefStoragePath.setSummary(storageDescription);
|
mPrefStoragePath.setSummary(storageDescription);
|
||||||
|
mPrefStoragePath.setValue(newStoragePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -784,7 +788,7 @@ public class Preferences extends PreferenceActivity {
|
||||||
SharedPreferences appPrefs =
|
SharedPreferences appPrefs =
|
||||||
PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
||||||
SharedPreferences.Editor editor = appPrefs.edit();
|
SharedPreferences.Editor editor = appPrefs.edit();
|
||||||
editor.putString("instant_upload_path", mUploadPath);
|
editor.putString(Keys.INSTANT_UPLOAD_PATH, mUploadPath);
|
||||||
editor.commit();
|
editor.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -802,16 +806,15 @@ public class Preferences extends PreferenceActivity {
|
||||||
SharedPreferences appPrefs =
|
SharedPreferences appPrefs =
|
||||||
PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
||||||
SharedPreferences.Editor editor = appPrefs.edit();
|
SharedPreferences.Editor editor = appPrefs.edit();
|
||||||
editor.putString("instant_video_upload_path", mUploadVideoPath);
|
editor.putString(Keys.INSTANT_VIDEO_UPLOAD_PATH, mUploadVideoPath);
|
||||||
editor.commit();
|
editor.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStorageMigrationFinished(String storagePath, boolean succeed) {
|
public void onStorageMigrationFinished(String storagePath, boolean succeed) {
|
||||||
if (succeed) {
|
if (succeed)
|
||||||
saveStoragePath(storagePath);
|
saveStoragePath(storagePath);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCancelMigration() {
|
public void onCancelMigration() {
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class DataStorageUtils {
|
||||||
storagePath = System.getenv("SECONDARY_STORAGE"); // : separated paths to sd cards
|
storagePath = System.getenv("SECONDARY_STORAGE"); // : separated paths to sd cards
|
||||||
list.addAll(getSDCardStorage(storagePath, context));
|
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()]);
|
return list.toArray(new Storage[list.size()]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,7 @@ import java.util.Vector;
|
||||||
|
|
||||||
import third_parties.daveKoeller.AlphanumComparator;
|
import third_parties.daveKoeller.AlphanumComparator;
|
||||||
|
|
||||||
|
import com.owncloud.android.ui.activity.Preferences;
|
||||||
|
|
||||||
import android.accounts.Account;
|
import android.accounts.Account;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
|
Loading…
Reference in a new issue