diff options
author | Siqi Liu <me@siqi.fr> | 2015-04-23 15:19:28 +0200 |
---|---|---|
committer | Siqi Liu <me@siqi.fr> | 2015-04-23 15:31:17 +0200 |
commit | 6c03914e2b762e0ba103eb7cb0ab9bf6203d2305 (patch) | |
tree | db31b58f951f9154e2e38e68b0f0ce969da73578 /android | |
parent | Use switch... and effectively sorts before listing. (diff) | |
download | core-6c03914e2b762e0ba103eb7cb0ab9bf6203d2305.tar.gz core-6c03914e2b762e0ba103eb7cb0ab9bf6203d2305.zip |
load default prefs once and use new sortmode/filter mode on refresh.
Change-Id: I54c3e25e960ade172eeb0f4bf24104b3b06e2ee2
Diffstat (limited to 'android')
-rw-r--r-- | android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java index 3c269bf83d89..fd085747d417 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java @@ -107,6 +107,7 @@ public class LibreOfficeUIActivity extends ActionBarActivity implements ActionBa DocumentProviderFactory.initialize(this); documentProviderFactory = DocumentProviderFactory.getInstance(); + readPreferences(); // init UI and populate with contents from the provider createUI(); switchToDocumentProvider(documentProviderFactory.getDefaultProvider()); @@ -496,11 +497,10 @@ public class LibreOfficeUIActivity extends ActionBarActivity implements ActionBa public void readPreferences(){ prefs = getSharedPreferences(EXPLORER_PREFS_KEY, MODE_PRIVATE); - viewMode = prefs.getInt( EXPLORER_VIEW_TYPE_KEY, GRID_VIEW); - sortMode = prefs.getInt( SORT_MODE_KEY, FileUtilities.SORT_AZ ); - SharedPreferences defaultPrefs = PreferenceManager.getDefaultSharedPreferences( getBaseContext() ); - filterMode = Integer.valueOf( defaultPrefs.getString( FILTER_MODE_KEY , "-1") ); - sortMode = Integer.valueOf( defaultPrefs.getString( SORT_MODE_KEY , "-1") ); + viewMode = prefs.getInt(EXPLORER_VIEW_TYPE_KEY, GRID_VIEW); + sortMode = prefs.getInt(SORT_MODE_KEY, FileUtilities.SORT_AZ); + SharedPreferences defaultPrefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); + filterMode = Integer.valueOf(defaultPrefs.getString(FILTER_MODE_KEY , "-1")); } @Override @@ -547,25 +547,7 @@ public class LibreOfficeUIActivity extends ActionBarActivity implements ActionBa protected void onResume() { super.onResume(); Log.d(LOGTAG, "onResume"); - readPreferences();// intent values take precedence over prefs? - Intent i = this.getIntent(); - if( i.hasExtra( CURRENT_DIRECTORY_KEY ) ){ - try { - currentDirectory = documentProvider.createFromUri(new URI( - i.getStringExtra(CURRENT_DIRECTORY_KEY))); - } catch (URISyntaxException e) { - currentDirectory = documentProvider.getRootDirectory(); - } - Log.d(LOGTAG, CURRENT_DIRECTORY_KEY); - } - if( i.hasExtra( FILTER_MODE_KEY ) ){ - filterMode = i.getIntExtra( FILTER_MODE_KEY, FileUtilities.ALL); - Log.d(LOGTAG, FILTER_MODE_KEY); - } - if( i.hasExtra( EXPLORER_VIEW_TYPE_KEY ) ){ - viewMode = i.getIntExtra( EXPLORER_VIEW_TYPE_KEY, GRID_VIEW); - Log.d(LOGTAG, EXPLORER_VIEW_TYPE_KEY); - } + Log.d(LOGTAG, "sortMode="+ sortMode + " filterMode=" + filterMode); createUI(); } |