Merge "bug:3321005 make Settings --> Storage screen display little less ugly"

This commit is contained in:
Vasu Nori
2011-03-02 17:52:42 -08:00
committed by Android (Google) Code Review
6 changed files with 30 additions and 37 deletions

View File

@@ -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">
</com.android.settings.deviceinfo.PercentageBarChart>

View File

@@ -18,13 +18,13 @@
<color name="black">#000</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_downloads">#F00</color>
<color name="memory_video">#0F0</color>
<color name="memory_audio">#00F</color>
<color name="memory_misc">#FF0</color>
<color name="memory_avail">#336600</color>
<color name="memory_apps_usage">#99CC00</color>
<color name="memory_downloads">#003399</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_foreground">#ff666666</color>

View File

@@ -18,5 +18,6 @@
<dimen name="vpn_connect_margin_right">10sp</dimen>
<dimen name="vpn_connect_normal_text_size">16sp</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>

View File

@@ -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. -->
<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 -->
<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] -->
<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] -->

View File

@@ -38,14 +38,11 @@
<PreferenceCategory android:title="@string/internal_memory">
<com.android.settings.deviceinfo.UsageBarPreference
android:key="memory_internal_chart"/>
<Preference android:key="memory_internal_size"
android:title="@string/memory_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"
android:title="@string/memory_apps_usage"
android:summary="@string/memory_calculating_size"/>
@@ -65,6 +62,9 @@
<Preference android:key="memory_internal_media_misc"
android:title="@string/memory_media_misc_usage"
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>

View File

@@ -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();