diff --git a/res/layout/preference_memoryusage.xml b/res/layout/preference_memoryusage.xml index 303a5b71a6c..60b2ba86edb 100644 --- a/res/layout/preference_memoryusage.xml +++ b/res/layout/preference_memoryusage.xml @@ -18,13 +18,12 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:settings="http://schemas.android.com/apk/res/com.android.settings" android:layout_width="match_parent" - android:layout_height="wrap_content" + android:layout_height="32dip" android:minHeight="?android:attr/listPreferredItemHeight" android:gravity="center_vertical" android:id="@+id/percentage_bar_chart" android:paddingRight="?android:attr/scrollbarSize" - android:paddingTop="6dip" - android:paddingBottom="6dip" settings:minTickWidth="6dip" settings:emptyColor="@color/memory_avail"> + diff --git a/res/values/colors.xml b/res/values/colors.xml index 715a6799736..af5595a99d7 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -18,13 +18,13 @@ #000 #F00 - #333 - #FFF #F00 - #F00 - #0F0 - #00F - #FF0 + #336600 + #99CC00 + #003399 + #993300 + #667788 + #FF6600 #ff9a9a9a #ff666666 diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 5d2aa331f51..418121b6b8a 100755 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -18,5 +18,6 @@ 10sp 16sp 90sp - 32dip + 16dip + 32dip diff --git a/res/values/strings.xml b/res/values/strings.xml index ff04cf73f28..9f2ff783e06 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1565,7 +1565,7 @@ Available - Total + Total space Calculating… diff --git a/res/xml/device_info_memory.xml b/res/xml/device_info_memory.xml index b536d002ba7..aa36698840f 100644 --- a/res/xml/device_info_memory.xml +++ b/res/xml/device_info_memory.xml @@ -38,14 +38,11 @@ + - - @@ -65,6 +62,9 @@ - + + diff --git a/src/com/android/settings/deviceinfo/Memory.java b/src/com/android/settings/deviceinfo/Memory.java index 7d2a55e2f05..1e10c58ac4d 100644 --- a/src/com/android/settings/deviceinfo/Memory.java +++ b/src/com/android/settings/deviceinfo/Memory.java @@ -33,7 +33,7 @@ import android.content.DialogInterface.OnCancelListener; import android.content.pm.ApplicationInfo; import android.content.res.Resources; import android.graphics.drawable.ShapeDrawable; -import android.graphics.drawable.shapes.RoundRectShape; +import android.graphics.drawable.shapes.RectShape; import android.os.Bundle; import android.os.Environment; import android.os.Handler; @@ -177,27 +177,16 @@ public class Memory extends SettingsPreferenceFragment implements OnCancelListen mInternalAppsColor = mRes.getColor(R.color.memory_apps_usage); mInternalUsedColor = android.graphics.Color.GRAY; mInternalAvailColor = mRes.getColor(R.color.memory_avail); - final int buttonSize = (int) mRes.getDimension(R.dimen.device_memory_usage_button_size); - float[] radius = new float[] { - 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f - }; - RoundRectShape shape1 = new RoundRectShape(radius, null, null); + final int buttonWidth = (int) mRes.getDimension(R.dimen.device_memory_usage_button_width); + final int buttonHeight = (int) mRes.getDimension(R.dimen.device_memory_usage_button_height); // total available space mInternalAvail = findPreference(MEMORY_INTERNAL_AVAIL); - ShapeDrawable availShape = new ShapeDrawable(shape1); - availShape.setIntrinsicWidth(buttonSize); - availShape.setIntrinsicHeight(buttonSize); - availShape.getPaint().setColor(mInternalAvailColor); - mInternalAvail.setIcon(availShape); + mInternalAvail.setIcon(createRectShape(buttonHeight, buttonWidth, mInternalAvailColor)); // used by apps mInternalAppsUsage = findPreference(MEMORY_INTERNAL_APPS); - ShapeDrawable appsShape = new ShapeDrawable(shape1); - appsShape.setIntrinsicWidth(buttonSize); - appsShape.setIntrinsicHeight(buttonSize); - appsShape.getPaint().setColor(mInternalAppsColor); - mInternalAppsUsage.setIcon(appsShape); + mInternalAppsUsage.setIcon(createRectShape(buttonHeight, buttonWidth, mInternalAppsColor)); // space used by individual major directories on /sdcard for (int i = 0; i < Constants.NUM_MEDIA_DIRS_TRACKED; i++) { @@ -206,9 +195,6 @@ public class Memory extends SettingsPreferenceFragment implements OnCancelListen continue; } mMediaPreferences[i] = findPreference(Constants.mMediaDirs.get(i).mPreferenceName); - ShapeDrawable shape = new ShapeDrawable(shape1); - shape.setIntrinsicWidth(buttonSize); - shape.setIntrinsicHeight(buttonSize); int color = 0; switch (i) { case Constants.DOWNLOADS_INDEX: @@ -224,8 +210,7 @@ public class Memory extends SettingsPreferenceFragment implements OnCancelListen color = mRes.getColor(R.color.memory_misc); break; } - shape.getPaint().setColor(color); - mMediaPreferences[i].setIcon(shape); + mMediaPreferences[i].setIcon(createRectShape(buttonHeight, buttonWidth, color)); } mInternalUsageChart = (UsageBarPreference) findPreference(MEMORY_INTERNAL_CHART); @@ -233,6 +218,14 @@ public class Memory extends SettingsPreferenceFragment implements OnCancelListen 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 public void onResume() { super.onResume();