bug:3321005 make Settings --> Storage screen display little less ugly
I have implemented most of what the UX designer proposed. except these 1. Percentage Bar chart left padding should be 16dip 2. Percentage Bar chart and Total Space preferences should be combined into one singne ViewGroup or something. and "total Space" shoudl be aligned on the right border Change-Id: I9b238eaa561c9837b47b9955e7d718d92543ca34
This commit is contained in:
@@ -18,13 +18,12 @@
|
|||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
|
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="32dip"
|
||||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:id="@+id/percentage_bar_chart"
|
android:id="@+id/percentage_bar_chart"
|
||||||
android:paddingRight="?android:attr/scrollbarSize"
|
android:paddingRight="?android:attr/scrollbarSize"
|
||||||
android:paddingTop="6dip"
|
|
||||||
android:paddingBottom="6dip"
|
|
||||||
settings:minTickWidth="6dip"
|
settings:minTickWidth="6dip"
|
||||||
settings:emptyColor="@color/memory_avail">
|
settings:emptyColor="@color/memory_avail">
|
||||||
|
|
||||||
</com.android.settings.deviceinfo.PercentageBarChart>
|
</com.android.settings.deviceinfo.PercentageBarChart>
|
||||||
|
@@ -18,13 +18,13 @@
|
|||||||
<color name="black">#000</color>
|
<color name="black">#000</color>
|
||||||
<color name="red">#F00</color>
|
<color name="red">#F00</color>
|
||||||
|
|
||||||
<color name="memory_avail">#333</color>
|
|
||||||
<color name="memory_apps_usage">#FFF</color>
|
|
||||||
<color name="memory_used">#F00</color>
|
<color name="memory_used">#F00</color>
|
||||||
<color name="memory_downloads">#F00</color>
|
<color name="memory_avail">#336600</color>
|
||||||
<color name="memory_video">#0F0</color>
|
<color name="memory_apps_usage">#99CC00</color>
|
||||||
<color name="memory_audio">#00F</color>
|
<color name="memory_downloads">#003399</color>
|
||||||
<color name="memory_misc">#FF0</color>
|
<color name="memory_video">#993300</color>
|
||||||
|
<color name="memory_audio">#667788</color>
|
||||||
|
<color name="memory_misc">#FF6600</color>
|
||||||
|
|
||||||
<color name="crypt_keeper_clock_background">#ff9a9a9a</color>
|
<color name="crypt_keeper_clock_background">#ff9a9a9a</color>
|
||||||
<color name="crypt_keeper_clock_foreground">#ff666666</color>
|
<color name="crypt_keeper_clock_foreground">#ff666666</color>
|
||||||
|
@@ -18,5 +18,6 @@
|
|||||||
<dimen name="vpn_connect_margin_right">10sp</dimen>
|
<dimen name="vpn_connect_margin_right">10sp</dimen>
|
||||||
<dimen name="vpn_connect_normal_text_size">16sp</dimen>
|
<dimen name="vpn_connect_normal_text_size">16sp</dimen>
|
||||||
<dimen name="vpn_connect_input_box_label_width">90sp</dimen>
|
<dimen name="vpn_connect_input_box_label_width">90sp</dimen>
|
||||||
<dimen name="device_memory_usage_button_size">32dip</dimen>
|
<dimen name="device_memory_usage_button_width">16dip</dimen>
|
||||||
|
<dimen name="device_memory_usage_button_height">32dip</dimen>
|
||||||
</resources>
|
</resources>
|
||||||
|
@@ -1565,7 +1565,7 @@
|
|||||||
<!-- SD card & phone storage settings title. The amount of free space for some storage partition. For example, this is listed under both the "Internal phone storage" section and the "SD card" section. -->
|
<!-- SD card & phone storage settings title. The amount of free space for some storage partition. For example, this is listed under both the "Internal phone storage" section and the "SD card" section. -->
|
||||||
<string name="memory_available">Available</string>
|
<string name="memory_available">Available</string>
|
||||||
<!-- SD card & phone storage settings screen heading. The total amount of storage space for some storage partition. For example, this is listed under both the "Internal phone storage" section and the "SD card" section -->
|
<!-- SD card & phone storage settings screen heading. The total amount of storage space for some storage partition. For example, this is listed under both the "Internal phone storage" section and the "SD card" section -->
|
||||||
<string name="memory_size">Total</string>
|
<string name="memory_size">Total space</string>
|
||||||
<!-- SD card & phone storage settings summary. Displayed when the total memory usage is being calculated. Will be replaced with a number like "12.3 GB" when finished calucating. [CHAR LIMIT=30] -->
|
<!-- SD card & phone storage settings summary. Displayed when the total memory usage is being calculated. Will be replaced with a number like "12.3 GB" when finished calucating. [CHAR LIMIT=30] -->
|
||||||
<string name="memory_calculating_size">Calculating…</string>
|
<string name="memory_calculating_size">Calculating…</string>
|
||||||
<!-- SD card & phone storage settings title. Displayed as a title when showing the total usage of applications installed. Below it will be a number like "123.4 MB" indicating used storage. [CHAR LIMIT=50] -->
|
<!-- SD card & phone storage settings title. Displayed as a title when showing the total usage of applications installed. Below it will be a number like "123.4 MB" indicating used storage. [CHAR LIMIT=50] -->
|
||||||
|
@@ -38,14 +38,11 @@
|
|||||||
<PreferenceCategory android:title="@string/internal_memory">
|
<PreferenceCategory android:title="@string/internal_memory">
|
||||||
<com.android.settings.deviceinfo.UsageBarPreference
|
<com.android.settings.deviceinfo.UsageBarPreference
|
||||||
android:key="memory_internal_chart"/>
|
android:key="memory_internal_chart"/>
|
||||||
|
|
||||||
<Preference android:key="memory_internal_size"
|
<Preference android:key="memory_internal_size"
|
||||||
android:title="@string/memory_size"
|
android:title="@string/memory_size"
|
||||||
android:summary="@string/memory_calculating_size"/>
|
android:summary="@string/memory_calculating_size"/>
|
||||||
|
|
||||||
<Preference android:key="memory_internal_avail"
|
|
||||||
android:title="@string/memory_available"
|
|
||||||
android:summary="@string/memory_calculating_size"/>
|
|
||||||
|
|
||||||
<Preference android:key="memory_internal_apps"
|
<Preference android:key="memory_internal_apps"
|
||||||
android:title="@string/memory_apps_usage"
|
android:title="@string/memory_apps_usage"
|
||||||
android:summary="@string/memory_calculating_size"/>
|
android:summary="@string/memory_calculating_size"/>
|
||||||
@@ -65,6 +62,9 @@
|
|||||||
<Preference android:key="memory_internal_media_misc"
|
<Preference android:key="memory_internal_media_misc"
|
||||||
android:title="@string/memory_media_misc_usage"
|
android:title="@string/memory_media_misc_usage"
|
||||||
android:summary="@string/memory_calculating_size"/>
|
android:summary="@string/memory_calculating_size"/>
|
||||||
</PreferenceCategory>
|
|
||||||
|
|
||||||
|
<Preference android:key="memory_internal_avail"
|
||||||
|
android:title="@string/memory_available"
|
||||||
|
android:summary="@string/memory_calculating_size"/>
|
||||||
|
</PreferenceCategory>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
@@ -33,7 +33,7 @@ import android.content.DialogInterface.OnCancelListener;
|
|||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.drawable.ShapeDrawable;
|
import android.graphics.drawable.ShapeDrawable;
|
||||||
import android.graphics.drawable.shapes.RoundRectShape;
|
import android.graphics.drawable.shapes.RectShape;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
@@ -177,27 +177,16 @@ public class Memory extends SettingsPreferenceFragment implements OnCancelListen
|
|||||||
mInternalAppsColor = mRes.getColor(R.color.memory_apps_usage);
|
mInternalAppsColor = mRes.getColor(R.color.memory_apps_usage);
|
||||||
mInternalUsedColor = android.graphics.Color.GRAY;
|
mInternalUsedColor = android.graphics.Color.GRAY;
|
||||||
mInternalAvailColor = mRes.getColor(R.color.memory_avail);
|
mInternalAvailColor = mRes.getColor(R.color.memory_avail);
|
||||||
final int buttonSize = (int) mRes.getDimension(R.dimen.device_memory_usage_button_size);
|
final int buttonWidth = (int) mRes.getDimension(R.dimen.device_memory_usage_button_width);
|
||||||
float[] radius = new float[] {
|
final int buttonHeight = (int) mRes.getDimension(R.dimen.device_memory_usage_button_height);
|
||||||
5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f
|
|
||||||
};
|
|
||||||
RoundRectShape shape1 = new RoundRectShape(radius, null, null);
|
|
||||||
|
|
||||||
// total available space
|
// total available space
|
||||||
mInternalAvail = findPreference(MEMORY_INTERNAL_AVAIL);
|
mInternalAvail = findPreference(MEMORY_INTERNAL_AVAIL);
|
||||||
ShapeDrawable availShape = new ShapeDrawable(shape1);
|
mInternalAvail.setIcon(createRectShape(buttonHeight, buttonWidth, mInternalAvailColor));
|
||||||
availShape.setIntrinsicWidth(buttonSize);
|
|
||||||
availShape.setIntrinsicHeight(buttonSize);
|
|
||||||
availShape.getPaint().setColor(mInternalAvailColor);
|
|
||||||
mInternalAvail.setIcon(availShape);
|
|
||||||
|
|
||||||
// used by apps
|
// used by apps
|
||||||
mInternalAppsUsage = findPreference(MEMORY_INTERNAL_APPS);
|
mInternalAppsUsage = findPreference(MEMORY_INTERNAL_APPS);
|
||||||
ShapeDrawable appsShape = new ShapeDrawable(shape1);
|
mInternalAppsUsage.setIcon(createRectShape(buttonHeight, buttonWidth, mInternalAppsColor));
|
||||||
appsShape.setIntrinsicWidth(buttonSize);
|
|
||||||
appsShape.setIntrinsicHeight(buttonSize);
|
|
||||||
appsShape.getPaint().setColor(mInternalAppsColor);
|
|
||||||
mInternalAppsUsage.setIcon(appsShape);
|
|
||||||
|
|
||||||
// space used by individual major directories on /sdcard
|
// space used by individual major directories on /sdcard
|
||||||
for (int i = 0; i < Constants.NUM_MEDIA_DIRS_TRACKED; i++) {
|
for (int i = 0; i < Constants.NUM_MEDIA_DIRS_TRACKED; i++) {
|
||||||
@@ -206,9 +195,6 @@ public class Memory extends SettingsPreferenceFragment implements OnCancelListen
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
mMediaPreferences[i] = findPreference(Constants.mMediaDirs.get(i).mPreferenceName);
|
mMediaPreferences[i] = findPreference(Constants.mMediaDirs.get(i).mPreferenceName);
|
||||||
ShapeDrawable shape = new ShapeDrawable(shape1);
|
|
||||||
shape.setIntrinsicWidth(buttonSize);
|
|
||||||
shape.setIntrinsicHeight(buttonSize);
|
|
||||||
int color = 0;
|
int color = 0;
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case Constants.DOWNLOADS_INDEX:
|
case Constants.DOWNLOADS_INDEX:
|
||||||
@@ -224,8 +210,7 @@ public class Memory extends SettingsPreferenceFragment implements OnCancelListen
|
|||||||
color = mRes.getColor(R.color.memory_misc);
|
color = mRes.getColor(R.color.memory_misc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
shape.getPaint().setColor(color);
|
mMediaPreferences[i].setIcon(createRectShape(buttonHeight, buttonWidth, color));
|
||||||
mMediaPreferences[i].setIcon(shape);
|
|
||||||
}
|
}
|
||||||
mInternalUsageChart = (UsageBarPreference) findPreference(MEMORY_INTERNAL_CHART);
|
mInternalUsageChart = (UsageBarPreference) findPreference(MEMORY_INTERNAL_CHART);
|
||||||
|
|
||||||
@@ -233,6 +218,14 @@ public class Memory extends SettingsPreferenceFragment implements OnCancelListen
|
|||||||
mMeasurement.setReceiver(this);
|
mMeasurement.setReceiver(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ShapeDrawable createRectShape(int height, int width, int color) {
|
||||||
|
ShapeDrawable shape = new ShapeDrawable(new RectShape());
|
||||||
|
shape.setIntrinsicHeight(height);
|
||||||
|
shape.setIntrinsicWidth(width);
|
||||||
|
shape.getPaint().setColor(color);
|
||||||
|
return shape;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
Reference in New Issue
Block a user