Left align preferences and graphs to leave space for icon.
Bug: 33559277 Test: Visual inspection Change-Id: Iacf9556826174a03b1cbf8a6f179b63d8686c5f5
This commit is contained in:
@@ -18,7 +18,7 @@
|
|||||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||||
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:paddingStart="@dimen/preference_no_icon_padding_start"
|
||||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingTop="1dp"
|
android:paddingTop="1dp"
|
||||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
android:paddingStart="@dimen/preference_no_icon_padding_start"
|
||||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
|
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
|||||||
@@ -1,75 +0,0 @@
|
|||||||
<?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="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/selectableItemBackground">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@android:id/icon"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="6dip"
|
|
||||||
android:layout_marginEnd="6dip"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:contentDescription="@null" />
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_marginStart="15dip"
|
|
||||||
android:paddingTop="16dip"
|
|
||||||
android:paddingBottom="16dip">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@android:id/title"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:textAppearance="@android:style/TextAppearance.Material.Subhead"
|
|
||||||
android:textColor="?android:attr/textColorPrimary"
|
|
||||||
android:ellipsize="marquee"
|
|
||||||
android:fadingEdge="horizontal" />
|
|
||||||
|
|
||||||
<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:visibility="gone"
|
|
||||||
android:textAlignment="viewStart"
|
|
||||||
android:textAppearance="@android:style/TextAppearance.Material.Body1"
|
|
||||||
android:textColor="?android:attr/textColorSecondary"
|
|
||||||
android:maxLines="10" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@android:id/widget_frame"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:minWidth="58dip"
|
|
||||||
android:gravity="end|center_vertical"
|
|
||||||
android:orientation="vertical" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
@@ -35,6 +35,7 @@
|
|||||||
android:id="@android:id/icon"
|
android:id="@android:id/icon"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:tint="?android:attr/textColorPrimary"
|
||||||
android:maxWidth="18dp"
|
android:maxWidth="18dp"
|
||||||
android:maxHeight="18dp"/>
|
android:maxHeight="18dp"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!-- Copyright (C) 2016 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.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!-- Layout used for PreferenceCategory in a PreferenceActivity. -->
|
|
||||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:id="@android:id/title"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="0dp"
|
|
||||||
android:textAppearance="@android:style/TextAppearance.Material.Body2"
|
|
||||||
android:textColor="?android:attr/colorAccent"
|
|
||||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
|
||||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
|
||||||
android:paddingTop="16dip" />
|
|
||||||
@@ -16,37 +16,46 @@
|
|||||||
|
|
||||||
<!-- Layout used for ProgressCategory in bluetooth settings. -->
|
<!-- Layout used for ProgressCategory in bluetooth settings. -->
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
style="?android:attr/listSeparatorTextViewStyle"
|
android:layout_width="match_parent"
|
||||||
android:background="@null"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:layout_height="wrap_content"
|
android:layout_marginBottom="16dp"
|
||||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd" >
|
android:paddingTop="16dp"
|
||||||
|
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/icon_container"
|
||||||
|
android:layout_width="60dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="start|center_vertical"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<com.android.internal.widget.PreferenceImageView
|
||||||
|
android:id="@android:id/icon"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:tint="?android:attr/textColorPrimary"
|
||||||
|
android:maxWidth="18dp"
|
||||||
|
android:maxHeight="18dp"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- This text view has the style of the list separator text view without the background and padding. -->
|
<!-- This text view has the style of the list separator text view without the background and padding. -->
|
||||||
<TextView
|
<TextView
|
||||||
android:textAppearance="@android:style/TextAppearance.Material.Body2"
|
|
||||||
android:textColor="?android:attr/colorAccent"
|
|
||||||
android:background="@null"
|
|
||||||
android:id="@android:id/title"
|
android:id="@android:id/title"
|
||||||
android:paddingStart="0dp"
|
|
||||||
android:paddingTop="6dp"
|
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_gravity="start|center"
|
android:layout_gravity="start|center"
|
||||||
/>
|
android:textAppearance="@android:style/TextAppearance.Material.Body2"/>
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:id="@+id/scanning_progress"
|
android:id="@+id/scanning_progress"
|
||||||
android:text="@string/progress_scanning"
|
style="?android:attr/progressBarStyleSmallTitle"
|
||||||
android:paddingTop="6dp"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_marginStart="16dip"
|
android:layout_marginStart="16dip"
|
||||||
style="?android:attr/progressBarStyleSmallTitle"
|
android:text="@string/progress_scanning"/>
|
||||||
/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
@@ -20,18 +20,18 @@
|
|||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout 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:paddingStart="@dimen/preference_no_icon_padding_start"
|
||||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/title"
|
android:id="@+id/title"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="48sp"
|
android:layout_height="48dp"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:ellipsize="marquee"
|
android:ellipsize="marquee"
|
||||||
android:textAppearance="@android:style/TextAppearance.Material.Body2"
|
android:textAppearance="@android:style/TextAppearance.Material.Body2"
|
||||||
android:textColor="?android:attr/colorAccent"
|
android:textColor="?android:attr/textColorPrimary"
|
||||||
android:textAlignment="viewStart"
|
android:textAlignment="viewStart"
|
||||||
android:gravity="left|center_vertical"
|
android:gravity="left|center_vertical"
|
||||||
android:text="@string/running_processes_header_title" />
|
android:text="@string/running_processes_header_title" />
|
||||||
@@ -44,12 +44,12 @@
|
|||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="32sp"
|
android:layout_height="32dp"
|
||||||
android:layout_marginTop="8sp"
|
android:layout_marginTop="8dp"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="16sp"
|
android:layout_width="16dp"
|
||||||
android:layout_height="16sp"
|
android:layout_height="16dp"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:scaleType="centerInside"
|
android:scaleType="centerInside"
|
||||||
android:src="@color/running_processes_system_ram"
|
android:src="@color/running_processes_system_ram"
|
||||||
@@ -90,11 +90,11 @@
|
|||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="32sp"
|
android:layout_height="32dp"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="16sp"
|
android:layout_width="16dp"
|
||||||
android:layout_height="16sp"
|
android:layout_height="16dp"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:scaleType="centerInside"
|
android:scaleType="centerInside"
|
||||||
android:src="?android:attr/colorAccent"
|
android:src="?android:attr/colorAccent"
|
||||||
@@ -135,11 +135,11 @@
|
|||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="32sp"
|
android:layout_height="32dp"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="16sp"
|
android:layout_width="16dp"
|
||||||
android:layout_height="16sp"
|
android:layout_height="16dp"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:scaleType="centerInside"
|
android:scaleType="centerInside"
|
||||||
android:src="@color/running_processes_free_ram"
|
android:src="@color/running_processes_free_ram"
|
||||||
@@ -182,11 +182,11 @@
|
|||||||
android:id="@+id/listHeader"
|
android:id="@+id/listHeader"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="48dp"
|
android:layout_height="48dp"
|
||||||
android:layout_marginTop="8sp"
|
android:layout_marginTop="8dp"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:ellipsize="marquee"
|
android:ellipsize="marquee"
|
||||||
android:textAppearance="@android:style/TextAppearance.Material.Body2"
|
android:textAppearance="@android:style/TextAppearance.Material.Body2"
|
||||||
android:textColor="?android:attr/colorAccent"
|
android:textColor="?android:attr/textColorPrimary"
|
||||||
android:textAlignment="viewStart"
|
android:textAlignment="viewStart"
|
||||||
android:gravity="left|center_vertical"
|
android:gravity="left|center_vertical"
|
||||||
android:text="@string/running_processes_header_footer" />
|
android:text="@string/running_processes_header_footer" />
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
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:paddingStart="@dimen/preference_no_icon_padding_start"
|
||||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,9 @@
|
|||||||
<!-- This file only contains custom attribute and style definition for preferences -->
|
<!-- This file only contains custom attribute and style definition for preferences -->
|
||||||
<!-- Things unrelated to preference framework UI customization should go to other styles files -->
|
<!-- Things unrelated to preference framework UI customization should go to other styles files -->
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
|
<dimen name="preference_no_icon_padding_start">72dp</dimen>
|
||||||
|
|
||||||
<style name="ApnPreference">
|
<style name="ApnPreference">
|
||||||
<item name="android:layout">@layout/apn_preference_layout</item>
|
<item name="android:layout">@layout/apn_preference_layout</item>
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -18,8 +18,7 @@
|
|||||||
android:title="@string/memory_usage">
|
android:title="@string/memory_usage">
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:title="@string/average_memory_use"
|
android:title="@string/average_memory_use"/>
|
||||||
android:layout="@layout/preference_category_short" />
|
|
||||||
|
|
||||||
<com.android.settings.SummaryPreference
|
<com.android.settings.SummaryPreference
|
||||||
android:key="status_header"
|
android:key="status_header"
|
||||||
|
|||||||
@@ -19,8 +19,7 @@
|
|||||||
android:title="@string/data_usage_summary_title">
|
android:title="@string/data_usage_summary_title">
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:title="@string/usage"
|
android:title="@string/usage">
|
||||||
android:layout="@layout/preference_category_short">
|
|
||||||
|
|
||||||
<com.android.settings.SummaryPreference
|
<com.android.settings.SummaryPreference
|
||||||
android:key="status_header"
|
android:key="status_header"
|
||||||
|
|||||||
@@ -18,8 +18,7 @@
|
|||||||
android:title="@string/data_usage_summary_title">
|
android:title="@string/data_usage_summary_title">
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="usage_amount"
|
android:key="usage_amount">
|
||||||
android:layout="@layout/preference_category_short">
|
|
||||||
|
|
||||||
<com.android.settings.datausage.ChartDataUsagePreference
|
<com.android.settings.datausage.ChartDataUsagePreference
|
||||||
android:key="chart_data" />
|
android:key="chart_data" />
|
||||||
|
|||||||
@@ -29,18 +29,18 @@
|
|||||||
android:title="@string/battery_level_title"
|
android:title="@string/battery_level_title"
|
||||||
android:summary="@string/device_info_not_available"
|
android:summary="@string/device_info_not_available"
|
||||||
android:persistent="false" />
|
android:persistent="false" />
|
||||||
<PreferenceScreen android:key="sim_status"
|
<Preference android:key="sim_status"
|
||||||
android:title="@string/sim_status_title"
|
android:title="@string/sim_status_title"
|
||||||
android:persistent="false">
|
android:persistent="false">
|
||||||
<intent android:targetPackage="com.android.settings"
|
<intent android:targetPackage="com.android.settings"
|
||||||
android:targetClass="com.android.settings.Settings$SimStatusActivity" />
|
android:targetClass="com.android.settings.Settings$SimStatusActivity" />
|
||||||
</PreferenceScreen>
|
</Preference>
|
||||||
<PreferenceScreen android:key="imei_info"
|
<Preference android:key="imei_info"
|
||||||
android:title="@string/imei_information_title"
|
android:title="@string/imei_information_title"
|
||||||
android:persistent="false">
|
android:persistent="false">
|
||||||
<intent android:targetPackage="com.android.settings"
|
<intent android:targetPackage="com.android.settings"
|
||||||
android:targetClass="com.android.settings.Settings$ImeiInformationActivity" />
|
android:targetClass="com.android.settings.Settings$ImeiInformationActivity" />
|
||||||
</PreferenceScreen>
|
</Preference>
|
||||||
<com.android.settings.CopyablePreference android:key="wifi_ip_address"
|
<com.android.settings.CopyablePreference android:key="wifi_ip_address"
|
||||||
android:enabled="false"
|
android:enabled="false"
|
||||||
android:shouldDisableView="false"
|
android:shouldDisableView="false"
|
||||||
|
|||||||
@@ -20,8 +20,7 @@
|
|||||||
android:key="app_list">
|
android:key="app_list">
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:title="@string/average_memory_use"
|
android:title="@string/average_memory_use"/>
|
||||||
android:layout="@layout/preference_category_short" />
|
|
||||||
|
|
||||||
<com.android.settings.SummaryPreference
|
<com.android.settings.SummaryPreference
|
||||||
android:key="status_header"
|
android:key="status_header"
|
||||||
|
|||||||
@@ -33,16 +33,19 @@ public class ProgressCategory extends ProgressCategoryBase {
|
|||||||
private boolean mNoDeviceFoundAdded;
|
private boolean mNoDeviceFoundAdded;
|
||||||
|
|
||||||
public ProgressCategory(Context context) {
|
public ProgressCategory(Context context) {
|
||||||
this(context, null);
|
super(context);
|
||||||
|
setLayoutResource(R.layout.preference_progress_category);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProgressCategory(Context context, AttributeSet attrs) {
|
public ProgressCategory(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs, 0);
|
super(context, attrs);
|
||||||
|
setLayoutResource(R.layout.preference_progress_category);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProgressCategory(Context context, AttributeSet attrs,
|
public ProgressCategory(Context context, AttributeSet attrs,
|
||||||
int defStyleAttr) {
|
int defStyleAttr) {
|
||||||
this(context, attrs, defStyleAttr, 0);
|
super(context, attrs, defStyleAttr);
|
||||||
|
setLayoutResource(R.layout.preference_progress_category);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProgressCategory(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
public ProgressCategory(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||||
@@ -71,7 +74,7 @@ public class ProgressCategory extends ProgressCategoryBase {
|
|||||||
} else {
|
} else {
|
||||||
if (!mNoDeviceFoundAdded) {
|
if (!mNoDeviceFoundAdded) {
|
||||||
if (mNoDeviceFoundPreference == null) {
|
if (mNoDeviceFoundPreference == null) {
|
||||||
mNoDeviceFoundPreference = new Preference(getPreferenceManager().getContext());
|
mNoDeviceFoundPreference = new Preference(getContext());
|
||||||
mNoDeviceFoundPreference.setLayoutResource(R.layout.preference_empty_list);
|
mNoDeviceFoundPreference.setLayoutResource(R.layout.preference_empty_list);
|
||||||
mNoDeviceFoundPreference.setTitle(mEmptyTextRes);
|
mNoDeviceFoundPreference.setTitle(mEmptyTextRes);
|
||||||
mNoDeviceFoundPreference.setSelectable(false);
|
mNoDeviceFoundPreference.setSelectable(false);
|
||||||
|
|||||||
@@ -22,24 +22,25 @@ import android.util.AttributeSet;
|
|||||||
|
|
||||||
public abstract class ProgressCategoryBase extends PreferenceCategory {
|
public abstract class ProgressCategoryBase extends PreferenceCategory {
|
||||||
public ProgressCategoryBase(Context context) {
|
public ProgressCategoryBase(Context context) {
|
||||||
this(context, null);
|
super(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProgressCategoryBase(Context context, AttributeSet attrs) {
|
public ProgressCategoryBase(Context context, AttributeSet attrs) {
|
||||||
this(context, attrs, 0);
|
super(context, attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProgressCategoryBase(Context context, AttributeSet attrs, int defStyleAttr) {
|
public ProgressCategoryBase(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||||
super(context, attrs, defStyleAttr, 0);
|
super(context, attrs, defStyleAttr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProgressCategoryBase(Context context, AttributeSet attrs, int defStyleAttr,
|
public ProgressCategoryBase(Context context, AttributeSet attrs, int defStyleAttr,
|
||||||
int defStyleRes) {
|
int defStyleRes) {
|
||||||
super(context, attrs, defStyleAttr, defStyleRes);
|
super(context, attrs, defStyleAttr, defStyleRes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turn on/off the progress indicator and text on the right.
|
* Turn on/off the progress indicator and text on the right.
|
||||||
|
*
|
||||||
* @param progressOn whether or not the progress should be displayed
|
* @param progressOn whether or not the progress should be displayed
|
||||||
*/
|
*/
|
||||||
public abstract void setProgress(boolean progressOn);
|
public abstract void setProgress(boolean progressOn);
|
||||||
|
|||||||
@@ -52,25 +52,25 @@ import java.util.Iterator;
|
|||||||
public class RunningProcessesView extends FrameLayout
|
public class RunningProcessesView extends FrameLayout
|
||||||
implements AdapterView.OnItemClickListener, RecyclerListener,
|
implements AdapterView.OnItemClickListener, RecyclerListener,
|
||||||
RunningState.OnRefreshUiListener {
|
RunningState.OnRefreshUiListener {
|
||||||
|
|
||||||
final int mMyUserId;
|
final int mMyUserId;
|
||||||
|
|
||||||
long SECONDARY_SERVER_MEM;
|
long SECONDARY_SERVER_MEM;
|
||||||
|
|
||||||
final HashMap<View, ActiveItem> mActiveItems = new HashMap<View, ActiveItem>();
|
final HashMap<View, ActiveItem> mActiveItems = new HashMap<View, ActiveItem>();
|
||||||
|
|
||||||
ActivityManager mAm;
|
ActivityManager mAm;
|
||||||
|
|
||||||
RunningState mState;
|
RunningState mState;
|
||||||
|
|
||||||
Fragment mOwner;
|
Fragment mOwner;
|
||||||
|
|
||||||
Runnable mDataAvail;
|
Runnable mDataAvail;
|
||||||
|
|
||||||
StringBuilder mBuilder = new StringBuilder(128);
|
StringBuilder mBuilder = new StringBuilder(128);
|
||||||
|
|
||||||
RunningState.BaseItem mCurSelected;
|
RunningState.BaseItem mCurSelected;
|
||||||
|
|
||||||
ListView mListView;
|
ListView mListView;
|
||||||
View mHeader;
|
View mHeader;
|
||||||
ServiceListAdapter mAdapter;
|
ServiceListAdapter mAdapter;
|
||||||
@@ -102,19 +102,19 @@ public class RunningProcessesView extends FrameLayout
|
|||||||
|
|
||||||
void updateTime(Context context, StringBuilder builder) {
|
void updateTime(Context context, StringBuilder builder) {
|
||||||
TextView uptimeView = null;
|
TextView uptimeView = null;
|
||||||
|
|
||||||
if (mItem instanceof RunningState.ServiceItem) {
|
if (mItem instanceof RunningState.ServiceItem) {
|
||||||
// If we are displaying a service, then the service
|
// If we are displaying a service, then the service
|
||||||
// uptime goes at the top.
|
// uptime goes at the top.
|
||||||
uptimeView = mHolder.size;
|
uptimeView = mHolder.size;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
String size = mItem.mSizeStr != null ? mItem.mSizeStr : "";
|
String size = mItem.mSizeStr != null ? mItem.mSizeStr : "";
|
||||||
if (!size.equals(mItem.mCurSizeStr)) {
|
if (!size.equals(mItem.mCurSizeStr)) {
|
||||||
mItem.mCurSizeStr = size;
|
mItem.mCurSizeStr = size;
|
||||||
mHolder.size.setText(size);
|
mHolder.size.setText(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mItem.mBackground) {
|
if (mItem.mBackground) {
|
||||||
// This is a background process; no uptime.
|
// This is a background process; no uptime.
|
||||||
if (!mSetBackground) {
|
if (!mSetBackground) {
|
||||||
@@ -150,7 +150,7 @@ public class RunningProcessesView extends FrameLayout
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ViewHolder {
|
public static class ViewHolder {
|
||||||
public View rootView;
|
public View rootView;
|
||||||
public ImageView icon;
|
public ImageView icon;
|
||||||
@@ -158,7 +158,7 @@ public class RunningProcessesView extends FrameLayout
|
|||||||
public TextView description;
|
public TextView description;
|
||||||
public TextView size;
|
public TextView size;
|
||||||
public TextView uptime;
|
public TextView uptime;
|
||||||
|
|
||||||
public ViewHolder(View v) {
|
public ViewHolder(View v) {
|
||||||
rootView = v;
|
rootView = v;
|
||||||
icon = (ImageView)v.findViewById(R.id.icon);
|
icon = (ImageView)v.findViewById(R.id.icon);
|
||||||
@@ -168,7 +168,7 @@ public class RunningProcessesView extends FrameLayout
|
|||||||
uptime = (TextView)v.findViewById(R.id.uptime);
|
uptime = (TextView)v.findViewById(R.id.uptime);
|
||||||
v.setTag(this);
|
v.setTag(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActiveItem bind(RunningState state, RunningState.BaseItem item,
|
public ActiveItem bind(RunningState state, RunningState.BaseItem item,
|
||||||
StringBuilder builder) {
|
StringBuilder builder) {
|
||||||
synchronized (state.mLock) {
|
synchronized (state.mLock) {
|
||||||
@@ -202,13 +202,7 @@ public class RunningProcessesView extends FrameLayout
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class TimeTicker extends TextView {
|
|
||||||
public TimeTicker(Context context, AttributeSet attrs) {
|
|
||||||
super(context, attrs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ServiceListAdapter extends BaseAdapter {
|
class ServiceListAdapter extends BaseAdapter {
|
||||||
final RunningState mState;
|
final RunningState mState;
|
||||||
final LayoutInflater mInflater;
|
final LayoutInflater mInflater;
|
||||||
@@ -216,7 +210,7 @@ public class RunningProcessesView extends FrameLayout
|
|||||||
ArrayList<RunningState.MergedItem> mOrigItems;
|
ArrayList<RunningState.MergedItem> mOrigItems;
|
||||||
final ArrayList<RunningState.MergedItem> mItems
|
final ArrayList<RunningState.MergedItem> mItems
|
||||||
= new ArrayList<RunningState.MergedItem>();
|
= new ArrayList<RunningState.MergedItem>();
|
||||||
|
|
||||||
ServiceListAdapter(RunningState state) {
|
ServiceListAdapter(RunningState state) {
|
||||||
mState = state;
|
mState = state;
|
||||||
mInflater = (LayoutInflater)getContext().getSystemService(
|
mInflater = (LayoutInflater)getContext().getSystemService(
|
||||||
@@ -254,11 +248,11 @@ public class RunningProcessesView extends FrameLayout
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasStableIds() {
|
public boolean hasStableIds() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCount() {
|
public int getCount() {
|
||||||
return mItems.size();
|
return mItems.size();
|
||||||
}
|
}
|
||||||
@@ -294,13 +288,13 @@ public class RunningProcessesView extends FrameLayout
|
|||||||
bindView(v, position);
|
bindView(v, position);
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
public View newView(ViewGroup parent) {
|
public View newView(ViewGroup parent) {
|
||||||
View v = mInflater.inflate(R.layout.running_processes_item, parent, false);
|
View v = mInflater.inflate(R.layout.running_processes_item, parent, false);
|
||||||
new ViewHolder(v);
|
new ViewHolder(v);
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void bindView(View view, int position) {
|
public void bindView(View view, int position) {
|
||||||
synchronized (mState.mLock) {
|
synchronized (mState.mLock) {
|
||||||
if (position >= mItems.size()) {
|
if (position >= mItems.size()) {
|
||||||
@@ -323,7 +317,7 @@ public class RunningProcessesView extends FrameLayout
|
|||||||
adapter.refreshItems();
|
adapter.refreshItems();
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mDataAvail != null) {
|
if (mDataAvail != null) {
|
||||||
mDataAvail.run();
|
mDataAvail.run();
|
||||||
mDataAvail = null;
|
mDataAvail = null;
|
||||||
@@ -396,7 +390,7 @@ public class RunningProcessesView extends FrameLayout
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
|
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
|
||||||
ListView l = (ListView)parent;
|
ListView l = (ListView)parent;
|
||||||
RunningState.MergedItem mi = (RunningState.MergedItem)l.getAdapter().getItem(position);
|
RunningState.MergedItem mi = (RunningState.MergedItem)l.getAdapter().getItem(position);
|
||||||
@@ -421,7 +415,7 @@ public class RunningProcessesView extends FrameLayout
|
|||||||
R.string.runningservicedetails_settings_title, null, null, 0);
|
R.string.runningservicedetails_settings_title, null, null, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onMovedToScrapHeap(View view) {
|
public void onMovedToScrapHeap(View view) {
|
||||||
mActiveItems.remove(view);
|
mActiveItems.remove(view);
|
||||||
}
|
}
|
||||||
@@ -430,7 +424,7 @@ public class RunningProcessesView extends FrameLayout
|
|||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
mMyUserId = UserHandle.myUserId();
|
mMyUserId = UserHandle.myUserId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doCreate() {
|
public void doCreate() {
|
||||||
mAm = (ActivityManager)getContext().getSystemService(Context.ACTIVITY_SERVICE);
|
mAm = (ActivityManager)getContext().getSystemService(Context.ACTIVITY_SERVICE);
|
||||||
mState = RunningState.getInstance(getContext());
|
mState = RunningState.getInstance(getContext());
|
||||||
@@ -464,7 +458,7 @@ public class RunningProcessesView extends FrameLayout
|
|||||||
mAm.getMemoryInfo(memInfo);
|
mAm.getMemoryInfo(memInfo);
|
||||||
SECONDARY_SERVER_MEM = memInfo.secondaryServerThreshold;
|
SECONDARY_SERVER_MEM = memInfo.secondaryServerThreshold;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doPause() {
|
public void doPause() {
|
||||||
mState.pause();
|
mState.pause();
|
||||||
mDataAvail = null;
|
mDataAvail = null;
|
||||||
|
|||||||
@@ -65,9 +65,9 @@ public final class BluetoothDevicePreference extends Preference implements
|
|||||||
|
|
||||||
/* Talk-back descriptions for various BT icons */
|
/* Talk-back descriptions for various BT icons */
|
||||||
Resources r = getContext().getResources();
|
Resources r = getContext().getResources();
|
||||||
public final String COMPUTER = r.getString(R.string.bluetooth_talkback_computer);
|
public final String COMPUTER = r.getString(R.string.bluetooth_talkback_computer);
|
||||||
public final String INPUT_PERIPHERAL = r.getString(
|
public final String INPUT_PERIPHERAL = r.getString(
|
||||||
R.string.bluetooth_talkback_input_peripheral);
|
R.string.bluetooth_talkback_input_peripheral);
|
||||||
public final String HEADSET = r.getString(R.string.bluetooth_talkback_headset);
|
public final String HEADSET = r.getString(R.string.bluetooth_talkback_headset);
|
||||||
public final String PHONE = r.getString(R.string.bluetooth_talkback_phone);
|
public final String PHONE = r.getString(R.string.bluetooth_talkback_phone);
|
||||||
public final String IMAGING = r.getString(R.string.bluetooth_talkback_imaging);
|
public final String IMAGING = r.getString(R.string.bluetooth_talkback_imaging);
|
||||||
@@ -85,11 +85,9 @@ public final class BluetoothDevicePreference extends Preference implements
|
|||||||
|
|
||||||
mCachedDevice = cachedDevice;
|
mCachedDevice = cachedDevice;
|
||||||
|
|
||||||
setLayoutResource(R.layout.preference_bt_icon);
|
|
||||||
|
|
||||||
if (cachedDevice.getBondState() == BluetoothDevice.BOND_BONDED) {
|
if (cachedDevice.getBondState() == BluetoothDevice.BOND_BONDED) {
|
||||||
UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE);
|
UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE);
|
||||||
if (! um.hasUserRestriction(DISALLOW_CONFIG_BLUETOOTH)) {
|
if (!um.hasUserRestriction(DISALLOW_CONFIG_BLUETOOTH)) {
|
||||||
setWidgetLayoutResource(R.layout.preference_bluetooth);
|
setWidgetLayoutResource(R.layout.preference_bluetooth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -266,7 +264,7 @@ public final class BluetoothDevicePreference extends Preference implements
|
|||||||
|
|
||||||
case BluetoothClass.Device.Major.PERIPHERAL:
|
case BluetoothClass.Device.Major.PERIPHERAL:
|
||||||
return new Pair<Integer, String>(HidProfile.getHidClassDrawable(btClass),
|
return new Pair<Integer, String>(HidProfile.getHidClassDrawable(btClass),
|
||||||
INPUT_PERIPHERAL);
|
INPUT_PERIPHERAL);
|
||||||
|
|
||||||
case BluetoothClass.Device.Major.IMAGING:
|
case BluetoothClass.Device.Major.IMAGING:
|
||||||
return new Pair<Integer, String>(R.drawable.ic_bt_imaging, IMAGING);
|
return new Pair<Integer, String>(R.drawable.ic_bt_imaging, IMAGING);
|
||||||
|
|||||||
@@ -27,21 +27,28 @@ import com.android.settings.R;
|
|||||||
*/
|
*/
|
||||||
public class BluetoothProgressCategory extends ProgressCategory {
|
public class BluetoothProgressCategory extends ProgressCategory {
|
||||||
public BluetoothProgressCategory(Context context) {
|
public BluetoothProgressCategory(Context context) {
|
||||||
this(context, null);
|
super(context);
|
||||||
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BluetoothProgressCategory(Context context, AttributeSet attrs) {
|
public BluetoothProgressCategory(Context context, AttributeSet attrs) {
|
||||||
this(context, attrs, 0);
|
super(context, attrs);
|
||||||
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BluetoothProgressCategory(Context context, AttributeSet attrs, int defStyleAttr) {
|
public BluetoothProgressCategory(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||||
this(context, attrs, defStyleAttr, 0);
|
super(context, attrs, defStyleAttr);
|
||||||
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BluetoothProgressCategory(Context context, AttributeSet attrs, int defStyleAttr,
|
public BluetoothProgressCategory(Context context, AttributeSet attrs, int defStyleAttr,
|
||||||
int defStyleRes) {
|
int defStyleRes) {
|
||||||
super(context, attrs, defStyleAttr, defStyleRes);
|
super(context, attrs, defStyleAttr, defStyleRes);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init() {
|
||||||
|
setIcon(R.drawable.ic_settings_bluetooth);
|
||||||
setEmptyTextRes(R.string.bluetooth_no_devices_found);
|
setEmptyTextRes(R.string.bluetooth_no_devices_found);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -161,13 +161,13 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem
|
|||||||
@Override
|
@Override
|
||||||
void addPreferencesForActivity() {
|
void addPreferencesForActivity() {
|
||||||
addPreferencesFromResource(R.xml.bluetooth_settings);
|
addPreferencesFromResource(R.xml.bluetooth_settings);
|
||||||
|
final Context prefContext = getPrefContext();
|
||||||
mPairedDevicesCategory = new PreferenceCategory(getPrefContext());
|
mPairedDevicesCategory = new PreferenceCategory(prefContext);
|
||||||
mPairedDevicesCategory.setKey(KEY_PAIRED_DEVICES);
|
mPairedDevicesCategory.setKey(KEY_PAIRED_DEVICES);
|
||||||
mPairedDevicesCategory.setOrder(1);
|
mPairedDevicesCategory.setOrder(1);
|
||||||
getPreferenceScreen().addPreference(mPairedDevicesCategory);
|
getPreferenceScreen().addPreference(mPairedDevicesCategory);
|
||||||
|
|
||||||
mAvailableDevicesCategory = new BluetoothProgressCategory(getActivity());
|
mAvailableDevicesCategory = new BluetoothProgressCategory(prefContext);
|
||||||
mAvailableDevicesCategory.setSelectable(false);
|
mAvailableDevicesCategory.setSelectable(false);
|
||||||
mAvailableDevicesCategory.setOrder(2);
|
mAvailableDevicesCategory.setOrder(2);
|
||||||
getPreferenceScreen().addPreference(mAvailableDevicesCategory);
|
getPreferenceScreen().addPreference(mAvailableDevicesCategory);
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import android.os.Looper;
|
|||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.provider.Settings.Global;
|
import android.provider.Settings.Global;
|
||||||
|
import android.support.v4.content.res.TypedArrayUtils;
|
||||||
import android.support.v7.preference.PreferenceViewHolder;
|
import android.support.v7.preference.PreferenceViewHolder;
|
||||||
import android.telephony.SubscriptionInfo;
|
import android.telephony.SubscriptionInfo;
|
||||||
import android.telephony.SubscriptionManager;
|
import android.telephony.SubscriptionManager;
|
||||||
@@ -53,7 +54,9 @@ public class CellDataPreference extends CustomDialogPreference implements Templa
|
|||||||
private SubscriptionManager mSubscriptionManager;
|
private SubscriptionManager mSubscriptionManager;
|
||||||
|
|
||||||
public CellDataPreference(Context context, AttributeSet attrs) {
|
public CellDataPreference(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs, android.R.attr.switchPreferenceStyle);
|
super(context, attrs, TypedArrayUtils.getAttr(context,
|
||||||
|
android.support.v7.preference.R.attr.switchPreferenceStyle,
|
||||||
|
android.R.attr.switchPreferenceStyle));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -46,14 +46,6 @@ import java.lang.ref.WeakReference;
|
|||||||
import static android.content.Context.CONNECTIVITY_SERVICE;
|
import static android.content.Context.CONNECTIVITY_SERVICE;
|
||||||
import static android.content.Context.WIFI_SERVICE;
|
import static android.content.Context.WIFI_SERVICE;
|
||||||
|
|
||||||
/**
|
|
||||||
* Display the following information
|
|
||||||
* # Battery Strength : TODO
|
|
||||||
* # Uptime
|
|
||||||
* # Awake Time
|
|
||||||
* # XMPP/buzz/tickle status : TODO
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class Status extends SettingsPreferenceFragment {
|
public class Status extends SettingsPreferenceFragment {
|
||||||
|
|
||||||
private static final String KEY_BATTERY_STATUS = "battery_status";
|
private static final String KEY_BATTERY_STATUS = "battery_status";
|
||||||
|
|||||||
Reference in New Issue
Block a user