android/source/res/values/strings.xml | 2 + android/source/res/xml/libreoffice_preferences.xml | 5 ++ android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java | 17 +++++++++- 3 files changed, 23 insertions(+), 1 deletion(-)
New commits: commit 2733ca6c0aed6468c26fd7a80b0b50e32fd608c4 Author: Mert Tümer <merttum...@gmail.com> Date: Mon Jan 8 13:15:21 2018 +0300 tdf#103083 option to show/hide hidden files/folders on Android The patch was sent for the ULAKBIM/PARDUS project. Signed-off-by: Mert Tümer <merttum...@gmail.com> Change-Id: Iadbb688a1a976279b23d246001818ac1c21b3d47 Reviewed-on: https://gerrit.libreoffice.org/47637 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> diff --git a/android/source/res/values/strings.xml b/android/source/res/values/strings.xml index 1fb23a528c06..9b6ff7abff9c 100644 --- a/android/source/res/values/strings.xml +++ b/android/source/res/values/strings.xml @@ -49,6 +49,8 @@ <string name="pref_category_general">General</string> <string name="pref_experimental_editing">Experimental Mode</string> <string name="pref_experimental_editing_summary">Enable the experimental editing mode. Use at your own risk.</string> + <string name="pref_show_hidden_files">Hidden Files/Folders</string> + <string name="pref_show_hidden_files_summary">Enable to show hidden files/folders</string> <string name="action_about">About</string> <string name="action_parts">Parts</string> diff --git a/android/source/res/xml/libreoffice_preferences.xml b/android/source/res/xml/libreoffice_preferences.xml index 347709b7d017..17236434daa2 100644 --- a/android/source/res/xml/libreoffice_preferences.xml +++ b/android/source/res/xml/libreoffice_preferences.xml @@ -20,6 +20,11 @@ android:title="File explorer layout" android:key="EXPLORER_VIEW_TYPE" android:summary="View files as a grid or in a list." /> + <CheckBoxPreference + android:title="@string/pref_show_hidden_files" + android:key="ENABLE_SHOW_HIDDEN_FILES" + android:summary="@string/pref_show_hidden_files_summary" + android:defaultValue="false" /> </PreferenceCategory> <PreferenceCategory android:title="@string/pref_category_general" diff --git a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java index 530644667aa9..8d4891f2053a 100644 --- a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java +++ b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java @@ -90,6 +90,7 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings private int filterMode = FileUtilities.ALL; private int viewMode; private int sortMode; + private boolean showHiddenFiles; FileFilter fileFilter; FilenameFilter filenameFilter; @@ -107,6 +108,7 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings public static final String EXPLORER_PREFS_KEY = "EXPLORER_PREFS"; public static final String SORT_MODE_KEY = "SORT_MODE"; private static final String RECENT_DOCUMENTS_KEY = "RECENT_DOCUMENTS"; + private static final String ENABLE_SHOW_HIDDEN_FILES_KEY = "ENABLE_SHOW_HIDDEN_FILES"; public static final String NEW_FILE_PATH_KEY = "NEW_FILE_PATH_KEY"; public static final String NEW_DOC_TYPE_KEY = "NEW_DOC_TYPE_KEY"; @@ -483,8 +485,18 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings // a different thread currentDirectory = dir[0]; try { - filePaths = currentDirectory.listFiles(FileUtilities + List<IFile> paths = currentDirectory.listFiles(FileUtilities .getFileFilter(filterMode)); + filePaths = new ArrayList<IFile>(); + for(IFile file: paths) { + if(showHiddenFiles){ + filePaths.add(file); + } else { + if(!file.getName().startsWith(".")){ + filePaths.add(file); + } + } + } } catch (final RuntimeException e) { final Activity activity = LibreOfficeUIActivity.this; @@ -813,6 +825,7 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings SharedPreferences defaultPrefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); viewMode = Integer.valueOf(defaultPrefs.getString(EXPLORER_VIEW_TYPE_KEY, ""+ GRID_VIEW)); filterMode = Integer.valueOf(defaultPrefs.getString(FILTER_MODE_KEY , "-1")); + showHiddenFiles = Boolean.valueOf(defaultPrefs.getBoolean(ENABLE_SHOW_HIDDEN_FILES_KEY, false)); Intent i = this.getIntent(); if (i.hasExtra(CURRENT_DIRECTORY_KEY)) { @@ -850,6 +863,7 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings outState.putInt(FILTER_MODE_KEY, filterMode); outState.putInt(EXPLORER_VIEW_TYPE_KEY , viewMode); outState.putInt(DOC_PROVIDER_KEY, documentProvider.getId()); + outState.putBoolean(ENABLE_SHOW_HIDDEN_FILES_KEY , showHiddenFiles); Log.d(LOGTAG, currentDirectory.toString() + Integer.toString(filterMode) + Integer.toString(viewMode)); //prefs.edit().putInt(EXPLORER_VIEW_TYPE, viewType).commit(); @@ -876,6 +890,7 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings } filterMode = savedInstanceState.getInt(FILTER_MODE_KEY, FileUtilities.ALL); viewMode = savedInstanceState.getInt(EXPLORER_VIEW_TYPE_KEY, GRID_VIEW); + showHiddenFiles = savedInstanceState.getBoolean(ENABLE_SHOW_HIDDEN_FILES_KEY, false); //openDirectory(currentDirectory); Log.d(LOGTAG, "onRestoreInstanceState"); Log.d(LOGTAG, currentDirectory.toString() + Integer.toString(filterMode) + Integer.toString(viewMode)); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits