Merge "Jostle the elements around in app storage settings." into oc-dev
am: bea96cfb65
Change-Id: Ib4a8bf827266d5fbb015fb5d4c71cd7a7f19b617
This commit is contained in:
@@ -15,8 +15,14 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||||
android:title="@string/application_info_label">
|
android:title="@string/application_info_label">
|
||||||
|
|
||||||
|
<com.android.settings.applications.LayoutPreference
|
||||||
|
android:key="header_view"
|
||||||
|
android:layout="@layout/app_action_buttons"
|
||||||
|
android:selectable="false" />
|
||||||
|
|
||||||
<com.android.settings.applications.SpacePreference
|
<com.android.settings.applications.SpacePreference
|
||||||
android:key="storage_space"
|
android:key="storage_space"
|
||||||
android:layout_height="8dp" />
|
android:layout_height="8dp" />
|
||||||
@@ -36,13 +42,9 @@
|
|||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="storage_category"
|
android:key="storage_category"
|
||||||
android:layout="@layout/tall_preference_category"
|
android:layout="@layout/tall_preference_category"
|
||||||
android:title="@string/storage_label">
|
android:title="@string/app_info_storage_title"
|
||||||
|
settings:allowDividerAbove="false"
|
||||||
<Preference
|
settings:allowDividerBelow="false">
|
||||||
android:key="total_size"
|
|
||||||
android:title="@string/total_size_label"
|
|
||||||
android:selectable="false"
|
|
||||||
android:layout="@layout/horizontal_preference" />
|
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="app_size"
|
android:key="app_size"
|
||||||
@@ -56,32 +58,28 @@
|
|||||||
android:selectable="false"
|
android:selectable="false"
|
||||||
android:layout="@layout/horizontal_preference" />
|
android:layout="@layout/horizontal_preference" />
|
||||||
|
|
||||||
<com.android.settings.applications.LayoutPreference
|
|
||||||
android:key="clear_data_button"
|
|
||||||
android:selectable="false"
|
|
||||||
android:layout="@layout/single_button_panel" />
|
|
||||||
</PreferenceCategory>
|
|
||||||
|
|
||||||
<com.android.settings.applications.SpacePreference
|
|
||||||
android:layout_height="8dp" />
|
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="cache_size"
|
android:key="cache_size"
|
||||||
android:title="@string/cache_size_label"
|
android:title="@string/cache_size_label"
|
||||||
android:selectable="false"
|
android:selectable="false"
|
||||||
android:layout="@layout/horizontal_preference" />
|
android:layout="@layout/horizontal_preference" />
|
||||||
|
|
||||||
<com.android.settings.applications.LayoutPreference
|
<Preference
|
||||||
android:key="clear_cache_button"
|
android:key="total_size"
|
||||||
|
android:title="@string/total_size_label"
|
||||||
android:selectable="false"
|
android:selectable="false"
|
||||||
android:layout="@layout/single_button_panel" />
|
android:layout="@layout/horizontal_preference" />
|
||||||
|
|
||||||
<com.android.settings.applications.SpacePreference
|
<com.android.settings.applications.SpacePreference
|
||||||
android:layout_height="8dp" />
|
android:layout_height="8dp" />
|
||||||
|
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="uri_category"
|
android:key="uri_category"
|
||||||
android:layout="@layout/headerless_preference_category" >
|
android:layout="@layout/headerless_preference_category"
|
||||||
|
settings:allowDividerAbove="false"
|
||||||
|
settings:allowDividerBelow="false">
|
||||||
<com.android.settings.applications.LayoutPreference
|
<com.android.settings.applications.LayoutPreference
|
||||||
android:key="clear_uri_button"
|
android:key="clear_uri_button"
|
||||||
android:layout="@layout/single_button_panel"
|
android:layout="@layout/single_button_panel"
|
||||||
|
@@ -90,13 +90,10 @@ public class AppStorageSettings extends AppInfoWithHeader
|
|||||||
|
|
||||||
private static final String KEY_TOTAL_SIZE = "total_size";
|
private static final String KEY_TOTAL_SIZE = "total_size";
|
||||||
private static final String KEY_APP_SIZE = "app_size";
|
private static final String KEY_APP_SIZE = "app_size";
|
||||||
private static final String KEY_EXTERNAL_CODE_SIZE = "external_code_size";
|
|
||||||
private static final String KEY_DATA_SIZE = "data_size";
|
private static final String KEY_DATA_SIZE = "data_size";
|
||||||
private static final String KEY_EXTERNAL_DATA_SIZE = "external_data_size";
|
|
||||||
private static final String KEY_CACHE_SIZE = "cache_size";
|
private static final String KEY_CACHE_SIZE = "cache_size";
|
||||||
|
|
||||||
private static final String KEY_CLEAR_DATA = "clear_data_button";
|
private static final String KEY_HEADER_BUTTONS = "header_view";
|
||||||
private static final String KEY_CLEAR_CACHE = "clear_cache_button";
|
|
||||||
|
|
||||||
private static final String KEY_URI_CATEGORY = "uri_category";
|
private static final String KEY_URI_CATEGORY = "uri_category";
|
||||||
private static final String KEY_CLEAR_URI = "clear_uri_button";
|
private static final String KEY_CLEAR_URI = "clear_uri_button";
|
||||||
@@ -119,16 +116,11 @@ public class AppStorageSettings extends AppInfoWithHeader
|
|||||||
private boolean mCanClearData = true;
|
private boolean mCanClearData = true;
|
||||||
private boolean mCacheCleared;
|
private boolean mCacheCleared;
|
||||||
|
|
||||||
private AppStorageStats mLastResult;
|
|
||||||
private AppStorageSizesController mSizeController;
|
private AppStorageSizesController mSizeController;
|
||||||
|
|
||||||
private ClearCacheObserver mClearCacheObserver;
|
private ClearCacheObserver mClearCacheObserver;
|
||||||
private ClearUserDataObserver mClearDataObserver;
|
private ClearUserDataObserver mClearDataObserver;
|
||||||
|
|
||||||
// Resource strings
|
|
||||||
private CharSequence mInvalidSizeStr;
|
|
||||||
private CharSequence mComputingStr;
|
|
||||||
|
|
||||||
private VolumeInfo[] mCandidates;
|
private VolumeInfo[] mCandidates;
|
||||||
private AlertDialog.Builder mDialogBuilder;
|
private AlertDialog.Builder mDialogBuilder;
|
||||||
private ApplicationInfo mInfo;
|
private ApplicationInfo mInfo;
|
||||||
@@ -158,9 +150,6 @@ public class AppStorageSettings extends AppInfoWithHeader
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setupViews() {
|
private void setupViews() {
|
||||||
mComputingStr = getActivity().getText(R.string.computing_size);
|
|
||||||
mInvalidSizeStr = getActivity().getText(R.string.invalid_size_value);
|
|
||||||
|
|
||||||
// Set default values on sizes
|
// Set default values on sizes
|
||||||
mSizeController = new AppStorageSizesController.Builder()
|
mSizeController = new AppStorageSizesController.Builder()
|
||||||
.setTotalSizePreference(findPreference(KEY_TOTAL_SIZE))
|
.setTotalSizePreference(findPreference(KEY_TOTAL_SIZE))
|
||||||
@@ -171,8 +160,8 @@ public class AppStorageSettings extends AppInfoWithHeader
|
|||||||
.setErrorString(R.string.invalid_size_value)
|
.setErrorString(R.string.invalid_size_value)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
mClearDataButton = (Button) ((LayoutPreference) findPreference(KEY_CLEAR_DATA))
|
mClearDataButton = (Button) ((LayoutPreference) findPreference(KEY_HEADER_BUTTONS))
|
||||||
.findViewById(R.id.button);
|
.findViewById(R.id.left_button);
|
||||||
|
|
||||||
mStorageUsed = findPreference(KEY_STORAGE_USED);
|
mStorageUsed = findPreference(KEY_STORAGE_USED);
|
||||||
mChangeStorageButton = (Button) ((LayoutPreference) findPreference(KEY_CHANGE_STORAGE))
|
mChangeStorageButton = (Button) ((LayoutPreference) findPreference(KEY_CHANGE_STORAGE))
|
||||||
@@ -182,8 +171,8 @@ public class AppStorageSettings extends AppInfoWithHeader
|
|||||||
|
|
||||||
// Cache section
|
// Cache section
|
||||||
mCacheSize = findPreference(KEY_CACHE_SIZE);
|
mCacheSize = findPreference(KEY_CACHE_SIZE);
|
||||||
mClearCacheButton = (Button) ((LayoutPreference) findPreference(KEY_CLEAR_CACHE))
|
mClearCacheButton = (Button) ((LayoutPreference) findPreference(KEY_HEADER_BUTTONS))
|
||||||
.findViewById(R.id.button);
|
.findViewById(R.id.right_button);
|
||||||
mClearCacheButton.setText(R.string.clear_cache_btn_text);
|
mClearCacheButton.setText(R.string.clear_cache_btn_text);
|
||||||
|
|
||||||
// URI permissions section
|
// URI permissions section
|
||||||
@@ -267,7 +256,7 @@ public class AppStorageSettings extends AppInfoWithHeader
|
|||||||
if (mAppEntry == null) {
|
if (mAppEntry == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
updateUiWithSize(mLastResult);
|
updateUiWithSize(mSizeController.getLastResult());
|
||||||
refreshGrantedUriPermissions();
|
refreshGrantedUriPermissions();
|
||||||
|
|
||||||
final VolumeInfo currentVol = getActivity().getPackageManager()
|
final VolumeInfo currentVol = getActivity().getPackageManager()
|
||||||
|
@@ -110,6 +110,13 @@ public class AppStorageSizesController {
|
|||||||
mCachedCleared = isCleared;
|
mCachedCleared = isCleared;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the last result calculated, if it exists. If it does not, returns null.
|
||||||
|
*/
|
||||||
|
public StorageStatsSource.AppStorageStats getLastResult() {
|
||||||
|
return mLastResult;
|
||||||
|
}
|
||||||
|
|
||||||
private String getSizeStr(Context context, long size) {
|
private String getSizeStr(Context context, long size) {
|
||||||
return Formatter.formatFileSize(context, size);
|
return Formatter.formatFileSize(context, size);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user