return mState;
}
+ /*
+ * Get the default directory to be presented after starting the activity.
+ * Method can be overridden if the change of the behavior of the the child activity is needed.
+ */
+ public Uri getDefaultRoot() {
+ return Shared.isHomeRootHidden(this)
+ ? DocumentsContract.buildRootUri("com.android.providers.downloads.documents",
+ "downloads")
+ : DocumentsContract.buildHomeUri();
+ }
+
void setDisplayFileSize(boolean display) {
LocalPreferences.setDisplayFileSize(this, display);
mState.showSize = display;
// we restore the stack as last used from that app.
if (mState.action == ACTION_PICK_COPY_DESTINATION) {
if (DEBUG) Log.d(TAG, "Launching directly into Home directory.");
- Uri homeUri = DocumentsContract.buildHomeUri();
- new LoadRootTask(this, homeUri).executeOnExecutor(
- ProviderExecutor.forAuthority(homeUri.getAuthority()));
+ loadRoot(getDefaultRoot());
} else {
if (DEBUG) Log.d(TAG, "Attempting to load last used stack for calling package.");
new LoadLastUsedStackTask(this).execute();
loadRoot(uri);
} else {
if (DEBUG) Log.d(TAG, "All other means skipped. Launching into default directory.");
- Uri defaultUri = DocumentsContract.buildRootUri(
- "com.android.providers.downloads.documents", "downloads");
- loadRoot(defaultUri);
+ loadRoot(getDefaultRoot());
}
final @DialogType int dialogType = intent.getIntExtra(
for (final RootInfo root : roots) {
final RootItem item = new RootItem(root);
- if (root.isHome() && isHomeRootHidden(context)) {
+ if (root.isHome() && Shared.isHomeRootHidden(context)) {
continue;
- } else if (root.isAdvanced() && areAdvancedRootsHidden(context)) {
+ } else if (root.isAdvanced() && Shared.areAdvancedRootsHidden(context)) {
continue;
} else if (root.isLibrary()) {
if (DEBUG) Log.d(TAG, "Adding " + root + " as library.");
}
}
- /*
- * Indicates if the home directory should be hidden in the roots list.
- */
- private boolean isHomeRootHidden(Context context) {
- return context.getResources().getBoolean(R.bool.home_root_hidden);
- }
-
- /*
- * Indicates if the advanced roots should be hidden.
- */
- private boolean areAdvancedRootsHidden(Context context) {
- return context.getResources().getBoolean(R.bool.advanced_roots_hidden);
- }
-
@Override
public View getView(int position, View convertView, ViewGroup parent) {
final Item item = getItem(position);
}
}
+ /*
+ * Indicates if the home directory should be hidden in the roots list.
+ */
+ public static boolean isHomeRootHidden(Context context) {
+ return context.getResources().getBoolean(R.bool.home_root_hidden);
+ }
+
+ /*
+ * Indicates if the advanced roots should be hidden.
+ */
+ public static boolean areAdvancedRootsHidden(Context context) {
+ return context.getResources().getBoolean(R.bool.advanced_roots_hidden);
+ }
+
}