summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Monk <jmonk@google.com>2015-06-16 13:17:01 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-06-16 13:17:02 +0000
commit744f2adb56ac0077a103c8e6e3b20f421eddc780 (patch)
tree7b67b635bf631748316ea76025d8f760c97843e7
parent9a5550e9e6efe211b03d067eae2689f6ef5eb2d1 (diff)
parent2cdafc6be386bb767404e42fc728a1a810aa896a (diff)
downloadpackages_apps_Settings-744f2adb56ac0077a103c8e6e3b20f421eddc780.zip
packages_apps_Settings-744f2adb56ac0077a103c8e6e3b20f421eddc780.tar.gz
packages_apps_Settings-744f2adb56ac0077a103c8e6e3b20f421eddc780.tar.bz2
Merge "Layout refinement for app lists" into mnc-dev
-rw-r--r--res/layout/app_item.xml (renamed from res/layout/app_percentage_item.xml)36
-rwxr-xr-xres/layout/app_item_linear_color.xml79
-rw-r--r--res/layout/app_ops_details.xml2
-rw-r--r--res/layout/data_usage_item.xml2
-rw-r--r--res/layout/installed_app_details.xml2
-rwxr-xr-xres/layout/manage_applications_item.xml85
-rw-r--r--res/layout/preference_app.xml (renamed from res/layout/preference_app_percentage.xml)2
-rw-r--r--res/layout/preference_material_settings.xml80
-rw-r--r--res/layout/widget_progress_bar.xml23
-rw-r--r--res/layout/widget_text_views.xml49
-rw-r--r--res/values/styles.xml6
-rw-r--r--res/values/themes.xml1
-rw-r--r--src/com/android/settings/AppPicker.java1
-rw-r--r--src/com/android/settings/AppProgressPreference.java45
-rw-r--r--src/com/android/settings/DataUsageSummary.java15
-rw-r--r--src/com/android/settings/SettingsActivity.java2
-rw-r--r--src/com/android/settings/applications/AppOpsDetails.java23
-rw-r--r--src/com/android/settings/applications/AppViewHolder.java15
-rwxr-xr-xsrc/com/android/settings/applications/InstalledAppDetails.java47
-rw-r--r--src/com/android/settings/applications/LayoutPreference.java5
-rw-r--r--src/com/android/settings/applications/ManageApplications.java1
-rw-r--r--src/com/android/settings/applications/ProcessStatsMemDetail.java5
-rw-r--r--src/com/android/settings/applications/ProcessStatsPreference.java41
-rw-r--r--src/com/android/settings/fuelgauge/PowerGaugePreference.java21
24 files changed, 286 insertions, 302 deletions
diff --git a/res/layout/app_percentage_item.xml b/res/layout/app_item.xml
index 64146d9..26f2b1e 100644
--- a/res/layout/app_percentage_item.xml
+++ b/res/layout/app_item.xml
@@ -17,19 +17,19 @@
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:minHeight="?android:attr/listPreferredItemHeight"
- android:paddingTop="14dp"
- android:paddingBottom="14dp"
+ android:minHeight="72dp"
+ android:paddingTop="16dp"
+ android:paddingBottom="16dp"
android:columnCount="3">
<ImageView
android:id="@android:id/icon"
- android:layout_width="40dp"
- android:layout_height="40dp"
+ android:layout_width="@dimen/app_icon_size"
+ android:layout_height="@dimen/app_icon_size"
android:layout_gravity="center"
android:scaleType="fitXY"
android:layout_rowSpan="3"
- android:layout_marginEnd="8dip"
+ android:layout_marginEnd="16dip"
android:contentDescription="@null" />
<TextView
@@ -44,30 +44,18 @@
android:textAlignment="viewStart" />
<TextView
- android:id="@android:id/text1"
+ android:id="@android:id/summary"
android:layout_marginStart="6dip"
android:layout_marginTop="2dip"
+ android:singleLine="true"
+ android:ellipsize="marquee"
android:textAppearance="@android:style/TextAppearance.Material.Subhead"
android:textColor="?android:attr/textColorSecondary" />
- <ProgressBar
- android:id="@android:id/progress"
+ <FrameLayout
+ android:id="@android:id/widget_frame"
android:layout_height="wrap_content"
android:layout_columnSpan="2"
- android:layout_gravity="fill_horizontal|top"
- android:layout_marginTop="4dip"
- android:max="100"
- android:progressBackgroundTint="@android:color/transparent"
- style="?android:attr/progressBarStyleHorizontal" />
-
- <TextView
- android:id="@android:id/summary"
- android:layout_width="0dip"
- android:layout_gravity="fill_horizontal|top"
- android:layout_columnSpan="2"
- android:layout_marginTop="6dip"
- android:visibility="gone"
- android:maxLines="2"
- android:textAppearance="?android:attr/textAppearanceSmall" />
+ android:layout_gravity="fill_horizontal|top" />
</GridLayout>
diff --git a/res/layout/app_item_linear_color.xml b/res/layout/app_item_linear_color.xml
deleted file mode 100755
index 7a4aad5..0000000
--- a/res/layout/app_item_linear_color.xml
+++ /dev/null
@@ -1,79 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2015 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.
--->
-
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:minHeight="?android:attr/listPreferredItemHeight"
- android:paddingStart="?android:attr/listPreferredItemPaddingStart"
- android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
- android:paddingTop="8dip"
- android:paddingBottom="8dip">
-
- <ImageView
- android:id="@android:id/icon"
- android:layout_width="@android:dimen/app_icon_size"
- android:layout_height="@android:dimen/app_icon_size"
- android:layout_marginEnd="8dip"
- android:scaleType="centerInside"
- android:contentDescription="@null"
- android:duplicateParentState="true" />
-
- <LinearLayout
- android:id="@+id/text_area"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_alignParentTop="true"
- android:layout_toEndOf="@android:id/icon"
- android:orientation="horizontal"
- android:duplicateParentState="true">
-
- <TextView
- android:id="@android:id/title"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:layout_marginTop="2dip"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:textAppearance="@android:style/TextAppearance.Material.Subhead"
- android:textAlignment="viewStart"
- android:duplicateParentState="true" />
-
- <TextView
- android:id="@android:id/summary"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
- android:textColor="?android:attr/textColorSecondary"
- android:gravity="end|bottom"
- android:duplicateParentState="true" />
-
- </LinearLayout>
-
- <com.android.settings.applications.LinearColorBar
- android:id="@+id/linear_color_bar"
- android:layout_width="match_parent"
- android:layout_height="10dp"
- android:layout_marginTop="7dp"
- android:layout_marginBottom="5dp"
- android:layout_toEndOf="@android:id/icon"
- android:layout_below="@id/text_area"
- android:duplicateParentState="true" />
-
-</RelativeLayout>
diff --git a/res/layout/app_ops_details.xml b/res/layout/app_ops_details.xml
index e3209ca..fc3c1de 100644
--- a/res/layout/app_ops_details.xml
+++ b/res/layout/app_ops_details.xml
@@ -41,7 +41,7 @@
<!-- Application snippet label, version and icon -->
<include
- layout="@layout/manage_applications_item"
+ layout="@layout/app_item"
android:id="@+id/app_snippet" />
</LinearLayout>
diff --git a/res/layout/data_usage_item.xml b/res/layout/data_usage_item.xml
index 6f496d5..5e931f9 100644
--- a/res/layout/data_usage_item.xml
+++ b/res/layout/data_usage_item.xml
@@ -20,6 +20,6 @@
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
- <include layout="@layout/app_percentage_item" />
+ <include layout="@layout/app_item" />
</FrameLayout>
diff --git a/res/layout/installed_app_details.xml b/res/layout/installed_app_details.xml
index b703ec0..fd98ec3 100644
--- a/res/layout/installed_app_details.xml
+++ b/res/layout/installed_app_details.xml
@@ -37,7 +37,7 @@
<!-- Application snippet label, version and icon -->
<include
- layout="@layout/manage_applications_item"
+ layout="@layout/app_item"
android:id="@+id/app_snippet" />
<Space
diff --git a/res/layout/manage_applications_item.xml b/res/layout/manage_applications_item.xml
deleted file mode 100755
index 6d24114..0000000
--- a/res/layout/manage_applications_item.xml
+++ /dev/null
@@ -1,85 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 2008, 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.
-*/
--->
-
-<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:minHeight="72dp"
- android:paddingStart="?android:attr/listPreferredItemPaddingStart"
- android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
- android:paddingTop="16dip"
- android:paddingBottom="16dip"
- android:columnCount="4">
-
- <ImageView
- android:id="@+id/app_icon"
- android:layout_width="@dimen/app_icon_size"
- android:layout_height="@dimen/app_icon_size"
- android:layout_rowSpan="2"
- android:layout_marginEnd="16dip"
- android:scaleType="centerInside"
- android:contentDescription="@null"
- android:duplicateParentState="true" />
-
- <TextView
- android:id="@+id/app_name"
- android:layout_width="0dip"
- android:layout_columnSpan="2"
- android:layout_gravity="fill_horizontal"
- android:layout_marginTop="2dip"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:textAppearance="@android:style/TextAppearance.Material.Subhead"
- android:textAlignment="viewStart"
- android:duplicateParentState="true" />
-
- <CheckBox android:id="@+id/app_on_sdcard"
- android:layout_marginStart="8dip"
- android:layout_gravity="center_vertical"
- android:layout_rowSpan="2"
- android:visibility="gone"
- android:clickable="false"
- android:focusable="false"
- android:duplicateParentState="true" />
-
- <TextView
- android:id="@+id/app_summary"
- android:layout_column="1"
- android:layout_row="1"
- android:layout_gravity="fill_horizontal|top"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
- android:textColor="?android:attr/textColorSecondary"
- android:textAlignment="viewStart"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:duplicateParentState="true" />
-
- <TextView
- android:id="@+id/app_disabled"
- android:layout_width="0dip"
- android:layout_marginStart="8dip"
- android:layout_gravity="fill_horizontal|top"
- android:textAppearance="@android:style/TextAppearance.Material.Body1"
- android:textColor="?android:attr/textColorSecondary"
- android:textAlignment="viewEnd"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:duplicateParentState="true" />
-
-</GridLayout>
diff --git a/res/layout/preference_app_percentage.xml b/res/layout/preference_app.xml
index 7dc9d46..da348fd 100644
--- a/res/layout/preference_app_percentage.xml
+++ b/res/layout/preference_app.xml
@@ -20,6 +20,6 @@
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
- <include layout="@layout/app_percentage_item" />
+ <include layout="@layout/app_item" />
</LinearLayout>
diff --git a/res/layout/preference_material_settings.xml b/res/layout/preference_material_settings.xml
new file mode 100644
index 0000000..f2dd2e1
--- /dev/null
+++ b/res/layout/preference_material_settings.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 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.
+-->
+
+<!-- Based off frameworks/base/core/res/res/layout/preference_material.xml
+ except that this has the negative margin on the image removed. -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:minHeight="?android:attr/listPreferredItemHeightSmall"
+ android:gravity="center_vertical"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:background="?android:attr/activatedBackgroundIndicator"
+ android:clipToPadding="false">
+
+ <LinearLayout
+ android:id="@*android:id/icon_frame"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:minWidth="60dp"
+ android:gravity="start|center_vertical"
+ android:orientation="horizontal"
+ android:paddingEnd="12dp"
+ android:paddingTop="4dp"
+ android:paddingBottom="4dp">
+ <com.android.internal.widget.PreferenceImageView
+ android:id="@android:id/icon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:maxWidth="48dp"
+ android:maxHeight="48dp" />
+ </LinearLayout>
+
+ <RelativeLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:paddingTop="16dp"
+ android:paddingBottom="16dp">
+
+ <TextView android:id="@android:id/title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:textAppearance="?android:attr/textAppearanceListItem"
+ android:ellipsize="marquee" />
+
+ <TextView android:id="@android:id/summary"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_below="@android:id/title"
+ android:layout_alignStart="@android:id/title"
+ android:textAppearance="?android:attr/textAppearanceListItemSecondary"
+ android:textColor="?android:attr/textColorSecondary"
+ android:maxLines="10" />
+
+ </RelativeLayout>
+
+ <!-- Preference should place its actual preference widget here. -->
+ <LinearLayout android:id="@android:id/widget_frame"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:gravity="end|center_vertical"
+ android:paddingStart="16dp"
+ android:orientation="vertical" />
+
+</LinearLayout>
diff --git a/res/layout/widget_progress_bar.xml b/res/layout/widget_progress_bar.xml
new file mode 100644
index 0000000..a2a5154
--- /dev/null
+++ b/res/layout/widget_progress_bar.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 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.
+-->
+
+<ProgressBar xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@android:id/progress"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="4dp"
+ android:max="100"
+ style="?android:attr/progressBarStyleHorizontal" />
diff --git a/res/layout/widget_text_views.xml b/res/layout/widget_text_views.xml
new file mode 100644
index 0000000..2e029e8
--- /dev/null
+++ b/res/layout/widget_text_views.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 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="wrap_content"
+ android:orientation="horizontal">
+
+ <TextView
+ android:id="@+id/widget_text1"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:layout_gravity="fill_horizontal|top"
+ android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textColor="?android:attr/textColorSecondary"
+ android:textAlignment="viewStart"
+ android:singleLine="true"
+ android:ellipsize="marquee"
+ android:duplicateParentState="true" />
+
+ <TextView
+ android:id="@+id/widget_text2"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:layout_marginStart="8dip"
+ android:layout_gravity="fill_horizontal|top"
+ android:textAppearance="@android:style/TextAppearance.Material.Body1"
+ android:textColor="?android:attr/textColorSecondary"
+ android:textAlignment="viewEnd"
+ android:singleLine="true"
+ android:ellipsize="marquee"
+ android:duplicateParentState="true" />
+
+</LinearLayout>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 1b7caf7..d24337f 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -93,6 +93,10 @@
<item name="android:windowContentOverlay">@null</item>
</style>
+ <style name="Preference">
+ <item name="android:layout">@layout/preference_material_settings</item>
+ </style>
+
<style name="PreferenceHeaderPanelSinglePane">
<item name="android:layout_marginStart">0dp</item>
<item name="android:layout_marginEnd">0dp</item>
@@ -339,4 +343,4 @@
<item name="android:textSize">16sp</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
</style>
-</resources> \ No newline at end of file
+</resources>
diff --git a/res/values/themes.xml b/res/values/themes.xml
index 08b8de3..e6621a8 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -80,6 +80,7 @@
<style name="Theme.SettingsBase" parent="@android:style/Theme.Material.Settings" />
<style name="Theme.Settings" parent="Theme.SettingsBase">
+ <item name="@*android:preferenceStyle">@style/Preference</item>
<item name="@*android:preferenceHeaderPanelStyle">@style/PreferenceHeaderPanelSinglePane</item>
<item name="@*android:preferencePanelStyle">@style/PreferencePanelSinglePane</item>
<item name="@*android:preferenceListStyle">@style/PreferenceHeaderListSinglePane</item>
diff --git a/src/com/android/settings/AppPicker.java b/src/com/android/settings/AppPicker.java
index 2447bcb..04e48ff 100644
--- a/src/com/android/settings/AppPicker.java
+++ b/src/com/android/settings/AppPicker.java
@@ -164,7 +164,6 @@ public class AppPicker extends ListActivity {
holder.summary.setText("");
}
holder.disabled.setVisibility(View.GONE);
- holder.checkBox.setVisibility(View.GONE);
return convertView;
}
}
diff --git a/src/com/android/settings/AppProgressPreference.java b/src/com/android/settings/AppProgressPreference.java
new file mode 100644
index 0000000..cd157d1
--- /dev/null
+++ b/src/com/android/settings/AppProgressPreference.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2015 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.
+ */
+package com.android.settings;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.ProgressBar;
+
+public class AppProgressPreference extends TintablePreference {
+
+ private int mProgress;
+
+ public AppProgressPreference(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ setLayoutResource(R.layout.preference_app);
+ setWidgetLayoutResource(R.layout.widget_progress_bar);
+ }
+
+ public void setProgress(int amount) {
+ mProgress = amount;
+ notifyChanged();
+ }
+
+ @Override
+ protected void onBindView(View view) {
+ super.onBindView(view);
+
+ final ProgressBar progress = (ProgressBar) view.findViewById(android.R.id.progress);
+ progress.setProgress(mProgress);
+ }
+}
diff --git a/src/com/android/settings/DataUsageSummary.java b/src/com/android/settings/DataUsageSummary.java
index 744ed3f..a4ee961 100644
--- a/src/com/android/settings/DataUsageSummary.java
+++ b/src/com/android/settings/DataUsageSummary.java
@@ -1882,10 +1882,10 @@ public class DataUsageSummary extends HighlightingFragment implements Indexable
@Override
public View getView(int position, View convertView, ViewGroup parent) {
final AppItem item = mItems.get(position);
+ LayoutInflater inflater = LayoutInflater.from(parent.getContext());
if (getItemViewType(position) == 1) {
if (convertView == null) {
- convertView = Utils.inflateCategoryHeader(LayoutInflater.from(
- parent.getContext()), parent);
+ convertView = Utils.inflateCategoryHeader(inflater, parent);
}
final TextView title = (TextView) convertView.findViewById(android.R.id.title);
@@ -1893,8 +1893,9 @@ public class DataUsageSummary extends HighlightingFragment implements Indexable
} else {
if (convertView == null) {
- convertView = LayoutInflater.from(parent.getContext()).inflate(
- R.layout.data_usage_item, parent, false);
+ convertView = inflater.inflate(R.layout.data_usage_item, parent, false);
+ inflater.inflate(R.layout.widget_progress_bar,
+ (ViewGroup) convertView.findViewById(android.R.id.widget_frame));
if (mInsetSide > 0) {
convertView.setPaddingRelative(mInsetSide, 0, mInsetSide, 0);
@@ -1903,7 +1904,7 @@ public class DataUsageSummary extends HighlightingFragment implements Indexable
final Context context = parent.getContext();
- final TextView text1 = (TextView) convertView.findViewById(android.R.id.text1);
+ final TextView summary = (TextView) convertView.findViewById(android.R.id.summary);
final ProgressBar progress = (ProgressBar) convertView.findViewById(
android.R.id.progress);
@@ -1911,10 +1912,10 @@ public class DataUsageSummary extends HighlightingFragment implements Indexable
UidDetailTask.bindView(mProvider, item, convertView);
if (item.restricted && item.total <= 0) {
- text1.setText(R.string.data_usage_app_restricted);
+ summary.setText(R.string.data_usage_app_restricted);
progress.setVisibility(View.GONE);
} else {
- text1.setText(Formatter.formatFileSize(context, item.total));
+ summary.setText(Formatter.formatFileSize(context, item.total));
progress.setVisibility(View.VISIBLE);
}
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index f376644..226ea0e 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -73,6 +73,7 @@ import com.android.settings.accounts.AccountSyncSettings;
import com.android.settings.applications.InstalledAppDetails;
import com.android.settings.applications.ManageApplications;
import com.android.settings.applications.ManageAssist;
+import com.android.settings.applications.ProcessStatsSummary;
import com.android.settings.applications.ProcessStatsUi;
import com.android.settings.applications.UsageAccessDetails;
import com.android.settings.bluetooth.BluetoothSettings;
@@ -346,6 +347,7 @@ public class SettingsActivity extends Activity
ZenModeExternalRuleSettings.class.getName(),
ProcessStatsUi.class.getName(),
PowerUsageDetail.class.getName(),
+ ProcessStatsSummary.class.getName(),
};
diff --git a/src/com/android/settings/applications/AppOpsDetails.java b/src/com/android/settings/applications/AppOpsDetails.java
index 0643b56..a8320b1 100644
--- a/src/com/android/settings/applications/AppOpsDetails.java
+++ b/src/com/android/settings/applications/AppOpsDetails.java
@@ -27,6 +27,7 @@ import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.PermissionGroupInfo;
import android.content.pm.PermissionInfo;
import android.content.res.Resources;
+import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
@@ -57,29 +58,15 @@ public class AppOpsDetails extends InstrumentedFragment {
private PackageInfo mPackageInfo;
private LayoutInflater mInflater;
private View mRootView;
- private TextView mAppVersion;
private LinearLayout mOperationsSection;
// Utility method to set application label and icon.
private void setAppLabelAndIcon(PackageInfo pkgInfo) {
final View appSnippet = mRootView.findViewById(R.id.app_snippet);
- appSnippet.setPaddingRelative(0, appSnippet.getPaddingTop(), 0, appSnippet.getPaddingBottom());
-
- ImageView icon = (ImageView) appSnippet.findViewById(R.id.app_icon);
- icon.setImageDrawable(mPm.getApplicationIcon(pkgInfo.applicationInfo));
- // Set application name.
- TextView label = (TextView) appSnippet.findViewById(R.id.app_name);
- label.setText(mPm.getApplicationLabel(pkgInfo.applicationInfo));
- // Version number of application
- mAppVersion = (TextView) appSnippet.findViewById(R.id.app_summary);
-
- if (pkgInfo.versionName != null) {
- mAppVersion.setVisibility(View.VISIBLE);
- mAppVersion.setText(getActivity().getString(R.string.version_text,
- String.valueOf(pkgInfo.versionName)));
- } else {
- mAppVersion.setVisibility(View.INVISIBLE);
- }
+ CharSequence label = mPm.getApplicationLabel(pkgInfo.applicationInfo);
+ Drawable icon = mPm.getApplicationIcon(pkgInfo.applicationInfo);
+ InstalledAppDetails.setupAppSnippet(appSnippet, label, icon,
+ pkgInfo != null ? pkgInfo.versionName : null);
}
private String retrieveAppEntry() {
diff --git a/src/com/android/settings/applications/AppViewHolder.java b/src/com/android/settings/applications/AppViewHolder.java
index f58cf06..9771427 100644
--- a/src/com/android/settings/applications/AppViewHolder.java
+++ b/src/com/android/settings/applications/AppViewHolder.java
@@ -19,6 +19,7 @@ package com.android.settings.applications;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
+import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;
@@ -34,21 +35,21 @@ public class AppViewHolder {
public ImageView appIcon;
public TextView summary;
public TextView disabled;
- public CheckBox checkBox;
static public AppViewHolder createOrRecycle(LayoutInflater inflater, View convertView) {
if (convertView == null) {
- convertView = inflater.inflate(R.layout.manage_applications_item, null);
+ convertView = inflater.inflate(R.layout.preference_app, null);
+ inflater.inflate(R.layout.widget_text_views,
+ (ViewGroup) convertView.findViewById(android.R.id.widget_frame));
// Creates a ViewHolder and store references to the two children views
// we want to bind data to.
AppViewHolder holder = new AppViewHolder();
holder.rootView = convertView;
- holder.appName = (TextView) convertView.findViewById(R.id.app_name);
- holder.appIcon = (ImageView) convertView.findViewById(R.id.app_icon);
- holder.summary = (TextView) convertView.findViewById(R.id.app_summary);
- holder.disabled = (TextView) convertView.findViewById(R.id.app_disabled);
- holder.checkBox = (CheckBox) convertView.findViewById(R.id.app_on_sdcard);
+ holder.appName = (TextView) convertView.findViewById(android.R.id.title);
+ holder.appIcon = (ImageView) convertView.findViewById(android.R.id.icon);
+ holder.summary = (TextView) convertView.findViewById(R.id.widget_text1);
+ holder.disabled = (TextView) convertView.findViewById(R.id.widget_text2);
convertView.setTag(holder);
return holder;
} else {
diff --git a/src/com/android/settings/applications/InstalledAppDetails.java b/src/com/android/settings/applications/InstalledAppDetails.java
index 9649d27..b344644 100755
--- a/src/com/android/settings/applications/InstalledAppDetails.java
+++ b/src/com/android/settings/applications/InstalledAppDetails.java
@@ -36,6 +36,7 @@ import android.content.pm.ResolveInfo;
import android.content.pm.UserInfo;
import android.content.res.Resources;
import android.icu.text.ListFormatter;
+import android.graphics.drawable.Drawable;
import android.net.INetworkStatsService;
import android.net.INetworkStatsSession;
import android.net.NetworkTemplate;
@@ -49,13 +50,16 @@ import android.os.ServiceManager;
import android.os.UserHandle;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
+import android.text.TextUtils;
import android.text.format.DateUtils;
import android.text.format.Formatter;
import android.util.Log;
+import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
+import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
@@ -130,7 +134,6 @@ public class InstalledAppDetails extends AppInfoBase
private LayoutPreference mHeader;
private Button mUninstallButton;
private boolean mUpdatedSysApp = false;
- private TextView mAppVersion;
private Button mForceStopButton;
private Preference mNotificationPreference;
private Preference mStoragePreference;
@@ -424,25 +427,9 @@ public class InstalledAppDetails extends AppInfoBase
// Utility method to set application label and icon.
private void setAppLabelAndIcon(PackageInfo pkgInfo) {
final View appSnippet = mHeader.findViewById(R.id.app_snippet);
- appSnippet.setPaddingRelative(0, appSnippet.getPaddingTop(), 0,
- appSnippet.getPaddingBottom());
-
- ImageView icon = (ImageView) appSnippet.findViewById(R.id.app_icon);
mState.ensureIcon(mAppEntry);
- icon.setImageDrawable(mAppEntry.icon);
- // Set application name.
- TextView label = (TextView) appSnippet.findViewById(R.id.app_name);
- label.setText(mAppEntry.label);
- // Version number of application
- mAppVersion = (TextView) appSnippet.findViewById(R.id.app_summary);
-
- if (pkgInfo != null && pkgInfo.versionName != null) {
- mAppVersion.setVisibility(View.VISIBLE);
- mAppVersion.setText(getActivity().getString(R.string.version_text,
- String.valueOf(pkgInfo.versionName)));
- } else {
- mAppVersion.setVisibility(View.INVISIBLE);
- }
+ setupAppSnippet(appSnippet, mAppEntry.label, mAppEntry.icon,
+ pkgInfo != null ? pkgInfo.versionName : null);
}
private boolean signaturesMatch(String pkg1, String pkg2) {
@@ -757,6 +744,28 @@ public class InstalledAppDetails extends AppInfoBase
return true;
}
+ public static void setupAppSnippet(View appSnippet, CharSequence label, Drawable icon,
+ CharSequence versionName) {
+ LayoutInflater.from(appSnippet.getContext()).inflate(R.layout.widget_text_views,
+ (ViewGroup) appSnippet.findViewById(android.R.id.widget_frame));
+
+ ImageView iconView = (ImageView) appSnippet.findViewById(android.R.id.icon);
+ iconView.setImageDrawable(icon);
+ // Set application name.
+ TextView labelView = (TextView) appSnippet.findViewById(android.R.id.title);
+ labelView.setText(label);
+ // Version number of application
+ TextView appVersion = (TextView) appSnippet.findViewById(R.id.widget_text1);
+
+ if (!TextUtils.isEmpty(versionName)) {
+ appVersion.setVisibility(View.VISIBLE);
+ appVersion.setText(appSnippet.getContext().getString(R.string.version_text,
+ String.valueOf(versionName)));
+ } else {
+ appVersion.setVisibility(View.INVISIBLE);
+ }
+ }
+
private static NetworkTemplate getTemplate(Context context) {
if (DataUsageSummary.hasReadyMobileRadio(context)) {
return NetworkTemplate.buildTemplateMobileWildcard();
diff --git a/src/com/android/settings/applications/LayoutPreference.java b/src/com/android/settings/applications/LayoutPreference.java
index 75387d3..f0c7e4a 100644
--- a/src/com/android/settings/applications/LayoutPreference.java
+++ b/src/com/android/settings/applications/LayoutPreference.java
@@ -58,6 +58,11 @@ public class LayoutPreference extends Preference {
return mRootView;
}
+ @Override
+ protected void onBindView(View view) {
+ // Do nothing.
+ }
+
public View findViewById(int id) {
return mRootView.findViewById(id);
}
diff --git a/src/com/android/settings/applications/ManageApplications.java b/src/com/android/settings/applications/ManageApplications.java
index 20c1601..9afcff8 100644
--- a/src/com/android/settings/applications/ManageApplications.java
+++ b/src/com/android/settings/applications/ManageApplications.java
@@ -993,7 +993,6 @@ public class ManageApplications extends InstrumentedFragment
} else {
holder.disabled.setVisibility(View.GONE);
}
- holder.checkBox.setVisibility(View.GONE);
}
mActive.remove(convertView);
mActive.add(convertView);
diff --git a/src/com/android/settings/applications/ProcessStatsMemDetail.java b/src/com/android/settings/applications/ProcessStatsMemDetail.java
index 7ae2824..6a4f470 100644
--- a/src/com/android/settings/applications/ProcessStatsMemDetail.java
+++ b/src/com/android/settings/applications/ProcessStatsMemDetail.java
@@ -105,8 +105,9 @@ public class ProcessStatsMemDetail extends InstrumentedFragment {
private void addDetailsItem(ViewGroup parent, CharSequence title,
float level, CharSequence value) {
LayoutInflater inflater = getActivity().getLayoutInflater();
- ViewGroup item = (ViewGroup) inflater.inflate(R.layout.app_percentage_item,
- null);
+ ViewGroup item = (ViewGroup) inflater.inflate(R.layout.app_item, null);
+ inflater.inflate(R.layout.widget_progress_bar,
+ (ViewGroup) item.findViewById(android.R.id.widget_frame));
parent.addView(item);
item.findViewById(android.R.id.icon).setVisibility(View.GONE);
TextView titleView = (TextView) item.findViewById(android.R.id.title);
diff --git a/src/com/android/settings/applications/ProcessStatsPreference.java b/src/com/android/settings/applications/ProcessStatsPreference.java
index 48c6a9f..996ed15 100644
--- a/src/com/android/settings/applications/ProcessStatsPreference.java
+++ b/src/com/android/settings/applications/ProcessStatsPreference.java
@@ -19,40 +19,17 @@ package com.android.settings.applications;
import android.content.Context;
import android.content.pm.PackageManager;
import android.graphics.drawable.ColorDrawable;
-import android.preference.Preference;
import android.text.TextUtils;
import android.text.format.Formatter;
-import android.util.AttributeSet;
-import android.view.View;
-import com.android.settings.R;
+import com.android.settings.AppProgressPreference;
-public class ProcessStatsPreference extends Preference {
+public class ProcessStatsPreference extends AppProgressPreference {
private ProcStatsPackageEntry mEntry;
- private final int mColor;
- private final int mRemainingColor;
- private float mRatio;
- private float mRemainingRatio;
public ProcessStatsPreference(Context context) {
- this(context, null);
- }
-
- public ProcessStatsPreference(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public ProcessStatsPreference(Context context, AttributeSet attrs, int defStyleAttr) {
- this(context, attrs, defStyleAttr, 0);
- }
-
- public ProcessStatsPreference(Context context, AttributeSet attrs, int defStyleAttr,
- int defStyleRes) {
- super(context, attrs, defStyleAttr, defStyleRes);
- setLayoutResource(R.layout.app_item_linear_color);
- mColor = context.getColor(R.color.memory_max_use);
- mRemainingColor = context.getColor(R.color.memory_remaining);
+ super(context, null);
}
public void init(ProcStatsPackageEntry entry, PackageManager pm, double maxMemory,
@@ -68,20 +45,10 @@ public class ProcessStatsPreference extends Preference {
double amount = avg ? (statsForeground ? entry.mRunWeight : entry.mBgWeight) * weightToRam
: (statsForeground ? entry.mMaxRunMem : entry.mMaxBgMem) * totalScale * 1024;
setSummary(Formatter.formatShortFileSize(getContext(), (long) amount));
- mRatio = (float) (amount / maxMemory);
- mRemainingRatio = 1 - mRatio;
+ setProgress((int) (100 * amount / maxMemory));
}
public ProcStatsPackageEntry getEntry() {
return mEntry;
}
-
- @Override
- protected void onBindView(View view) {
- super.onBindView(view);
-
- LinearColorBar linearColorBar = (LinearColorBar) view.findViewById(R.id.linear_color_bar);
- linearColorBar.setColors(mColor, mColor, mRemainingColor);
- linearColorBar.setRatios(mRatio, 0, mRemainingRatio);
- }
}
diff --git a/src/com/android/settings/fuelgauge/PowerGaugePreference.java b/src/com/android/settings/fuelgauge/PowerGaugePreference.java
index e80f492..0be73d8 100644
--- a/src/com/android/settings/fuelgauge/PowerGaugePreference.java
+++ b/src/com/android/settings/fuelgauge/PowerGaugePreference.java
@@ -19,38 +19,31 @@ package com.android.settings.fuelgauge;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
-import android.preference.Preference;
import android.view.View;
-import android.widget.ProgressBar;
import android.widget.TextView;
-import com.android.settings.R;
-import com.android.settings.TintablePreference;
+import com.android.settings.AppProgressPreference;
import com.android.settings.Utils;
/**
* Custom preference for displaying power consumption as a bar and an icon on
* the left for the subsystem/app type.
*/
-public class PowerGaugePreference extends TintablePreference {
+public class PowerGaugePreference extends AppProgressPreference {
private BatteryEntry mInfo;
- private int mProgress;
- private CharSequence mProgressText;
private final CharSequence mContentDescription;
public PowerGaugePreference(Context context, Drawable icon, CharSequence contentDescription,
BatteryEntry info) {
super(context, null);
- setLayoutResource(R.layout.preference_app_percentage);
setIcon(icon != null ? icon : new ColorDrawable(0));
mInfo = info;
mContentDescription = contentDescription;
}
public void setPercent(double percentOfMax, double percentOfTotal) {
- mProgress = (int) Math.ceil(percentOfMax);
- mProgressText = Utils.formatPercentage((int) (percentOfTotal + 0.5));
- notifyChanged();
+ setProgress((int) Math.ceil(percentOfMax));
+ setSummary(Utils.formatPercentage((int) (percentOfTotal + 0.5)));
}
BatteryEntry getInfo() {
@@ -61,12 +54,6 @@ public class PowerGaugePreference extends TintablePreference {
protected void onBindView(View view) {
super.onBindView(view);
- final ProgressBar progress = (ProgressBar) view.findViewById(android.R.id.progress);
- progress.setProgress(mProgress);
-
- final TextView text1 = (TextView) view.findViewById(android.R.id.text1);
- text1.setText(mProgressText);
-
if (mContentDescription != null) {
final TextView titleView = (TextView) view.findViewById(android.R.id.title);
titleView.setContentDescription(mContentDescription);