Loading res/menu/activity.xml +5 −0 Original line number Original line Diff line number Diff line Loading @@ -76,6 +76,11 @@ android:title="@string/menu_inspect" android:title="@string/menu_inspect" android:visible="false" android:visible="false" app:showAsAction="never"/> app:showAsAction="never"/> <item android:id="@+id/option_menu_show_hidden_files" android:title="@string/menu_show_hidden_files" android:visible="false" app:showAsAction="never"/> <item <item android:id="@+id/option_menu_launcher" android:id="@+id/option_menu_launcher" android:visible="false" android:visible="false" Loading res/values/config.xml +3 −0 Original line number Original line Diff line number Diff line Loading @@ -29,6 +29,9 @@ <!-- Indicates if showing as search bar design --> <!-- Indicates if showing as search bar design --> <bool name="show_search_bar">false</bool> <bool name="show_search_bar">false</bool> <!-- Indicates if showing hidden files by default --> <bool name="show_hidden_files_by_default">false</bool> <string name="default_root_uri" translatable="false">content://com.android.providers.downloads.documents/root/downloads</string> <string name="default_root_uri" translatable="false">content://com.android.providers.downloads.documents/root/downloads</string> <!-- The value is used in sorting process on Drawer menu. If the root's package name <!-- The value is used in sorting process on Drawer menu. If the root's package name start with it, the item will have higher order than others.--> start with it, the item will have higher order than others.--> Loading res/values/strings.xml +4 −0 Original line number Original line Diff line number Diff line Loading @@ -75,6 +75,10 @@ <string name="menu_rename">Rename</string> <string name="menu_rename">Rename</string> <!-- Menu item that displays properties about the selected document [CHAR LIMIT=28] --> <!-- Menu item that displays properties about the selected document [CHAR LIMIT=28] --> <string name="menu_inspect">Get info</string> <string name="menu_inspect">Get info</string> <!-- Menu item that shows hidden files [CHAR LIMIT=28] --> <string name="menu_show_hidden_files">Show hidden files</string> <!-- Menu item that hides hidden files [CHAR LIMIT=28] --> <string name="menu_hide_hidden_files">Don\u2019t show hidden files</string> <!-- Menu item that renames the selected document [CHAR LIMIT=28] --> <!-- Menu item that renames the selected document [CHAR LIMIT=28] --> <string name="menu_view_in_owner">View in <xliff:g id="source" example="Google Drive">%1$s</xliff:g></string> <string name="menu_view_in_owner">View in <xliff:g id="source" example="Google Drive">%1$s</xliff:g></string> Loading src/com/android/documentsui/BaseActivity.java +27 −0 Original line number Original line Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static com.android.documentsui.base.Shared.EXTRA_BENCHMARK; import static com.android.documentsui.base.SharedMinimal.DEBUG; import static com.android.documentsui.base.SharedMinimal.DEBUG; import static com.android.documentsui.base.State.MODE_GRID; import static com.android.documentsui.base.State.MODE_GRID; import android.content.Context; import android.content.Intent; import android.content.Intent; import android.content.pm.PackageInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager; Loading Loading @@ -403,6 +404,11 @@ public abstract class BaseActivity state.localOnly = intent.getBooleanExtra(Intent.EXTRA_LOCAL_ONLY, false); state.localOnly = intent.getBooleanExtra(Intent.EXTRA_LOCAL_ONLY, false); state.excludedAuthorities = getExcludedAuthorities(); state.excludedAuthorities = getExcludedAuthorities(); state.restrictScopeStorage = Shared.shouldRestrictStorageAccessFramework(this); state.restrictScopeStorage = Shared.shouldRestrictStorageAccessFramework(this); state.showHiddenFiles = LocalPreferences.getShowHiddenFiles( getApplicationContext(), getApplicationContext() .getResources() .getBoolean(R.bool.show_hidden_files_by_default)); includeState(state); includeState(state); Loading Loading @@ -524,6 +530,10 @@ public abstract class BaseActivity getInjector().actions.switchLauncherIcon(); getInjector().actions.switchLauncherIcon(); return true; return true; case R.id.option_menu_show_hidden_files: onClickedShowHiddenFiles(); return true; case R.id.sub_menu_grid: case R.id.sub_menu_grid: setViewMode(State.MODE_GRID); setViewMode(State.MODE_GRID); return true; return true; Loading Loading @@ -655,6 +665,23 @@ public abstract class BaseActivity return mState; return mState; } } /** * Updates hidden files visibility based on user action. */ private void onClickedShowHiddenFiles() { boolean showHiddenFiles = !mState.showHiddenFiles; Context context = getApplicationContext(); Metrics.logUserAction(showHiddenFiles ? MetricConsts.USER_ACTION_SHOW_HIDDEN_FILES : MetricConsts.USER_ACTION_HIDE_HIDDEN_FILES); LocalPreferences.setShowHiddenFiles(context, showHiddenFiles); mState.showHiddenFiles = showHiddenFiles; // Calls this to trigger either MultiRootDocumentsLoader or DirectoryLoader reloading. mInjector.actions.loadDocumentsForCurrentStack(); } /** /** * Set mode based on explicit user action. * Set mode based on explicit user action. */ */ Loading src/com/android/documentsui/DirectoryLoader.java +3 −0 Original line number Original line Diff line number Diff line Loading @@ -178,6 +178,9 @@ public class DirectoryLoader extends AsyncTaskLoader<DirectoryResult> { } } cursor.registerContentObserver(mObserver); cursor.registerContentObserver(mObserver); // Filter hidden files. cursor = new FilteringCursorWrapper(cursor, mState.showHiddenFiles); if (mSearchMode && !mFeatures.isFoldersInSearchResultsEnabled()) { if (mSearchMode && !mFeatures.isFoldersInSearchResultsEnabled()) { // There is no findDocumentPath API. Enable filtering on folders in search mode. // There is no findDocumentPath API. Enable filtering on folders in search mode. cursor = new FilteringCursorWrapper(cursor, null, SEARCH_REJECT_MIMES); cursor = new FilteringCursorWrapper(cursor, null, SEARCH_REJECT_MIMES); Loading Loading
res/menu/activity.xml +5 −0 Original line number Original line Diff line number Diff line Loading @@ -76,6 +76,11 @@ android:title="@string/menu_inspect" android:title="@string/menu_inspect" android:visible="false" android:visible="false" app:showAsAction="never"/> app:showAsAction="never"/> <item android:id="@+id/option_menu_show_hidden_files" android:title="@string/menu_show_hidden_files" android:visible="false" app:showAsAction="never"/> <item <item android:id="@+id/option_menu_launcher" android:id="@+id/option_menu_launcher" android:visible="false" android:visible="false" Loading
res/values/config.xml +3 −0 Original line number Original line Diff line number Diff line Loading @@ -29,6 +29,9 @@ <!-- Indicates if showing as search bar design --> <!-- Indicates if showing as search bar design --> <bool name="show_search_bar">false</bool> <bool name="show_search_bar">false</bool> <!-- Indicates if showing hidden files by default --> <bool name="show_hidden_files_by_default">false</bool> <string name="default_root_uri" translatable="false">content://com.android.providers.downloads.documents/root/downloads</string> <string name="default_root_uri" translatable="false">content://com.android.providers.downloads.documents/root/downloads</string> <!-- The value is used in sorting process on Drawer menu. If the root's package name <!-- The value is used in sorting process on Drawer menu. If the root's package name start with it, the item will have higher order than others.--> start with it, the item will have higher order than others.--> Loading
res/values/strings.xml +4 −0 Original line number Original line Diff line number Diff line Loading @@ -75,6 +75,10 @@ <string name="menu_rename">Rename</string> <string name="menu_rename">Rename</string> <!-- Menu item that displays properties about the selected document [CHAR LIMIT=28] --> <!-- Menu item that displays properties about the selected document [CHAR LIMIT=28] --> <string name="menu_inspect">Get info</string> <string name="menu_inspect">Get info</string> <!-- Menu item that shows hidden files [CHAR LIMIT=28] --> <string name="menu_show_hidden_files">Show hidden files</string> <!-- Menu item that hides hidden files [CHAR LIMIT=28] --> <string name="menu_hide_hidden_files">Don\u2019t show hidden files</string> <!-- Menu item that renames the selected document [CHAR LIMIT=28] --> <!-- Menu item that renames the selected document [CHAR LIMIT=28] --> <string name="menu_view_in_owner">View in <xliff:g id="source" example="Google Drive">%1$s</xliff:g></string> <string name="menu_view_in_owner">View in <xliff:g id="source" example="Google Drive">%1$s</xliff:g></string> Loading
src/com/android/documentsui/BaseActivity.java +27 −0 Original line number Original line Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static com.android.documentsui.base.Shared.EXTRA_BENCHMARK; import static com.android.documentsui.base.SharedMinimal.DEBUG; import static com.android.documentsui.base.SharedMinimal.DEBUG; import static com.android.documentsui.base.State.MODE_GRID; import static com.android.documentsui.base.State.MODE_GRID; import android.content.Context; import android.content.Intent; import android.content.Intent; import android.content.pm.PackageInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager; Loading Loading @@ -403,6 +404,11 @@ public abstract class BaseActivity state.localOnly = intent.getBooleanExtra(Intent.EXTRA_LOCAL_ONLY, false); state.localOnly = intent.getBooleanExtra(Intent.EXTRA_LOCAL_ONLY, false); state.excludedAuthorities = getExcludedAuthorities(); state.excludedAuthorities = getExcludedAuthorities(); state.restrictScopeStorage = Shared.shouldRestrictStorageAccessFramework(this); state.restrictScopeStorage = Shared.shouldRestrictStorageAccessFramework(this); state.showHiddenFiles = LocalPreferences.getShowHiddenFiles( getApplicationContext(), getApplicationContext() .getResources() .getBoolean(R.bool.show_hidden_files_by_default)); includeState(state); includeState(state); Loading Loading @@ -524,6 +530,10 @@ public abstract class BaseActivity getInjector().actions.switchLauncherIcon(); getInjector().actions.switchLauncherIcon(); return true; return true; case R.id.option_menu_show_hidden_files: onClickedShowHiddenFiles(); return true; case R.id.sub_menu_grid: case R.id.sub_menu_grid: setViewMode(State.MODE_GRID); setViewMode(State.MODE_GRID); return true; return true; Loading Loading @@ -655,6 +665,23 @@ public abstract class BaseActivity return mState; return mState; } } /** * Updates hidden files visibility based on user action. */ private void onClickedShowHiddenFiles() { boolean showHiddenFiles = !mState.showHiddenFiles; Context context = getApplicationContext(); Metrics.logUserAction(showHiddenFiles ? MetricConsts.USER_ACTION_SHOW_HIDDEN_FILES : MetricConsts.USER_ACTION_HIDE_HIDDEN_FILES); LocalPreferences.setShowHiddenFiles(context, showHiddenFiles); mState.showHiddenFiles = showHiddenFiles; // Calls this to trigger either MultiRootDocumentsLoader or DirectoryLoader reloading. mInjector.actions.loadDocumentsForCurrentStack(); } /** /** * Set mode based on explicit user action. * Set mode based on explicit user action. */ */ Loading
src/com/android/documentsui/DirectoryLoader.java +3 −0 Original line number Original line Diff line number Diff line Loading @@ -178,6 +178,9 @@ public class DirectoryLoader extends AsyncTaskLoader<DirectoryResult> { } } cursor.registerContentObserver(mObserver); cursor.registerContentObserver(mObserver); // Filter hidden files. cursor = new FilteringCursorWrapper(cursor, mState.showHiddenFiles); if (mSearchMode && !mFeatures.isFoldersInSearchResultsEnabled()) { if (mSearchMode && !mFeatures.isFoldersInSearchResultsEnabled()) { // There is no findDocumentPath API. Enable filtering on folders in search mode. // There is no findDocumentPath API. Enable filtering on folders in search mode. cursor = new FilteringCursorWrapper(cursor, null, SEARCH_REJECT_MIMES); cursor = new FilteringCursorWrapper(cursor, null, SEARCH_REJECT_MIMES); Loading