Loading res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -51,4 +51,7 @@ <bool name="feature_inspector">false</bool> <bool name="feature_debug_mode">false</bool> <!-- Indicates if internal storage is shown as default or not. --> <bool name="config_defaultIncludeDeviceRoot">false</bool> </resources> src/com/android/documentsui/prefs/ScopedPreferences.java +9 −3 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ import android.content.SharedPreferences; import android.preference.PreferenceManager; import android.text.TextUtils; import com.android.documentsui.R; /** * Provides an interface (and runtime implementation) for preferences that are * scoped (presumably to an activity). This eliminates the need to pass Loading @@ -39,25 +41,29 @@ public interface ScopedPreferences { * for prefs that are set using this object. */ public static ScopedPreferences create(Context context, String scope) { return new RuntimeScopedPreferences( return new RuntimeScopedPreferences(context, PreferenceManager.getDefaultSharedPreferences(context), scope); } static final class RuntimeScopedPreferences implements ScopedPreferences { private boolean defaultIncludeDeviceRoot; private SharedPreferences mSharedPrefs; private String mScope; private RuntimeScopedPreferences(SharedPreferences sharedPrefs, String scope) { private RuntimeScopedPreferences(Context context, SharedPreferences sharedPrefs, String scope) { assert(!TextUtils.isEmpty(scope)); defaultIncludeDeviceRoot = context.getResources() .getBoolean(R.bool.config_defaultIncludeDeviceRoot); mSharedPrefs = sharedPrefs; mScope = scope; } @Override public boolean getShowDeviceRoot() { return mSharedPrefs.getBoolean(INCLUDE_DEVICE_ROOT, false); return mSharedPrefs.getBoolean(INCLUDE_DEVICE_ROOT, defaultIncludeDeviceRoot); } @Override Loading Loading
res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -51,4 +51,7 @@ <bool name="feature_inspector">false</bool> <bool name="feature_debug_mode">false</bool> <!-- Indicates if internal storage is shown as default or not. --> <bool name="config_defaultIncludeDeviceRoot">false</bool> </resources>
src/com/android/documentsui/prefs/ScopedPreferences.java +9 −3 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ import android.content.SharedPreferences; import android.preference.PreferenceManager; import android.text.TextUtils; import com.android.documentsui.R; /** * Provides an interface (and runtime implementation) for preferences that are * scoped (presumably to an activity). This eliminates the need to pass Loading @@ -39,25 +41,29 @@ public interface ScopedPreferences { * for prefs that are set using this object. */ public static ScopedPreferences create(Context context, String scope) { return new RuntimeScopedPreferences( return new RuntimeScopedPreferences(context, PreferenceManager.getDefaultSharedPreferences(context), scope); } static final class RuntimeScopedPreferences implements ScopedPreferences { private boolean defaultIncludeDeviceRoot; private SharedPreferences mSharedPrefs; private String mScope; private RuntimeScopedPreferences(SharedPreferences sharedPrefs, String scope) { private RuntimeScopedPreferences(Context context, SharedPreferences sharedPrefs, String scope) { assert(!TextUtils.isEmpty(scope)); defaultIncludeDeviceRoot = context.getResources() .getBoolean(R.bool.config_defaultIncludeDeviceRoot); mSharedPrefs = sharedPrefs; mScope = scope; } @Override public boolean getShowDeviceRoot() { return mSharedPrefs.getBoolean(INCLUDE_DEVICE_ROOT, false); return mSharedPrefs.getBoolean(INCLUDE_DEVICE_ROOT, defaultIncludeDeviceRoot); } @Override Loading