Fix icon size for Data Usage / Battery Stats / Process Stats

- remove padding from app_percentage_item and apply it correctly
on its containers
- wrap app_percentage_item into preference_app_percentage for having
correct padding o nProcessStatsPreference and PowerGaugePreference

Change-Id: I290c92959f51a33a1edb49435cd0bd1e6cd9afa3
This commit is contained in:
Fabrice Di Meglio
2014-06-26 13:48:55 -07:00
parent c0ac943eb6
commit 200cca4c1d
7 changed files with 36 additions and 14 deletions

View File

@@ -18,20 +18,18 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight" android:minHeight="?android:attr/listPreferredItemHeight"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:paddingTop="8dip" android:paddingTop="8dip"
android:paddingBottom="8dip" android:paddingBottom="8dip"
android:columnCount="3"> android:columnCount="3">
<ImageView <ImageView
android:id="@android:id/icon" android:id="@android:id/icon"
android:layout_width="@dimen/app_icon_size" android:layout_width="@android:dimen/app_icon_size"
android:layout_height="@dimen/app_icon_size" android:layout_height="@android:dimen/app_icon_size"
android:layout_gravity="center" android:layout_gravity="center"
android:scaleType="fitXY"
android:layout_rowSpan="3" android:layout_rowSpan="3"
android:layout_marginEnd="8dip" android:layout_marginEnd="8dip"
android:scaleType="centerInside"
android:contentDescription="@null" /> android:contentDescription="@null" />
<TextView <TextView

View File

@@ -16,7 +16,9 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
<include layout="@layout/app_percentage_item" /> <include layout="@layout/app_percentage_item" />

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
<include layout="@layout/app_percentage_item" />
</LinearLayout>

View File

@@ -27,15 +27,15 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:paddingTop="5dip" android:paddingTop="5dip"
android:paddingBottom="5dip" android:paddingBottom="5dip"
android:orientation="vertical"> android:orientation="vertical"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
<include layout="@layout/app_percentage_item" /> <include layout="@layout/app_percentage_item" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:orientation="vertical"> android:orientation="vertical">
<!-- Force stop and report buttons --> <!-- Force stop and report buttons -->

View File

@@ -90,9 +90,6 @@
<!-- Default text size for caption preview samples. Uses dp rather than sp because captions are not scaled. --> <!-- Default text size for caption preview samples. Uses dp rather than sp because captions are not scaled. -->
<dimen name="caption_preview_text_size">48dp</dimen> <dimen name="caption_preview_text_size">48dp</dimen>
<!-- Dashboard image tile size -->
<dimen name="app_icon_size">24dp</dimen>
<!-- ActionBar height --> <!-- ActionBar height -->
<dimen name="actionbar_size">56dip</dimen> <dimen name="actionbar_size">56dip</dimen>

View File

@@ -47,7 +47,7 @@ public class ProcessStatsPreference extends Preference {
public ProcessStatsPreference(Context context, AttributeSet attrs, int defStyleAttr, public ProcessStatsPreference(Context context, AttributeSet attrs, int defStyleAttr,
int defStyleRes) { int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes); super(context, attrs, defStyleAttr, defStyleRes);
setLayoutResource(R.layout.app_percentage_item); setLayoutResource(R.layout.preference_app_percentage);
} }
public void init(Drawable icon, ProcStatsEntry entry) { public void init(Drawable icon, ProcStatsEntry entry) {

View File

@@ -37,7 +37,7 @@ public class PowerGaugePreference extends Preference {
public PowerGaugePreference(Context context, Drawable icon, BatteryEntry info) { public PowerGaugePreference(Context context, Drawable icon, BatteryEntry info) {
super(context); super(context);
setLayoutResource(R.layout.app_percentage_item); setLayoutResource(R.layout.preference_app_percentage);
setIcon(icon != null ? icon : new ColorDrawable(0)); setIcon(icon != null ? icon : new ColorDrawable(0));
mInfo = info; mInfo = info;
} }