Depend on support lib preferences
Bug: 24576551
Change-Id: Ic6190bacd3f7582c9bbc8de972da4612bd92421e
diff --git a/Android.mk b/Android.mk
index 09ce955..2adad1f 100644
--- a/Android.mk
+++ b/Android.mk
@@ -2,7 +2,14 @@
include $(CLEAR_VARS)
LOCAL_JAVA_LIBRARIES := bouncycastle conscrypt telephony-common ims-common
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-v4 android-support-v13 jsr305
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ android-support-v4 \
+ android-support-v13 \
+ android-support-v7-recyclerview \
+ android-support-v7-preference \
+ android-support-v7-appcompat \
+ android-support-v14-preference \
+ jsr305
LOCAL_MODULE_TAGS := optional
@@ -10,7 +17,11 @@
$(call all-java-files-under, src) \
src/com/android/settings/EventLogTags.logtags
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res \
+ frameworks/support/v7/preference/res \
+ frameworks/support/v14/preference/res \
+ frameworks/support/v7/appcompat/res \
+ frameworks/support/v7/recyclerview/res
LOCAL_PACKAGE_NAME := Settings
LOCAL_CERTIFICATE := platform
@@ -18,6 +29,9 @@
LOCAL_PROGUARD_FLAG_FILES := proguard.flags
+LOCAL_AAPT_FLAGS := --auto-add-overlay \
+ --extra-packages android.support.v7.preference:android.support.v14.preference:android.support.v17.preference:android.support.v7.appcompat:android.support.v7.recyclerview
+
ifneq ($(INCREMENTAL_BUILDS),)
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_JACK_ENABLED := incremental
diff --git a/res/layout/dream_info_row.xml b/res/layout/dream_info_row.xml
index 7ed26cb..1a4dc8e 100644
--- a/res/layout/dream_info_row.xml
+++ b/res/layout/dream_info_row.xml
@@ -13,75 +13,66 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<RelativeLayout 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_height="wrap_content"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
- android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:clickable="true"
+ android:focusable="true"
+ android:orientation="horizontal"
+ android:background="?android:attr/selectableItemBackground" >
- <!-- Dream selectable row (icon, caption, radio button) -->
+ <!-- Dream icon -->
- <RelativeLayout
- android:id="@android:id/widget_frame"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_toStartOf="@+id/divider"
- android:clickable="true"
- android:focusable="true"
- android:background="?android:attr/selectableItemBackground" >
+ <ImageView
+ android:id="@android:id/icon"
+ android:layout_width="@android:dimen/app_icon_size"
+ android:layout_height="@android:dimen/app_icon_size"
+ android:layout_centerVertical="true"
+ android:layout_marginBottom="10dp"
+ android:layout_marginStart="0dp"
+ android:layout_marginEnd="6dp"
+ android:layout_marginTop="10dp"
+ android:contentDescription="@null"
+ android:maxHeight="@android:dimen/app_icon_size"
+ android:maxWidth="@android:dimen/app_icon_size"
+ android:scaleType="fitCenter" />
- <!-- Dream icon -->
+ <!-- Dream caption -->
- <ImageView
- android:id="@android:id/icon"
- android:layout_width="@android:dimen/app_icon_size"
- android:layout_height="@android:dimen/app_icon_size"
- android:layout_centerVertical="true"
- android:layout_marginBottom="10dp"
- android:layout_marginStart="0dp"
- android:layout_marginEnd="6dp"
- android:layout_marginTop="10dp"
- android:contentDescription="@null"
- android:maxHeight="@android:dimen/app_icon_size"
- android:maxWidth="@android:dimen/app_icon_size"
- android:scaleType="fitCenter" />
+ <TextView
+ android:id="@android:id/title"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:layout_centerVertical="true"
+ android:ellipsize="end"
+ android:singleLine="true"
+ android:gravity="center_vertical"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textAlignment="viewStart"
+ android:labelFor="@android:id/button2" />
- <!-- Dream caption -->
+ <!-- Dream radio button -->
- <TextView
- android:id="@android:id/title"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_centerVertical="true"
- android:layout_toStartOf="@android:id/button1"
- android:layout_toEndOf="@android:id/icon"
- android:ellipsize="end"
- android:singleLine="true"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textAlignment="viewStart"
- android:labelFor="@android:id/button2" />
-
- <!-- Dream radio button -->
-
- <RadioButton
- android:id="@android:id/button1"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_alignParentEnd="true"
- android:layout_centerVertical="true"
- android:duplicateParentState="true"
- android:clickable="false"
- android:focusable="false" />
- </RelativeLayout>
+ <RadioButton
+ android:id="@android:id/button1"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:layout_alignParentEnd="true"
+ android:layout_centerVertical="true"
+ android:duplicateParentState="true"
+ android:clickable="false"
+ android:focusable="false" />
<!-- Divider -->
<ImageView
- android:id="@id/divider"
+ android:id="@+id/divider"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerVertical="true"
- android:layout_toStartOf="@android:id/button2"
android:contentDescription="@null"
android:src="@drawable/nav_divider" />
@@ -91,9 +82,6 @@
android:id="@android:id/button2"
android:layout_width="wrap_content"
android:layout_height="match_parent"
- android:layout_alignBottom="@android:id/widget_frame"
- android:layout_alignParentEnd="true"
- android:layout_alignTop="@android:id/widget_frame"
android:layout_centerVertical="true"
android:layout_margin="0dip"
android:background="?android:attr/selectableItemBackground"
@@ -103,4 +91,4 @@
android:focusable="true"
android:src="@drawable/ic_bt_config" />
-</RelativeLayout>
+</LinearLayout>
diff --git a/res/layout/layout_preference_frame.xml b/res/layout/layout_preference_frame.xml
new file mode 100644
index 0000000..eec3d7a
--- /dev/null
+++ b/res/layout/layout_preference_frame.xml
@@ -0,0 +1,18 @@
+<!--
+ 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.
+-->
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
diff --git a/res/layout/notification_log_row.xml b/res/layout/notification_log_row.xml
index cf8b112..d7f57c6 100644
--- a/res/layout/notification_log_row.xml
+++ b/res/layout/notification_log_row.xml
@@ -120,4 +120,4 @@
/>
</LinearLayout>
-</LinearLayout>
\ No newline at end of file
+</LinearLayout>
diff --git a/res/layout/preference_list_fragment.xml b/res/layout/preference_list_fragment.xml
index 2e9299c..7eb1511 100644
--- a/res/layout/preference_list_fragment.xml
+++ b/res/layout/preference_list_fragment.xml
@@ -29,11 +29,13 @@
android:layout_height="wrap_content"
android:visibility="gone" />
- <FrameLayout android:layout_height="0px"
+ <FrameLayout
+ android:id="@id/list_container"
+ android:layout_height="0px"
android:layout_weight="1"
android:layout_width="match_parent">
- <ListView android:id="@android:id/list"
+ <ListView android:id="@+id/backup_list"
style="@style/PreferenceFragmentListSinglePane"
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -45,6 +47,7 @@
android:clipToPadding="false"
android:drawSelectorOnTop="false"
android:elevation="@dimen/dashboard_category_elevation"
+ android:visibility="gone"
android:scrollbarAlwaysDrawVerticalTrack="true" />
<include layout="@layout/loading_container" />
diff --git a/res/layout/preference_material_settings.xml b/res/layout/preference_material_settings.xml
index f2dd2e1..b8a00f2 100644
--- a/res/layout/preference_material_settings.xml
+++ b/res/layout/preference_material_settings.xml
@@ -27,7 +27,7 @@
android:clipToPadding="false">
<LinearLayout
- android:id="@*android:id/icon_frame"
+ android:id="@id/icon_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="60dp"
diff --git a/res/layout/space_preference.xml b/res/layout/space_preference.xml
new file mode 100644
index 0000000..78f3637
--- /dev/null
+++ b/res/layout/space_preference.xml
@@ -0,0 +1,18 @@
+<!--
+ 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.
+-->
+<Space xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index a08b2e8..62c34ea 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -19,7 +19,7 @@
<attr name="state_encrypted" format="boolean" />
</declare-styleable>
<declare-styleable name="IconPreferenceScreen">
- <attr name="icon" format="reference" />
+ <attr name="icon" />
</declare-styleable>
<declare-styleable name="BatteryHistoryChart">
diff --git a/res/values/themes.xml b/res/values/themes.xml
index b1bf390..0aac316 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -89,6 +89,7 @@
<style name="Theme.SettingsBase" parent="@android:style/Theme.Material.Settings" />
<style name="Theme.Settings" parent="Theme.SettingsBase">
+ <item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
<item name="@*android:preferenceStyle">@style/Preference</item>
<item name="@*android:preferenceHeaderPanelStyle">@style/PreferenceHeaderPanelSinglePane</item>
<item name="@*android:preferencePanelStyle">@style/PreferencePanelSinglePane</item>
@@ -171,6 +172,7 @@
</style>
<style name="Theme.SubSettingsDialogWhenLarge" parent="Theme.DialogWhenLarge">
+ <item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
<item name="android:actionBarWidgetTheme">@null</item>
<item name="android:actionBarTheme">@android:style/ThemeOverlay.Material.Dark.ActionBar</item>
@@ -188,7 +190,7 @@
<item name="android:actionBarStyle">@style/Theme.ActionBar</item>
</style>
- <style name="Theme.NotificationStation" parent="@android:style/Theme.Material">
+ <style name="Theme.NotificationStation" parent="@style/Theme.Settings">
<!-- Redefine the ActionBar style for contentInsetStart -->
<item name="android:actionBarStyle">@style/Theme.ActionBar.SubSettings</item>
<item name="@*android:actionBarSize">@dimen/actionbar_size</item>
diff --git a/res/xml/device_info_settings.xml b/res/xml/device_info_settings.xml
index 1372ce7..e52712d 100644
--- a/res/xml/device_info_settings.xml
+++ b/res/xml/device_info_settings.xml
@@ -67,49 +67,57 @@
<!-- Device hardware model -->
<Preference android:key="device_model"
- style="?android:preferenceInformationStyle"
+ android:enabled="false"
+ android:shouldDisableView="false"
android:title="@string/model_number"
android:summary="@string/device_info_default"/>
<!-- Device firmware version -->
<Preference android:key="firmware_version"
- style="?android:preferenceInformationStyle"
+ android:enabled="false"
+ android:shouldDisableView="false"
android:title="@string/firmware_version"
android:summary="@string/device_info_default"/>
<!-- Security patch level -->
<Preference android:key="security_patch"
- style="?android:preferenceInformationStyle"
+ android:enabled="false"
+ android:shouldDisableView="false"
android:title="@string/security_patch"
android:summary="@string/device_info_default"/>
<!-- Device FCC equipment id -->
<Preference android:key="fcc_equipment_id"
- style="?android:preferenceInformationStyle"
+ android:enabled="false"
+ android:shouldDisableView="false"
android:title="@string/fcc_equipment_id"
android:summary="@string/device_info_default"/>
<!-- Device Baseband version -->
<Preference android:key="baseband_version"
- style="?android:preferenceInformationStyle"
+ android:enabled="false"
+ android:shouldDisableView="false"
android:title="@string/baseband_version"
android:summary="@string/device_info_default"/>
<!-- Device Kernel version -->
<Preference android:key="kernel_version"
- style="?android:preferenceInformationStyle"
+ android:enabled="false"
+ android:shouldDisableView="false"
android:title="@string/kernel_version"
android:summary="@string/device_info_default"/>
<!-- Detailed build version -->
<Preference android:key="build_number"
- style="?android:preferenceInformationStyle"
+ android:enabled="false"
+ android:shouldDisableView="false"
android:title="@string/build_number"
android:summary="@string/device_info_default"/>
<!-- SELinux status information -->
<Preference android:key="selinux_status"
- style="?android:preferenceInformationStyle"
+ android:enabled="false"
+ android:shouldDisableView="false"
android:title="@string/selinux_status"
android:summary="@string/selinux_status_enforcing"/>
diff --git a/res/xml/device_info_sim_status.xml b/res/xml/device_info_sim_status.xml
index 9e9444d..71fd5c6 100644
--- a/res/xml/device_info_sim_status.xml
+++ b/res/xml/device_info_sim_status.xml
@@ -18,61 +18,71 @@
android:title="@string/sim_status_title">
<Preference android:key="operator_name"
- style="?android:attr/preferenceInformationStyle"
+ android:enabled="false"
+ android:shouldDisableView="false"
android:title="@string/status_operator"
android:summary="@string/device_info_not_available"
android:persistent="false" />
<Preference android:key="signal_strength"
- style="?android:attr/preferenceInformationStyle"
+ android:enabled="false"
+ android:shouldDisableView="false"
android:title="@string/status_signal_strength"
android:summary="@string/device_info_not_available"
android:persistent="false" />
<Preference android:key="network_type"
- style="?android:attr/preferenceInformationStyle"
+ android:enabled="false"
+ android:shouldDisableView="false"
android:title="@string/status_network_type"
android:summary="@string/device_info_not_available"
android:persistent="false" />
<Preference android:key="latest_area_info"
- style="?android:attr/preferenceInformationStyle"
+ android:enabled="false"
+ android:shouldDisableView="false"
android:title="@string/status_latest_area_info"
android:summary="@string/device_info_not_available"
android:persistent="false" />
<Preference android:key="service_state"
- style="?android:attr/preferenceInformationStyle"
+ android:enabled="false"
+ android:shouldDisableView="false"
android:title="@string/status_service_state"
android:summary="@string/device_info_not_available"
android:persistent="false" />
<Preference android:key="roaming_state"
- style="?android:attr/preferenceInformationStyle"
+ android:enabled="false"
+ android:shouldDisableView="false"
android:title="@string/status_roaming"
android:summary="@string/device_info_not_available"
android:persistent="false" />
<Preference android:key="data_state"
- style="?android:attr/preferenceInformationStyle"
+ android:enabled="false"
+ android:shouldDisableView="false"
android:title="@string/status_data_state"
android:summary="@string/device_info_not_available"
android:persistent="false" />
<Preference android:key="number"
- style="?android:attr/preferenceInformationStyle"
+ android:enabled="false"
+ android:shouldDisableView="false"
android:title="@string/status_number"
android:summary="@string/device_info_not_available"
android:persistent="false" />
<Preference android:key="imei"
- style="?android:attr/preferenceInformationStyle"
+ android:enabled="false"
+ android:shouldDisableView="false"
android:title="@string/status_imei"
android:summary="@string/device_info_not_available"
android:persistent="false" />
<Preference android:key="imei_sv"
- style="?android:attr/preferenceInformationStyle"
+ android:enabled="false"
+ android:shouldDisableView="false"
android:title="@string/status_imei_sv"
android:summary="@string/device_info_not_available"
android:persistent="false" />
diff --git a/res/xml/device_info_status.xml b/res/xml/device_info_status.xml
index fc6016f..2cb5c6d 100644
--- a/res/xml/device_info_status.xml
+++ b/res/xml/device_info_status.xml
@@ -17,13 +17,15 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/device_status_activity_title">
- <Preference android:key="battery_status"
- style="?android:attr/preferenceInformationStyle"
+ <com.android.settings.CopyablePreference android:key="battery_status"
+ android:enabled="false"
+ android:shouldDisableView="false"
android:title="@string/battery_status_title"
android:summary="@string/device_info_not_available"
android:persistent="false" />
- <Preference android:key="battery_level"
- style="?android:attr/preferenceInformationStyle"
+ <com.android.settings.CopyablePreference android:key="battery_level"
+ android:enabled="false"
+ android:shouldDisableView="false"
android:title="@string/battery_level_title"
android:summary="@string/device_info_not_available"
android:persistent="false" />
@@ -39,33 +41,39 @@
<intent android:targetPackage="com.android.settings"
android:targetClass="com.android.settings.deviceinfo.ImeiInformation" />
</PreferenceScreen>
- <Preference android:key="wifi_ip_address"
- style="?android:attr/preferenceInformationStyle"
+ <com.android.settings.CopyablePreference android:key="wifi_ip_address"
+ android:enabled="false"
+ android:shouldDisableView="false"
android:title="@string/wifi_advanced_ip_address_title"
android:summary="@string/device_info_not_available"
android:persistent="false" />
- <Preference android:key="wifi_mac_address"
- style="?android:attr/preferenceInformationStyle"
+ <com.android.settings.CopyablePreference android:key="wifi_mac_address"
+ android:enabled="false"
+ android:shouldDisableView="false"
android:title="@string/status_wifi_mac_address"
android:summary="@string/device_info_not_available"
android:persistent="false" />
- <Preference android:key="bt_address"
- style="?android:attr/preferenceInformationStyle"
+ <com.android.settings.CopyablePreference android:key="bt_address"
+ android:enabled="false"
+ android:shouldDisableView="false"
android:title="@string/status_bt_address"
android:summary="@string/device_info_not_available"
android:persistent="false" />
- <Preference android:key="serial_number"
- style="?android:attr/preferenceInformationStyle"
+ <com.android.settings.CopyablePreference android:key="serial_number"
+ android:enabled="false"
+ android:shouldDisableView="false"
android:title="@string/status_serial_number"
android:summary="@string/device_info_not_available"
android:persistent="false" />
- <Preference android:key="up_time"
- style="?android:attr/preferenceInformationStyle"
+ <com.android.settings.CopyablePreference android:key="up_time"
+ android:enabled="false"
+ android:shouldDisableView="false"
android:title="@string/status_up_time"
android:summary="@string/device_info_not_available"
android:persistent="false" />
- <Preference android:key="wimax_mac_address"
- style="?android:attr/preferenceInformationStyle"
+ <com.android.settings.CopyablePreference android:key="wimax_mac_address"
+ android:enabled="false"
+ android:shouldDisableView="false"
android:title="@string/status_wimax_mac_address"
android:summary="@string/device_info_not_available"
android:persistent="false" />
diff --git a/res/xml/print_job_settings.xml b/res/xml/print_job_settings.xml
index a78cec1..5550478 100644
--- a/res/xml/print_job_settings.xml
+++ b/res/xml/print_job_settings.xml
@@ -24,7 +24,8 @@
<Preference
android:key="print_job_message_preference"
- android:layout="@layout/print_job_summary">
+ android:layout="@layout/print_job_summary"
+ android:selectable="false">
</Preference>
</PreferenceScreen>
diff --git a/res/xml/security_settings_encrypted.xml b/res/xml/security_settings_encrypted.xml
index 2399243..391f0fe 100644
--- a/res/xml/security_settings_encrypted.xml
+++ b/res/xml/security_settings_encrypted.xml
@@ -22,7 +22,8 @@
android:title="@string/crypt_keeper_settings_title">
<Preference
- style="?android:preferenceInformationStyle"
+ android:enabled="false"
+ android:shouldDisableView="false"
android:key="crypt_keeper_encrypt_title"
android:title="@string/crypt_keeper_encrypt_title"
android:summary="@string/crypt_keeper_encrypted_summary"/>
diff --git a/res/xml/security_settings_misc.xml b/res/xml/security_settings_misc.xml
index a010a88..62b6fa3 100644
--- a/res/xml/security_settings_misc.xml
+++ b/res/xml/security_settings_misc.xml
@@ -66,7 +66,8 @@
<Preference android:key="credential_storage_type"
android:title="@string/credential_storage_type"
- style="?android:attr/preferenceInformationStyle"
+ android:enabled="false"
+ android:shouldDisableView="false"
android:persistent="false" />
<Preference android:key="trusted_credentials"
diff --git a/res/xml/tts_settings.xml b/res/xml/tts_settings.xml
index ab132df..3e5e097 100644
--- a/res/xml/tts_settings.xml
+++ b/res/xml/tts_settings.xml
@@ -39,7 +39,8 @@
android:summary="@string/tts_play_example_summary" />
<Preference android:key="tts_status"
- style="?android:attr/preferenceInformationStyle"
+ android:enabled="false"
+ android:shouldDisableView="false"
android:persistent="false"
android:title="@string/tts_status_title"/>
</PreferenceScreen>
diff --git a/src/com/android/settings/AccessiblePreferenceCategory.java b/src/com/android/settings/AccessiblePreferenceCategory.java
index 7784c16..7145999 100644
--- a/src/com/android/settings/AccessiblePreferenceCategory.java
+++ b/src/com/android/settings/AccessiblePreferenceCategory.java
@@ -17,8 +17,8 @@
package com.android.settings;
import android.content.Context;
-import android.preference.PreferenceCategory;
-import android.view.View;
+import android.support.v7.preference.PreferenceCategory;
+import android.support.v7.preference.PreferenceViewHolder;
/**
* Preference category that accepts a content description for accessibility.
@@ -35,9 +35,9 @@
}
@Override
- protected void onBindView(View view) {
- super.onBindView(view);
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
- view.setContentDescription(mContentDescription);
+ view.itemView.setContentDescription(mContentDescription);
}
}
diff --git a/src/com/android/settings/AccountPreference.java b/src/com/android/settings/AccountPreference.java
index 64685c0..fe39244 100644
--- a/src/com/android/settings/AccountPreference.java
+++ b/src/com/android/settings/AccountPreference.java
@@ -16,16 +16,16 @@
package com.android.settings;
-import java.util.ArrayList;
-
import android.accounts.Account;
import android.content.Context;
import android.graphics.drawable.Drawable;
-import android.preference.Preference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceViewHolder;
import android.util.Log;
-import android.view.View;
import android.widget.ImageView;
+import java.util.ArrayList;
+
/**
* AccountPreference is used to display a username, status and provider icon for an account on
* the device.
@@ -68,8 +68,8 @@
}
@Override
- protected void onBindView(View view) {
- super.onBindView(view);
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
if (!mShowTypeIcon) {
mSyncStatusIcon = (ImageView) view.findViewById(android.R.id.icon);
mSyncStatusIcon.setImageResource(getSyncStatusIcon(mStatus));
diff --git a/src/com/android/settings/ActivityPicker.java b/src/com/android/settings/ActivityPicker.java
index 7c26923..2c3436f 100644
--- a/src/com/android/settings/ActivityPicker.java
+++ b/src/com/android/settings/ActivityPicker.java
@@ -16,22 +16,18 @@
package com.android.settings;
-import android.graphics.ColorFilter;
-import android.util.DisplayMetrics;
-import com.android.internal.app.AlertActivity;
-import com.android.internal.app.AlertController;
-
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.Intent.ShortcutIconResource;
import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
import android.content.pm.PackageManager.NameNotFoundException;
+import android.content.pm.ResolveInfo;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
+import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.PaintFlagsDrawFilter;
import android.graphics.PixelFormat;
@@ -41,12 +37,16 @@
import android.graphics.drawable.PaintDrawable;
import android.os.Bundle;
import android.os.Parcelable;
+import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
+import com.android.internal.app.AlertActivity;
+import com.android.internal.app.AlertController;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
diff --git a/src/com/android/settings/AirplaneModeEnabler.java b/src/com/android/settings/AirplaneModeEnabler.java
index 39f6114..6cc0d60 100644
--- a/src/com/android/settings/AirplaneModeEnabler.java
+++ b/src/com/android/settings/AirplaneModeEnabler.java
@@ -23,9 +23,9 @@
import android.os.Message;
import android.os.SystemProperties;
import android.os.UserHandle;
-import android.preference.Preference;
-import android.preference.SwitchPreference;
import android.provider.Settings;
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.Preference;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.telephony.PhoneStateIntentReceiver;
diff --git a/src/com/android/settings/ApnEditor.java b/src/com/android/settings/ApnEditor.java
index 8299c67..e785abb 100644
--- a/src/com/android/settings/ApnEditor.java
+++ b/src/com/android/settings/ApnEditor.java
@@ -26,13 +26,12 @@
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
-import android.preference.EditTextPreference;
-import android.preference.ListPreference;
-import android.preference.MultiSelectListPreference;
-import android.preference.Preference;
-import android.preference.PreferenceActivity;
-import android.preference.SwitchPreference;
import android.provider.Telephony;
+import android.support.v14.preference.MultiSelectListPreference;
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.EditTextPreference;
+import android.support.v7.preference.ListPreference;
+import android.support.v7.preference.Preference;
import android.telephony.ServiceState;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
@@ -41,6 +40,7 @@
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
+
import com.android.internal.logging.MetricsLogger;
import java.util.HashSet;
diff --git a/src/com/android/settings/ApnPreference.java b/src/com/android/settings/ApnPreference.java
index 1e29d22..a6ab8b7 100644
--- a/src/com/android/settings/ApnPreference.java
+++ b/src/com/android/settings/ApnPreference.java
@@ -20,12 +20,12 @@
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
-import android.preference.Preference;
import android.provider.Telephony;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceViewHolder;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
-import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.CompoundButton;
import android.widget.RadioButton;
@@ -53,8 +53,8 @@
private boolean mSelectable = true;
@Override
- public View getView(View convertView, ViewGroup parent) {
- View view = super.getView(convertView, parent);
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
View widget = view.findViewById(R.id.apn_radiobutton);
if ((widget != null) && widget instanceof RadioButton) {
@@ -81,8 +81,6 @@
if ((textLayout != null) && textLayout instanceof RelativeLayout) {
textLayout.setOnClickListener(this);
}
-
- return view;
}
public boolean isChecked() {
diff --git a/src/com/android/settings/ApnSettings.java b/src/com/android/settings/ApnSettings.java
index 67069c6..df5179f 100644
--- a/src/com/android/settings/ApnSettings.java
+++ b/src/com/android/settings/ApnSettings.java
@@ -34,15 +34,15 @@
import android.os.Looper;
import android.os.Message;
import android.os.PersistableBundle;
-import android.os.UserHandle;
import android.os.UserManager;
-import android.preference.Preference;
-import android.preference.PreferenceGroup;
-import android.preference.PreferenceScreen;
import android.provider.Telephony;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceGroup;
+import android.support.v7.preference.PreferenceScreen;
import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
+import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
import android.view.Menu;
@@ -58,8 +58,6 @@
import com.android.internal.telephony.uicc.IccRecords;
import com.android.internal.telephony.uicc.UiccController;
-import android.telephony.TelephonyManager;
-
import java.util.ArrayList;
public class ApnSettings extends SettingsPreferenceFragment implements
@@ -180,19 +178,17 @@
TextView empty = (TextView) getView().findViewById(android.R.id.empty);
if (empty != null) {
empty.setText(R.string.apn_settings_not_available);
- getListView().setEmptyView(empty);
+ setEmptyView(empty);
}
if (mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)
|| !mUm.isAdminUser()) {
mUnavailable = true;
- setPreferenceScreen(new PreferenceScreen(getActivity(), null));
+ setPreferenceScreen(new PreferenceScreen(getPrefContext(), null));
return;
}
addPreferencesFromResource(R.xml.apn_settings);
-
- getListView().setItemsCanFocus(true);
}
@Override
@@ -270,7 +266,7 @@
String mvnoType = cursor.getString(MVNO_TYPE_INDEX);
String mvnoMatchData = cursor.getString(MVNO_MATCH_DATA_INDEX);
- ApnPreference pref = new ApnPreference(getActivity());
+ ApnPreference pref = new ApnPreference(getPrefContext());
pref.setKey(key);
pref.setTitle(name);
@@ -365,7 +361,7 @@
}
@Override
- public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
+ public boolean onPreferenceTreeClick(Preference preference) {
int pos = Integer.parseInt(preference.getKey());
Uri url = ContentUris.withAppendedId(Telephony.Carriers.CONTENT_URI, pos);
startActivity(new Intent(Intent.ACTION_EDIT, url));
diff --git a/src/com/android/settings/AppListPreference.java b/src/com/android/settings/AppListPreference.java
index d5e0c3b..c480d5a 100644
--- a/src/com/android/settings/AppListPreference.java
+++ b/src/com/android/settings/AppListPreference.java
@@ -17,15 +17,15 @@
package com.android.settings;
import android.app.Activity;
-import android.app.AlertDialog.Builder;
+import android.app.AlertDialog;
import android.content.Context;
+import android.content.DialogInterface;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.graphics.drawable.Drawable;
import android.os.Parcel;
import android.os.Parcelable;
-import android.preference.ListPreference;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
@@ -43,7 +43,7 @@
* because the names of applications are very similar and the user may not be able to determine what
* app they are selecting without an icon.
*/
-public class AppListPreference extends ListPreference {
+public class AppListPreference extends CustomListPreference {
public static final String ITEM_NONE_VALUE = "";
@@ -63,7 +63,7 @@
@Override
public View getView(int position, View convertView, ViewGroup parent) {
- LayoutInflater inflater = ((Activity)getContext()).getLayoutInflater();
+ LayoutInflater inflater = LayoutInflater.from(getContext());
View view = inflater.inflate(R.layout.app_preference_item, parent, false);
TextView textView = (TextView) view.findViewById(R.id.app_label);
textView.setText(getItem(position));
@@ -141,9 +141,9 @@
}
@Override
- protected void onPrepareDialogBuilder(Builder builder) {
- builder.setAdapter(createListAdapter(), this);
- super.onPrepareDialogBuilder(builder);
+ protected void onPrepareDialogBuilder(AlertDialog.Builder builder,
+ DialogInterface.OnClickListener listener) {
+ builder.setAdapter(createListAdapter(), listener);
}
@Override
diff --git a/src/com/android/settings/AppListPreferenceWithSettings.java b/src/com/android/settings/AppListPreferenceWithSettings.java
index bbbd332..f14b982 100644
--- a/src/com/android/settings/AppListPreferenceWithSettings.java
+++ b/src/com/android/settings/AppListPreferenceWithSettings.java
@@ -3,6 +3,7 @@
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
+import android.support.v7.preference.PreferenceViewHolder;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
@@ -21,8 +22,8 @@
}
@Override
- protected void onBindView(View view) {
- super.onBindView(view);
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
mSettingsIcon = view.findViewById(R.id.settings_button);
mSettingsIcon.setOnClickListener(new View.OnClickListener() {
diff --git a/src/com/android/settings/AppListSwitchPreference.java b/src/com/android/settings/AppListSwitchPreference.java
index f9f1ba0..cb656d1 100644
--- a/src/com/android/settings/AppListSwitchPreference.java
+++ b/src/com/android/settings/AppListSwitchPreference.java
@@ -1,10 +1,9 @@
package com.android.settings;
import android.content.Context;
-import android.os.Bundle;
+import android.support.v7.preference.PreferenceViewHolder;
import android.util.AttributeSet;
import android.util.Log;
-import android.view.View;
import android.widget.Checkable;
/**
@@ -23,14 +22,14 @@
}
@Override
- protected void onBindView(View view) {
- super.onBindView(view);
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
mSwitch = (Checkable) view.findViewById(com.android.internal.R.id.switchWidget);
mSwitch.setChecked(getValue() != null);
}
@Override
- protected void showDialog(Bundle state) {
+ protected void onClick() {
if (getValue() != null) {
// Turning off the current value.
if (callChangeListener(null)) {
@@ -45,7 +44,7 @@
setValue(value);
}
} else {
- super.showDialog(state);
+ super.onClick();
}
}
diff --git a/src/com/android/settings/AppPicker.java b/src/com/android/settings/AppPicker.java
index 04e48ff..3c85bf5 100644
--- a/src/com/android/settings/AppPicker.java
+++ b/src/com/android/settings/AppPicker.java
@@ -16,20 +16,12 @@
package com.android.settings;
-import java.text.Collator;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import android.content.pm.PackageInfo;
-import android.content.pm.PackageManager;
-import com.android.settings.applications.AppViewHolder;
-
import android.app.ListActivity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.os.Process;
@@ -39,6 +31,14 @@
import android.widget.ArrayAdapter;
import android.widget.ListView;
+import com.android.settings.applications.AppViewHolder;
+
+import java.text.Collator;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
public class AppPicker extends ListActivity {
private AppListAdapter mAdapter;
diff --git a/src/com/android/settings/AppProgressPreference.java b/src/com/android/settings/AppProgressPreference.java
index cd157d1..1329878 100644
--- a/src/com/android/settings/AppProgressPreference.java
+++ b/src/com/android/settings/AppProgressPreference.java
@@ -16,8 +16,8 @@
package com.android.settings;
import android.content.Context;
+import android.support.v7.preference.PreferenceViewHolder;
import android.util.AttributeSet;
-import android.view.View;
import android.widget.ProgressBar;
public class AppProgressPreference extends TintablePreference {
@@ -36,8 +36,8 @@
}
@Override
- protected void onBindView(View view) {
- super.onBindView(view);
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
final ProgressBar progress = (ProgressBar) view.findViewById(android.R.id.progress);
progress.setProgress(mProgress);
diff --git a/src/com/android/settings/ApplicationSettings.java b/src/com/android/settings/ApplicationSettings.java
index 9e010b6..486b8c0 100644
--- a/src/com/android/settings/ApplicationSettings.java
+++ b/src/com/android/settings/ApplicationSettings.java
@@ -18,16 +18,16 @@
import android.content.Intent;
import android.os.Bundle;
-import android.preference.CheckBoxPreference;
-import android.preference.ListPreference;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceChangeListener;
-import android.preference.PreferenceScreen;
import android.provider.Settings;
+import android.support.v7.preference.CheckBoxPreference;
+import android.support.v7.preference.ListPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceChangeListener;
+
import com.android.internal.logging.MetricsLogger;
public class ApplicationSettings extends SettingsPreferenceFragment {
-
+
private static final String KEY_TOGGLE_ADVANCED_SETTINGS = "toggle_advanced_settings";
private static final String KEY_APP_INSTALL_LOCATION = "app_install_location";
@@ -101,17 +101,17 @@
}
@Override
- public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
+ public boolean onPreferenceTreeClick(Preference preference) {
if (preference == mToggleAdvancedSettings) {
boolean value = mToggleAdvancedSettings.isChecked();
setAdvancedSettingsEnabled(value);
}
- return super.onPreferenceTreeClick(preferenceScreen, preference);
+ return super.onPreferenceTreeClick(preference);
}
private boolean isAdvancedSettingsEnabled() {
- return Settings.System.getInt(getContentResolver(),
+ return Settings.System.getInt(getContentResolver(),
Settings.System.ADVANCED_SETTINGS,
Settings.System.ADVANCED_SETTINGS_DEFAULT) > 0;
}
diff --git a/src/com/android/settings/BandMode.java b/src/com/android/settings/BandMode.java
index 81e8b49..c145381 100644
--- a/src/com/android/settings/BandMode.java
+++ b/src/com/android/settings/BandMode.java
@@ -2,20 +2,21 @@
import android.app.Activity;
import android.app.AlertDialog;
+import android.content.DialogInterface;
+import android.os.AsyncResult;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.util.Log;
+import android.view.View;
+import android.view.Window;
+import android.view.WindowManager;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
+
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneFactory;
-import android.os.Bundle;
-import android.os.Message;
-import android.os.Handler;
-import android.os.AsyncResult;
-import android.util.Log;
-import android.content.DialogInterface;
-import android.view.View;
-import android.view.WindowManager;
-import android.view.Window;
-import android.widget.ListView;
-import android.widget.ArrayAdapter;
-import android.widget.AdapterView;
/**
diff --git a/src/com/android/settings/BrightnessPreference.java b/src/com/android/settings/BrightnessPreference.java
index 7d60e7f..af17bb1 100644
--- a/src/com/android/settings/BrightnessPreference.java
+++ b/src/com/android/settings/BrightnessPreference.java
@@ -19,7 +19,7 @@
import android.content.Context;
import android.content.Intent;
import android.os.UserHandle;
-import android.preference.Preference;
+import android.support.v7.preference.Preference;
import android.util.AttributeSet;
public class BrightnessPreference extends Preference {
diff --git a/src/com/android/settings/BugreportPreference.java b/src/com/android/settings/BugreportPreference.java
index ba58ef4..24af284 100644
--- a/src/com/android/settings/BugreportPreference.java
+++ b/src/com/android/settings/BugreportPreference.java
@@ -19,41 +19,23 @@
import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.DialogInterface;
-import android.os.Bundle;
import android.os.SystemProperties;
-import android.preference.DialogPreference;
import android.util.AttributeSet;
-import android.view.View;
-public class BugreportPreference extends DialogPreference {
+public class BugreportPreference extends CustomDialogPreference {
public BugreportPreference(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
- protected void onPrepareDialogBuilder(Builder builder) {
- super.onPrepareDialogBuilder(builder);
- builder.setPositiveButton(com.android.internal.R.string.report, this);
+ protected void onPrepareDialogBuilder(Builder builder, DialogInterface.OnClickListener listener) {
+ super.onPrepareDialogBuilder(builder, listener);
+ builder.setPositiveButton(com.android.internal.R.string.report, listener);
builder.setMessage(com.android.internal.R.string.bugreport_message);
}
@Override
- protected void showDialog(Bundle state) {
- super.showDialog(state);
- }
-
- @Override
- protected void onBindDialogView(View view) {
- super.onBindDialogView(view);
- }
-
- @Override
- protected void onDialogClosed(boolean positiveResult) {
- super.onDialogClosed(positiveResult);
- }
-
- @Override
- public void onClick(DialogInterface dialog, int which) {
+ protected void onClick(DialogInterface dialog, int which) {
if (which == DialogInterface.BUTTON_POSITIVE) {
SystemProperties.set("ctl.start", "bugreport");
}
diff --git a/src/com/android/settings/CancellablePreference.java b/src/com/android/settings/CancellablePreference.java
index ab723ca..eb67f87 100644
--- a/src/com/android/settings/CancellablePreference.java
+++ b/src/com/android/settings/CancellablePreference.java
@@ -16,7 +16,8 @@
package com.android.settings;
import android.content.Context;
-import android.preference.Preference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceViewHolder;
import android.util.AttributeSet;
import android.view.View;
import android.view.View.OnClickListener;
@@ -47,8 +48,8 @@
}
@Override
- protected void onBindView(View view) {
- super.onBindView(view);
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
ImageView cancel = (ImageView) view.findViewById(R.id.cancel);
cancel.setVisibility(mCancellable ? View.VISIBLE : View.INVISIBLE);
diff --git a/src/com/android/settings/ChooseLockGeneric.java b/src/com/android/settings/ChooseLockGeneric.java
index 8c0b0b6..6fb7579 100644
--- a/src/com/android/settings/ChooseLockGeneric.java
+++ b/src/com/android/settings/ChooseLockGeneric.java
@@ -27,21 +27,19 @@
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
-import android.os.Bundle;
-import android.os.Process;
-import android.os.UserHandle;
-import android.preference.Preference;
-import android.preference.PreferenceScreen;
-import android.security.KeyStore;
import android.hardware.fingerprint.Fingerprint;
import android.hardware.fingerprint.FingerprintManager;
import android.hardware.fingerprint.FingerprintManager.RemovalCallback;
+import android.os.Bundle;
+import android.os.Process;
+import android.os.UserHandle;
+import android.security.KeyStore;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceScreen;
import android.util.EventLog;
import android.util.Log;
-import android.view.LayoutInflater;
import android.view.View;
import android.view.accessibility.AccessibilityManager;
-import android.widget.ListView;
import android.widget.Toast;
import com.android.internal.logging.MetricsLogger;
@@ -181,17 +179,12 @@
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
if (mForFingerprint) {
- final LayoutInflater inflater = LayoutInflater.from(getContext());
- final ListView listView = getListView();
- final View fingerprintHeader = inflater.inflate(
- R.layout.choose_lock_generic_fingerprint_header, listView, false);
- listView.addHeaderView(fingerprintHeader, null, false);
+ setHeaderView(R.layout.choose_lock_generic_fingerprint_header);
}
}
@Override
- public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
- Preference preference) {
+ public boolean onPreferenceTreeClick(Preference preference) {
final String key = preference.getKey();
if (!isUnlockMethodSecure(key) && mLockPatternUtils.isSecure(UserHandle.myUserId())) {
diff --git a/src/com/android/settings/ChooseLockPassword.java b/src/com/android/settings/ChooseLockPassword.java
index 54c3620..3760ef7 100644
--- a/src/com/android/settings/ChooseLockPassword.java
+++ b/src/com/android/settings/ChooseLockPassword.java
@@ -16,14 +16,6 @@
package com.android.settings;
-import com.android.internal.logging.MetricsLogger;
-import com.android.internal.widget.LockPatternUtils;
-import com.android.internal.widget.PasswordEntryKeyboardHelper;
-import com.android.internal.widget.PasswordEntryKeyboardView;
-import com.android.internal.widget.TextViewInputDisabler;
-import com.android.internal.widget.LockPatternUtils.RequestThrottledException;
-import com.android.settings.notification.RedactionInterstitial;
-
import android.app.Activity;
import android.app.Fragment;
import android.app.admin.DevicePolicyManager;
@@ -44,13 +36,21 @@
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
-import android.view.ViewGroup;
import android.view.View.OnClickListener;
+import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
import android.widget.Button;
import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;
+import com.android.internal.logging.MetricsLogger;
+import com.android.internal.widget.LockPatternUtils;
+import com.android.internal.widget.LockPatternUtils.RequestThrottledException;
+import com.android.internal.widget.PasswordEntryKeyboardHelper;
+import com.android.internal.widget.PasswordEntryKeyboardView;
+import com.android.internal.widget.TextViewInputDisabler;
+import com.android.settings.notification.RedactionInterstitial;
+
public class ChooseLockPassword extends SettingsActivity {
public static final String PASSWORD_MIN_KEY = "lockscreen.password_min";
public static final String PASSWORD_MAX_KEY = "lockscreen.password_max";
diff --git a/src/com/android/settings/ChooseLockPattern.java b/src/com/android/settings/ChooseLockPattern.java
index 1dd24f2..99cd033 100644
--- a/src/com/android/settings/ChooseLockPattern.java
+++ b/src/com/android/settings/ChooseLockPattern.java
@@ -16,17 +16,6 @@
package com.android.settings;
-import com.android.internal.logging.MetricsLogger;
-import com.google.android.collect.Lists;
-import com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient;
-import com.android.internal.widget.LockPatternUtils;
-import com.android.internal.widget.LockPatternUtils.RequestThrottledException;
-import com.android.internal.widget.LockPatternView;
-import com.android.internal.widget.LockPatternView.Cell;
-import com.android.settings.notification.RedactionInterstitial;
-
-import static com.android.internal.widget.LockPatternView.DisplayMode;
-
import android.app.Activity;
import android.app.Fragment;
import android.content.Context;
@@ -40,6 +29,16 @@
import android.view.ViewGroup;
import android.widget.TextView;
+import com.android.internal.logging.MetricsLogger;
+import com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient;
+import com.android.internal.widget.LockPatternUtils;
+import com.android.internal.widget.LockPatternUtils.RequestThrottledException;
+import com.android.internal.widget.LockPatternView;
+import com.android.internal.widget.LockPatternView.Cell;
+import com.android.internal.widget.LockPatternView.DisplayMode;
+import com.android.settings.notification.RedactionInterstitial;
+import com.google.android.collect.Lists;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
diff --git a/src/com/android/settings/ChooseLockSettingsHelper.java b/src/com/android/settings/ChooseLockSettingsHelper.java
index 665bffe..56a3f67 100644
--- a/src/com/android/settings/ChooseLockSettingsHelper.java
+++ b/src/com/android/settings/ChooseLockSettingsHelper.java
@@ -21,7 +21,6 @@
import android.app.Fragment;
import android.app.admin.DevicePolicyManager;
import android.content.Intent;
-import android.os.UserHandle;
import com.android.internal.widget.LockPatternUtils;
diff --git a/src/com/android/settings/ColorModePreference.java b/src/com/android/settings/ColorModePreference.java
index 14ffe48..94b6499 100644
--- a/src/com/android/settings/ColorModePreference.java
+++ b/src/com/android/settings/ColorModePreference.java
@@ -15,24 +15,16 @@
*/
package com.android.settings;
-import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.res.Resources;
import android.hardware.display.DisplayManager;
import android.hardware.display.DisplayManager.DisplayListener;
import android.os.Handler;
import android.os.Looper;
-import android.preference.DialogPreference;
-import android.preference.SwitchPreference;
+import android.support.v14.preference.SwitchPreference;
import android.util.AttributeSet;
import android.view.Display;
import android.view.Display.ColorTransform;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.Checkable;
-import android.widget.LinearLayout;
-import android.widget.TextView;
import java.util.ArrayList;
diff --git a/src/com/android/settings/ConfirmLockPassword.java b/src/com/android/settings/ConfirmLockPassword.java
index cce29dd..25fb671 100644
--- a/src/com/android/settings/ConfirmLockPassword.java
+++ b/src/com/android/settings/ConfirmLockPassword.java
@@ -16,18 +16,10 @@
package com.android.settings;
-import android.text.TextUtils;
-import com.android.internal.logging.MetricsLogger;
-import com.android.internal.widget.LockPatternChecker;
-import com.android.internal.widget.LockPatternUtils;
-import com.android.internal.widget.TextViewInputDisabler;
-import com.android.settingslib.animation.AppearAnimationUtils;
-import com.android.settingslib.animation.DisappearAnimationUtils;
-
import android.app.Fragment;
import android.app.admin.DevicePolicyManager;
-import android.content.Intent;
import android.content.Context;
+import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.CountDownTimer;
@@ -35,6 +27,7 @@
import android.os.SystemClock;
import android.os.storage.StorageManager;
import android.text.InputType;
+import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
@@ -46,6 +39,13 @@
import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;
+import com.android.internal.logging.MetricsLogger;
+import com.android.internal.widget.LockPatternChecker;
+import com.android.internal.widget.LockPatternUtils;
+import com.android.internal.widget.TextViewInputDisabler;
+import com.android.settingslib.animation.AppearAnimationUtils;
+import com.android.settingslib.animation.DisappearAnimationUtils;
+
import java.util.ArrayList;
public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
diff --git a/src/com/android/settings/ConfirmLockPattern.java b/src/com/android/settings/ConfirmLockPattern.java
index 94ba01a..d375a52 100644
--- a/src/com/android/settings/ConfirmLockPattern.java
+++ b/src/com/android/settings/ConfirmLockPattern.java
@@ -16,30 +16,30 @@
package com.android.settings;
+import android.app.Activity;
+import android.content.Intent;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.os.CountDownTimer;
+import android.os.SystemClock;
+import android.os.storage.StorageManager;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.animation.AnimationUtils;
+import android.view.animation.Interpolator;
+import android.widget.TextView;
+
import com.android.internal.logging.MetricsLogger;
-import com.android.internal.widget.LockPatternUtils;
-import com.android.internal.widget.LockPatternView;
import com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient;
import com.android.internal.widget.LockPatternChecker;
+import com.android.internal.widget.LockPatternUtils;
+import com.android.internal.widget.LockPatternView;
import com.android.internal.widget.LockPatternView.Cell;
import com.android.settingslib.animation.AppearAnimationCreator;
import com.android.settingslib.animation.AppearAnimationUtils;
import com.android.settingslib.animation.DisappearAnimationUtils;
-import android.app.Activity;
-import android.content.Intent;
-import android.os.CountDownTimer;
-import android.os.SystemClock;
-import android.os.AsyncTask;
-import android.os.Bundle;
-import android.os.storage.StorageManager;
-import android.view.animation.AnimationUtils;
-import android.view.animation.Interpolator;
-import android.widget.TextView;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
diff --git a/src/com/android/settings/CopyablePreference.java b/src/com/android/settings/CopyablePreference.java
new file mode 100644
index 0000000..b1f101d
--- /dev/null
+++ b/src/com/android/settings/CopyablePreference.java
@@ -0,0 +1,55 @@
+/*
+ * 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.ClipboardManager;
+import android.content.Context;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceViewHolder;
+import android.util.AttributeSet;
+import android.view.View;
+import android.view.View.OnLongClickListener;
+import android.widget.Toast;
+
+public class CopyablePreference extends Preference {
+
+ public CopyablePreference(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ @Override
+ public void onBindViewHolder(PreferenceViewHolder holder) {
+ super.onBindViewHolder(holder);
+ holder.setDividerAllowedAbove(true);
+ holder.setDividerAllowedBelow(true);
+ holder.itemView.setLongClickable(true);
+ holder.itemView.setOnLongClickListener(new OnLongClickListener() {
+ @Override
+ public boolean onLongClick(View v) {
+ copyPreference(getContext(), CopyablePreference.this);
+ return true;
+ }
+ });
+ }
+
+ public static void copyPreference(Context context, Preference pref) {
+ ClipboardManager cm =
+ (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
+ cm.setText(pref.getSummary());
+ Toast.makeText(context, com.android.internal.R.string.text_copied, Toast.LENGTH_SHORT)
+ .show();
+ }
+}
diff --git a/src/com/android/settings/CredentialStorage.java b/src/com/android/settings/CredentialStorage.java
index 18b4ac8..0924f99 100644
--- a/src/com/android/settings/CredentialStorage.java
+++ b/src/com/android/settings/CredentialStorage.java
@@ -27,13 +27,13 @@
import android.content.res.Resources;
import android.os.AsyncTask;
import android.os.Bundle;
-import android.os.RemoteException;
import android.os.Process;
+import android.os.RemoteException;
import android.os.UserHandle;
import android.os.UserManager;
import android.security.Credentials;
-import android.security.KeyChain.KeyChainConnection;
import android.security.KeyChain;
+import android.security.KeyChain.KeyChainConnection;
import android.security.KeyStore;
import android.text.Editable;
import android.text.TextUtils;
diff --git a/src/com/android/settings/CryptKeeper.java b/src/com/android/settings/CryptKeeper.java
index 45b4ff1..90ea622 100644
--- a/src/com/android/settings/CryptKeeper.java
+++ b/src/com/android/settings/CryptKeeper.java
@@ -65,11 +65,10 @@
import com.android.internal.widget.LockPatternUtils;
import com.android.internal.widget.LockPatternView;
import com.android.internal.widget.LockPatternView.Cell;
+import com.android.internal.widget.LockPatternView.DisplayMode;
import java.util.List;
-import static com.android.internal.widget.LockPatternView.DisplayMode;
-
/**
* Settings screens to show the UI flows for encrypting/decrypting the device.
*
diff --git a/src/com/android/settings/CryptKeeperConfirm.java b/src/com/android/settings/CryptKeeperConfirm.java
index df487bf..c2dde20 100644
--- a/src/com/android/settings/CryptKeeperConfirm.java
+++ b/src/com/android/settings/CryptKeeperConfirm.java
@@ -17,7 +17,6 @@
package com.android.settings;
import android.app.Activity;
-import android.app.Fragment;
import android.app.StatusBarManager;
import android.content.Context;
import android.content.Intent;
diff --git a/src/com/android/settings/CryptKeeperSettings.java b/src/com/android/settings/CryptKeeperSettings.java
index 46d7dd1..b12aabb 100644
--- a/src/com/android/settings/CryptKeeperSettings.java
+++ b/src/com/android/settings/CryptKeeperSettings.java
@@ -18,7 +18,6 @@
import android.app.Activity;
import android.app.AlertDialog;
-import android.app.Fragment;
import android.app.admin.DevicePolicyManager;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -29,12 +28,13 @@
import android.os.Bundle;
import android.os.UserHandle;
import android.os.storage.StorageManager;
-import android.preference.Preference;
+import android.support.v7.preference.Preference;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
+
import com.android.internal.logging.MetricsLogger;
public class CryptKeeperSettings extends InstrumentedFragment {
@@ -193,7 +193,7 @@
}
private void showFinalConfirmation(int type, String password) {
- Preference preference = new Preference(getActivity());
+ Preference preference = new Preference(getPreferenceManager().getContext());
preference.setFragment(CryptKeeperConfirm.class.getName());
preference.setTitle(R.string.crypt_keeper_confirm_title);
addEncryptionInfoToPreference(preference, type, password);
diff --git a/src/com/android/settings/CustomDialogPreference.java b/src/com/android/settings/CustomDialogPreference.java
new file mode 100644
index 0000000..0b1c8bf
--- /dev/null
+++ b/src/com/android/settings/CustomDialogPreference.java
@@ -0,0 +1,101 @@
+/*
+ * 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.app.AlertDialog;
+import android.app.Dialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.os.Bundle;
+import android.support.v14.preference.PreferenceDialogFragment;
+import android.support.v7.preference.DialogPreference;
+import android.util.AttributeSet;
+
+public class CustomDialogPreference extends DialogPreference {
+
+ private CustomPreferenceDialogFragment mFragment;
+
+ public CustomDialogPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+ super(context, attrs, defStyleAttr, defStyleRes);
+ }
+
+ public CustomDialogPreference(Context context, AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ }
+
+ public CustomDialogPreference(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public CustomDialogPreference(Context context) {
+ super(context);
+ }
+
+ public boolean isDialogOpen() {
+ return getDialog() != null && getDialog().isShowing();
+ }
+
+ public Dialog getDialog() {
+ return mFragment != null ? mFragment.getDialog() : null;
+ }
+
+ protected void onPrepareDialogBuilder(AlertDialog.Builder builder,
+ DialogInterface.OnClickListener listener) {
+ }
+
+ protected void onDialogClosed(boolean positiveResult) {
+ }
+
+ protected void onClick(DialogInterface dialog, int which) {
+ }
+
+ private void setFragment(CustomPreferenceDialogFragment fragment) {
+ mFragment = fragment;
+ }
+
+ public static class CustomPreferenceDialogFragment extends PreferenceDialogFragment {
+
+ public static CustomPreferenceDialogFragment newInstance(String key) {
+ final CustomPreferenceDialogFragment fragment = new CustomPreferenceDialogFragment();
+ final Bundle b = new Bundle(1);
+ b.putString(ARG_KEY, key);
+ fragment.setArguments(b);
+ return fragment;
+ }
+
+ private CustomDialogPreference getCustomizablePreference() {
+ return (CustomDialogPreference) getPreference();
+ }
+
+ @Override
+ protected void onPrepareDialogBuilder(AlertDialog.Builder builder) {
+ super.onPrepareDialogBuilder(builder);
+ getCustomizablePreference().setFragment(this);
+ getCustomizablePreference().onPrepareDialogBuilder(builder, this);
+ }
+
+ @Override
+ public void onDialogClosed(boolean positiveResult) {
+ getCustomizablePreference().onDialogClosed(positiveResult);
+ }
+
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ super.onClick(dialog, which);
+ getCustomizablePreference().onClick(dialog, which);
+ }
+ }
+}
diff --git a/src/com/android/settings/CustomEditTextPreference.java b/src/com/android/settings/CustomEditTextPreference.java
new file mode 100644
index 0000000..7bb1d86
--- /dev/null
+++ b/src/com/android/settings/CustomEditTextPreference.java
@@ -0,0 +1,117 @@
+/*
+ * 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.app.AlertDialog;
+import android.app.Dialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.os.Bundle;
+import android.support.v14.preference.EditTextPreferenceDialogFragment;
+import android.support.v7.preference.EditTextPreference;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.EditText;
+
+public class CustomEditTextPreference extends EditTextPreference {
+
+ private CustomPreferenceDialogFragment mFragment;
+
+ public CustomEditTextPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+ super(context, attrs, defStyleAttr, defStyleRes);
+ }
+
+ public CustomEditTextPreference(Context context, AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ }
+
+ public CustomEditTextPreference(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public CustomEditTextPreference(Context context) {
+ super(context);
+ }
+
+ public EditText getEditText() {
+ return mFragment != null ? (EditText) mFragment.getDialog().findViewById(android.R.id.edit)
+ : null;
+ }
+
+ public boolean isDialogOpen() {
+ return getDialog() != null && getDialog().isShowing();
+ }
+
+ public Dialog getDialog() {
+ return mFragment != null ? mFragment.getDialog() : null;
+ }
+
+ protected void onPrepareDialogBuilder(AlertDialog.Builder builder,
+ DialogInterface.OnClickListener listener) {
+ }
+
+ protected void onDialogClosed(boolean positiveResult) {
+ }
+
+ protected void onClick(DialogInterface dialog, int which) {
+ }
+
+ protected void onBindDialogView(View view) {
+ }
+
+ private void setFragment(CustomPreferenceDialogFragment fragment) {
+ mFragment = fragment;
+ }
+
+ public static class CustomPreferenceDialogFragment extends EditTextPreferenceDialogFragment {
+
+ public static CustomPreferenceDialogFragment newInstance(String key) {
+ final CustomPreferenceDialogFragment fragment = new CustomPreferenceDialogFragment();
+ final Bundle b = new Bundle(1);
+ b.putString(ARG_KEY, key);
+ fragment.setArguments(b);
+ return fragment;
+ }
+
+ private CustomEditTextPreference getCustomizablePreference() {
+ return (CustomEditTextPreference) getPreference();
+ }
+
+ @Override
+ protected void onBindDialogView(View view) {
+ super.onBindDialogView(view);
+ getCustomizablePreference().onBindDialogView(view);
+ }
+
+ @Override
+ protected void onPrepareDialogBuilder(AlertDialog.Builder builder) {
+ super.onPrepareDialogBuilder(builder);
+ getCustomizablePreference().setFragment(this);
+ getCustomizablePreference().onPrepareDialogBuilder(builder, this);
+ }
+
+ @Override
+ public void onDialogClosed(boolean positiveResult) {
+ getCustomizablePreference().onDialogClosed(positiveResult);
+ }
+
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ super.onClick(dialog, which);
+ getCustomizablePreference().onClick(dialog, which);
+ }
+ }
+}
diff --git a/src/com/android/settings/CustomListPreference.java b/src/com/android/settings/CustomListPreference.java
new file mode 100644
index 0000000..1d49165
--- /dev/null
+++ b/src/com/android/settings/CustomListPreference.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2013 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.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.os.Bundle;
+import android.support.v14.preference.ListPreferenceDialogFragment;
+import android.support.v7.preference.ListPreference;
+import android.util.AttributeSet;
+
+public class CustomListPreference extends ListPreference{
+
+ public CustomListPreference(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public CustomListPreference(Context context, AttributeSet attrs, int defStyleAttr,
+ int defStyleRes) {
+ super(context, attrs, defStyleAttr, defStyleRes);
+ }
+
+ protected void onPrepareDialogBuilder(AlertDialog.Builder builder,
+ DialogInterface.OnClickListener listener) {
+ }
+
+ protected void onDialogClosed(boolean positiveResult) {
+ }
+
+ public static class CustomListPreferenceDialogFragment extends ListPreferenceDialogFragment {
+
+ public static ListPreferenceDialogFragment newInstance(String key) {
+ final ListPreferenceDialogFragment fragment = new CustomListPreferenceDialogFragment();
+ final Bundle b = new Bundle(1);
+ b.putString(ARG_KEY, key);
+ fragment.setArguments(b);
+ return fragment;
+ }
+
+ private CustomListPreference getCustomizablePreference() {
+ return (CustomListPreference) getPreference();
+ }
+
+ @Override
+ protected void onPrepareDialogBuilder(AlertDialog.Builder builder) {
+ super.onPrepareDialogBuilder(builder);
+ getCustomizablePreference().onPrepareDialogBuilder(builder, this);
+ }
+
+ @Override
+ public void onDialogClosed(boolean positiveResult) {
+ getCustomizablePreference().onDialogClosed(positiveResult);
+ }
+ }
+}
diff --git a/src/com/android/settings/DataUsageSummary.java b/src/com/android/settings/DataUsageSummary.java
index f6fbf57..ce4b1af 100644
--- a/src/com/android/settings/DataUsageSummary.java
+++ b/src/com/android/settings/DataUsageSummary.java
@@ -16,37 +16,6 @@
package com.android.settings;
-import static android.net.ConnectivityManager.TYPE_ETHERNET;
-import static android.net.ConnectivityManager.TYPE_MOBILE;
-import static android.net.ConnectivityManager.TYPE_WIFI;
-import static android.net.ConnectivityManager.TYPE_WIMAX;
-import static android.net.NetworkPolicy.LIMIT_DISABLED;
-import static android.net.NetworkPolicy.WARNING_DISABLED;
-import static android.net.NetworkPolicyManager.EXTRA_NETWORK_TEMPLATE;
-import static android.net.NetworkPolicyManager.POLICY_NONE;
-import static android.net.NetworkPolicyManager.POLICY_REJECT_METERED_BACKGROUND;
-import static android.net.NetworkPolicyManager.computeLastCycleBoundary;
-import static android.net.NetworkPolicyManager.computeNextCycleBoundary;
-import static android.net.NetworkTemplate.MATCH_MOBILE_3G_LOWER;
-import static android.net.NetworkTemplate.MATCH_MOBILE_4G;
-import static android.net.NetworkTemplate.MATCH_MOBILE_ALL;
-import static android.net.NetworkTemplate.MATCH_WIFI;
-import static android.net.NetworkTemplate.buildTemplateEthernet;
-import static android.net.NetworkTemplate.buildTemplateMobile3gLower;
-import static android.net.NetworkTemplate.buildTemplateMobile4g;
-import static android.net.NetworkTemplate.buildTemplateMobileAll;
-import static android.net.NetworkTemplate.buildTemplateWifiWildcard;
-import static android.net.TrafficStats.GB_IN_BYTES;
-import static android.net.TrafficStats.MB_IN_BYTES;
-import static android.net.TrafficStats.UID_REMOVED;
-import static android.net.TrafficStats.UID_TETHERING;
-import static android.telephony.TelephonyManager.SIM_STATE_READY;
-import static android.text.format.DateUtils.FORMAT_ABBREV_MONTH;
-import static android.text.format.DateUtils.FORMAT_SHOW_DATE;
-import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
-import static com.android.internal.util.Preconditions.checkNotNull;
-import static com.android.settings.Utils.prepareCustomPreferencesList;
-
import android.animation.LayoutTransition;
import android.app.ActivityManager;
import android.app.AlertDialog;
@@ -55,6 +24,8 @@
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.app.LoaderManager.LoaderCallbacks;
+import android.icu.impl.ICUResourceBundle;
+import android.icu.util.UResourceBundle;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
@@ -68,8 +39,6 @@
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
-import android.icu.impl.ICUResourceBundle;
-import android.icu.util.UResourceBundle;
import android.net.ConnectivityManager;
import android.net.INetworkPolicyManager;
import android.net.INetworkStatsService;
@@ -88,7 +57,7 @@
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
-import android.preference.Preference;
+import android.support.v7.preference.Preference;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
@@ -156,6 +125,37 @@
import java.util.Map;
import java.util.Set;
+import static android.net.ConnectivityManager.TYPE_ETHERNET;
+import static android.net.ConnectivityManager.TYPE_MOBILE;
+import static android.net.ConnectivityManager.TYPE_WIFI;
+import static android.net.ConnectivityManager.TYPE_WIMAX;
+import static android.net.NetworkPolicy.LIMIT_DISABLED;
+import static android.net.NetworkPolicy.WARNING_DISABLED;
+import static android.net.NetworkPolicyManager.EXTRA_NETWORK_TEMPLATE;
+import static android.net.NetworkPolicyManager.POLICY_NONE;
+import static android.net.NetworkPolicyManager.POLICY_REJECT_METERED_BACKGROUND;
+import static android.net.NetworkPolicyManager.computeLastCycleBoundary;
+import static android.net.NetworkPolicyManager.computeNextCycleBoundary;
+import static android.net.NetworkTemplate.MATCH_MOBILE_3G_LOWER;
+import static android.net.NetworkTemplate.MATCH_MOBILE_4G;
+import static android.net.NetworkTemplate.MATCH_MOBILE_ALL;
+import static android.net.NetworkTemplate.MATCH_WIFI;
+import static android.net.NetworkTemplate.buildTemplateEthernet;
+import static android.net.NetworkTemplate.buildTemplateMobile3gLower;
+import static android.net.NetworkTemplate.buildTemplateMobile4g;
+import static android.net.NetworkTemplate.buildTemplateMobileAll;
+import static android.net.NetworkTemplate.buildTemplateWifiWildcard;
+import static android.net.TrafficStats.GB_IN_BYTES;
+import static android.net.TrafficStats.MB_IN_BYTES;
+import static android.net.TrafficStats.UID_REMOVED;
+import static android.net.TrafficStats.UID_TETHERING;
+import static android.telephony.TelephonyManager.SIM_STATE_READY;
+import static android.text.format.DateUtils.FORMAT_ABBREV_MONTH;
+import static android.text.format.DateUtils.FORMAT_SHOW_DATE;
+import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
+import static com.android.internal.util.Preconditions.checkNotNull;
+import static com.android.settings.Utils.prepareCustomPreferencesList;
+
/**
* Panel showing data usage history across various networks, including options
* to inspect based on usage cycle and control through {@link NetworkPolicy}.
diff --git a/src/com/android/settings/DateTimeSettings.java b/src/com/android/settings/DateTimeSettings.java
index 8a9e2ad..0540575 100644
--- a/src/com/android/settings/DateTimeSettings.java
+++ b/src/com/android/settings/DateTimeSettings.java
@@ -29,11 +29,10 @@
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.Bundle;
-import android.preference.Preference;
-import android.preference.PreferenceScreen;
-import android.preference.SwitchPreference;
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.Preference;
import android.text.format.DateFormat;
import android.widget.DatePicker;
import android.widget.TimePicker;
@@ -270,7 +269,7 @@
}
*/
@Override
- public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
+ public boolean onPreferenceTreeClick(Preference preference) {
if (preference == mDatePref) {
showDialog(DIALOG_DATEPICKER);
} else if (preference == mTimePref) {
@@ -283,7 +282,7 @@
updateTimeAndDateDisplay(getActivity());
timeUpdated(is24Hour);
}
- return super.onPreferenceTreeClick(preferenceScreen, preference);
+ return super.onPreferenceTreeClick(preference);
}
@Override
diff --git a/src/com/android/settings/DateTimeSettingsSetupWizard.java b/src/com/android/settings/DateTimeSettingsSetupWizard.java
index 9ad75be..64b9204 100644
--- a/src/com/android/settings/DateTimeSettingsSetupWizard.java
+++ b/src/com/android/settings/DateTimeSettingsSetupWizard.java
@@ -23,10 +23,10 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
-import android.preference.Preference;
-import android.preference.PreferenceFragment;
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
+import android.support.v14.preference.PreferenceFragment;
+import android.support.v7.preference.Preference;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
diff --git a/src/com/android/settings/DefaultRingtonePreference.java b/src/com/android/settings/DefaultRingtonePreference.java
index 4607bcd..4e0e1e7 100644
--- a/src/com/android/settings/DefaultRingtonePreference.java
+++ b/src/com/android/settings/DefaultRingtonePreference.java
@@ -21,7 +21,6 @@
import android.content.Intent;
import android.media.RingtoneManager;
import android.net.Uri;
-import android.preference.RingtonePreference;
import android.util.AttributeSet;
public class DefaultRingtonePreference extends RingtonePreference {
@@ -32,7 +31,7 @@
}
@Override
- protected void onPrepareRingtonePickerIntent(Intent ringtonePickerIntent) {
+ public void onPrepareRingtonePickerIntent(Intent ringtonePickerIntent) {
super.onPrepareRingtonePickerIntent(ringtonePickerIntent);
/*
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index 6854e81..80de567 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -52,16 +52,15 @@
import android.os.ServiceManager;
import android.os.StrictMode;
import android.os.SystemProperties;
-import android.os.UserHandle;
import android.os.UserManager;
-import android.preference.ListPreference;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceChangeListener;
-import android.preference.PreferenceGroup;
-import android.preference.PreferenceScreen;
-import android.preference.SwitchPreference;
import android.provider.SearchIndexableResource;
import android.provider.Settings;
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.ListPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceChangeListener;
+import android.support.v7.preference.PreferenceGroup;
+import android.support.v7.preference.PreferenceScreen;
import android.text.TextUtils;
import android.util.Log;
import android.view.HardwareRenderer;
@@ -294,7 +293,7 @@
if (!mUm.isAdminUser()
|| mUm.hasUserRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES)) {
mUnavailable = true;
- setPreferenceScreen(new PreferenceScreen(getActivity(), null));
+ setPreferenceScreen(new PreferenceScreen(getPrefContext(), null));
return;
}
@@ -500,7 +499,7 @@
if (mUnavailable) {
// Show error message
TextView emptyView = (TextView) getView().findViewById(android.R.id.empty);
- getListView().setEmptyView(emptyView);
+ setEmptyView(emptyView);
if (emptyView != null) {
emptyView.setText(R.string.development_settings_not_available);
}
@@ -645,7 +644,7 @@
SwitchPreference cb = mResetSwitchPrefs.get(i);
if (cb.isChecked()) {
cb.setChecked(false);
- onPreferenceTreeClick(null, cb);
+ onPreferenceTreeClick(cb);
}
}
resetDebuggerOptions();
@@ -1570,7 +1569,7 @@
}
@Override
- public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
+ public boolean onPreferenceTreeClick(Preference preference) {
if (Utils.isMonkeyRunning()) {
return false;
}
@@ -1690,7 +1689,7 @@
} else if (INACTIVE_APPS_KEY.equals(preference.getKey())) {
startInactiveAppsFragment();
} else {
- return super.onPreferenceTreeClick(preferenceScreen, preference);
+ return super.onPreferenceTreeClick(preference);
}
return false;
diff --git a/src/com/android/settings/DeviceAdminAdd.java b/src/com/android/settings/DeviceAdminAdd.java
index 6c6f8d3..1f10851 100644
--- a/src/com/android/settings/DeviceAdminAdd.java
+++ b/src/com/android/settings/DeviceAdminAdd.java
@@ -16,13 +16,10 @@
package com.android.settings;
-import android.app.AppOpsManager;
-
-import org.xmlpull.v1.XmlPullParserException;
-
import android.app.Activity;
import android.app.ActivityManagerNative;
import android.app.AlertDialog;
+import android.app.AppOpsManager;
import android.app.Dialog;
import android.app.admin.DeviceAdminInfo;
import android.app.admin.DeviceAdminReceiver;
@@ -57,6 +54,8 @@
import android.widget.ImageView;
import android.widget.TextView;
+import org.xmlpull.v1.XmlPullParserException;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
diff --git a/src/com/android/settings/DeviceAdminSettings.java b/src/com/android/settings/DeviceAdminSettings.java
index f0b3070..9eb1ddb 100644
--- a/src/com/android/settings/DeviceAdminSettings.java
+++ b/src/com/android/settings/DeviceAdminSettings.java
@@ -16,8 +16,6 @@
package com.android.settings;
-import org.xmlpull.v1.XmlPullParserException;
-
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ListFragment;
@@ -47,6 +45,8 @@
import android.widget.ListView;
import android.widget.TextView;
+import org.xmlpull.v1.XmlPullParserException;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
diff --git a/src/com/android/settings/DeviceInfoSettings.java b/src/com/android/settings/DeviceInfoSettings.java
index d8af962..9c4de4b 100644
--- a/src/com/android/settings/DeviceInfoSettings.java
+++ b/src/com/android/settings/DeviceInfoSettings.java
@@ -28,13 +28,11 @@
import android.os.SELinux;
import android.os.SystemClock;
import android.os.SystemProperties;
-import android.os.UserHandle;
import android.os.UserManager;
-import android.preference.Preference;
-import android.preference.PreferenceGroup;
-import android.preference.PreferenceScreen;
import android.provider.SearchIndexableResource;
import android.provider.Settings;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceGroup;
import android.telephony.CarrierConfigManager;
import android.text.TextUtils;
import android.text.format.DateFormat;
@@ -208,7 +206,7 @@
}
@Override
- public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
+ public boolean onPreferenceTreeClick(Preference preference) {
if (preference.getKey().equals(KEY_FIRMWARE_VERSION)) {
System.arraycopy(mHits, 1, mHits, 0, mHits.length-1);
mHits[mHits.length-1] = SystemClock.uptimeMillis();
@@ -278,7 +276,7 @@
ciActionOnSysUpdate(b);
}
}
- return super.onPreferenceTreeClick(preferenceScreen, preference);
+ return super.onPreferenceTreeClick(preference);
}
/**
diff --git a/src/com/android/settings/DimmableIconPreference.java b/src/com/android/settings/DimmableIconPreference.java
index 2d73603..57cdc8d 100644
--- a/src/com/android/settings/DimmableIconPreference.java
+++ b/src/com/android/settings/DimmableIconPreference.java
@@ -19,10 +19,10 @@
import android.annotation.Nullable;
import android.content.Context;
import android.graphics.drawable.Drawable;
-import android.preference.Preference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceViewHolder;
import android.text.TextUtils;
import android.util.AttributeSet;
-import android.view.View;
import android.widget.TextView;
/**
@@ -66,8 +66,8 @@
}
@Override
- protected void onBindView(View view) {
- super.onBindView(view);
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
if (!TextUtils.isEmpty(mContentDescription)) {
final TextView titleView = (TextView) view.findViewById(android.R.id.title);
titleView.setContentDescription(mContentDescription);
diff --git a/src/com/android/settings/DisplaySettings.java b/src/com/android/settings/DisplaySettings.java
index 3762480..8e32322 100644
--- a/src/com/android/settings/DisplaySettings.java
+++ b/src/com/android/settings/DisplaySettings.java
@@ -16,19 +16,8 @@
package com.android.settings;
-import static android.provider.Settings.Secure.CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED;
-import static android.provider.Settings.Secure.CAMERA_GESTURE_DISABLED;
-import static android.provider.Settings.Secure.DOUBLE_TAP_TO_WAKE;
-import static android.provider.Settings.Secure.DOZE_ENABLED;
-import static android.provider.Settings.Secure.WAKE_GESTURE_ENABLED;
-import static android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE;
-import static android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC;
-import static android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL;
-import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
-
import android.app.Activity;
import android.app.ActivityManagerNative;
-import android.app.Dialog;
import android.app.UiModeManager;
import android.app.admin.DevicePolicyManager;
import android.content.ContentResolver;
@@ -41,14 +30,12 @@
import android.os.Bundle;
import android.os.RemoteException;
import android.os.SystemProperties;
-import android.preference.ListPreference;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceChangeListener;
-import android.preference.Preference.OnPreferenceClickListener;
-import android.preference.PreferenceScreen;
-import android.preference.SwitchPreference;
import android.provider.SearchIndexableResource;
import android.provider.Settings;
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.ListPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceChangeListener;
import android.text.TextUtils;
import android.util.Log;
@@ -60,6 +47,16 @@
import java.util.ArrayList;
import java.util.List;
+import static android.provider.Settings.Secure.CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED;
+import static android.provider.Settings.Secure.CAMERA_GESTURE_DISABLED;
+import static android.provider.Settings.Secure.DOUBLE_TAP_TO_WAKE;
+import static android.provider.Settings.Secure.DOZE_ENABLED;
+import static android.provider.Settings.Secure.WAKE_GESTURE_ENABLED;
+import static android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE;
+import static android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC;
+import static android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL;
+import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
+
public class DisplaySettings extends SettingsPreferenceFragment implements
Preference.OnPreferenceChangeListener, Indexable {
private static final String TAG = "DisplaySettings";
@@ -421,11 +418,6 @@
}
@Override
- public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
- return super.onPreferenceTreeClick(preferenceScreen, preference);
- }
-
- @Override
public boolean onPreferenceChange(Preference preference, Object objValue) {
final String key = preference.getKey();
if (KEY_SCREEN_TIMEOUT.equals(key)) {
diff --git a/src/com/android/settings/DreamSettings.java b/src/com/android/settings/DreamSettings.java
index 05d4df4..a5bfa5d 100644
--- a/src/com/android/settings/DreamSettings.java
+++ b/src/com/android/settings/DreamSettings.java
@@ -25,8 +25,9 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceViewHolder;
import android.util.Log;
-import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
@@ -35,10 +36,7 @@
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
-import android.view.ViewGroup;
-import android.widget.ArrayAdapter;
import android.widget.ImageView;
-import android.widget.ListView;
import android.widget.RadioButton;
import android.widget.Switch;
import android.widget.TextView;
@@ -46,6 +44,7 @@
import com.android.internal.logging.MetricsLogger;
import com.android.settings.widget.SwitchBar;
import com.android.settingslib.dream.DreamBackend;
+import com.android.settingslib.dream.DreamBackend.DreamInfo;
import java.util.List;
@@ -60,7 +59,6 @@
private Context mContext;
private DreamBackend mBackend;
- private DreamInfoAdapter mAdapter;
private SwitchBar mSwitchBar;
private MenuItem[] mMenuItemsWhenEnabled;
private boolean mRefreshing;
@@ -120,15 +118,9 @@
logd("onActivityCreated(%s)", savedInstanceState);
super.onActivityCreated(savedInstanceState);
- ListView listView = getListView();
- listView.setItemsCanFocus(true);
-
TextView emptyView = (TextView) getView().findViewById(android.R.id.empty);
emptyView.setText(R.string.screensaver_settings_disabled_prompt);
- listView.setEmptyView(emptyView);
-
- mAdapter = new DreamInfoAdapter(mContext);
- listView.setAdapter(mAdapter);
+ setEmptyView(emptyView);
final SettingsActivity sa = (SettingsActivity) getActivity();
mSwitchBar = sa.getSwitchBar();
@@ -269,10 +261,17 @@
if (mSwitchBar.isChecked() != dreamsEnabled)
mSwitchBar.setChecked(dreamsEnabled);
- mAdapter.clear();
+ if (getPreferenceScreen() == null) {
+ setPreferenceScreen(getPreferenceManager().createPreferenceScreen(getContext()));
+ }
+ getPreferenceScreen().removeAll();
if (dreamsEnabled) {
List<DreamBackend.DreamInfo> dreamInfos = mBackend.getDreamInfos();
- mAdapter.addAll(dreamInfos);
+ final int N = dreamInfos.size();
+ for (int i = 0; i < N; i++) {
+ getPreferenceScreen().addPreference(
+ new DreamInfoPreference(getPrefContext(), dreamInfos.get(i)));
+ }
}
if (mMenuItemsWhenEnabled != null)
for (MenuItem menuItem : mMenuItemsWhenEnabled)
@@ -285,85 +284,63 @@
Log.d(TAG, args == null || args.length == 0 ? msg : String.format(msg, args));
}
- private class DreamInfoAdapter extends ArrayAdapter<DreamBackend.DreamInfo> {
- private final LayoutInflater mInflater;
+ private class DreamInfoPreference extends Preference {
- public DreamInfoAdapter(Context context) {
- super(context, 0);
- mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ private final DreamInfo mInfo;
+
+ public DreamInfoPreference(Context context, DreamInfo info) {
+ super(context);
+ mInfo = info;
+ setLayoutResource(R.layout.dream_info_row);
+ setTitle(mInfo.caption);
+ setIcon(mInfo.icon);
}
- @Override
- public View getView(int position, View convertView, ViewGroup parent) {
- DreamBackend.DreamInfo dreamInfo = getItem(position);
- logd("getView(%s)", dreamInfo.caption);
- final View row = convertView != null ? convertView : createDreamInfoRow(parent);
- row.setTag(dreamInfo);
-
- // bind icon
- ((ImageView) row.findViewById(android.R.id.icon)).setImageDrawable(dreamInfo.icon);
-
- // bind caption
- ((TextView) row.findViewById(android.R.id.title)).setText(dreamInfo.caption);
+ public void onBindViewHolder(final PreferenceViewHolder holder) {
+ super.onBindViewHolder(holder);
// bind radio button
- RadioButton radioButton = (RadioButton) row.findViewById(android.R.id.button1);
- radioButton.setChecked(dreamInfo.isActive);
+ RadioButton radioButton = (RadioButton) holder.findViewById(android.R.id.button1);
+ radioButton.setChecked(mInfo.isActive);
radioButton.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
- row.onTouchEvent(event);
+ holder.itemView.onTouchEvent(event);
return false;
- }});
+ }
+ });
// bind settings button + divider
- boolean showSettings = dreamInfo.settingsComponentName != null;
- View settingsDivider = row.findViewById(R.id.divider);
+ boolean showSettings = mInfo.settingsComponentName != null;
+ View settingsDivider = holder.findViewById(R.id.divider);
settingsDivider.setVisibility(showSettings ? View.VISIBLE : View.INVISIBLE);
- ImageView settingsButton = (ImageView) row.findViewById(android.R.id.button2);
+ ImageView settingsButton = (ImageView) holder.findViewById(android.R.id.button2);
settingsButton.setVisibility(showSettings ? View.VISIBLE : View.INVISIBLE);
- settingsButton.setAlpha(dreamInfo.isActive ? 1f : Utils.DISABLED_ALPHA);
- settingsButton.setEnabled(dreamInfo.isActive);
- settingsButton.setFocusable(dreamInfo.isActive);
+ settingsButton.setAlpha(mInfo.isActive ? 1f : Utils.DISABLED_ALPHA);
+ settingsButton.setEnabled(mInfo.isActive);
+ settingsButton.setFocusable(mInfo.isActive);
settingsButton.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
- mBackend.launchSettings((DreamBackend.DreamInfo) row.getTag());
- }});
-
- return row;
+ mBackend.launchSettings(mInfo);
+ }
+ });
}
- private View createDreamInfoRow(ViewGroup parent) {
- final View row = mInflater.inflate(R.layout.dream_info_row, parent, false);
- final View header = row.findViewById(android.R.id.widget_frame);
- header.setOnClickListener(new OnClickListener(){
- @Override
- public void onClick(View v) {
- v.setPressed(true);
- activate((DreamBackend.DreamInfo) row.getTag());
- }});
- return row;
- }
-
- private DreamBackend.DreamInfo getCurrentSelection() {
- for (int i = 0; i < getCount(); i++) {
- DreamBackend.DreamInfo dreamInfo = getItem(i);
- if (dreamInfo.isActive)
- return dreamInfo;
- }
- return null;
- }
- private void activate(DreamBackend.DreamInfo dreamInfo) {
- if (dreamInfo.equals(getCurrentSelection()))
+ @Override
+ public void performClick() {
+ if (mInfo.isActive)
return;
- for (int i = 0; i < getCount(); i++) {
- getItem(i).isActive = false;
+ for (int i = 0; i < getPreferenceScreen().getPreferenceCount(); i++) {
+ DreamInfoPreference preference =
+ (DreamInfoPreference) getPreferenceScreen().getPreference(i);
+ preference.mInfo.isActive = false;
+ preference.notifyChanged();
}
- dreamInfo.isActive = true;
- mBackend.setActiveDream(dreamInfo.componentName);
- notifyDataSetChanged();
+ mInfo.isActive = true;
+ mBackend.setActiveDream(mInfo.componentName);
+ notifyChanged();
}
}
diff --git a/src/com/android/settings/DropDownPreference.java b/src/com/android/settings/DropDownPreference.java
index dd18b7e..3088497 100644
--- a/src/com/android/settings/DropDownPreference.java
+++ b/src/com/android/settings/DropDownPreference.java
@@ -17,9 +17,9 @@
package com.android.settings;
import android.content.Context;
-import android.preference.ListPreference;
+import android.support.v7.preference.ListPreference;
+import android.support.v7.preference.PreferenceViewHolder;
import android.util.AttributeSet;
-import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
@@ -27,8 +27,6 @@
import android.widget.ArrayAdapter;
import android.widget.Spinner;
-import libcore.util.Objects;
-
public class DropDownPreference extends ListPreference {
private final Context mContext;
@@ -105,13 +103,13 @@
}
@Override
- protected void onBindView(View view) {
- super.onBindView(view);
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
if (view.equals(mSpinner.getParent())) return;
if (mSpinner.getParent() != null) {
((ViewGroup) mSpinner.getParent()).removeView(mSpinner);
}
- final ViewGroup vg = (ViewGroup) view;
+ final ViewGroup vg = (ViewGroup) view.itemView;
vg.addView(mSpinner, 0);
final ViewGroup.LayoutParams lp = mSpinner.getLayoutParams();
lp.width = 0;
diff --git a/src/com/android/settings/EditPinPreference.java b/src/com/android/settings/EditPinPreference.java
index 1877d43..e53a2bf 100644
--- a/src/com/android/settings/EditPinPreference.java
+++ b/src/com/android/settings/EditPinPreference.java
@@ -18,7 +18,6 @@
import android.app.Dialog;
import android.content.Context;
-import android.preference.EditTextPreference;
import android.text.InputType;
import android.util.AttributeSet;
import android.view.View;
@@ -27,7 +26,7 @@
/**
* TODO: Add a soft dialpad for PIN entry.
*/
-class EditPinPreference extends EditTextPreference {
+class EditPinPreference extends CustomEditTextPreference {
interface OnPinEnteredListener {
void onPinEntered(EditPinPreference preference, boolean positiveResult);
@@ -55,7 +54,7 @@
if (editText != null) {
editText.setInputType(InputType.TYPE_CLASS_NUMBER |
- InputType.TYPE_NUMBER_VARIATION_PASSWORD);
+ InputType.TYPE_NUMBER_VARIATION_PASSWORD);
}
}
@@ -75,7 +74,7 @@
public void showPinDialog() {
Dialog dialog = getDialog();
if (dialog == null || !dialog.isShowing()) {
- showDialog(null);
+ onClick();
}
}
}
diff --git a/src/com/android/settings/EncryptionInterstitial.java b/src/com/android/settings/EncryptionInterstitial.java
index 1bef99a..3aec03e 100644
--- a/src/com/android/settings/EncryptionInterstitial.java
+++ b/src/com/android/settings/EncryptionInterstitial.java
@@ -16,14 +16,6 @@
package com.android.settings;
-import com.android.internal.logging.MetricsLogger;
-import com.android.internal.widget.LockPatternUtils;
-import com.android.settings.R;
-import com.android.settings.SettingsActivity;
-import com.android.settings.SettingsPreferenceFragment;
-
-import java.util.List;
-
import android.accessibilityservice.AccessibilityServiceInfo;
import android.app.AlertDialog;
import android.app.Dialog;
@@ -41,6 +33,11 @@
import android.widget.RadioButton;
import android.widget.TextView;
+import com.android.internal.logging.MetricsLogger;
+import com.android.internal.widget.LockPatternUtils;
+
+import java.util.List;
+
public class EncryptionInterstitial extends SettingsActivity {
protected static final String EXTRA_PASSWORD_QUALITY = "extra_password_quality";
diff --git a/src/com/android/settings/HighlightingFragment.java b/src/com/android/settings/HighlightingFragment.java
index ef2fbf3..2d305e7 100644
--- a/src/com/android/settings/HighlightingFragment.java
+++ b/src/com/android/settings/HighlightingFragment.java
@@ -16,7 +16,6 @@
package com.android.settings;
-import android.app.Fragment;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.text.TextUtils;
diff --git a/src/com/android/settings/HomeSettings.java b/src/com/android/settings/HomeSettings.java
index 22d4cdc..fbd2ea5 100644
--- a/src/com/android/settings/HomeSettings.java
+++ b/src/com/android/settings/HomeSettings.java
@@ -16,9 +16,6 @@
package com.android.settings;
-import java.util.ArrayList;
-import java.util.List;
-
import android.app.Activity;
import android.app.ActivityManager;
import android.content.BroadcastReceiver;
@@ -32,8 +29,8 @@
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
-import android.content.res.Resources;
import android.content.pm.UserInfo;
+import android.content.res.Resources;
import android.graphics.ColorFilter;
import android.graphics.ColorMatrix;
import android.graphics.ColorMatrixColorFilter;
@@ -43,20 +40,25 @@
import android.os.Bundle;
import android.os.Handler;
import android.os.UserManager;
-import android.preference.Preference;
-import android.preference.PreferenceGroup;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceGroup;
+import android.support.v7.preference.PreferenceViewHolder;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.RadioButton;
+
import com.android.internal.logging.MetricsLogger;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Index;
import com.android.settings.search.Indexable;
import com.android.settings.search.SearchIndexableRaw;
+import java.util.ArrayList;
+import java.util.List;
+
public class HomeSettings extends SettingsPreferenceFragment implements Indexable {
static final String TAG = "HomeSettings";
@@ -176,7 +178,7 @@
ArrayList<ResolveInfo> homeActivities = new ArrayList<ResolveInfo>();
ComponentName currentDefaultHome = mPm.getHomeActivities(homeActivities);
- Context context = getActivity();
+ Context context = getPrefContext();
mCurrentHome = null;
mPrefGroup.removeAll();
mPrefs = new ArrayList<HomeAppPreference>();
@@ -350,8 +352,8 @@
}
@Override
- protected void onBindView(View view) {
- super.onBindView(view);
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
RadioButton radio = (RadioButton) view.findViewById(R.id.home_radio);
radio.setChecked(isChecked);
diff --git a/src/com/android/settings/IccLockSettings.java b/src/com/android/settings/IccLockSettings.java
index 168d3c8..1243956 100644
--- a/src/com/android/settings/IccLockSettings.java
+++ b/src/com/android/settings/IccLockSettings.java
@@ -25,10 +25,9 @@
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
-import android.preference.Preference;
-import android.preference.PreferenceActivity;
-import android.preference.PreferenceScreen;
-import android.preference.SwitchPreference;
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceScreen;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
diff --git a/src/com/android/settings/IconPreferenceScreen.java b/src/com/android/settings/IconPreferenceScreen.java
index 64fce29..5d4c0e3 100644
--- a/src/com/android/settings/IconPreferenceScreen.java
+++ b/src/com/android/settings/IconPreferenceScreen.java
@@ -19,9 +19,9 @@
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
-import android.preference.Preference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceViewHolder;
import android.util.AttributeSet;
-import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
@@ -45,8 +45,8 @@
}
@Override
- public void onBindView(View view) {
- super.onBindView(view);
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
ImageView imageView = (ImageView) view.findViewById(R.id.icon);
if (imageView != null && mIcon != null) {
imageView.setImageDrawable(mIcon);
diff --git a/src/com/android/settings/InstrumentedActivity.java b/src/com/android/settings/InstrumentedActivity.java
index 4a0e03a..e302ca1 100644
--- a/src/com/android/settings/InstrumentedActivity.java
+++ b/src/com/android/settings/InstrumentedActivity.java
@@ -16,10 +16,10 @@
package com.android.settings;
-import com.android.internal.logging.MetricsLogger;
-
import android.app.Activity;
+import com.android.internal.logging.MetricsLogger;
+
/**
* Instrumented activity that logs visibility state.
*/
diff --git a/src/com/android/settings/InstrumentedFragment.java b/src/com/android/settings/InstrumentedFragment.java
index 900c9b1..5453d52 100644
--- a/src/com/android/settings/InstrumentedFragment.java
+++ b/src/com/android/settings/InstrumentedFragment.java
@@ -16,7 +16,9 @@
package com.android.settings;
-import android.preference.PreferenceFragment;
+import android.os.Bundle;
+import android.support.v14.preference.PreferenceFragment;
+
import com.android.internal.logging.MetricsLogger;
/**
@@ -38,6 +40,10 @@
protected abstract int getMetricsCategory();
@Override
+ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
+ }
+
+ @Override
public void onResume() {
super.onResume();
MetricsLogger.visible(getActivity(), getMetricsCategory());
diff --git a/src/com/android/settings/InstrumentedPreferenceActivity.java b/src/com/android/settings/InstrumentedPreferenceActivity.java
index 480d5c7..93f5dd3 100644
--- a/src/com/android/settings/InstrumentedPreferenceActivity.java
+++ b/src/com/android/settings/InstrumentedPreferenceActivity.java
@@ -16,7 +16,6 @@
package com.android.settings;
-import android.preference.PreferenceActivity;
import com.android.internal.logging.MetricsLogger;
/**
diff --git a/src/com/android/settings/InstrumentedPreferenceFragment.java b/src/com/android/settings/InstrumentedPreferenceFragment.java
index f56bce0..252c899 100644
--- a/src/com/android/settings/InstrumentedPreferenceFragment.java
+++ b/src/com/android/settings/InstrumentedPreferenceFragment.java
@@ -16,7 +16,8 @@
package com.android.settings;
-import android.preference.PreferenceFragment;
+import android.support.v14.preference.PreferenceFragment;
+
import com.android.internal.logging.MetricsLogger;
/**
diff --git a/src/com/android/settings/LegalSettings.java b/src/com/android/settings/LegalSettings.java
index cd91d20..29e8275 100644
--- a/src/com/android/settings/LegalSettings.java
+++ b/src/com/android/settings/LegalSettings.java
@@ -23,8 +23,8 @@
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
-import android.preference.PreferenceGroup;
import android.provider.SearchIndexableResource;
+import android.support.v7.preference.PreferenceGroup;
import com.android.internal.logging.MetricsLogger;
import com.android.settings.search.BaseSearchIndexProvider;
diff --git a/src/com/android/settings/LocalePicker.java b/src/com/android/settings/LocalePicker.java
index 7a8f120..8ea99a1 100644
--- a/src/com/android/settings/LocalePicker.java
+++ b/src/com/android/settings/LocalePicker.java
@@ -23,7 +23,9 @@
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
+
import com.android.settings.SettingsPreferenceFragment.SettingsDialogFragment;
+
import java.util.Locale;
public class LocalePicker extends com.android.internal.app.LocalePicker
diff --git a/src/com/android/settings/ManagedProfileSetup.java b/src/com/android/settings/ManagedProfileSetup.java
index a72d2de..677bdf1 100644
--- a/src/com/android/settings/ManagedProfileSetup.java
+++ b/src/com/android/settings/ManagedProfileSetup.java
@@ -23,9 +23,9 @@
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.pm.UserInfo;
-import android.util.Log;
import android.os.UserHandle;
import android.os.UserManager;
+import android.util.Log;
import java.util.List;
diff --git a/src/com/android/settings/MasterClear.java b/src/com/android/settings/MasterClear.java
index cf55913..8474b45 100644
--- a/src/com/android/settings/MasterClear.java
+++ b/src/com/android/settings/MasterClear.java
@@ -20,7 +20,6 @@
import android.accounts.AccountManager;
import android.accounts.AuthenticatorDescription;
import android.app.Activity;
-import android.app.Fragment;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
@@ -29,7 +28,6 @@
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Environment;
-import android.os.Process;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
@@ -41,6 +39,7 @@
import android.widget.CheckBox;
import android.widget.LinearLayout;
import android.widget.TextView;
+
import com.android.internal.logging.MetricsLogger;
import java.util.List;
diff --git a/src/com/android/settings/MasterClearConfirm.java b/src/com/android/settings/MasterClearConfirm.java
index 12a86de..a3caf29 100644
--- a/src/com/android/settings/MasterClearConfirm.java
+++ b/src/com/android/settings/MasterClearConfirm.java
@@ -18,21 +18,20 @@
import android.app.ProgressDialog;
import android.content.Context;
+import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.AsyncTask;
-import android.service.persistentdata.PersistentDataBlockManager;
-
-import com.android.internal.logging.MetricsLogger;
-
-import android.content.Intent;
import android.os.Bundle;
import android.os.UserManager;
+import android.service.persistentdata.PersistentDataBlockManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
+import com.android.internal.logging.MetricsLogger;
+
/**
* Confirm and execute a reset of the device to a clean "just out of the box"
* state. Multiple confirmations are required: first, a general "are you sure
diff --git a/src/com/android/settings/PreferenceActivity.java b/src/com/android/settings/PreferenceActivity.java
new file mode 100644
index 0000000..dc3689c
--- /dev/null
+++ b/src/com/android/settings/PreferenceActivity.java
@@ -0,0 +1,75 @@
+/*
+ * 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.annotation.Nullable;
+import android.os.Bundle;
+import android.support.v14.preference.PreferenceFragment;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceScreen;
+
+public class PreferenceActivity extends SettingsActivity {
+
+ private PreferenceActivityFragment mFragment;
+
+ @Override
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
+ getIntent().putExtra(EXTRA_SHOW_FRAGMENT, PreferenceActivityFragment.class.getName());
+ super.onCreate(savedInstanceState);
+ }
+
+ public void addPreferencesFromResource(int resource) {
+ mFragment.addPreferencesFromResource(resource);
+ }
+
+ public Preference findPreference(String preference) {
+ return mFragment.findPreference(preference);
+ }
+
+ public PreferenceScreen getPreferenceScreen() {
+ return mFragment.getPreferenceScreen();
+ }
+
+ public void setPreferenceScreen(PreferenceScreen screen) {
+ mFragment.setPreferenceScreen(screen);
+ }
+
+ public boolean onPreferenceTreeClick(Preference preference) {
+ return false;
+ }
+
+ @Override
+ protected boolean isValidFragment(String fragmentName) {
+ return super.isValidFragment(fragmentName)
+ || PreferenceActivityFragment.class.getName().equals(fragmentName);
+ }
+
+ public static class PreferenceActivityFragment extends PreferenceFragment {
+ @Override
+ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
+ ((PreferenceActivity) getActivity()).mFragment = this;
+ }
+
+ @Override
+ public boolean onPreferenceTreeClick(Preference preference) {
+ if (((PreferenceActivity) getActivity()).onPreferenceTreeClick(preference)) {
+ return true;
+ }
+ return super.onPreferenceTreeClick(preference);
+ }
+ }
+
+}
diff --git a/src/com/android/settings/PrivacySettings.java b/src/com/android/settings/PrivacySettings.java
index 7586cb6..14e45be 100644
--- a/src/com/android/settings/PrivacySettings.java
+++ b/src/com/android/settings/PrivacySettings.java
@@ -21,22 +21,22 @@
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
-import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;
import android.os.UserManager;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceChangeListener;
-import android.preference.PreferenceScreen;
-import android.preference.SwitchPreference;
import android.provider.SearchIndexableResource;
import android.provider.Settings;
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceChangeListener;
+import android.support.v7.preference.PreferenceScreen;
import android.util.Log;
import com.android.internal.logging.MetricsLogger;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
diff --git a/src/com/android/settings/ProgressCategory.java b/src/com/android/settings/ProgressCategory.java
index c85dd0b..0c4a782 100644
--- a/src/com/android/settings/ProgressCategory.java
+++ b/src/com/android/settings/ProgressCategory.java
@@ -17,7 +17,8 @@
package com.android.settings;
import android.content.Context;
-import android.preference.Preference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceViewHolder;
import android.util.AttributeSet;
import android.view.View;
@@ -54,8 +55,8 @@
}
@Override
- public void onBindView(View view) {
- super.onBindView(view);
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
final View progressBar = view.findViewById(R.id.scanning_progress);
boolean noDeviceFound = (getPreferenceCount() == 0 ||
@@ -70,7 +71,7 @@
} else {
if (!mNoDeviceFoundAdded) {
if (mNoDeviceFoundPreference == null) {
- mNoDeviceFoundPreference = new Preference(getContext());
+ mNoDeviceFoundPreference = new Preference(getPreferenceManager().getContext());
mNoDeviceFoundPreference.setLayoutResource(R.layout.preference_empty_list);
mNoDeviceFoundPreference.setTitle(mEmptyTextRes);
mNoDeviceFoundPreference.setSelectable(false);
diff --git a/src/com/android/settings/ProgressCategoryBase.java b/src/com/android/settings/ProgressCategoryBase.java
index c08806c..79ed51f 100644
--- a/src/com/android/settings/ProgressCategoryBase.java
+++ b/src/com/android/settings/ProgressCategoryBase.java
@@ -17,7 +17,7 @@
package com.android.settings;
import android.content.Context;
-import android.preference.PreferenceCategory;
+import android.support.v7.preference.PreferenceCategory;
import android.util.AttributeSet;
public abstract class ProgressCategoryBase extends PreferenceCategory {
diff --git a/src/com/android/settings/ProxySelector.java b/src/com/android/settings/ProxySelector.java
index 7e83f66..9ec5b27 100644
--- a/src/com/android/settings/ProxySelector.java
+++ b/src/com/android/settings/ProxySelector.java
@@ -16,13 +16,9 @@
package com.android.settings;
-import com.android.internal.logging.MetricsLogger;
-import com.android.settings.SettingsPreferenceFragment.SettingsDialogFragment;
-
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
-import android.app.Fragment;
import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.content.Intent;
@@ -43,6 +39,9 @@
import android.widget.EditText;
import android.widget.TextView;
+import com.android.internal.logging.MetricsLogger;
+import com.android.settings.SettingsPreferenceFragment.SettingsDialogFragment;
+
public class ProxySelector extends InstrumentedFragment implements DialogCreatable {
private static final String TAG = "ProxySelector";
diff --git a/src/com/android/settings/RadioInfo.java b/src/com/android/settings/RadioInfo.java
index fa98bac..2f10bb5 100644
--- a/src/com/android/settings/RadioInfo.java
+++ b/src/com/android/settings/RadioInfo.java
@@ -32,10 +32,10 @@
import android.telephony.CellInfo;
import android.telephony.CellLocation;
import android.telephony.DataConnectionRealTimeInfo;
+import android.telephony.NeighboringCellInfo;
import android.telephony.PhoneStateListener;
import android.telephony.ServiceState;
import android.telephony.TelephonyManager;
-import android.telephony.NeighboringCellInfo;
import android.telephony.cdma.CdmaCellLocation;
import android.telephony.gsm.GsmCellLocation;
import android.util.Log;
@@ -46,22 +46,22 @@
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
+import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
-import android.widget.EditText;
+import com.android.ims.ImsConfig;
+import com.android.ims.ImsException;
+import com.android.ims.ImsManager;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.PhoneStateIntentReceiver;
import com.android.internal.telephony.TelephonyProperties;
-import com.android.ims.ImsConfig;
-import com.android.ims.ImsException;
-import com.android.ims.ImsManager;
-import java.net.HttpURLConnection;
-import java.net.URL;
import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.URL;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
diff --git a/src/com/android/settings/ResetNetwork.java b/src/com/android/settings/ResetNetwork.java
index 4f77474..e446d1b 100644
--- a/src/com/android/settings/ResetNetwork.java
+++ b/src/com/android/settings/ResetNetwork.java
@@ -17,32 +17,19 @@
package com.android.settings;
import android.app.Activity;
-import android.app.Fragment;
-import android.content.Context;
import android.content.Intent;
-import android.content.pm.PackageManager;
import android.content.res.Resources;
-import android.graphics.drawable.Drawable;
import android.os.Bundle;
-import android.os.Environment;
-import android.os.SystemProperties;
-import android.os.Process;
import android.os.UserManager;
-import android.preference.Preference;
-import android.preference.PreferenceActivity;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.text.TextUtils;
-import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
-import android.widget.CheckBox;
-import android.widget.LinearLayout;
import android.widget.Spinner;
-import android.widget.TextView;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.telephony.PhoneConstants;
diff --git a/src/com/android/settings/ResetNetworkConfirm.java b/src/com/android/settings/ResetNetworkConfirm.java
index db4b9a5..9050448 100644
--- a/src/com/android/settings/ResetNetworkConfirm.java
+++ b/src/com/android/settings/ResetNetworkConfirm.java
@@ -16,9 +16,8 @@
package com.android.settings;
-import android.app.Fragment;
-import android.content.Context;
import android.bluetooth.BluetoothManager;
+import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkPolicyManager;
import android.net.wifi.WifiManager;
@@ -29,17 +28,12 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.ArrayAdapter;
import android.widget.Button;
-import android.widget.Spinner;
import android.widget.Toast;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.telephony.PhoneConstants;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* Confirm and execute a reset of the network settings to a clean "just out of the box"
* state. Multiple confirmations are required: first, a general "are you sure
diff --git a/src/com/android/settings/RingtonePreference.java b/src/com/android/settings/RingtonePreference.java
new file mode 100644
index 0000000..454ae0b
--- /dev/null
+++ b/src/com/android/settings/RingtonePreference.java
@@ -0,0 +1,236 @@
+/*
+ * Copyright (C) 2007 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.content.Intent;
+import android.content.res.TypedArray;
+import android.media.AudioAttributes;
+import android.media.RingtoneManager;
+import android.net.Uri;
+import android.provider.Settings.System;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceManager;
+import android.text.TextUtils;
+import android.util.AttributeSet;
+
+/**
+ * A {@link Preference} that allows the user to choose a ringtone from those on the device.
+ * The chosen ringtone's URI will be persisted as a string.
+ * <p>
+ * If the user chooses the "Default" item, the saved string will be one of
+ * {@link System#DEFAULT_RINGTONE_URI},
+ * {@link System#DEFAULT_NOTIFICATION_URI}, or
+ * {@link System#DEFAULT_ALARM_ALERT_URI}. If the user chooses the "Silent"
+ * item, the saved string will be an empty string.
+ *
+ * @attr ref android.R.styleable#RingtonePreference_ringtoneType
+ * @attr ref android.R.styleable#RingtonePreference_showDefault
+ * @attr ref android.R.styleable#RingtonePreference_showSilent
+ *
+ * Based of frameworks/base/core/java/android/preference/RingtonePreference.java
+ * but extends android.support.v7.preference.Preference instead.
+ */
+public class RingtonePreference extends Preference {
+
+ private static final String TAG = "RingtonePreference";
+
+ private static int sRequestCode = 100;
+
+ private int mRingtoneType;
+ private boolean mShowDefault;
+ private boolean mShowSilent;
+
+ private int mRequestCode;
+
+ public RingtonePreference(Context context, AttributeSet attrs) {
+ super(context, attrs);
+
+ final TypedArray a = context.obtainStyledAttributes(attrs,
+ com.android.internal.R.styleable.RingtonePreference, 0, 0);
+ mRingtoneType = a.getInt(com.android.internal.R.styleable.RingtonePreference_ringtoneType,
+ RingtoneManager.TYPE_RINGTONE);
+ mShowDefault = a.getBoolean(com.android.internal.R.styleable.RingtonePreference_showDefault,
+ true);
+ mShowSilent = a.getBoolean(com.android.internal.R.styleable.RingtonePreference_showSilent,
+ true);
+ setIntent(new Intent(RingtoneManager.ACTION_RINGTONE_PICKER));
+ a.recycle();
+ }
+
+ /**
+ * Returns the sound type(s) that are shown in the picker.
+ *
+ * @return The sound type(s) that are shown in the picker.
+ * @see #setRingtoneType(int)
+ */
+ public int getRingtoneType() {
+ return mRingtoneType;
+ }
+
+ /**
+ * Sets the sound type(s) that are shown in the picker.
+ *
+ * @param type The sound type(s) that are shown in the picker.
+ * @see RingtoneManager#EXTRA_RINGTONE_TYPE
+ */
+ public void setRingtoneType(int type) {
+ mRingtoneType = type;
+ }
+
+ /**
+ * Returns whether to a show an item for the default sound/ringtone.
+ *
+ * @return Whether to show an item for the default sound/ringtone.
+ */
+ public boolean getShowDefault() {
+ return mShowDefault;
+ }
+
+ /**
+ * Sets whether to show an item for the default sound/ringtone. The default
+ * to use will be deduced from the sound type(s) being shown.
+ *
+ * @param showDefault Whether to show the default or not.
+ * @see RingtoneManager#EXTRA_RINGTONE_SHOW_DEFAULT
+ */
+ public void setShowDefault(boolean showDefault) {
+ mShowDefault = showDefault;
+ }
+
+ /**
+ * Returns whether to a show an item for 'Silent'.
+ *
+ * @return Whether to show an item for 'Silent'.
+ */
+ public boolean getShowSilent() {
+ return mShowSilent;
+ }
+
+ /**
+ * Sets whether to show an item for 'Silent'.
+ *
+ * @param showSilent Whether to show 'Silent'.
+ * @see RingtoneManager#EXTRA_RINGTONE_SHOW_SILENT
+ */
+ public void setShowSilent(boolean showSilent) {
+ mShowSilent = showSilent;
+ }
+
+ public int getRequestCode() {
+ return mRequestCode;
+ }
+
+ /**
+ * Prepares the intent to launch the ringtone picker. This can be modified
+ * to adjust the parameters of the ringtone picker.
+ *
+ * @param ringtonePickerIntent The ringtone picker intent that can be
+ * modified by putting extras.
+ */
+ public void onPrepareRingtonePickerIntent(Intent ringtonePickerIntent) {
+
+ ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI,
+ onRestoreRingtone());
+
+ ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, mShowDefault);
+ if (mShowDefault) {
+ ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI,
+ RingtoneManager.getDefaultUri(getRingtoneType()));
+ }
+
+ ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, mShowSilent);
+ ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, mRingtoneType);
+ ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, getTitle());
+ ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_AUDIO_ATTRIBUTES_FLAGS,
+ AudioAttributes.FLAG_BYPASS_INTERRUPTION_POLICY);
+ }
+
+ /**
+ * Called when a ringtone is chosen.
+ * <p>
+ * By default, this saves the ringtone URI to the persistent storage as a
+ * string.
+ *
+ * @param ringtoneUri The chosen ringtone's {@link Uri}. Can be null.
+ */
+ protected void onSaveRingtone(Uri ringtoneUri) {
+ persistString(ringtoneUri != null ? ringtoneUri.toString() : "");
+ }
+
+ /**
+ * Called when the chooser is about to be shown and the current ringtone
+ * should be marked. Can return null to not mark any ringtone.
+ * <p>
+ * By default, this restores the previous ringtone URI from the persistent
+ * storage.
+ *
+ * @return The ringtone to be marked as the current ringtone.
+ */
+ protected Uri onRestoreRingtone() {
+ final String uriString = getPersistedString(null);
+ return !TextUtils.isEmpty(uriString) ? Uri.parse(uriString) : null;
+ }
+
+ @Override
+ protected Object onGetDefaultValue(TypedArray a, int index) {
+ return a.getString(index);
+ }
+
+ @Override
+ protected void onSetInitialValue(boolean restorePersistedValue, Object defaultValueObj) {
+ String defaultValue = (String) defaultValueObj;
+
+ /*
+ * This method is normally to make sure the internal state and UI
+ * matches either the persisted value or the default value. Since we
+ * don't show the current value in the UI (until the dialog is opened)
+ * and we don't keep local state, if we are restoring the persisted
+ * value we don't need to do anything.
+ */
+ if (restorePersistedValue) {
+ return;
+ }
+
+ // If we are setting to the default value, we should persist it.
+ if (!TextUtils.isEmpty(defaultValue)) {
+ onSaveRingtone(Uri.parse(defaultValue));
+ }
+ }
+ protected void onAttachedToHierarchy(PreferenceManager preferenceManager) {
+ super.onAttachedToHierarchy(preferenceManager);
+
+ mRequestCode = sRequestCode++;
+ }
+
+ public boolean onActivityResult(int requestCode, int resultCode, Intent data) {
+ if (requestCode == mRequestCode) {
+ if (data != null) {
+ Uri uri = data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI);
+
+ if (callChangeListener(uri != null ? uri.toString() : "")) {
+ onSaveRingtone(uri);
+ }
+ }
+
+ return true;
+ }
+
+ return false;
+ }
+
+}
diff --git a/src/com/android/settings/ScreenPinningSettings.java b/src/com/android/settings/ScreenPinningSettings.java
index bf17b9f..7031271 100644
--- a/src/com/android/settings/ScreenPinningSettings.java
+++ b/src/com/android/settings/ScreenPinningSettings.java
@@ -21,14 +21,13 @@
import android.content.res.Resources;
import android.os.Bundle;
import android.os.UserHandle;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceChangeListener;
-import android.preference.PreferenceScreen;
-import android.preference.SwitchPreference;
import android.provider.Settings;
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceChangeListener;
+import android.support.v7.preference.PreferenceScreen;
import android.view.LayoutInflater;
import android.view.View;
-import android.view.ViewGroup;
import android.widget.Switch;
import com.android.internal.logging.MetricsLogger;
@@ -68,8 +67,7 @@
View emptyView = LayoutInflater.from(activity)
.inflate(R.layout.screen_pinning_instructions, null);
- ((ViewGroup) getListView().getParent()).addView(emptyView);
- getListView().setEmptyView(emptyView);
+ setEmptyView(emptyView);
mSwitchBar = activity.getSwitchBar();
mSwitchBar.addOnSwitchChangeListener(this);
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index e2d1c71..ee95839 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -33,17 +33,17 @@
import android.os.PersistableBundle;
import android.os.UserHandle;
import android.os.UserManager;
-import android.preference.ListPreference;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceChangeListener;
-import android.preference.Preference.OnPreferenceClickListener;
-import android.preference.PreferenceGroup;
-import android.preference.PreferenceScreen;
-import android.preference.SwitchPreference;
import android.provider.SearchIndexableResource;
import android.provider.Settings;
import android.security.KeyStore;
import android.service.trust.TrustAgentService;
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.ListPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceChangeListener;
+import android.support.v7.preference.Preference.OnPreferenceClickListener;
+import android.support.v7.preference.PreferenceGroup;
+import android.support.v7.preference.PreferenceScreen;
import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
@@ -637,7 +637,7 @@
}
@Override
- public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
+ public boolean onPreferenceTreeClick(Preference preference) {
final String key = preference.getKey();
if (KEY_UNLOCK_SET_OR_CHANGE.equals(key)) {
startFragment(this, "com.android.settings.ChooseLockGeneric$ChooseLockGenericFragment",
@@ -655,7 +655,7 @@
}
} else {
// If we didn't handle it, let preferences handle it.
- return super.onPreferenceTreeClick(preferenceScreen, preference);
+ return super.onPreferenceTreeClick(preference);
}
return true;
}
diff --git a/src/com/android/settings/SeekBarPreference.java b/src/com/android/settings/SeekBarPreference.java
new file mode 100644
index 0000000..f225967
--- /dev/null
+++ b/src/com/android/settings/SeekBarPreference.java
@@ -0,0 +1,260 @@
+/*
+ * Copyright (C) 2011 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.content.res.TypedArray;
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceViewHolder;
+import android.util.AttributeSet;
+import android.view.KeyEvent;
+import android.view.View;
+import android.widget.SeekBar;
+import android.widget.SeekBar.OnSeekBarChangeListener;
+
+/**
+ * Based on android.preference.SeekBarPreference, but uses support preference as base.
+ */
+public class SeekBarPreference extends Preference
+ implements OnSeekBarChangeListener, View.OnKeyListener {
+
+ private int mProgress;
+ private int mMax;
+ private boolean mTrackingTouch;
+
+ public SeekBarPreference(
+ Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+ super(context, attrs, defStyleAttr, defStyleRes);
+
+ TypedArray a = context.obtainStyledAttributes(
+ attrs, com.android.internal.R.styleable.ProgressBar, defStyleAttr, defStyleRes);
+ setMax(a.getInt(com.android.internal.R.styleable.ProgressBar_max, mMax));
+ a.recycle();
+
+ a = context.obtainStyledAttributes(attrs,
+ com.android.internal.R.styleable.SeekBarPreference, defStyleAttr, defStyleRes);
+ final int layoutResId = a.getResourceId(
+ com.android.internal.R.styleable.SeekBarPreference_layout,
+ com.android.internal.R.layout.preference_widget_seekbar);
+ a.recycle();
+
+ setLayoutResource(layoutResId);
+ }
+
+ public SeekBarPreference(Context context, AttributeSet attrs, int defStyleAttr) {
+ this(context, attrs, defStyleAttr, 0);
+ }
+
+ public SeekBarPreference(Context context, AttributeSet attrs) {
+ this(context, attrs, com.android.internal.R.attr.seekBarPreferenceStyle);
+ }
+
+ public SeekBarPreference(Context context) {
+ this(context, null);
+ }
+
+ @Override
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
+ view.itemView.setOnKeyListener(this);
+ SeekBar seekBar = (SeekBar) view.findViewById(
+ com.android.internal.R.id.seekbar);
+ seekBar.setOnSeekBarChangeListener(this);
+ seekBar.setMax(mMax);
+ seekBar.setProgress(mProgress);
+ seekBar.setEnabled(isEnabled());
+ }
+
+ @Override
+ public CharSequence getSummary() {
+ return null;
+ }
+
+ @Override
+ protected void onSetInitialValue(boolean restoreValue, Object defaultValue) {
+ setProgress(restoreValue ? getPersistedInt(mProgress)
+ : (Integer) defaultValue);
+ }
+
+ @Override
+ protected Object onGetDefaultValue(TypedArray a, int index) {
+ return a.getInt(index, 0);
+ }
+
+ @Override
+ public boolean onKey(View v, int keyCode, KeyEvent event) {
+ if (event.getAction() != KeyEvent.ACTION_DOWN) {
+ return false;
+ }
+
+ SeekBar seekBar = (SeekBar) v.findViewById(com.android.internal.R.id.seekbar);
+ if (seekBar == null) {
+ return false;
+ }
+ return seekBar.onKeyDown(keyCode, event);
+ }
+
+ public void setMax(int max) {
+ if (max != mMax) {
+ mMax = max;
+ notifyChanged();
+ }
+ }
+
+ public void setProgress(int progress) {
+ setProgress(progress, true);
+ }
+
+ private void setProgress(int progress, boolean notifyChanged) {
+ if (progress > mMax) {
+ progress = mMax;
+ }
+ if (progress < 0) {
+ progress = 0;
+ }
+ if (progress != mProgress) {
+ mProgress = progress;
+ persistInt(progress);
+ if (notifyChanged) {
+ notifyChanged();
+ }
+ }
+ }
+
+ public int getProgress() {
+ return mProgress;
+ }
+
+ /**
+ * Persist the seekBar's progress value if callChangeListener
+ * returns true, otherwise set the seekBar's progress to the stored value
+ */
+ void syncProgress(SeekBar seekBar) {
+ int progress = seekBar.getProgress();
+ if (progress != mProgress) {
+ if (callChangeListener(progress)) {
+ setProgress(progress, false);
+ } else {
+ seekBar.setProgress(mProgress);
+ }
+ }
+ }
+
+ @Override
+ public void onProgressChanged(
+ SeekBar seekBar, int progress, boolean fromUser) {
+ if (fromUser && !mTrackingTouch) {
+ syncProgress(seekBar);
+ }
+ }
+
+ @Override
+ public void onStartTrackingTouch(SeekBar seekBar) {
+ mTrackingTouch = true;
+ }
+
+ @Override
+ public void onStopTrackingTouch(SeekBar seekBar) {
+ mTrackingTouch = false;
+ if (seekBar.getProgress() != mProgress) {
+ syncProgress(seekBar);
+ }
+ }
+
+ @Override
+ protected Parcelable onSaveInstanceState() {
+ /*
+ * Suppose a client uses this preference type without persisting. We
+ * must save the instance state so it is able to, for example, survive
+ * orientation changes.
+ */
+
+ final Parcelable superState = super.onSaveInstanceState();
+ if (isPersistent()) {
+ // No need to save instance state since it's persistent
+ return superState;
+ }
+
+ // Save the instance state
+ final SavedState myState = new SavedState(superState);
+ myState.progress = mProgress;
+ myState.max = mMax;
+ return myState;
+ }
+
+ @Override
+ protected void onRestoreInstanceState(Parcelable state) {
+ if (!state.getClass().equals(SavedState.class)) {
+ // Didn't save state for us in onSaveInstanceState
+ super.onRestoreInstanceState(state);
+ return;
+ }
+
+ // Restore the instance state
+ SavedState myState = (SavedState) state;
+ super.onRestoreInstanceState(myState.getSuperState());
+ mProgress = myState.progress;
+ mMax = myState.max;
+ notifyChanged();
+ }
+
+ /**
+ * SavedState, a subclass of {@link BaseSavedState}, will store the state
+ * of MyPreference, a subclass of Preference.
+ * <p>
+ * It is important to always call through to super methods.
+ */
+ private static class SavedState extends BaseSavedState {
+ int progress;
+ int max;
+
+ public SavedState(Parcel source) {
+ super(source);
+
+ // Restore the click counter
+ progress = source.readInt();
+ max = source.readInt();
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ super.writeToParcel(dest, flags);
+
+ // Save the click counter
+ dest.writeInt(progress);
+ dest.writeInt(max);
+ }
+
+ public SavedState(Parcelable superState) {
+ super(superState);
+ }
+
+ @SuppressWarnings("unused")
+ public static final Parcelable.Creator<SavedState> CREATOR =
+ new Parcelable.Creator<SavedState>() {
+ public SavedState createFromParcel(Parcel in) {
+ return new SavedState(in);
+ }
+
+ public SavedState[] newArray(int size) {
+ return new SavedState[size];
+ }
+ };
+ }
+}
diff --git a/src/com/android/settings/SelectableEditTextPreference.java b/src/com/android/settings/SelectableEditTextPreference.java
index c14709f..f6237ec 100644
--- a/src/com/android/settings/SelectableEditTextPreference.java
+++ b/src/com/android/settings/SelectableEditTextPreference.java
@@ -17,13 +17,12 @@
package com.android.settings;
import android.content.Context;
-import android.preference.EditTextPreference;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
import android.widget.EditText;
-public class SelectableEditTextPreference extends EditTextPreference {
+public class SelectableEditTextPreference extends CustomEditTextPreference {
private int mSelectionMode;
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index d830c33..c979f76 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -16,8 +16,6 @@
package com.android.settings;
-import static com.android.settings.dashboard.DashboardTile.TILE_ID_UNDEFINED;
-
import android.app.ActionBar;
import android.app.Activity;
import android.app.Fragment;
@@ -42,10 +40,9 @@
import android.os.Message;
import android.os.UserHandle;
import android.os.UserManager;
-import android.preference.Preference;
-import android.preference.PreferenceFragment;
-import android.preference.PreferenceManager;
-import android.preference.PreferenceScreen;
+import android.support.v14.preference.PreferenceFragment;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceManager;
import android.text.TextUtils;
import android.transition.TransitionManager;
import android.util.ArrayMap;
@@ -107,8 +104,8 @@
import com.android.settings.notification.ZenModeAutomationSettings;
import com.android.settings.notification.ZenModeEventRuleSettings;
import com.android.settings.notification.ZenModePrioritySettings;
-import com.android.settings.notification.ZenModeSettings;
import com.android.settings.notification.ZenModeScheduleRuleSettings;
+import com.android.settings.notification.ZenModeSettings;
import com.android.settings.print.PrintJobSettingsFragment;
import com.android.settings.print.PrintSettingsFragment;
import com.android.settings.search.DynamicIndexableContentMonitor;
@@ -133,6 +130,8 @@
import java.util.Map;
import java.util.Set;
+import static com.android.settings.dashboard.DashboardTile.TILE_ID_UNDEFINED;
+
public class SettingsActivity extends Activity
implements PreferenceManager.OnPreferenceTreeClickListener,
PreferenceFragment.OnPreferenceStartFragmentCallback,
@@ -438,17 +437,17 @@
@Override
public boolean onPreferenceStartFragment(PreferenceFragment caller, Preference pref) {
// Override the fragment title for Wallpaper settings
- int titleRes = pref.getTitleRes();
+ CharSequence title = pref.getTitle();
if (pref.getFragment().equals(WallpaperTypeSettings.class.getName())) {
- titleRes = R.string.wallpaper_settings_fragment_title;
+ title = getString(R.string.wallpaper_settings_fragment_title);
}
- startPreferencePanel(pref.getFragment(), pref.getExtras(), titleRes, pref.getTitle(),
+ startPreferencePanel(pref.getFragment(), pref.getExtras(), 0, title,
null, 0);
return true;
}
@Override
- public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
+ public boolean onPreferenceTreeClick(Preference preference) {
return false;
}
@@ -795,7 +794,7 @@
}
@Override
- public void onResume() {
+ protected void onResume() {
super.onResume();
if (mIsShowingDashboard) {
MetricsLogger.visible(this, MetricsLogger.MAIN_SETTINGS);
@@ -826,7 +825,7 @@
}
@Override
- public void onPause() {
+ protected void onPause() {
super.onPause();
if (mIsShowingDashboard) {
MetricsLogger.hidden(this, MetricsLogger.MAIN_SETTINGS);
diff --git a/src/com/android/settings/SettingsPreferenceFragment.java b/src/com/android/settings/SettingsPreferenceFragment.java
index 61b9753..34c773a 100644
--- a/src/com/android/settings/SettingsPreferenceFragment.java
+++ b/src/com/android/settings/SettingsPreferenceFragment.java
@@ -24,26 +24,26 @@
import android.content.Context;
import android.content.DialogInterface;
import android.content.pm.PackageManager;
-import android.database.DataSetObserver;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
-import android.preference.Preference;
-import android.preference.PreferenceActivity;
-import android.preference.PreferenceGroupAdapter;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceGroupAdapter;
+import android.support.v7.preference.PreferenceScreen;
+import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
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.ListAdapter;
-import android.widget.ListView;
+import com.android.settings.applications.LayoutPreference;
import com.android.settings.widget.FloatingActionButton;
+import java.util.UUID;
+
/**
* Base class for Settings fragments, with some helper functions and dialog management.
*/
@@ -67,17 +67,13 @@
private boolean mPreferenceHighlighted = false;
private Drawable mHighlightDrawable;
- private ListAdapter mCurrentRootAdapter;
+ private RecyclerView.Adapter mCurrentRootAdapter;
private boolean mIsDataSetObserverRegistered = false;
- private DataSetObserver mDataSetObserver = new DataSetObserver() {
+ private RecyclerView.AdapterDataObserver mDataSetObserver =
+ new RecyclerView.AdapterDataObserver() {
@Override
public void onChanged() {
- highlightPreferenceIfNeeded();
- }
-
- @Override
- public void onInvalidated() {
- highlightPreferenceIfNeeded();
+ onDataSetChanged();
}
};
@@ -85,6 +81,11 @@
private FloatingActionButton mFloatingActionButton;
private ViewGroup mButtonBar;
+ private LayoutPreference mHeader;
+
+ private LayoutPreference mFooter;
+ private View mEmptyView;
+
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
@@ -110,6 +111,10 @@
return root;
}
+ @Override
+ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
+ }
+
public FloatingActionButton getFloatingActionButton() {
return mFloatingActionButton;
}
@@ -176,16 +181,16 @@
public void showLoadingWhenEmpty() {
View loading = getView().findViewById(R.id.loading_container);
- getListView().setEmptyView(loading);
+ setEmptyView(loading);
}
public void registerObserverIfNeeded() {
if (!mIsDataSetObserverRegistered) {
if (mCurrentRootAdapter != null) {
- mCurrentRootAdapter.unregisterDataSetObserver(mDataSetObserver);
+ mCurrentRootAdapter.unregisterAdapterDataObserver(mDataSetObserver);
}
- mCurrentRootAdapter = getPreferenceScreen().getRootAdapter();
- mCurrentRootAdapter.registerDataSetObserver(mDataSetObserver);
+ mCurrentRootAdapter = getListView().getAdapter();
+ mCurrentRootAdapter.registerAdapterDataObserver(mDataSetObserver);
mIsDataSetObserverRegistered = true;
}
}
@@ -193,7 +198,7 @@
public void unregisterObserverIfNeeded() {
if (mIsDataSetObserverRegistered) {
if (mCurrentRootAdapter != null) {
- mCurrentRootAdapter.unregisterDataSetObserver(mDataSetObserver);
+ mCurrentRootAdapter.unregisterAdapterDataObserver(mDataSetObserver);
mCurrentRootAdapter = null;
}
mIsDataSetObserverRegistered = false;
@@ -206,6 +211,11 @@
}
}
+ private void onDataSetChanged() {
+ highlightPreferenceIfNeeded();
+ updateEmptyView();
+ }
+
private Drawable getHighlightDrawable() {
if (mHighlightDrawable == null) {
mHighlightDrawable = getActivity().getDrawable(R.drawable.preference_highlight);
@@ -213,19 +223,92 @@
return mHighlightDrawable;
}
+ public LayoutPreference getHeaderView() {
+ return mHeader;
+ }
+
+ public LayoutPreference getFooterView() {
+ return mFooter;
+ }
+
+ protected void setHeaderView(int resource) {
+ mHeader = new LayoutPreference(getPrefContext(), resource);
+ mHeader.setOrder(-1);
+ if (getPreferenceScreen() != null) {
+ getPreferenceScreen().addPreference(mHeader);
+ }
+ }
+
+ protected void setFooterView(int resource) {
+ setFooterView(resource != 0 ? new LayoutPreference(getPrefContext(), resource) : null);
+ }
+
+ protected void setFooterView(View v) {
+ setFooterView(v != null ? new LayoutPreference(getPrefContext(), v) : null);
+ }
+
+ private void setFooterView(LayoutPreference footer) {
+ if (getPreferenceScreen() != null && mFooter != null) {
+ getPreferenceScreen().removePreference(mFooter);
+ }
+ if (footer != null) {
+ mFooter = footer;
+ mFooter.setOrder(Integer.MAX_VALUE);
+ if (getPreferenceScreen() != null) {
+ getPreferenceScreen().addPreference(mFooter);
+ }
+ } else {
+ mFooter = null;
+ }
+ }
+
+ @Override
+ public void setPreferenceScreen(PreferenceScreen preferenceScreen) {
+ super.setPreferenceScreen(preferenceScreen);
+ if (preferenceScreen != null) {
+ if (mHeader != null) {
+ preferenceScreen.addPreference(mHeader);
+ }
+ if (mFooter != null) {
+ preferenceScreen.addPreference(mFooter);
+ }
+ }
+ }
+
+ private void updateEmptyView() {
+ if (mEmptyView == null) return;
+ if (getPreferenceScreen() != null) {
+ boolean show = (getPreferenceScreen().getPreferenceCount()
+ - (mHeader != null ? 1 : 0)
+ - (mFooter != null ? 1 : 0)) <= 0;
+ mEmptyView.setVisibility(show ? View.VISIBLE : View.GONE);
+ } else {
+ mEmptyView.setVisibility(View.VISIBLE);
+ }
+ }
+
+ public void setEmptyView(View v) {
+ mEmptyView = v;
+ updateEmptyView();
+ }
+
+ public View getEmptyView() {
+ return mEmptyView;
+ }
+
/**
* Return a valid ListView position or -1 if none is found
*/
private int canUseListViewForHighLighting(String key) {
- if (!hasListView()) {
+ if (getListView() == null) {
return -1;
}
- ListView listView = getListView();
- ListAdapter adapter = listView.getAdapter();
+ RecyclerView listView = getListView();
+ RecyclerView.Adapter adapter = listView.getAdapter();
if (adapter != null && adapter instanceof PreferenceGroupAdapter) {
- return findListPositionFromKey(adapter, key);
+ return findListPositionFromKey((PreferenceGroupAdapter) adapter, key);
}
return -1;
@@ -238,45 +321,44 @@
if (position >= 0) {
mPreferenceHighlighted = true;
- final ListView listView = getListView();
- final ListAdapter adapter = listView.getAdapter();
-
- ((PreferenceGroupAdapter) adapter).setHighlightedDrawable(highlight);
- ((PreferenceGroupAdapter) adapter).setHighlighted(position);
-
- listView.post(new Runnable() {
- @Override
- public void run() {
- listView.setSelection(position);
- listView.postDelayed(new Runnable() {
- @Override
- public void run() {
- final int index = position - listView.getFirstVisiblePosition();
- if (index >= 0 && index < listView.getChildCount()) {
- final View v = listView.getChildAt(index);
- final int centerX = v.getWidth() / 2;
- final int centerY = v.getHeight() / 2;
- highlight.setHotspot(centerX, centerY);
- v.setPressed(true);
- v.setPressed(false);
- }
- }
- }, DELAY_HIGHLIGHT_DURATION_MILLIS);
- }
- });
+ // TODO: Need to find a way to scroll to and highlight search items now
+ // that we are using RecyclerView instead.
+// final RecyclerView listView = getListView();
+// final RecyclerView.Adapter adapter = listView.getAdapter();
+//
+//// ((PreferenceGroupAdapter) adapter).setHighlightedDrawable(highlight);
+//// ((PreferenceGroupAdapter) adapter).setHighlighted(position);
+//
+// listView.post(new Runnable() {
+// @Override
+// public void run() {
+// listView.setSelection(position);
+// listView.postDelayed(new Runnable() {
+// @Override
+// public void run() {
+// final int index = position - listView.getFirstVisiblePosition();
+// if (index >= 0 && index < listView.getChildCount()) {
+// final View v = listView.getChildAt(index);
+// final int centerX = v.getWidth() / 2;
+// final int centerY = v.getHeight() / 2;
+// highlight.setHotspot(centerX, centerY);
+// v.setPressed(true);
+// v.setPressed(false);
+// }
+// }
+// }, DELAY_HIGHLIGHT_DURATION_MILLIS);
+// }
+// });
}
}
- private int findListPositionFromKey(ListAdapter adapter, String key) {
- final int count = adapter.getCount();
+ private int findListPositionFromKey(PreferenceGroupAdapter adapter, String key) {
+ final int count = adapter.getItemCount();
for (int n = 0; n < count; n++) {
- final Object item = adapter.getItem(n);
- if (item instanceof Preference) {
- Preference preference = (Preference) item;
- final String preferenceKey = preference.getKey();
- if (preferenceKey != null && preferenceKey.equals(key)) {
- return n;
- }
+ final Preference preference = adapter.getItem(n);
+ final String preferenceKey = preference.getKey();
+ if (preferenceKey != null && preferenceKey.equals(key)) {
+ return n;
}
}
return -1;
@@ -400,6 +482,31 @@
// override in subclass to attach a dismiss listener, for instance
}
+ @Override
+ public void onDisplayPreferenceDialog(Preference preference) {
+ if (preference.getKey() == null) {
+ // Auto-key preferences that don't have a key, so the dialog can find them.
+ preference.setKey(UUID.randomUUID().toString());
+ }
+ DialogFragment f = null;
+ if (preference instanceof CustomListPreference) {
+ f = CustomListPreference.CustomListPreferenceDialogFragment
+ .newInstance(preference.getKey());
+ } else if (preference instanceof CustomDialogPreference) {
+ f = CustomDialogPreference.CustomPreferenceDialogFragment
+ .newInstance(preference.getKey());
+ } else if (preference instanceof CustomEditTextPreference) {
+ f = CustomEditTextPreference.CustomPreferenceDialogFragment
+ .newInstance(preference.getKey());
+ } else {
+ super.onDisplayPreferenceDialog(preference);
+ return;
+ }
+ f.setTargetFragment(this, 0);
+ f.show(getFragmentManager(), "dialog_preference");
+ onDialogShowing();
+ }
+
public static class SettingsDialogFragment extends DialogFragment {
private static final String KEY_DIALOG_ID = "key_dialog_id";
private static final String KEY_PARENT_FRAGMENT_ID = "key_parent_fragment_id";
@@ -517,6 +624,10 @@
}
}
+ protected final Context getPrefContext() {
+ return getPreferenceManager().getContext();
+ }
+
public boolean startFragment(Fragment caller, String fragmentClass, int titleRes,
int requestCode, Bundle extras) {
final Activity activity = getActivity();
diff --git a/src/com/android/settings/SetupChooseLockGeneric.java b/src/com/android/settings/SetupChooseLockGeneric.java
index fb5cd8a..a1dd91e 100644
--- a/src/com/android/settings/SetupChooseLockGeneric.java
+++ b/src/com/android/settings/SetupChooseLockGeneric.java
@@ -16,10 +16,6 @@
package com.android.settings;
-import com.android.internal.widget.LockPatternUtils;
-import com.android.setupwizardlib.SetupWizardListLayout;
-import com.android.setupwizardlib.view.NavigationBar;
-
import android.app.Activity;
import android.app.admin.DevicePolicyManager;
import android.content.Context;
@@ -27,11 +23,15 @@
import android.content.res.Resources;
import android.os.Bundle;
import android.os.UserHandle;
-import android.preference.PreferenceFragment;
+import android.support.v14.preference.PreferenceFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import com.android.internal.widget.LockPatternUtils;
+import com.android.setupwizardlib.SetupWizardListLayout;
+import com.android.setupwizardlib.view.NavigationBar;
+
/**
* Setup Wizard's version of ChooseLockGeneric screen. It inherits the logic and basic structure
* from ChooseLockGeneric class, and should remain similar to that behaviorally. This class should
diff --git a/src/com/android/settings/SetupChooseLockPassword.java b/src/com/android/settings/SetupChooseLockPassword.java
index 9837562..d9b034b 100644
--- a/src/com/android/settings/SetupChooseLockPassword.java
+++ b/src/com/android/settings/SetupChooseLockPassword.java
@@ -16,10 +16,6 @@
package com.android.settings;
-import com.android.setupwizardlib.SetupWizardLayout;
-import com.android.setupwizardlib.util.SystemBarHelper;
-import com.android.setupwizardlib.view.NavigationBar;
-
import android.app.Activity;
import android.app.Fragment;
import android.content.Context;
@@ -30,6 +26,10 @@
import android.view.View;
import android.view.ViewGroup;
+import com.android.setupwizardlib.SetupWizardLayout;
+import com.android.setupwizardlib.util.SystemBarHelper;
+import com.android.setupwizardlib.view.NavigationBar;
+
/**
* Setup Wizard's version of ChooseLockPassword screen. It inherits the logic and basic structure
* from ChooseLockPassword class, and should remain similar to that behaviorally. This class should
diff --git a/src/com/android/settings/SetupChooseLockPattern.java b/src/com/android/settings/SetupChooseLockPattern.java
index bdf7af8..e6b1c47 100644
--- a/src/com/android/settings/SetupChooseLockPattern.java
+++ b/src/com/android/settings/SetupChooseLockPattern.java
@@ -16,9 +16,6 @@
package com.android.settings;
-import com.android.setupwizardlib.SetupWizardLayout;
-import com.android.setupwizardlib.view.NavigationBar;
-
import android.app.Activity;
import android.app.Fragment;
import android.content.Context;
@@ -30,6 +27,9 @@
import android.view.ViewGroup;
import android.widget.Button;
+import com.android.setupwizardlib.SetupWizardLayout;
+import com.android.setupwizardlib.view.NavigationBar;
+
/**
* Setup Wizard's version of ChooseLockPattern screen. It inherits the logic and basic structure
* from ChooseLockPattern class, and should remain similar to that behaviorally. This class should
diff --git a/src/com/android/settings/SetupEncryptionInterstitial.java b/src/com/android/settings/SetupEncryptionInterstitial.java
index 27d7e0c..cd943af 100644
--- a/src/com/android/settings/SetupEncryptionInterstitial.java
+++ b/src/com/android/settings/SetupEncryptionInterstitial.java
@@ -16,9 +16,6 @@
package com.android.settings;
-import com.android.setupwizardlib.SetupWizardLayout;
-import com.android.setupwizardlib.view.NavigationBar;
-
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
@@ -28,6 +25,9 @@
import android.view.View;
import android.view.ViewGroup;
+import com.android.setupwizardlib.SetupWizardLayout;
+import com.android.setupwizardlib.view.NavigationBar;
+
/**
* Setup Wizard's version of EncryptionInterstitial screen. It inherits the logic and basic
* structure from EncryptionInterstitial class, and should remain similar to that behaviorally. This
diff --git a/src/com/android/settings/SetupWizardUtils.java b/src/com/android/settings/SetupWizardUtils.java
index 61043ca..b7a2447 100644
--- a/src/com/android/settings/SetupWizardUtils.java
+++ b/src/com/android/settings/SetupWizardUtils.java
@@ -16,13 +16,13 @@
package com.android.settings;
-import com.android.setupwizardlib.util.SystemBarHelper;
-import com.android.setupwizardlib.util.WizardManagerHelper;
-
import android.app.Activity;
import android.app.Dialog;
import android.content.Intent;
+import com.android.setupwizardlib.util.SystemBarHelper;
+import com.android.setupwizardlib.util.WizardManagerHelper;
+
public class SetupWizardUtils {
private static final String TAG = "SetupWizardUtils";
diff --git a/src/com/android/settings/SingleLineSummaryPreference.java b/src/com/android/settings/SingleLineSummaryPreference.java
index 420fe08..5c941f2 100644
--- a/src/com/android/settings/SingleLineSummaryPreference.java
+++ b/src/com/android/settings/SingleLineSummaryPreference.java
@@ -16,10 +16,10 @@
package com.android.settings;
import android.content.Context;
-import android.preference.Preference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceViewHolder;
import android.text.TextUtils.TruncateAt;
import android.util.AttributeSet;
-import android.view.View;
import android.widget.TextView;
public class SingleLineSummaryPreference extends Preference {
@@ -29,8 +29,8 @@
}
@Override
- protected void onBindView(View view) {
- super.onBindView(view);
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
final TextView summaryView = (TextView) view.findViewById(
com.android.internal.R.id.summary);
diff --git a/src/com/android/settings/TestingSettings.java b/src/com/android/settings/TestingSettings.java
index b3de6fa..7a6f252 100644
--- a/src/com/android/settings/TestingSettings.java
+++ b/src/com/android/settings/TestingSettings.java
@@ -18,8 +18,7 @@
import android.os.Bundle;
import android.os.UserManager;
-import android.preference.PreferenceActivity;
-import android.preference.PreferenceScreen;
+import android.support.v7.preference.PreferenceScreen;
public class TestingSettings extends PreferenceActivity {
diff --git a/src/com/android/settings/TestingSettingsBroadcastReceiver.java b/src/com/android/settings/TestingSettingsBroadcastReceiver.java
index 37e0b50..18d59be 100644
--- a/src/com/android/settings/TestingSettingsBroadcastReceiver.java
+++ b/src/com/android/settings/TestingSettingsBroadcastReceiver.java
@@ -1,10 +1,10 @@
package com.android.settings;
-import static com.android.internal.telephony.TelephonyIntents.SECRET_CODE_ACTION;
-
+import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
-import android.content.BroadcastReceiver;
+
+import static com.android.internal.telephony.TelephonyIntents.SECRET_CODE_ACTION;
public class TestingSettingsBroadcastReceiver extends BroadcastReceiver {
diff --git a/src/com/android/settings/TetherSettings.java b/src/com/android/settings/TetherSettings.java
index d5df40f..ee8900e 100644
--- a/src/com/android/settings/TetherSettings.java
+++ b/src/com/android/settings/TetherSettings.java
@@ -16,11 +16,6 @@
package com.android.settings;
-import static com.android.settingslib.TetherUtil.TETHERING_INVALID;
-import static com.android.settingslib.TetherUtil.TETHERING_WIFI;
-import static com.android.settingslib.TetherUtil.TETHERING_USB;
-import static com.android.settingslib.TetherUtil.TETHERING_BLUETOOTH;
-
import android.app.Activity;
import android.app.Dialog;
import android.bluetooth.BluetoothAdapter;
@@ -38,11 +33,10 @@
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.os.Environment;
-import android.os.UserHandle;
import android.os.UserManager;
-import android.preference.Preference;
-import android.preference.PreferenceScreen;
-import android.preference.SwitchPreference;
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceScreen;
import android.widget.TextView;
import com.android.internal.logging.MetricsLogger;
@@ -53,6 +47,11 @@
import java.util.ArrayList;
import java.util.concurrent.atomic.AtomicReference;
+import static com.android.settingslib.TetherUtil.TETHERING_BLUETOOTH;
+import static com.android.settingslib.TetherUtil.TETHERING_INVALID;
+import static com.android.settingslib.TetherUtil.TETHERING_USB;
+import static com.android.settingslib.TetherUtil.TETHERING_WIFI;
+
/*
* Displays preferences for Tethering.
*/
@@ -127,7 +126,7 @@
if (mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_TETHERING)
|| !mUm.isAdminUser()) {
mUnavailable = true;
- setPreferenceScreen(new PreferenceScreen(getActivity(), null));
+ setPreferenceScreen(new PreferenceScreen(getPrefContext(), null));
return;
}
@@ -286,7 +285,7 @@
if (mUnavailable) {
TextView emptyView = (TextView) getView().findViewById(android.R.id.empty);
- getListView().setEmptyView(emptyView);
+ setEmptyView(emptyView);
if (emptyView != null) {
emptyView.setText(R.string.tethering_settings_not_available);
}
@@ -561,7 +560,7 @@
}
@Override
- public boolean onPreferenceTreeClick(PreferenceScreen screen, Preference preference) {
+ public boolean onPreferenceTreeClick(Preference preference) {
ConnectivityManager cm =
(ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
@@ -606,7 +605,7 @@
showDialog(DIALOG_AP_SETTINGS);
}
- return super.onPreferenceTreeClick(screen, preference);
+ return super.onPreferenceTreeClick(preference);
}
private static String findIface(String[] ifaces, String[] regexes) {
diff --git a/src/com/android/settings/TintablePreference.java b/src/com/android/settings/TintablePreference.java
index 58794b9..0ada6ed 100644
--- a/src/com/android/settings/TintablePreference.java
+++ b/src/com/android/settings/TintablePreference.java
@@ -17,9 +17,9 @@
import android.content.Context;
import android.content.res.ColorStateList;
-import android.preference.Preference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceViewHolder;
import android.util.AttributeSet;
-import android.view.View;
import android.widget.ImageView;
public class TintablePreference extends Preference {
@@ -36,8 +36,8 @@
}
@Override
- protected void onBindView(View view) {
- super.onBindView(view);
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
if (mTintColor != 0) {
((ImageView) view.findViewById(android.R.id.icon)).setImageTintList(
diff --git a/src/com/android/settings/TrustAgentSettings.java b/src/com/android/settings/TrustAgentSettings.java
index 02a4ef2..d0a25b9 100644
--- a/src/com/android/settings/TrustAgentSettings.java
+++ b/src/com/android/settings/TrustAgentSettings.java
@@ -16,8 +16,6 @@
package com.android.settings;
-import java.util.List;
-
import android.app.admin.DevicePolicyManager;
import android.content.ComponentName;
import android.content.Context;
@@ -27,16 +25,18 @@
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.UserHandle;
-import android.preference.Preference;
-import android.preference.PreferenceGroup;
-import android.preference.SwitchPreference;
import android.service.trust.TrustAgentService;
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceGroup;
import android.util.ArrayMap;
import android.util.ArraySet;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.widget.LockPatternUtils;
+import java.util.List;
+
public class TrustAgentSettings extends SettingsPreferenceFragment implements
Preference.OnPreferenceChangeListener {
private static final String SERVICE_INTERFACE = TrustAgentService.SERVICE_INTERFACE;
@@ -102,7 +102,7 @@
final int count = mAvailableAgents.size();
for (int i = 0; i < count; i++) {
AgentInfo agent = mAvailableAgents.valueAt(i);
- final SwitchPreference preference = new SwitchPreference(context);
+ final SwitchPreference preference = new SwitchPreference(getPrefContext());
agent.preference = preference;
preference.setPersistent(false);
preference.setTitle(agent.label);
diff --git a/src/com/android/settings/TrustedCredentialsSettings.java b/src/com/android/settings/TrustedCredentialsSettings.java
index d3935db..77fc322 100644
--- a/src/com/android/settings/TrustedCredentialsSettings.java
+++ b/src/com/android/settings/TrustedCredentialsSettings.java
@@ -18,7 +18,6 @@
import android.app.AlertDialog;
import android.app.Dialog;
-import android.app.Fragment;
import android.content.Context;
import android.content.DialogInterface;
import android.content.pm.UserInfo;
@@ -31,8 +30,8 @@
import android.security.IKeyChainService;
import android.security.KeyChain;
import android.security.KeyChain.KeyChainConnection;
-import android.util.SparseArray;
import android.util.Log;
+import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -58,8 +57,8 @@
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.List;
import java.util.HashMap;
+import java.util.List;
public class TrustedCredentialsSettings extends InstrumentedFragment {
diff --git a/src/com/android/settings/UsageStatsActivity.java b/src/com/android/settings/UsageStatsActivity.java
index 90aec5b..1d3edbc 100755
--- a/src/com/android/settings/UsageStatsActivity.java
+++ b/src/com/android/settings/UsageStatsActivity.java
@@ -24,6 +24,18 @@
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle;
+import android.text.format.DateUtils;
+import android.util.ArrayMap;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemSelectedListener;
+import android.widget.BaseAdapter;
+import android.widget.ListView;
+import android.widget.Spinner;
+import android.widget.TextView;
import java.text.DateFormat;
import java.util.ArrayList;
@@ -33,19 +45,6 @@
import java.util.List;
import java.util.Map;
-import android.text.format.DateUtils;
-import android.util.ArrayMap;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.AdapterView;
-import android.widget.BaseAdapter;
-import android.widget.ListView;
-import android.widget.Spinner;
-import android.widget.TextView;
-import android.widget.AdapterView.OnItemSelectedListener;
-
/**
* Activity to display package usage statistics.
*/
diff --git a/src/com/android/settings/UserCredentialsSettings.java b/src/com/android/settings/UserCredentialsSettings.java
index f10bb09..c440acf 100644
--- a/src/com/android/settings/UserCredentialsSettings.java
+++ b/src/com/android/settings/UserCredentialsSettings.java
@@ -17,8 +17,6 @@
package com.android.settings;
import android.app.AlertDialog;
-import android.app.Dialog;
-import android.app.Fragment;
import android.content.Context;
import android.content.DialogInterface;
import android.os.AsyncTask;
@@ -28,23 +26,20 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.Adapter;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
-import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import java.util.EnumSet;
-import java.util.List;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
-import static android.view.View.VISIBLE;
import static android.view.View.GONE;
+import static android.view.View.VISIBLE;
public class UserCredentialsSettings extends InstrumentedFragment implements OnItemClickListener {
private static final String TAG = "UserCredentialsSettings";
diff --git a/src/com/android/settings/UserDictionarySettings.java b/src/com/android/settings/UserDictionarySettings.java
index 1e9fd0a..73e9cf5 100644
--- a/src/com/android/settings/UserDictionarySettings.java
+++ b/src/com/android/settings/UserDictionarySettings.java
@@ -16,9 +16,6 @@
package com.android.settings;
-import com.android.settings.inputmethod.UserDictionaryAddWordContents;
-import com.android.settings.inputmethod.UserDictionarySettingsUtils;
-
import android.app.ListFragment;
import android.content.ContentResolver;
import android.content.Context;
@@ -40,6 +37,9 @@
import android.widget.SimpleCursorAdapter;
import android.widget.TextView;
+import com.android.settings.inputmethod.UserDictionaryAddWordContents;
+import com.android.settings.inputmethod.UserDictionarySettingsUtils;
+
import java.util.Locale;
public class UserDictionarySettings extends ListFragment {
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index ed1a970..ed67ee4 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -46,7 +46,6 @@
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
-import android.graphics.drawable.Drawable;
import android.hardware.usb.IUsbManager;
import android.net.ConnectivityManager;
import android.net.LinkProperties;
@@ -60,15 +59,15 @@
import android.os.UserHandle;
import android.os.UserManager;
import android.os.storage.StorageManager;
-import android.preference.Preference;
import android.preference.PreferenceFrameLayout;
-import android.preference.PreferenceGroup;
import android.provider.ContactsContract.CommonDataKinds;
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Data;
import android.provider.ContactsContract.Profile;
import android.provider.ContactsContract.RawContacts;
import android.service.persistentdata.PersistentDataBlockManager;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceGroup;
import android.telephony.TelephonyManager;
import android.text.Spannable;
import android.text.SpannableString;
@@ -90,7 +89,6 @@
import com.android.settings.UserAdapter.UserDetails;
import com.android.settings.dashboard.DashboardTile;
import com.android.settingslib.applications.ApplicationsState;
-import com.android.settingslib.drawable.CircleFramedDrawable;
import java.io.IOException;
import java.io.InputStream;
diff --git a/src/com/android/settings/VoiceInputOutputSettings.java b/src/com/android/settings/VoiceInputOutputSettings.java
index a264d50..3a8f1a5 100644
--- a/src/com/android/settings/VoiceInputOutputSettings.java
+++ b/src/com/android/settings/VoiceInputOutputSettings.java
@@ -16,12 +16,10 @@
package com.android.settings;
-import android.preference.Preference;
-import android.preference.PreferenceCategory;
-import android.preference.PreferenceGroup;
import android.speech.tts.TtsEngines;
-
-import com.android.settings.voice.VoiceInputHelper;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceCategory;
+import android.support.v7.preference.PreferenceGroup;
/**
* Settings screen for voice input/output.
diff --git a/src/com/android/settings/WallpaperTypeSettings.java b/src/com/android/settings/WallpaperTypeSettings.java
index 9046bfb..0ee3c9d 100644
--- a/src/com/android/settings/WallpaperTypeSettings.java
+++ b/src/com/android/settings/WallpaperTypeSettings.java
@@ -22,8 +22,9 @@
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
-import android.preference.Preference;
-import android.preference.PreferenceScreen;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceScreen;
+
import com.android.internal.logging.MetricsLogger;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
@@ -63,7 +64,7 @@
parent.setOrderingAsAdded(false);
// Add Preference items for each of the matching activities
for (ResolveInfo info : rList) {
- Preference pref = new Preference(getActivity());
+ Preference pref = new Preference(getPrefContext());
Intent prefIntent = new Intent(intent);
prefIntent.setComponent(new ComponentName(
info.activityInfo.packageName, info.activityInfo.name));
diff --git a/src/com/android/settings/WarnedListPreference.java b/src/com/android/settings/WarnedListPreference.java
index 634986d..b678d67 100644
--- a/src/com/android/settings/WarnedListPreference.java
+++ b/src/com/android/settings/WarnedListPreference.java
@@ -17,7 +17,7 @@
package com.android.settings;
import android.content.Context;
-import android.preference.ListPreference;
+import android.support.v7.preference.ListPreference;
import android.util.AttributeSet;
public class WarnedListPreference extends ListPreference {
diff --git a/src/com/android/settings/WifiCallingSettings.java b/src/com/android/settings/WifiCallingSettings.java
index 787ccb4..d09c92c 100644
--- a/src/com/android/settings/WifiCallingSettings.java
+++ b/src/com/android/settings/WifiCallingSettings.java
@@ -23,9 +23,9 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
-import android.preference.ListPreference;
-import android.preference.Preference;
-import android.preference.PreferenceScreen;
+import android.support.v7.preference.ListPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceScreen;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.util.Log;
@@ -97,7 +97,7 @@
mSwitchBar.show();
mEmptyView = (TextView) getView().findViewById(android.R.id.empty);
- getListView().setEmptyView(mEmptyView);
+ setEmptyView(mEmptyView);
mEmptyView.setText(R.string.wifi_calling_off_explanation);
}
diff --git a/src/com/android/settings/WirelessSettings.java b/src/com/android/settings/WirelessSettings.java
index c92e8c5..55a2c32 100644
--- a/src/com/android/settings/WirelessSettings.java
+++ b/src/com/android/settings/WirelessSettings.java
@@ -35,11 +35,11 @@
import android.os.Bundle;
import android.os.SystemProperties;
import android.os.UserManager;
-import android.preference.Preference;
-import android.preference.PreferenceScreen;
-import android.preference.SwitchPreference;
import android.provider.SearchIndexableResource;
import android.provider.Settings;
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceScreen;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
@@ -95,7 +95,7 @@
* preference click events.
*/
@Override
- public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
+ public boolean onPreferenceTreeClick(Preference preference) {
log("onPreferenceTreeClick: preference=" + preference);
if (preference == mAirplaneModePreference && Boolean.parseBoolean(
SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE))) {
@@ -108,7 +108,7 @@
onManageMobilePlanClick();
}
// Let the intents be launched by the Preference manager
- return super.onPreferenceTreeClick(preferenceScreen, preference);
+ return super.onPreferenceTreeClick(preference);
}
private String mManageMobilePlanMessage;
diff --git a/src/com/android/settings/ZonePicker.java b/src/com/android/settings/ZonePicker.java
index 2a61a5a..b375fa8 100644
--- a/src/com/android/settings/ZonePicker.java
+++ b/src/com/android/settings/ZonePicker.java
@@ -16,12 +16,12 @@
package com.android.settings;
+import android.annotation.NonNull;
import android.app.Activity;
import android.app.AlarmManager;
import android.app.ListFragment;
import android.content.Context;
import android.os.Bundle;
-import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
diff --git a/src/com/android/settings/accessibility/AccessibilitySettings.java b/src/com/android/settings/accessibility/AccessibilitySettings.java
index a0d2b51..1dcbaa5 100644
--- a/src/com/android/settings/accessibility/AccessibilitySettings.java
+++ b/src/com/android/settings/accessibility/AccessibilitySettings.java
@@ -30,18 +30,19 @@
import android.os.Handler;
import android.os.RemoteException;
import android.os.UserHandle;
-import android.preference.ListPreference;
-import android.preference.Preference;
-import android.preference.PreferenceCategory;
-import android.preference.PreferenceScreen;
-import android.preference.SwitchPreference;
import android.provider.SearchIndexableResource;
import android.provider.Settings;
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.ListPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceCategory;
+import android.support.v7.preference.PreferenceScreen;
import android.text.TextUtils;
import android.text.TextUtils.SimpleStringSplitter;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import android.view.accessibility.AccessibilityManager;
+
import com.android.internal.content.PackageMonitor;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.view.RotationPolicy;
@@ -270,7 +271,7 @@
}
@Override
- public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
+ public boolean onPreferenceTreeClick(Preference preference) {
if (mToggleLargeTextPreference == preference) {
handleToggleLargeTextPreferenceClick();
return true;
@@ -293,7 +294,7 @@
handleDisplayMagnificationPreferenceScreenClick();
return true;
}
- return super.onPreferenceTreeClick(preferenceScreen, preference);
+ return super.onPreferenceTreeClick(preference);
}
private void handleToggleLargeTextPreferenceClick() {
@@ -338,8 +339,7 @@
R.string.accessibility_global_gesture_preference_description));
extras.putBoolean(EXTRA_CHECKED, Settings.Global.getInt(getContentResolver(),
Settings.Global.ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED, 0) == 1);
- super.onPreferenceTreeClick(mGlobalGesturePreferenceScreen,
- mGlobalGesturePreferenceScreen);
+ super.onPreferenceTreeClick(mGlobalGesturePreferenceScreen);
}
private void handleDisplayMagnificationPreferenceScreenClick() {
@@ -350,8 +350,7 @@
R.string.accessibility_screen_magnification_summary));
extras.putBoolean(EXTRA_CHECKED, Settings.Secure.getInt(getContentResolver(),
Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED, 0) == 1);
- super.onPreferenceTreeClick(mDisplayMagnificationPreferenceScreen,
- mDisplayMagnificationPreferenceScreen);
+ super.onPreferenceTreeClick(mDisplayMagnificationPreferenceScreen);
}
private void initializeAllPreferences() {
@@ -527,7 +526,7 @@
if (mServicesCategory.getPreferenceCount() == 0) {
if (mNoServicesMessagePreference == null) {
- mNoServicesMessagePreference = new Preference(getActivity());
+ mNoServicesMessagePreference = new Preference(getPrefContext());
mNoServicesMessagePreference.setPersistent(false);
mNoServicesMessagePreference.setLayoutResource(
R.layout.text_description_preference);
diff --git a/src/com/android/settings/accessibility/CaptionPropertiesFragment.java b/src/com/android/settings/accessibility/CaptionPropertiesFragment.java
index 81640e8..7469fa3 100644
--- a/src/com/android/settings/accessibility/CaptionPropertiesFragment.java
+++ b/src/com/android/settings/accessibility/CaptionPropertiesFragment.java
@@ -21,12 +21,12 @@
import android.content.res.Resources;
import android.graphics.Color;
import android.os.Bundle;
-import android.preference.ListPreference;
-import android.preference.Preference;
-import android.preference.PreferenceCategory;
import android.preference.PreferenceFrameLayout;
-import android.preference.Preference.OnPreferenceChangeListener;
import android.provider.Settings;
+import android.support.v7.preference.ListPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceChangeListener;
+import android.support.v7.preference.PreferenceCategory;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnLayoutChangeListener;
diff --git a/src/com/android/settings/accessibility/ColorPreference.java b/src/com/android/settings/accessibility/ColorPreference.java
index 39e555a..27d46a0 100644
--- a/src/com/android/settings/accessibility/ColorPreference.java
+++ b/src/com/android/settings/accessibility/ColorPreference.java
@@ -20,6 +20,7 @@
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
+import android.support.v7.preference.PreferenceViewHolder;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
@@ -79,8 +80,8 @@
}
@Override
- protected void onBindView(View view) {
- super.onBindView(view);
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
if (mPreviewEnabled) {
final ImageView previewImage = (ImageView) view.findViewById(R.id.color_preview);
diff --git a/src/com/android/settings/accessibility/ListDialogPreference.java b/src/com/android/settings/accessibility/ListDialogPreference.java
index 2140d91..a67bf48 100644
--- a/src/com/android/settings/accessibility/ListDialogPreference.java
+++ b/src/com/android/settings/accessibility/ListDialogPreference.java
@@ -16,26 +16,27 @@
package com.android.settings.accessibility;
-import android.app.AlertDialog.Builder;
+import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
+import android.content.DialogInterface;
import android.content.res.TypedArray;
import android.os.Parcel;
import android.os.Parcelable;
-import android.preference.DialogPreference;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.AdapterView;
-import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
+import com.android.settings.CustomDialogPreference;
+
/**
* Abstract dialog preference that displays a set of values and optional titles.
*/
-public abstract class ListDialogPreference extends DialogPreference {
+public abstract class ListDialogPreference extends CustomDialogPreference {
private CharSequence[] mEntryTitles;
private int[] mEntryValues;
@@ -137,8 +138,9 @@
}
@Override
- protected void onPrepareDialogBuilder(Builder builder) {
- super.onPrepareDialogBuilder(builder);
+ protected void onPrepareDialogBuilder(AlertDialog.Builder builder,
+ DialogInterface.OnClickListener listener) {
+ super.onPrepareDialogBuilder(builder, listener);
final Context context = getContext();
final int dialogLayout = getDialogLayoutResource();
@@ -146,7 +148,7 @@
final ListPreferenceAdapter adapter = new ListPreferenceAdapter();
final AbsListView list = (AbsListView) picker.findViewById(android.R.id.list);
list.setAdapter(adapter);
- list.setOnItemClickListener(new OnItemClickListener() {
+ list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapter, View v, int position, long id) {
if (callChangeListener((int) id)) {
diff --git a/src/com/android/settings/accessibility/LocalePreference.java b/src/com/android/settings/accessibility/LocalePreference.java
index 10e94a8..2d87b6e 100644
--- a/src/com/android/settings/accessibility/LocalePreference.java
+++ b/src/com/android/settings/accessibility/LocalePreference.java
@@ -17,7 +17,7 @@
package com.android.settings.accessibility;
import android.content.Context;
-import android.preference.ListPreference;
+import android.support.v7.preference.ListPreference;
import android.util.AttributeSet;
import com.android.internal.app.LocalePicker;
diff --git a/src/com/android/settings/accessibility/ToggleAutoclickPreferenceFragment.java b/src/com/android/settings/accessibility/ToggleAutoclickPreferenceFragment.java
index 053c0b0..b625d75 100644
--- a/src/com/android/settings/accessibility/ToggleAutoclickPreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleAutoclickPreferenceFragment.java
@@ -18,16 +18,16 @@
import android.content.res.Resources;
import android.os.Bundle;
-import android.preference.SeekBarPreference;
-import android.preference.Preference;
import android.provider.Settings;
+import android.support.v7.preference.Preference;
import android.view.View;
import android.view.accessibility.AccessibilityManager;
import android.widget.Switch;
-import com.android.settings.widget.SwitchBar;
import com.android.settings.InstrumentedFragment;
import com.android.settings.R;
+import com.android.settings.SeekBarPreference;
+import com.android.settings.widget.SwitchBar;
/**
diff --git a/src/com/android/settings/accessibility/ToggleDaltonizerPreferenceFragment.java b/src/com/android/settings/accessibility/ToggleDaltonizerPreferenceFragment.java
index c7ed1a1..2f4e3b5 100644
--- a/src/com/android/settings/accessibility/ToggleDaltonizerPreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleDaltonizerPreferenceFragment.java
@@ -17,13 +17,13 @@
package com.android.settings.accessibility;
import android.os.Bundle;
-import android.preference.ListPreference;
-import android.preference.Preference;
import android.provider.Settings;
+import android.support.v7.preference.ListPreference;
+import android.support.v7.preference.Preference;
import android.view.View;
import android.view.accessibility.AccessibilityManager;
-
import android.widget.Switch;
+
import com.android.internal.logging.MetricsLogger;
import com.android.settings.R;
import com.android.settings.widget.SwitchBar;
diff --git a/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java b/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
index 34882ae..bee46c8 100644
--- a/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
@@ -17,11 +17,10 @@
package com.android.settings.accessibility;
import android.content.Intent;
-import android.graphics.Color;
-import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
-import android.preference.Preference;
-import android.preference.PreferenceScreen;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceScreen;
+import android.support.v7.preference.PreferenceViewHolder;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
@@ -54,10 +53,12 @@
PreferenceScreen preferenceScreen = getPreferenceManager().createPreferenceScreen(
getActivity());
setPreferenceScreen(preferenceScreen);
- mSummaryPreference = new Preference(getActivity()) {
+ mSummaryPreference = new Preference(getPrefContext()) {
@Override
- protected void onBindView(View view) {
- super.onBindView(view);
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
+ view.setDividerAllowedAbove(false);
+ view.setDividerAllowedBelow(false);
final TextView summaryView = (TextView) view.findViewById(android.R.id.summary);
summaryView.setText(getSummary());
sendAccessibilityEvent(summaryView);
@@ -167,10 +168,6 @@
final CharSequence summary = arguments.getCharSequence(
AccessibilitySettings.EXTRA_SUMMARY);
mSummaryPreference.setSummary(summary);
-
- // Set a transparent drawable to prevent use of the default one.
- getListView().setSelector(new ColorDrawable(Color.TRANSPARENT));
- getListView().setDivider(null);
} else {
getPreferenceScreen().removePreference(mSummaryPreference);
}
diff --git a/src/com/android/settings/accounts/AccountPreferenceBase.java b/src/com/android/settings/accounts/AccountPreferenceBase.java
index a34be22..6bb5b28 100644
--- a/src/com/android/settings/accounts/AccountPreferenceBase.java
+++ b/src/com/android/settings/accounts/AccountPreferenceBase.java
@@ -30,7 +30,7 @@
import android.os.Handler;
import android.os.UserHandle;
import android.os.UserManager;
-import android.preference.PreferenceScreen;
+import android.support.v7.preference.PreferenceScreen;
import android.text.format.DateFormat;
import android.util.Log;
import android.view.ContextThemeWrapper;
diff --git a/src/com/android/settings/accounts/AccountSettings.java b/src/com/android/settings/accounts/AccountSettings.java
index 3c68ca3..2f47eb7 100644
--- a/src/com/android/settings/accounts/AccountSettings.java
+++ b/src/com/android/settings/accounts/AccountSettings.java
@@ -35,19 +35,19 @@
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
+import android.os.Process;
import android.os.UserHandle;
import android.os.UserManager;
-import android.os.Process;
+import android.provider.SearchIndexableResource;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceClickListener;
+import android.support.v7.preference.PreferenceGroup;
+import android.support.v7.preference.PreferenceScreen;
import android.util.Log;
import android.util.SparseArray;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceClickListener;
-import android.provider.SearchIndexableResource;
-import android.preference.PreferenceGroup;
-import android.preference.PreferenceScreen;
import com.android.internal.logging.MetricsLogger;
import com.android.settings.AccessiblePreferenceCategory;
@@ -133,7 +133,7 @@
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mUm = (UserManager) getSystemService(Context.USER_SERVICE);
- mProfileNotAvailablePreference = new Preference(getActivity());
+ mProfileNotAvailablePreference = new Preference(getPrefContext());
mAuthorities = getActivity().getIntent().getStringArrayExtra(EXTRA_AUTHORITIES);
if (mAuthorities != null) {
mAuthoritiesCount = mAuthorities.length;
@@ -277,7 +277,7 @@
final ProfileData profileData = new ProfileData();
profileData.userInfo = userInfo;
if (addCategory) {
- profileData.preferenceGroup = new AccessiblePreferenceCategory(context);
+ profileData.preferenceGroup = new AccessiblePreferenceCategory(getPrefContext());
if (userInfo.isManagedProfile()) {
profileData.preferenceGroup.setLayoutResource(R.layout.work_profile_category);
profileData.preferenceGroup.setTitle(R.string.category_work);
@@ -308,7 +308,7 @@
}
private Preference newAddAccountPreference(Context context) {
- Preference preference = new Preference(context);
+ Preference preference = new Preference(getPrefContext());
preference.setTitle(R.string.add_account_label);
preference.setIcon(R.drawable.ic_menu_add);
preference.setOnPreferenceClickListener(this);
@@ -317,7 +317,7 @@
}
private Preference newRemoveWorkProfilePreference(Context context) {
- Preference preference = new Preference(context);
+ Preference preference = new Preference(getPrefContext());
preference.setTitle(R.string.remove_managed_profile_label);
preference.setIcon(R.drawable.ic_menu_delete);
preference.setOnPreferenceClickListener(this);
@@ -419,7 +419,7 @@
accounts[0]);
fragmentArguments.putParcelable(EXTRA_USER, userHandle);
- accountTypePreferences.add(new AccountPreference(getActivity(), label,
+ accountTypePreferences.add(new AccountPreference(getPrefContext(), label,
titleResPackageName, titleResId, AccountSyncSettings.class.getName(),
fragmentArguments,
helper.getDrawableForType(getActivity(), accountType)));
@@ -430,7 +430,7 @@
label.toString());
fragmentArguments.putParcelable(EXTRA_USER, userHandle);
- accountTypePreferences.add(new AccountPreference(getActivity(), label,
+ accountTypePreferences.add(new AccountPreference(getPrefContext(), label,
titleResPackageName, titleResId, ManageAccountsSettings.class.getName(),
fragmentArguments,
helper.getDrawableForType(getActivity(), accountType)));
diff --git a/src/com/android/settings/accounts/AccountSyncSettings.java b/src/com/android/settings/accounts/AccountSyncSettings.java
index 2fbae85..5cb1c4a 100644
--- a/src/com/android/settings/accounts/AccountSyncSettings.java
+++ b/src/com/android/settings/accounts/AccountSyncSettings.java
@@ -16,9 +16,6 @@
package com.android.settings.accounts;
-import com.android.internal.logging.MetricsLogger;
-import com.google.android.collect.Lists;
-
import android.accounts.Account;
import android.accounts.AccountManager;
import android.accounts.AccountManagerCallback;
@@ -40,8 +37,7 @@
import android.os.Bundle;
import android.os.UserHandle;
import android.os.UserManager;
-import android.preference.Preference;
-import android.preference.PreferenceScreen;
+import android.support.v7.preference.Preference;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
@@ -54,8 +50,10 @@
import android.widget.ListView;
import android.widget.TextView;
+import com.android.internal.logging.MetricsLogger;
import com.android.settings.R;
import com.android.settings.Utils;
+import com.google.android.collect.Lists;
import java.io.IOException;
import java.util.ArrayList;
@@ -232,7 +230,7 @@
private void addSyncStateSwitch(Account account, String authority) {
SyncStateSwitchPreference item =
- new SyncStateSwitchPreference(getActivity(), account, authority);
+ new SyncStateSwitchPreference(getPrefContext(), account, authority);
item.setPersistent(false);
final ProviderInfo providerInfo = getPackageManager().resolveContentProviderAsUser(
authority, 0, mUserHandle.getIdentifier());
@@ -302,7 +300,7 @@
}
@Override
- public boolean onPreferenceTreeClick(PreferenceScreen preferences, Preference preference) {
+ public boolean onPreferenceTreeClick(Preference preference) {
if (preference instanceof SyncStateSwitchPreference) {
SyncStateSwitchPreference syncPref = (SyncStateSwitchPreference) preference;
String authority = syncPref.getAuthority();
@@ -328,7 +326,7 @@
}
return true;
} else {
- return super.onPreferenceTreeClick(preferences, preference);
+ return super.onPreferenceTreeClick(preference);
}
}
diff --git a/src/com/android/settings/accounts/AuthenticatorHelper.java b/src/com/android/settings/accounts/AuthenticatorHelper.java
index 56a689c..a0ded04 100644
--- a/src/com/android/settings/accounts/AuthenticatorHelper.java
+++ b/src/com/android/settings/accounts/AuthenticatorHelper.java
@@ -16,8 +16,6 @@
package com.android.settings.accounts;
-import com.google.android.collect.Maps;
-
import android.accounts.Account;
import android.accounts.AccountManager;
import android.accounts.AuthenticatorDescription;
@@ -35,6 +33,8 @@
import android.os.UserManager;
import android.util.Log;
+import com.google.android.collect.Maps;
+
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
diff --git a/src/com/android/settings/accounts/ChooseAccountActivity.java b/src/com/android/settings/accounts/ChooseAccountActivity.java
index 12077af..d1e29f3 100644
--- a/src/com/android/settings/accounts/ChooseAccountActivity.java
+++ b/src/com/android/settings/accounts/ChooseAccountActivity.java
@@ -28,10 +28,8 @@
import android.os.Bundle;
import android.os.UserHandle;
import android.os.UserManager;
-import android.preference.Preference;
-import android.preference.PreferenceActivity;
-import android.preference.PreferenceGroup;
-import android.preference.PreferenceScreen;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceGroup;
import android.util.Log;
import com.android.internal.logging.MetricsLogger;
@@ -39,7 +37,6 @@
import com.android.settings.InstrumentedPreferenceActivity;
import com.android.settings.R;
import com.android.settings.Utils;
-
import com.google.android.collect.Maps;
import java.util.ArrayList;
@@ -171,8 +168,8 @@
mAddAccountGroup.removeAll();
for (ProviderEntry pref : mProviderList) {
Drawable drawable = getDrawableForType(pref.type);
- ProviderPreference p =
- new ProviderPreference(this, pref.type, drawable, pref.name);
+ ProviderPreference p = new ProviderPreference(getPreferenceScreen().getContext(),
+ pref.type, drawable, pref.name);
mAddAccountGroup.addPreference(p);
}
} else {
@@ -260,7 +257,7 @@
}
@Override
- public boolean onPreferenceTreeClick(PreferenceScreen preferences, Preference preference) {
+ public boolean onPreferenceTreeClick(Preference preference) {
if (preference instanceof ProviderPreference) {
ProviderPreference pref = (ProviderPreference) preference;
if (Log.isLoggable(TAG, Log.VERBOSE)) {
diff --git a/src/com/android/settings/accounts/ManageAccountsSettings.java b/src/com/android/settings/accounts/ManageAccountsSettings.java
index bbb8c14..351ab12 100644
--- a/src/com/android/settings/accounts/ManageAccountsSettings.java
+++ b/src/com/android/settings/accounts/ManageAccountsSettings.java
@@ -34,9 +34,9 @@
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.UserHandle;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceClickListener;
-import android.preference.PreferenceScreen;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceClickListener;
+import android.support.v7.preference.PreferenceScreen;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
@@ -155,7 +155,7 @@
}
@Override
- public boolean onPreferenceTreeClick(PreferenceScreen preferences, Preference preference) {
+ public boolean onPreferenceTreeClick(Preference preference) {
if (preference instanceof AccountPreference) {
startAccountSettings((AccountPreference) preference);
} else {
@@ -385,7 +385,7 @@
if (showAccount) {
final Drawable icon = getDrawableForType(account.type);
final AccountPreference preference =
- new AccountPreference(getActivity(), account, icon, auths, false);
+ new AccountPreference(getPrefContext(), account, icon, auths, false);
getPreferenceScreen().addPreference(preference);
if (mFirstAccount == null) {
mFirstAccount = account;
diff --git a/src/com/android/settings/accounts/ProviderPreference.java b/src/com/android/settings/accounts/ProviderPreference.java
index 257cd1c..9a63062 100644
--- a/src/com/android/settings/accounts/ProviderPreference.java
+++ b/src/com/android/settings/accounts/ProviderPreference.java
@@ -18,7 +18,7 @@
import android.content.Context;
import android.graphics.drawable.Drawable;
-import android.preference.Preference;
+import android.support.v7.preference.Preference;
/**
* ProviderPreference is used to display an image to the left of a provider name.
diff --git a/src/com/android/settings/accounts/SyncStateSwitchPreference.java b/src/com/android/settings/accounts/SyncStateSwitchPreference.java
index fd0c45c..5800fc2 100644
--- a/src/com/android/settings/accounts/SyncStateSwitchPreference.java
+++ b/src/com/android/settings/accounts/SyncStateSwitchPreference.java
@@ -19,11 +19,11 @@
import android.accounts.Account;
import android.app.ActivityManager;
import android.content.Context;
-import android.preference.SwitchPreference;
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.PreferenceViewHolder;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
-import android.view.ViewGroup;
import android.widget.TextView;
import com.android.settings.R;
@@ -56,8 +56,8 @@
}
@Override
- public void onBindView(View view) {
- super.onBindView(view);
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
final AnimatedImageView syncActiveView = (AnimatedImageView) view.findViewById(
R.id.sync_active);
final View syncFailedView = view.findViewById(R.id.sync_failed);
diff --git a/src/com/android/settings/applications/AdvancedAppSettings.java b/src/com/android/settings/applications/AdvancedAppSettings.java
index 43fae71..ed266c9 100644
--- a/src/com/android/settings/applications/AdvancedAppSettings.java
+++ b/src/com/android/settings/applications/AdvancedAppSettings.java
@@ -15,20 +15,16 @@
*/
package com.android.settings.applications;
-import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Intent;
-import android.content.pm.ApplicationInfo;
-import android.os.Bundle;
import android.os.AsyncTask;
-import android.preference.Preference;
-import android.provider.Settings;
+import android.os.Bundle;
+import android.support.v7.preference.Preference;
import com.android.internal.logging.MetricsLogger;
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.applications.PermissionsSummaryHelper.PermissionsResultCallback;
-import com.android.settings.fuelgauge.PowerWhitelistBackend;
import com.android.settingslib.applications.ApplicationsState;
import com.android.settingslib.applications.ApplicationsState.AppEntry;
import com.android.settingslib.applications.ApplicationsState.Session;
diff --git a/src/com/android/settings/applications/AppDomainsPreference.java b/src/com/android/settings/applications/AppDomainsPreference.java
index 5d6bdb0..684a0b7 100644
--- a/src/com/android/settings/applications/AppDomainsPreference.java
+++ b/src/com/android/settings/applications/AppDomainsPreference.java
@@ -21,8 +21,8 @@
import android.view.View;
import android.widget.TextView;
-import com.android.settings.accessibility.ListDialogPreference;
import com.android.settings.R;
+import com.android.settings.accessibility.ListDialogPreference;
public class AppDomainsPreference extends ListDialogPreference {
private int mNumEntries;
diff --git a/src/com/android/settings/applications/AppLaunchSettings.java b/src/com/android/settings/applications/AppLaunchSettings.java
index 3db08ff..cbac4a1 100644
--- a/src/com/android/settings/applications/AppLaunchSettings.java
+++ b/src/com/android/settings/applications/AppLaunchSettings.java
@@ -26,8 +26,8 @@
import android.net.Uri;
import android.os.Bundle;
import android.os.UserHandle;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceChangeListener;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceChangeListener;
import android.util.ArraySet;
import android.util.Log;
import android.view.View;
@@ -41,7 +41,6 @@
import java.util.List;
import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS;
-import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK;
import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK;
import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER;
import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED;
diff --git a/src/com/android/settings/applications/AppOpsCategory.java b/src/com/android/settings/applications/AppOpsCategory.java
index 03ebb9e..3ccd6bb 100644
--- a/src/com/android/settings/applications/AppOpsCategory.java
+++ b/src/com/android/settings/applications/AppOpsCategory.java
@@ -36,12 +36,12 @@
import android.widget.ListView;
import android.widget.TextView;
-import java.util.List;
-
import com.android.settings.R;
import com.android.settings.SettingsActivity;
import com.android.settings.applications.AppOpsState.AppOpEntry;
+import java.util.List;
+
public class AppOpsCategory extends ListFragment implements
LoaderManager.LoaderCallbacks<List<AppOpEntry>> {
diff --git a/src/com/android/settings/applications/AppOpsDetails.java b/src/com/android/settings/applications/AppOpsDetails.java
index a8320b1..7e9270a 100644
--- a/src/com/android/settings/applications/AppOpsDetails.java
+++ b/src/com/android/settings/applications/AppOpsDetails.java
@@ -18,7 +18,6 @@
import android.app.Activity;
import android.app.AppOpsManager;
-import android.app.Fragment;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
diff --git a/src/com/android/settings/applications/AppOpsState.java b/src/com/android/settings/applications/AppOpsState.java
index 07e955d..c3189d6 100644
--- a/src/com/android/settings/applications/AppOpsState.java
+++ b/src/com/android/settings/applications/AppOpsState.java
@@ -27,9 +27,9 @@
import android.os.Parcel;
import android.os.Parcelable;
import android.text.format.DateUtils;
-
import android.util.Log;
import android.util.SparseArray;
+
import com.android.settings.R;
import java.io.File;
diff --git a/src/com/android/settings/applications/AppStateAppOpsBridge.java b/src/com/android/settings/applications/AppStateAppOpsBridge.java
index ebff54e..59af46d 100644
--- a/src/com/android/settings/applications/AppStateAppOpsBridge.java
+++ b/src/com/android/settings/applications/AppStateAppOpsBridge.java
@@ -15,7 +15,6 @@
*/
package com.android.settings.applications;
-import android.Manifest;
import android.app.AppGlobals;
import android.app.AppOpsManager;
import android.app.AppOpsManager.PackageOps;
@@ -32,7 +31,6 @@
import com.android.settingslib.applications.ApplicationsState;
import com.android.settingslib.applications.ApplicationsState.AppEntry;
-import com.android.settingslib.applications.ApplicationsState.AppFilter;
import java.util.Arrays;
import java.util.Collection;
diff --git a/src/com/android/settings/applications/AppStateOverlayBridge.java b/src/com/android/settings/applications/AppStateOverlayBridge.java
index 71a6037..af51984 100644
--- a/src/com/android/settings/applications/AppStateOverlayBridge.java
+++ b/src/com/android/settings/applications/AppStateOverlayBridge.java
@@ -18,7 +18,6 @@
import android.Manifest;
import android.app.AppOpsManager;
import android.content.Context;
-import android.util.Log;
import com.android.settingslib.applications.ApplicationsState;
import com.android.settingslib.applications.ApplicationsState.AppEntry;
diff --git a/src/com/android/settings/applications/AppStateUsageBridge.java b/src/com/android/settings/applications/AppStateUsageBridge.java
index 70a3ae6..f84ef3e 100644
--- a/src/com/android/settings/applications/AppStateUsageBridge.java
+++ b/src/com/android/settings/applications/AppStateUsageBridge.java
@@ -18,7 +18,6 @@
import android.Manifest;
import android.app.AppOpsManager;
import android.content.Context;
-import android.util.Log;
import com.android.settingslib.applications.ApplicationsState;
import com.android.settingslib.applications.ApplicationsState.AppEntry;
diff --git a/src/com/android/settings/applications/AppStateWriteSettingsBridge.java b/src/com/android/settings/applications/AppStateWriteSettingsBridge.java
index 7cdf7ea..7851598 100644
--- a/src/com/android/settings/applications/AppStateWriteSettingsBridge.java
+++ b/src/com/android/settings/applications/AppStateWriteSettingsBridge.java
@@ -18,7 +18,6 @@
import android.Manifest;
import android.app.AppOpsManager;
import android.content.Context;
-import android.util.Log;
import com.android.settingslib.applications.ApplicationsState;
import com.android.settingslib.applications.ApplicationsState.AppEntry;
diff --git a/src/com/android/settings/applications/AppStorageSettings.java b/src/com/android/settings/applications/AppStorageSettings.java
index 29a4819..355ed72 100644
--- a/src/com/android/settings/applications/AppStorageSettings.java
+++ b/src/com/android/settings/applications/AppStorageSettings.java
@@ -32,8 +32,8 @@
import android.os.RemoteException;
import android.os.storage.StorageManager;
import android.os.storage.VolumeInfo;
-import android.preference.Preference;
-import android.preference.PreferenceCategory;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceCategory;
import android.text.format.Formatter;
import android.util.Log;
import android.view.View;
diff --git a/src/com/android/settings/applications/AppViewHolder.java b/src/com/android/settings/applications/AppViewHolder.java
index 9771427..cdb8048 100644
--- a/src/com/android/settings/applications/AppViewHolder.java
+++ b/src/com/android/settings/applications/AppViewHolder.java
@@ -20,7 +20,6 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;
diff --git a/src/com/android/settings/applications/ClearDefaultsPreference.java b/src/com/android/settings/applications/ClearDefaultsPreference.java
index bcb6a8a..96a9b3f 100644
--- a/src/com/android/settings/applications/ClearDefaultsPreference.java
+++ b/src/com/android/settings/applications/ClearDefaultsPreference.java
@@ -24,14 +24,14 @@
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;
-import android.preference.Preference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceViewHolder;
import android.text.SpannableString;
import android.text.TextUtils;
import android.text.style.BulletSpan;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
-import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
@@ -43,7 +43,6 @@
protected static final String TAG = ClearDefaultsPreference.class.getSimpleName();
- private View mRootView;
private Button mActivitiesButton;
private AppWidgetManager mAppWidgetManager;
@@ -85,10 +84,10 @@
}
@Override
- protected View onCreateView(ViewGroup parent) {
- mRootView = super.onCreateView(parent);
+ public void onBindViewHolder(final PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
- mActivitiesButton = (Button) mRootView.findViewById(R.id.clear_activities_button);
+ mActivitiesButton = (Button) view.findViewById(R.id.clear_activities_button);
mActivitiesButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -104,27 +103,20 @@
Log.e(TAG, "mUsbManager.clearDefaults", e);
}
mAppWidgetManager.setBindAppWidgetPermission(mPackageName, false);
- TextView autoLaunchView = (TextView) mRootView.findViewById(R.id.auto_launch);
+ TextView autoLaunchView = (TextView) view.findViewById(R.id.auto_launch);
resetLaunchDefaultsUi(autoLaunchView);
}
}
});
- return mRootView;
+ updateUI(view);
}
- @Override
- protected void onBindView(View view) {
- super.onBindView(view);
-
- updateUI();
- }
-
- public boolean updateUI() {
+ public boolean updateUI(PreferenceViewHolder view) {
boolean hasBindAppWidgetPermission =
mAppWidgetManager.hasBindAppWidgetPermission(mAppEntry.info.packageName);
- TextView autoLaunchView = (TextView) mRootView.findViewById(R.id.auto_launch);
+ TextView autoLaunchView = (TextView) view.findViewById(R.id.auto_launch);
boolean autoLaunchEnabled = Utils.hasPreferredActivities(mPm, mPackageName)
|| isDefaultBrowser(mPackageName)
|| Utils.hasUsbDefaults(mUsbManager, mPackageName);
diff --git a/src/com/android/settings/applications/DrawOverlayDetails.java b/src/com/android/settings/applications/DrawOverlayDetails.java
index ef92c21..85d3d7b 100644
--- a/src/com/android/settings/applications/DrawOverlayDetails.java
+++ b/src/com/android/settings/applications/DrawOverlayDetails.java
@@ -18,31 +18,25 @@
import android.app.AlertDialog;
import android.app.AppOpsManager;
import android.content.ActivityNotFoundException;
-import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.UserHandle;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceChangeListener;
-import android.preference.Preference.OnPreferenceClickListener;
-import android.preference.SwitchPreference;
import android.provider.Settings;
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceChangeListener;
+import android.support.v7.preference.Preference.OnPreferenceClickListener;
import android.util.Log;
import com.android.internal.logging.MetricsLogger;
-import com.android.settings.InstrumentedFragment;
import com.android.settings.R;
import com.android.settings.applications.AppStateAppOpsBridge.PermissionState;
import com.android.settings.applications.AppStateOverlayBridge.OverlayState;
-import com.android.settingslib.applications.ApplicationsState;
import com.android.settingslib.applications.ApplicationsState.AppEntry;
-import java.util.List;
-
public class DrawOverlayDetails extends AppInfoWithHeader implements OnPreferenceChangeListener,
OnPreferenceClickListener {
diff --git a/src/com/android/settings/applications/InstalledAppDetails.java b/src/com/android/settings/applications/InstalledAppDetails.java
index 1d5ed87..ce7b9fd 100755
--- a/src/com/android/settings/applications/InstalledAppDetails.java
+++ b/src/com/android/settings/applications/InstalledAppDetails.java
@@ -21,6 +21,7 @@
import android.app.AlertDialog;
import android.app.LoaderManager.LoaderCallbacks;
import android.app.admin.DevicePolicyManager;
+import android.icu.text.ListFormatter;
import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
@@ -35,7 +36,6 @@
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;
@@ -48,8 +48,8 @@
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceClickListener;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceClickListener;
import android.text.TextUtils;
import android.text.format.DateUtils;
import android.text.format.Formatter;
@@ -79,8 +79,8 @@
import com.android.settings.notification.NotificationBackend;
import com.android.settings.notification.NotificationBackend.AppRow;
import com.android.settingslib.AppItem;
-import com.android.settingslib.applications.ApplicationsState.AppEntry;
import com.android.settingslib.applications.ApplicationsState;
+import com.android.settingslib.applications.ApplicationsState.AppEntry;
import com.android.settingslib.net.ChartData;
import com.android.settingslib.net.ChartDataLoader;
diff --git a/src/com/android/settings/applications/InstalledAppDetailsTop.java b/src/com/android/settings/applications/InstalledAppDetailsTop.java
index e078729..8072694 100644
--- a/src/com/android/settings/applications/InstalledAppDetailsTop.java
+++ b/src/com/android/settings/applications/InstalledAppDetailsTop.java
@@ -17,6 +17,7 @@
package com.android.settings.applications;
import android.content.Intent;
+
import com.android.settings.SettingsActivity;
public class InstalledAppDetailsTop extends SettingsActivity {
diff --git a/src/com/android/settings/applications/LayoutPreference.java b/src/com/android/settings/applications/LayoutPreference.java
index f0c7e4a..ac1bd3e 100644
--- a/src/com/android/settings/applications/LayoutPreference.java
+++ b/src/com/android/settings/applications/LayoutPreference.java
@@ -18,11 +18,13 @@
import android.content.Context;
import android.content.res.TypedArray;
-import android.preference.Preference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceViewHolder;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.FrameLayout;
import com.android.settings.R;
import com.android.settings.Utils;
@@ -33,7 +35,6 @@
public LayoutPreference(Context context, AttributeSet attrs) {
super(context, attrs);
- setSelectable(false);
final TypedArray a = context.obtainStyledAttributes(
attrs, com.android.internal.R.styleable.Preference, 0, 0);
int layoutResource = a.getResourceId(com.android.internal.R.styleable.Preference_layout,
@@ -44,7 +45,21 @@
// Need to create view now so that findViewById can be called immediately.
final View view = LayoutInflater.from(getContext())
.inflate(layoutResource, null, false);
+ setView(view);
+ }
+ public LayoutPreference(Context context, int resource) {
+ this(context, LayoutInflater.from(context).inflate(resource, null, false));
+ }
+
+ public LayoutPreference(Context context, View view) {
+ super(context);
+ setView(view);
+ }
+
+ private void setView(View view) {
+ setLayoutResource(R.layout.layout_preference_frame);
+ setSelectable(false);
final ViewGroup allDetails = (ViewGroup) view.findViewById(R.id.all_details);
if (allDetails != null) {
Utils.forceCustomPadding(allDetails, true /* additive padding */);
@@ -54,13 +69,10 @@
}
@Override
- protected View onCreateView(ViewGroup parent) {
- return mRootView;
- }
-
- @Override
- protected void onBindView(View view) {
- // Do nothing.
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ FrameLayout layout = (FrameLayout) view.itemView;
+ layout.removeAllViews();
+ layout.addView(mRootView);
}
public View findViewById(int id) {
diff --git a/src/com/android/settings/applications/LinearColorPreference.java b/src/com/android/settings/applications/LinearColorPreference.java
index b5f707e..e400f5e 100644
--- a/src/com/android/settings/applications/LinearColorPreference.java
+++ b/src/com/android/settings/applications/LinearColorPreference.java
@@ -17,8 +17,9 @@
package com.android.settings.applications;
import android.content.Context;
-import android.preference.Preference;
-import android.view.View;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceViewHolder;
+
import com.android.settings.R;
public class LinearColorPreference extends Preference {
@@ -61,8 +62,8 @@
}
@Override
- protected void onBindView(View view) {
- super.onBindView(view);
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
LinearColorBar colors = (LinearColorBar)view.findViewById(
R.id.linear_color_bar);
diff --git a/src/com/android/settings/applications/ManageApplications.java b/src/com/android/settings/applications/ManageApplications.java
index 868f5f8..8694ca9 100644
--- a/src/com/android/settings/applications/ManageApplications.java
+++ b/src/com/android/settings/applications/ManageApplications.java
@@ -26,7 +26,6 @@
import android.os.UserHandle;
import android.os.UserManager;
import android.preference.PreferenceFrameLayout;
-import android.provider.Settings;
import android.util.ArraySet;
import android.util.Log;
import android.view.LayoutInflater;
@@ -35,7 +34,6 @@
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
-import android.view.animation.AnimationUtils;
import android.widget.AbsListView;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
@@ -57,9 +55,9 @@
import com.android.settings.Settings.DomainsURLsAppListActivity;
import com.android.settings.Settings.HighPowerApplicationsActivity;
import com.android.settings.Settings.NotificationAppListActivity;
+import com.android.settings.Settings.OverlaySettingsActivity;
import com.android.settings.Settings.StorageUseActivity;
import com.android.settings.Settings.UsageAccessSettingsActivity;
-import com.android.settings.Settings.OverlaySettingsActivity;
import com.android.settings.Settings.WriteSettingsActivity;
import com.android.settings.SettingsActivity;
import com.android.settings.Utils;
diff --git a/src/com/android/settings/applications/ManageAssist.java b/src/com/android/settings/applications/ManageAssist.java
index f1d70ee..fb4248d 100644
--- a/src/com/android/settings/applications/ManageAssist.java
+++ b/src/com/android/settings/applications/ManageAssist.java
@@ -21,12 +21,11 @@
import android.content.DialogInterface;
import android.os.Bundle;
import android.os.Handler;
-import android.preference.Preference;
-import android.preference.SwitchPreference;
import android.provider.Settings;
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.Preference;
import com.android.internal.logging.MetricsLogger;
-import com.android.settings.InstrumentedFragment;
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.voice.VoiceInputListPreference;
diff --git a/src/com/android/settings/applications/ManageDefaultApps.java b/src/com/android/settings/applications/ManageDefaultApps.java
index f4ec843..cbba122 100644
--- a/src/com/android/settings/applications/ManageDefaultApps.java
+++ b/src/com/android/settings/applications/ManageDefaultApps.java
@@ -25,14 +25,13 @@
import android.os.Handler;
import android.os.UserHandle;
import android.os.UserManager;
-import android.preference.Preference;
import android.provider.SearchIndexableResource;
+import android.support.v7.preference.Preference;
import android.text.TextUtils;
import android.util.Log;
import com.android.internal.content.PackageMonitor;
import com.android.internal.logging.MetricsLogger;
-import com.android.settings.InstrumentedFragment;
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.search.BaseSearchIndexProvider;
diff --git a/src/com/android/settings/applications/ProcStatsEntry.java b/src/com/android/settings/applications/ProcStatsEntry.java
index 637003c..faf0f5e 100644
--- a/src/com/android/settings/applications/ProcStatsEntry.java
+++ b/src/com/android/settings/applications/ProcStatsEntry.java
@@ -23,6 +23,7 @@
import android.util.ArrayMap;
import android.util.Log;
import android.util.SparseArray;
+
import com.android.internal.app.ProcessStats;
import java.util.ArrayList;
diff --git a/src/com/android/settings/applications/ProcessStatsDetail.java b/src/com/android/settings/applications/ProcessStatsDetail.java
index 2fe5bd8..9db79bc 100644
--- a/src/com/android/settings/applications/ProcessStatsDetail.java
+++ b/src/com/android/settings/applications/ProcessStatsDetail.java
@@ -31,8 +31,8 @@
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.os.Process;
-import android.preference.Preference;
-import android.preference.PreferenceCategory;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceCategory;
import android.text.format.Formatter;
import android.util.ArrayMap;
import android.util.Log;
@@ -48,7 +48,6 @@
import com.android.settings.CancellablePreference.OnCancelListener;
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
-import com.android.settings.Utils;
import com.android.settings.applications.ProcStatsEntry.Service;
import java.util.ArrayList;
@@ -245,7 +244,7 @@
Collections.sort(entries, sEntryCompare);
for (int ie = 0; ie < entries.size(); ie++) {
ProcStatsEntry entry = entries.get(ie);
- Preference processPref = new Preference(getActivity());
+ Preference processPref = new Preference(getPrefContext());
processPref.setTitle(entry.mLabel);
processPref.setSelectable(false);
@@ -350,7 +349,7 @@
for (int is=0; is<services.size(); is++) {
final ProcStatsEntry.Service service = services.get(is);
CharSequence label = getLabel(service);
- CancellablePreference servicePref = new CancellablePreference(getActivity());
+ CancellablePreference servicePref = new CancellablePreference(getPrefContext());
servicePref.setSelectable(false);
servicePref.setTitle(label);
servicePref.setSummary(ProcStatsPackageEntry.getFrequency(
diff --git a/src/com/android/settings/applications/ProcessStatsMemDetail.java b/src/com/android/settings/applications/ProcessStatsMemDetail.java
index 6a4f470..f08dfbc 100644
--- a/src/com/android/settings/applications/ProcessStatsMemDetail.java
+++ b/src/com/android/settings/applications/ProcessStatsMemDetail.java
@@ -23,6 +23,7 @@
import android.view.ViewGroup;
import android.widget.ProgressBar;
import android.widget.TextView;
+
import com.android.internal.app.ProcessStats;
import com.android.internal.logging.MetricsLogger;
import com.android.settings.InstrumentedFragment;
diff --git a/src/com/android/settings/applications/ProcessStatsSummary.java b/src/com/android/settings/applications/ProcessStatsSummary.java
index dc24c73..399558b 100644
--- a/src/com/android/settings/applications/ProcessStatsSummary.java
+++ b/src/com/android/settings/applications/ProcessStatsSummary.java
@@ -17,8 +17,8 @@
import android.content.Context;
import android.os.Bundle;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceClickListener;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceClickListener;
import android.text.TextUtils;
import android.text.format.Formatter;
import android.text.format.Formatter.BytesResult;
diff --git a/src/com/android/settings/applications/ProcessStatsUi.java b/src/com/android/settings/applications/ProcessStatsUi.java
index ac78c17..3ac7746 100644
--- a/src/com/android/settings/applications/ProcessStatsUi.java
+++ b/src/com/android/settings/applications/ProcessStatsUi.java
@@ -19,9 +19,8 @@
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Bundle;
-import android.preference.Preference;
-import android.preference.PreferenceGroup;
-import android.preference.PreferenceScreen;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceGroup;
import android.util.Log;
import android.util.TimeUtils;
import android.view.Menu;
@@ -102,7 +101,7 @@
}
@Override
- public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
+ public boolean onPreferenceTreeClick(Preference preference) {
if (!(preference instanceof ProcessStatsPreference)) {
return false;
}
@@ -110,7 +109,7 @@
MemInfo memInfo = mStatsManager.getMemInfo();
launchMemoryDetail((SettingsActivity) getActivity(), memInfo, pgp.getEntry(), true);
- return super.onPreferenceTreeClick(preferenceScreen, preference);
+ return super.onPreferenceTreeClick(preference);
}
/**
@@ -172,7 +171,7 @@
: memInfo.usedWeight * memInfo.weightToRam;
for (int i = 0; i < pkgEntries.size(); i++) {
ProcStatsPackageEntry pkg = pkgEntries.get(i);
- ProcessStatsPreference pref = new ProcessStatsPreference(context);
+ ProcessStatsPreference pref = new ProcessStatsPreference(getPrefContext());
pkg.retrieveUiData(context, mPm);
pref.init(pkg, mPm, maxMemory, memInfo.weightToRam,
memInfo.totalScale, !mShowMax);
diff --git a/src/com/android/settings/applications/ResetAppsHelper.java b/src/com/android/settings/applications/ResetAppsHelper.java
index ad2ea02..5d87204 100644
--- a/src/com/android/settings/applications/ResetAppsHelper.java
+++ b/src/com/android/settings/applications/ResetAppsHelper.java
@@ -15,9 +15,6 @@
*/
package com.android.settings.applications;
-import static android.net.NetworkPolicyManager.POLICY_NONE;
-import static android.net.NetworkPolicyManager.POLICY_REJECT_METERED_BACKGROUND;
-
import android.app.ActivityManager;
import android.app.AlertDialog;
import android.app.AppOpsManager;
@@ -38,6 +35,9 @@
import java.util.List;
+import static android.net.NetworkPolicyManager.POLICY_NONE;
+import static android.net.NetworkPolicyManager.POLICY_REJECT_METERED_BACKGROUND;
+
public class ResetAppsHelper implements DialogInterface.OnClickListener,
DialogInterface.OnDismissListener {
diff --git a/src/com/android/settings/applications/RunningProcessesView.java b/src/com/android/settings/applications/RunningProcessesView.java
index ea9b6da..af60996 100644
--- a/src/com/android/settings/applications/RunningProcessesView.java
+++ b/src/com/android/settings/applications/RunningProcessesView.java
@@ -16,11 +16,6 @@
package com.android.settings.applications;
-import android.content.res.Resources;
-import android.text.BidiFormatter;
-import com.android.internal.util.MemInfoReader;
-import com.android.settings.R;
-
import android.app.ActivityManager;
import android.app.Dialog;
import android.app.Fragment;
@@ -29,19 +24,23 @@
import android.os.Bundle;
import android.os.SystemClock;
import android.os.UserHandle;
+import android.text.BidiFormatter;
import android.text.format.DateUtils;
import android.text.format.Formatter;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.AbsListView.RecyclerListener;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
-import android.widget.AbsListView.RecyclerListener;
+
+import com.android.internal.util.MemInfoReader;
+import com.android.settings.R;
import com.android.settings.SettingsActivity;
import java.util.ArrayList;
diff --git a/src/com/android/settings/applications/RunningServiceDetails.java b/src/com/android/settings/applications/RunningServiceDetails.java
index 8f074fd..79cdfb2 100644
--- a/src/com/android/settings/applications/RunningServiceDetails.java
+++ b/src/com/android/settings/applications/RunningServiceDetails.java
@@ -6,7 +6,6 @@
import android.app.ApplicationErrorReport;
import android.app.Dialog;
import android.app.DialogFragment;
-import android.app.Fragment;
import android.app.PendingIntent;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
diff --git a/src/com/android/settings/applications/RunningState.java b/src/com/android/settings/applications/RunningState.java
index f3a1b56..395947b 100644
--- a/src/com/android/settings/applications/RunningState.java
+++ b/src/com/android/settings/applications/RunningState.java
@@ -45,8 +45,8 @@
import android.util.SparseArray;
import com.android.settings.R;
-import com.android.settingslib.applications.InterestingConfigChanges;
import com.android.settingslib.Utils;
+import com.android.settingslib.applications.InterestingConfigChanges;
import java.util.ArrayList;
import java.util.Collections;
diff --git a/src/com/android/settings/applications/SpacePreference.java b/src/com/android/settings/applications/SpacePreference.java
index deaa987..d90ff18 100644
--- a/src/com/android/settings/applications/SpacePreference.java
+++ b/src/com/android/settings/applications/SpacePreference.java
@@ -17,12 +17,12 @@
import android.content.Context;
import android.content.res.TypedArray;
-import android.preference.Preference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceViewHolder;
import android.util.AttributeSet;
-import android.view.View;
-import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
-import android.widget.Space;
+
+import com.android.settings.R;
/**
* A blank preference that has a specified height by android:layout_height. It can be used
@@ -42,6 +42,7 @@
public SpacePreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
+ setLayoutResource(R.layout.space_preference);
final TypedArray a = context.obtainStyledAttributes(attrs,
new int[] { com.android.internal.R.attr.layout_height }, defStyleAttr, defStyleRes);
@@ -53,16 +54,11 @@
}
@Override
- protected View onCreateView(ViewGroup parent) {
- return new Space(getContext());
- }
-
- @Override
- protected void onBindView(View view) {
- super.onBindView(view);
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, mHeight);
- view.setLayoutParams(params);
+ view.itemView.setLayoutParams(params);
}
}
diff --git a/src/com/android/settings/applications/UsageAccessDetails.java b/src/com/android/settings/applications/UsageAccessDetails.java
index 7af1d9b..00034e6 100644
--- a/src/com/android/settings/applications/UsageAccessDetails.java
+++ b/src/com/android/settings/applications/UsageAccessDetails.java
@@ -26,11 +26,11 @@
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.os.UserHandle;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceChangeListener;
-import android.preference.Preference.OnPreferenceClickListener;
-import android.preference.SwitchPreference;
import android.provider.Settings;
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceChangeListener;
+import android.support.v7.preference.Preference.OnPreferenceClickListener;
import android.util.Log;
import com.android.internal.logging.MetricsLogger;
diff --git a/src/com/android/settings/applications/WriteSettingsDetails.java b/src/com/android/settings/applications/WriteSettingsDetails.java
index c89e7b3..6fb5dfb 100644
--- a/src/com/android/settings/applications/WriteSettingsDetails.java
+++ b/src/com/android/settings/applications/WriteSettingsDetails.java
@@ -18,26 +18,23 @@
import android.app.AlertDialog;
import android.app.AppOpsManager;
import android.content.ActivityNotFoundException;
-import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.UserHandle;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceChangeListener;
-import android.preference.Preference.OnPreferenceClickListener;
-import android.preference.SwitchPreference;
import android.provider.Settings;
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceChangeListener;
+import android.support.v7.preference.Preference.OnPreferenceClickListener;
import android.util.Log;
import com.android.internal.logging.MetricsLogger;
-import com.android.settings.InstrumentedFragment;
import com.android.settings.R;
import com.android.settings.applications.AppStateAppOpsBridge.PermissionState;
import com.android.settings.applications.AppStateWriteSettingsBridge.WriteSettingsState;
-import com.android.settingslib.applications.ApplicationsState;
import com.android.settingslib.applications.ApplicationsState.AppEntry;
import java.util.List;
diff --git a/src/com/android/settings/backup/ToggleBackupSettingFragment.java b/src/com/android/settings/backup/ToggleBackupSettingFragment.java
index 6942a42..e6f15c8 100644
--- a/src/com/android/settings/backup/ToggleBackupSettingFragment.java
+++ b/src/com/android/settings/backup/ToggleBackupSettingFragment.java
@@ -1,16 +1,17 @@
package com.android.settings.backup;
import android.app.AlertDialog;
-import android.app.backup.IBackupManager;
import android.app.Dialog;
+import android.app.backup.IBackupManager;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.os.RemoteException;
import android.os.ServiceManager;
-import android.preference.Preference;
-import android.preference.PreferenceScreen;
import android.provider.Settings;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceScreen;
+import android.support.v7.preference.PreferenceViewHolder;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
@@ -58,10 +59,10 @@
PreferenceScreen preferenceScreen = getPreferenceManager().createPreferenceScreen(
getActivity());
setPreferenceScreen(preferenceScreen);
- mSummaryPreference = new Preference(getActivity()) {
+ mSummaryPreference = new Preference(getPrefContext()) {
@Override
- protected void onBindView(View view) {
- super.onBindView(view);
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
final TextView summaryView = (TextView) view.findViewById(android.R.id.summary);
summaryView.setText(getSummary());
}
diff --git a/src/com/android/settings/bluetooth/BluetoothDevicePreference.java b/src/com/android/settings/bluetooth/BluetoothDevicePreference.java
index b36d2ea..4544a50 100644
--- a/src/com/android/settings/bluetooth/BluetoothDevicePreference.java
+++ b/src/com/android/settings/bluetooth/BluetoothDevicePreference.java
@@ -16,15 +16,14 @@
package com.android.settings.bluetooth;
-import static android.os.UserManager.DISALLOW_CONFIG_BLUETOOTH;
-
import android.app.AlertDialog;
import android.bluetooth.BluetoothClass;
import android.bluetooth.BluetoothDevice;
import android.content.Context;
import android.content.DialogInterface;
import android.os.UserManager;
-import android.preference.Preference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceViewHolder;
import android.text.Html;
import android.text.TextUtils;
import android.util.Log;
@@ -42,6 +41,8 @@
import java.util.List;
+import static android.os.UserManager.DISALLOW_CONFIG_BLUETOOTH;
+
/**
* BluetoothDevicePreference is the preference type used to display each remote
* Bluetooth device in the Bluetooth Settings screen.
@@ -129,7 +130,7 @@
}
@Override
- protected void onBindView(View view) {
+ public void onBindViewHolder(PreferenceViewHolder view) {
// Disable this view if the bluetooth enable/disable preference view is off
if (null != findPreferenceInHierarchy("bt_checkbox")) {
setDependency("bt_checkbox");
@@ -144,7 +145,7 @@
}
}
- super.onBindView(view);
+ super.onBindViewHolder(view);
}
public void onClick(View v) {
diff --git a/src/com/android/settings/bluetooth/BluetoothDiscoverableEnabler.java b/src/com/android/settings/bluetooth/BluetoothDiscoverableEnabler.java
index 6841b54..534e5f9 100755
--- a/src/com/android/settings/bluetooth/BluetoothDiscoverableEnabler.java
+++ b/src/com/android/settings/bluetooth/BluetoothDiscoverableEnabler.java
@@ -24,7 +24,7 @@
import android.content.SharedPreferences;
import android.os.Handler;
import android.os.SystemProperties;
-import android.preference.Preference;
+import android.support.v7.preference.Preference;
import android.util.Log;
import com.android.settings.R;
diff --git a/src/com/android/settings/bluetooth/BluetoothPairingDialog.java b/src/com/android/settings/bluetooth/BluetoothPairingDialog.java
index 7fa31b3..a2150e9 100755
--- a/src/com/android/settings/bluetooth/BluetoothPairingDialog.java
+++ b/src/com/android/settings/bluetooth/BluetoothPairingDialog.java
@@ -25,12 +25,12 @@
import android.content.IntentFilter;
import android.os.Bundle;
import android.text.Editable;
-import android.text.Html;
import android.text.InputFilter;
+import android.text.InputFilter.LengthFilter;
import android.text.InputType;
import android.text.TextWatcher;
-import android.text.InputFilter.LengthFilter;
import android.util.Log;
+import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
@@ -44,8 +44,6 @@
import com.android.settingslib.bluetooth.CachedBluetoothDeviceManager;
import com.android.settingslib.bluetooth.LocalBluetoothManager;
-import android.view.KeyEvent;
-
import java.util.Locale;
/**
diff --git a/src/com/android/settings/bluetooth/BluetoothPairingRequest.java b/src/com/android/settings/bluetooth/BluetoothPairingRequest.java
index 5b06661..dd716ef 100644
--- a/src/com/android/settings/bluetooth/BluetoothPairingRequest.java
+++ b/src/com/android/settings/bluetooth/BluetoothPairingRequest.java
@@ -16,8 +16,6 @@
package com.android.settings.bluetooth;
-import com.android.settings.R;
-
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
@@ -26,8 +24,10 @@
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
-import android.text.TextUtils;
import android.os.PowerManager;
+import android.text.TextUtils;
+
+import com.android.settings.R;
/**
* BluetoothPairingRequest is a receiver for any Bluetooth pairing request. It
diff --git a/src/com/android/settings/bluetooth/BluetoothPermissionActivity.java b/src/com/android/settings/bluetooth/BluetoothPermissionActivity.java
index 2267555..efcc7f9 100644
--- a/src/com/android/settings/bluetooth/BluetoothPermissionActivity.java
+++ b/src/com/android/settings/bluetooth/BluetoothPermissionActivity.java
@@ -23,11 +23,11 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
-import android.preference.Preference;
+import android.support.v7.preference.Preference;
import android.util.Log;
import android.view.View;
-import android.widget.TextView;
import android.widget.Button;
+import android.widget.TextView;
import com.android.internal.app.AlertActivity;
import com.android.internal.app.AlertController;
diff --git a/src/com/android/settings/bluetooth/BluetoothProgressCategory.java b/src/com/android/settings/bluetooth/BluetoothProgressCategory.java
index 9f64f9d..ae94981 100644
--- a/src/com/android/settings/bluetooth/BluetoothProgressCategory.java
+++ b/src/com/android/settings/bluetooth/BluetoothProgressCategory.java
@@ -16,12 +16,12 @@
package com.android.settings.bluetooth;
-import com.android.settings.ProgressCategory;
-import com.android.settings.R;
-
import android.content.Context;
import android.util.AttributeSet;
+import com.android.settings.ProgressCategory;
+import com.android.settings.R;
+
/**
* A Bluetooth discovery progress category
*/
diff --git a/src/com/android/settings/bluetooth/BluetoothSettings.java b/src/com/android/settings/bluetooth/BluetoothSettings.java
index 4c48981..8a1ef46 100644
--- a/src/com/android/settings/bluetooth/BluetoothSettings.java
+++ b/src/com/android/settings/bluetooth/BluetoothSettings.java
@@ -16,8 +16,6 @@
package com.android.settings.bluetooth;
-import static android.os.UserManager.DISALLOW_CONFIG_BLUETOOTH;
-
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.BroadcastReceiver;
@@ -27,11 +25,11 @@
import android.content.IntentFilter;
import android.content.res.Resources;
import android.os.Bundle;
-import android.preference.Preference;
-import android.preference.PreferenceCategory;
-import android.preference.PreferenceGroup;
-import android.preference.PreferenceScreen;
import android.provider.Settings;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceCategory;
+import android.support.v7.preference.PreferenceGroup;
+import android.support.v7.preference.PreferenceScreen;
import android.text.Spannable;
import android.text.style.TextAppearanceSpan;
import android.util.Log;
@@ -59,6 +57,8 @@
import java.util.List;
import java.util.Set;
+import static android.os.UserManager.DISALLOW_CONFIG_BLUETOOTH;
+
/**
* BluetoothSettings is the Settings screen for Bluetooth configuration and
* connection management.
@@ -135,7 +135,7 @@
mInitiateDiscoverable = true;
mEmptyView = (TextView) getView().findViewById(android.R.id.empty);
- getListView().setEmptyView(mEmptyView);
+ setEmptyView(mEmptyView);
mEmptyView.setGravity(Gravity.START | Gravity.CENTER_VERTICAL);
final SettingsActivity activity = (SettingsActivity) getActivity();
@@ -302,7 +302,7 @@
// Paired devices category
if (mPairedDevicesCategory == null) {
- mPairedDevicesCategory = new PreferenceCategory(getActivity());
+ mPairedDevicesCategory = new PreferenceCategory(getPrefContext());
} else {
mPairedDevicesCategory.removeAll();
}
@@ -332,7 +332,7 @@
}
if (mMyDevicePreference == null) {
- mMyDevicePreference = new Preference(getActivity());
+ mMyDevicePreference = new Preference(getPrefContext());
}
mMyDevicePreference.setSummary(getResources().getString(
diff --git a/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java b/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java
index cc98c7b..607db59 100644
--- a/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java
+++ b/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java
@@ -19,10 +19,9 @@
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.os.Bundle;
-import android.preference.Preference;
-import android.preference.PreferenceCategory;
-import android.preference.PreferenceGroup;
-import android.preference.PreferenceScreen;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceCategory;
+import android.support.v7.preference.PreferenceGroup;
import android.util.Log;
import com.android.settings.RestrictedSettingsFragment;
@@ -136,8 +135,7 @@
}
@Override
- public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
- Preference preference) {
+ public boolean onPreferenceTreeClick(Preference preference) {
if (KEY_BT_SCAN.equals(preference.getKey())) {
mLocalAdapter.startScanning(true);
return true;
@@ -151,7 +149,7 @@
return true;
}
- return super.onPreferenceTreeClick(preferenceScreen, preference);
+ return super.onPreferenceTreeClick(preference);
}
void onDevicePreferenceClick(BluetoothDevicePreference btPreference) {
@@ -179,7 +177,7 @@
}
BluetoothDevicePreference preference = new BluetoothDevicePreference(
- getActivity(), cachedDevice);
+ getPrefContext(), cachedDevice);
initDevicePreference(preference);
mDeviceListGroup.addPreference(preference);
diff --git a/src/com/android/settings/bluetooth/DevicePickerActivity.java b/src/com/android/settings/bluetooth/DevicePickerActivity.java
index 8f6e0df..d3d9d78 100644
--- a/src/com/android/settings/bluetooth/DevicePickerActivity.java
+++ b/src/com/android/settings/bluetooth/DevicePickerActivity.java
@@ -16,11 +16,11 @@
package com.android.settings.bluetooth;
-import com.android.settings.R;
-
import android.app.Activity;
import android.os.Bundle;
+import com.android.settings.R;
+
/**
* Activity for Bluetooth device picker dialog. The device picker logic
* is implemented in the {@link BluetoothSettings} fragment.
diff --git a/src/com/android/settings/bluetooth/DevicePickerFragment.java b/src/com/android/settings/bluetooth/DevicePickerFragment.java
index 9441626..a1693fe 100644
--- a/src/com/android/settings/bluetooth/DevicePickerFragment.java
+++ b/src/com/android/settings/bluetooth/DevicePickerFragment.java
@@ -16,8 +16,6 @@
package com.android.settings.bluetooth;
-import static android.os.UserManager.DISALLOW_CONFIG_BLUETOOTH;
-
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothDevicePicker;
@@ -33,6 +31,8 @@
import com.android.settings.R;
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
+import static android.os.UserManager.DISALLOW_CONFIG_BLUETOOTH;
+
/**
* BluetoothSettings is the Settings screen for Bluetooth configuration and
* connection management.
diff --git a/src/com/android/settings/bluetooth/DeviceProfilesSettings.java b/src/com/android/settings/bluetooth/DeviceProfilesSettings.java
index ae42e3d..ca4d4f5 100755
--- a/src/com/android/settings/bluetooth/DeviceProfilesSettings.java
+++ b/src/com/android/settings/bluetooth/DeviceProfilesSettings.java
@@ -24,8 +24,8 @@
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
-import android.preference.CheckBoxPreference;
-import android.preference.EditTextPreference;
+import android.support.v7.preference.CheckBoxPreference;
+import android.support.v7.preference.EditTextPreference;
import android.text.Html;
import android.text.TextUtils;
import android.util.Log;
diff --git a/src/com/android/settings/bluetooth/RequestPermissionHelperActivity.java b/src/com/android/settings/bluetooth/RequestPermissionHelperActivity.java
index c30113e..fafa284 100644
--- a/src/com/android/settings/bluetooth/RequestPermissionHelperActivity.java
+++ b/src/com/android/settings/bluetooth/RequestPermissionHelperActivity.java
@@ -16,18 +16,18 @@
package com.android.settings.bluetooth;
-import com.android.internal.app.AlertActivity;
-import com.android.internal.app.AlertController;
-import com.android.settings.R;
-import com.android.settingslib.bluetooth.LocalBluetoothAdapter;
-import com.android.settingslib.bluetooth.LocalBluetoothManager;
-
import android.bluetooth.BluetoothAdapter;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
+import com.android.internal.app.AlertActivity;
+import com.android.internal.app.AlertController;
+import com.android.settings.R;
+import com.android.settingslib.bluetooth.LocalBluetoothAdapter;
+import com.android.settingslib.bluetooth.LocalBluetoothManager;
+
/**
* RequestPermissionHelperActivity asks the user whether to enable discovery.
* This is usually started by RequestPermissionActivity.
diff --git a/src/com/android/settings/dashboard/DashboardContainerView.java b/src/com/android/settings/dashboard/DashboardContainerView.java
index f009891..af7e787 100644
--- a/src/com/android/settings/dashboard/DashboardContainerView.java
+++ b/src/com/android/settings/dashboard/DashboardContainerView.java
@@ -21,6 +21,7 @@
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
+
import com.android.settings.R;
public class DashboardContainerView extends ViewGroup {
diff --git a/src/com/android/settings/dashboard/NoHomeDialogFragment.java b/src/com/android/settings/dashboard/NoHomeDialogFragment.java
index a795cc9..0bc1705 100644
--- a/src/com/android/settings/dashboard/NoHomeDialogFragment.java
+++ b/src/com/android/settings/dashboard/NoHomeDialogFragment.java
@@ -21,6 +21,7 @@
import android.app.Dialog;
import android.app.DialogFragment;
import android.os.Bundle;
+
import com.android.settings.R;
public class NoHomeDialogFragment extends DialogFragment {
diff --git a/src/com/android/settings/dashboard/SearchResultsSummary.java b/src/com/android/settings/dashboard/SearchResultsSummary.java
index ca764b3..f52ad1f 100644
--- a/src/com/android/settings/dashboard/SearchResultsSummary.java
+++ b/src/com/android/settings/dashboard/SearchResultsSummary.java
@@ -36,6 +36,7 @@
import android.widget.ListView;
import android.widget.SearchView;
import android.widget.TextView;
+
import com.android.internal.logging.MetricsLogger;
import com.android.settings.InstrumentedFragment;
import com.android.settings.R;
diff --git a/src/com/android/settings/deviceinfo/ImeiInformation.java b/src/com/android/settings/deviceinfo/ImeiInformation.java
index d82e6c9..d1fccd0 100644
--- a/src/com/android/settings/deviceinfo/ImeiInformation.java
+++ b/src/com/android/settings/deviceinfo/ImeiInformation.java
@@ -15,19 +15,18 @@
*/
package com.android.settings.deviceinfo;
+import android.content.Context;
+import android.os.Bundle;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceScreen;
+import android.telephony.SubscriptionManager;
+import android.telephony.TelephonyManager;
+import android.text.TextUtils;
+
import com.android.internal.logging.MetricsLogger;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.PhoneFactory;
-
-import android.content.Context;
-import android.os.Bundle;
-import android.preference.Preference;
-import android.preference.PreferenceActivity;
-import android.preference.PreferenceScreen;
-import android.telephony.SubscriptionManager;
-import android.telephony.TelephonyManager;
-import android.text.TextUtils;
import com.android.settings.InstrumentedPreferenceActivity;
import com.android.settings.R;
diff --git a/src/com/android/settings/deviceinfo/MigrateEstimateTask.java b/src/com/android/settings/deviceinfo/MigrateEstimateTask.java
index c3e0717..395b6a2 100644
--- a/src/com/android/settings/deviceinfo/MigrateEstimateTask.java
+++ b/src/com/android/settings/deviceinfo/MigrateEstimateTask.java
@@ -16,8 +16,6 @@
package com.android.settings.deviceinfo;
-import static com.android.settings.deviceinfo.StorageSettings.TAG;
-
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -38,6 +36,8 @@
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
+import static com.android.settings.deviceinfo.StorageSettings.TAG;
+
public abstract class MigrateEstimateTask extends AsyncTask<Void, Void, Long> implements
ServiceConnection {
private static final String EXTRA_SIZE_BYTES = "size_bytes";
diff --git a/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java b/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
index e8fbb8c..d4a653b 100644
--- a/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
+++ b/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
@@ -16,8 +16,6 @@
package com.android.settings.deviceinfo;
-import static com.android.settings.deviceinfo.StorageSettings.TAG;
-
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
@@ -38,11 +36,11 @@
import android.os.storage.StorageManager;
import android.os.storage.VolumeInfo;
import android.os.storage.VolumeRecord;
-import android.preference.Preference;
-import android.preference.PreferenceCategory;
-import android.preference.PreferenceGroup;
-import android.preference.PreferenceScreen;
import android.provider.DocumentsContract;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceCategory;
+import android.support.v7.preference.PreferenceGroup;
+import android.support.v7.preference.PreferenceScreen;
import android.text.TextUtils;
import android.text.format.Formatter;
import android.text.format.Formatter.BytesResult;
@@ -71,6 +69,8 @@
import java.util.List;
import java.util.Objects;
+import static com.android.settings.deviceinfo.StorageSettings.TAG;
+
/**
* Panel showing summary and actions for a {@link VolumeInfo#TYPE_PRIVATE}
* storage volume.
@@ -153,7 +153,7 @@
addPreferencesFromResource(R.xml.device_info_storage_volume);
getPreferenceScreen().setOrderingAsAdded(true);
- mSummary = new StorageSummaryPreference(context);
+ mSummary = new StorageSummaryPreference(getPrefContext());
mCurrentUser = mUserManager.getUserInfo(UserHandle.myUserId());
mExplore = buildAction(R.string.storage_menu_explore);
@@ -242,7 +242,7 @@
if (mHeaderPoolIndex < mHeaderPreferencePool.size()) {
category = mHeaderPreferencePool.get(mHeaderPoolIndex);
} else {
- category = new PreferenceCategory(getActivity(), null,
+ category = new PreferenceCategory(getPrefContext(), null,
com.android.internal.R.attr.preferenceCategoryStyle);
mHeaderPreferencePool.add(category);
}
@@ -270,8 +270,10 @@
}
if (title != null) {
item.setTitle(title);
+ item.setKey(title.toString());
} else {
item.setTitle(titleRes);
+ item.setKey(Integer.toString(titleRes));
}
item.setSummary(R.string.memory_calculating_size);
item.userHandle = userId;
@@ -280,12 +282,12 @@
}
private StorageItemPreference buildItem() {
- final StorageItemPreference item = new StorageItemPreference(getActivity());
+ final StorageItemPreference item = new StorageItemPreference(getPrefContext());
return item;
}
private Preference buildAction(int titleRes) {
- final Preference pref = new Preference(getActivity());
+ final Preference pref = new Preference(getPrefContext());
pref.setTitle(titleRes);
return pref;
}
@@ -390,12 +392,17 @@
}
@Override
- public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference pref) {
+ public boolean onPreferenceTreeClick(Preference pref) {
// TODO: launch better intents for specific volume
final int userId = (pref instanceof StorageItemPreference ?
((StorageItemPreference)pref).userHandle : -1);
- final int itemTitleId = pref.getTitleRes();
+ int itemTitleId;
+ try {
+ itemTitleId = Integer.parseInt(pref.getKey());
+ } catch (NumberFormatException e) {
+ itemTitleId = 0;
+ }
Intent intent = null;
switch (itemTitleId) {
case R.string.storage_detail_apps: {
@@ -459,7 +466,7 @@
}
return true;
}
- return super.onPreferenceTreeClick(preferenceScreen, pref);
+ return super.onPreferenceTreeClick(pref);
}
private final MeasurementReceiver mReceiver = new MeasurementReceiver() {
@@ -473,7 +480,12 @@
for (int i = 0; i < mItemPoolIndex; ++i) {
StorageItemPreference item = mItemPreferencePool.get(i);
final int userId = item.userHandle;
- final int itemTitleId = item.getTitleRes();
+ int itemTitleId;
+ try {
+ itemTitleId = Integer.parseInt(item.getKey());
+ } catch (NumberFormatException e) {
+ itemTitleId = 0;
+ }
switch (itemTitleId) {
case R.string.storage_detail_apps: {
updatePreference(item, details.appsSize.get(userId));
diff --git a/src/com/android/settings/deviceinfo/PublicVolumeSettings.java b/src/com/android/settings/deviceinfo/PublicVolumeSettings.java
index e5ac9fe..334e3fe 100644
--- a/src/com/android/settings/deviceinfo/PublicVolumeSettings.java
+++ b/src/com/android/settings/deviceinfo/PublicVolumeSettings.java
@@ -28,9 +28,9 @@
import android.os.storage.StorageManager;
import android.os.storage.VolumeInfo;
import android.os.storage.VolumeRecord;
-import android.preference.Preference;
-import android.preference.PreferenceScreen;
import android.provider.DocumentsContract;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceScreen;
import android.text.TextUtils;
import android.text.format.Formatter;
import android.text.format.Formatter.BytesResult;
@@ -114,7 +114,7 @@
addPreferencesFromResource(R.xml.device_info_storage_volume);
getPreferenceScreen().setOrderingAsAdded(true);
- mSummary = new StorageSummaryPreference(context);
+ mSummary = new StorageSummaryPreference(getPrefContext());
mMount = buildAction(R.string.storage_menu_mount);
mUnmount = new Button(getActivity());
@@ -187,7 +187,7 @@
}
private Preference buildAction(int titleRes) {
- final Preference pref = new Preference(getActivity());
+ final Preference pref = new Preference(getPrefContext());
pref.setTitle(titleRes);
return pref;
}
@@ -214,7 +214,7 @@
}
@Override
- public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference pref) {
+ public boolean onPreferenceTreeClick(Preference pref) {
final Context context = getActivity();
if (pref == mMount) {
new MountTask(context, mVolume).execute();
@@ -230,7 +230,7 @@
startActivity(intent);
}
- return super.onPreferenceTreeClick(preferenceScreen, pref);
+ return super.onPreferenceTreeClick(pref);
}
private final View.OnClickListener mUnmountListener = new View.OnClickListener() {
diff --git a/src/com/android/settings/deviceinfo/SimStatus.java b/src/com/android/settings/deviceinfo/SimStatus.java
index b8e25c0..2138c24 100644
--- a/src/com/android/settings/deviceinfo/SimStatus.java
+++ b/src/com/android/settings/deviceinfo/SimStatus.java
@@ -25,7 +25,7 @@
import android.os.Bundle;
import android.os.UserHandle;
import android.os.UserManager;
-import android.preference.Preference;
+import android.support.v7.preference.Preference;
import android.telephony.CellBroadcastMessage;
import android.telephony.PhoneNumberUtils;
import android.telephony.PhoneStateListener;
@@ -36,14 +36,6 @@
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
-
-import com.android.internal.logging.MetricsLogger;
-import com.android.internal.telephony.DefaultPhoneNotifier;
-import com.android.internal.telephony.Phone;
-import com.android.internal.telephony.PhoneFactory;
-import com.android.settings.InstrumentedPreferenceActivity;
-import com.android.settings.R;
-
import android.view.View;
import android.widget.ListView;
import android.widget.TabHost;
@@ -52,6 +44,13 @@
import android.widget.TabHost.TabSpec;
import android.widget.TabWidget;
+import com.android.internal.logging.MetricsLogger;
+import com.android.internal.telephony.DefaultPhoneNotifier;
+import com.android.internal.telephony.Phone;
+import com.android.internal.telephony.PhoneFactory;
+import com.android.settings.InstrumentedPreferenceActivity;
+import com.android.settings.R;
+
import java.util.List;
diff --git a/src/com/android/settings/deviceinfo/Status.java b/src/com/android/settings/deviceinfo/Status.java
index 9f3960c..982f1c9 100644
--- a/src/com/android/settings/deviceinfo/Status.java
+++ b/src/com/android/settings/deviceinfo/Status.java
@@ -18,7 +18,6 @@
import android.bluetooth.BluetoothAdapter;
import android.content.BroadcastReceiver;
-import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
@@ -33,12 +32,8 @@
import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.UserManager;
-import android.preference.Preference;
+import android.support.v7.preference.Preference;
import android.text.TextUtils;
-import android.view.View;
-import android.widget.AdapterView;
-import android.widget.ListAdapter;
-import android.widget.Toast;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.util.ArrayUtils;
@@ -210,27 +205,6 @@
removePreferenceFromScreen(KEY_SIM_STATUS);
removePreferenceFromScreen(KEY_IMEI_INFO);
}
-
- // Make every pref on this screen copy its data to the clipboard on longpress.
- // Super convenient for capturing the IMEI, MAC addr, serial, etc.
- getListView().setOnItemLongClickListener(
- new AdapterView.OnItemLongClickListener() {
- @Override
- public boolean onItemLongClick(AdapterView<?> parent, View view,
- int position, long id) {
- ListAdapter listAdapter = (ListAdapter) parent.getAdapter();
- Preference pref = (Preference) listAdapter.getItem(position);
-
- ClipboardManager cm = (ClipboardManager)
- getSystemService(Context.CLIPBOARD_SERVICE);
- cm.setText(pref.getSummary());
- Toast.makeText(
- Status.this,
- com.android.internal.R.string.text_copied,
- Toast.LENGTH_SHORT).show();
- return true;
- }
- });
}
@Override
diff --git a/src/com/android/settings/deviceinfo/StorageItemPreference.java b/src/com/android/settings/deviceinfo/StorageItemPreference.java
index c4bad8a..3875885 100644
--- a/src/com/android/settings/deviceinfo/StorageItemPreference.java
+++ b/src/com/android/settings/deviceinfo/StorageItemPreference.java
@@ -17,8 +17,8 @@
package com.android.settings.deviceinfo;
import android.content.Context;
-import android.os.UserHandle;
-import android.preference.Preference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceViewHolder;
import android.text.format.Formatter;
import android.view.View;
import android.widget.ProgressBar;
@@ -58,9 +58,9 @@
}
@Override
- protected void onBindView(View view) {
+ public void onBindViewHolder(PreferenceViewHolder view) {
progressBar = (ProgressBar) view.findViewById(android.R.id.progress);
updateProgressBar();
- super.onBindView(view);
+ super.onBindViewHolder(view);
}
}
diff --git a/src/com/android/settings/deviceinfo/StorageSettings.java b/src/com/android/settings/deviceinfo/StorageSettings.java
index c36d0df..0eb7264 100644
--- a/src/com/android/settings/deviceinfo/StorageSettings.java
+++ b/src/com/android/settings/deviceinfo/StorageSettings.java
@@ -32,9 +32,8 @@
import android.os.storage.StorageManager;
import android.os.storage.VolumeInfo;
import android.os.storage.VolumeRecord;
-import android.preference.Preference;
-import android.preference.PreferenceCategory;
-import android.preference.PreferenceScreen;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceCategory;
import android.text.TextUtils;
import android.text.format.Formatter;
import android.text.format.Formatter.BytesResult;
@@ -105,7 +104,7 @@
mInternalCategory = (PreferenceCategory) findPreference("storage_internal");
mExternalCategory = (PreferenceCategory) findPreference("storage_external");
- mInternalSummary = new StorageSummaryPreference(context);
+ mInternalSummary = new StorageSummaryPreference(getPrefContext());
setHasOptionsMenu(true);
}
@@ -130,7 +129,7 @@
}
private void refresh() {
- final Context context = getActivity();
+ final Context context = getPrefContext();
getPreferenceScreen().removeAll();
mInternalCategory.removeAll();
@@ -231,7 +230,7 @@
}
@Override
- public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference pref) {
+ public boolean onPreferenceTreeClick(Preference pref) {
final String key = pref.getKey();
if (pref instanceof StorageVolumePreference) {
// Picked a normal volume
diff --git a/src/com/android/settings/deviceinfo/StorageSummaryPreference.java b/src/com/android/settings/deviceinfo/StorageSummaryPreference.java
index 2641cb6..9fc1363 100644
--- a/src/com/android/settings/deviceinfo/StorageSummaryPreference.java
+++ b/src/com/android/settings/deviceinfo/StorageSummaryPreference.java
@@ -18,7 +18,8 @@
import android.content.Context;
import android.graphics.Color;
-import android.preference.Preference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceViewHolder;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.TextView;
@@ -40,7 +41,7 @@
}
@Override
- protected void onBindView(View view) {
+ public void onBindViewHolder(PreferenceViewHolder view) {
final ProgressBar progress = (ProgressBar) view.findViewById(android.R.id.progress);
if (mPercent != -1) {
progress.setVisibility(View.VISIBLE);
@@ -52,6 +53,6 @@
final TextView summary = (TextView) view.findViewById(android.R.id.summary);
summary.setTextColor(Color.parseColor("#8a000000"));
- super.onBindView(view);
+ super.onBindViewHolder(view);
}
}
diff --git a/src/com/android/settings/deviceinfo/StorageUnmountReceiver.java b/src/com/android/settings/deviceinfo/StorageUnmountReceiver.java
index 81ac97b..095cf15 100644
--- a/src/com/android/settings/deviceinfo/StorageUnmountReceiver.java
+++ b/src/com/android/settings/deviceinfo/StorageUnmountReceiver.java
@@ -16,8 +16,6 @@
package com.android.settings.deviceinfo;
-import static com.android.settings.deviceinfo.StorageSettings.TAG;
-
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -27,6 +25,8 @@
import com.android.settings.deviceinfo.StorageSettings.UnmountTask;
+import static com.android.settings.deviceinfo.StorageSettings.TAG;
+
public class StorageUnmountReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
diff --git a/src/com/android/settings/deviceinfo/StorageVolumePreference.java b/src/com/android/settings/deviceinfo/StorageVolumePreference.java
index 3511b91..657ade5 100644
--- a/src/com/android/settings/deviceinfo/StorageVolumePreference.java
+++ b/src/com/android/settings/deviceinfo/StorageVolumePreference.java
@@ -22,7 +22,8 @@
import android.graphics.drawable.Drawable;
import android.os.storage.StorageManager;
import android.os.storage.VolumeInfo;
-import android.preference.Preference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceViewHolder;
import android.text.format.Formatter;
import android.view.View;
import android.view.View.OnClickListener;
@@ -97,7 +98,7 @@
}
@Override
- protected void onBindView(View view) {
+ public void onBindViewHolder(PreferenceViewHolder view) {
final ImageView unmount = (ImageView) view.findViewById(R.id.unmount);
if (unmount != null) {
unmount.setImageTintList(ColorStateList.valueOf(Color.parseColor("#8a000000")));
@@ -113,7 +114,7 @@
progress.setVisibility(View.GONE);
}
- super.onBindView(view);
+ super.onBindViewHolder(view);
}
private final View.OnClickListener mUnmountListener = new OnClickListener() {
diff --git a/src/com/android/settings/deviceinfo/StorageWizardFormatProgress.java b/src/com/android/settings/deviceinfo/StorageWizardFormatProgress.java
index 169c016..b3e30af 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardFormatProgress.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardFormatProgress.java
@@ -16,8 +16,6 @@
package com.android.settings.deviceinfo;
-import static com.android.settings.deviceinfo.StorageSettings.TAG;
-
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
@@ -39,6 +37,8 @@
import java.util.Objects;
+import static com.android.settings.deviceinfo.StorageSettings.TAG;
+
public class StorageWizardFormatProgress extends StorageWizardBase {
private static final String TAG_SLOW_WARNING = "slow_warning";
diff --git a/src/com/android/settings/deviceinfo/StorageWizardMigrateConfirm.java b/src/com/android/settings/deviceinfo/StorageWizardMigrateConfirm.java
index 84d8803..3eae081 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardMigrateConfirm.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardMigrateConfirm.java
@@ -16,8 +16,6 @@
package com.android.settings.deviceinfo;
-import static com.android.settings.deviceinfo.StorageSettings.TAG;
-
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
@@ -26,6 +24,8 @@
import com.android.settings.R;
+import static com.android.settings.deviceinfo.StorageSettings.TAG;
+
public class StorageWizardMigrateConfirm extends StorageWizardBase {
private MigrateEstimateTask mEstimate;
diff --git a/src/com/android/settings/deviceinfo/StorageWizardMigrateProgress.java b/src/com/android/settings/deviceinfo/StorageWizardMigrateProgress.java
index 88a3042..163ff42 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardMigrateProgress.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardMigrateProgress.java
@@ -16,9 +16,6 @@
package com.android.settings.deviceinfo;
-import static android.content.pm.PackageManager.EXTRA_MOVE_ID;
-import static com.android.settings.deviceinfo.StorageSettings.TAG;
-
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
@@ -32,6 +29,9 @@
import com.android.settings.R;
+import static android.content.pm.PackageManager.EXTRA_MOVE_ID;
+import static com.android.settings.deviceinfo.StorageSettings.TAG;
+
public class StorageWizardMigrateProgress extends StorageWizardBase {
private static final String ACTION_FINISH_WIZARD = "com.android.systemui.action.FINISH_WIZARD";
diff --git a/src/com/android/settings/deviceinfo/StorageWizardMoveConfirm.java b/src/com/android/settings/deviceinfo/StorageWizardMoveConfirm.java
index b58b780..65b3d1f 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardMoveConfirm.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardMoveConfirm.java
@@ -16,11 +16,6 @@
package com.android.settings.deviceinfo;
-import static android.content.Intent.EXTRA_PACKAGE_NAME;
-import static android.content.Intent.EXTRA_TITLE;
-import static android.content.pm.PackageManager.EXTRA_MOVE_ID;
-import static android.os.storage.VolumeInfo.EXTRA_VOLUME_ID;
-
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager.NameNotFoundException;
@@ -29,6 +24,11 @@
import com.android.internal.util.Preconditions;
import com.android.settings.R;
+import static android.content.Intent.EXTRA_PACKAGE_NAME;
+import static android.content.Intent.EXTRA_TITLE;
+import static android.content.pm.PackageManager.EXTRA_MOVE_ID;
+import static android.os.storage.VolumeInfo.EXTRA_VOLUME_ID;
+
public class StorageWizardMoveConfirm extends StorageWizardBase {
private String mPackageName;
private ApplicationInfo mApp;
diff --git a/src/com/android/settings/deviceinfo/StorageWizardMoveProgress.java b/src/com/android/settings/deviceinfo/StorageWizardMoveProgress.java
index 3c18835..fffdf74 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardMoveProgress.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardMoveProgress.java
@@ -16,10 +16,6 @@
package com.android.settings.deviceinfo;
-import static android.content.Intent.EXTRA_TITLE;
-import static android.content.pm.PackageManager.EXTRA_MOVE_ID;
-import static com.android.settings.deviceinfo.StorageSettings.TAG;
-
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.MoveCallback;
import android.os.Bundle;
@@ -30,6 +26,10 @@
import com.android.settings.R;
+import static android.content.Intent.EXTRA_TITLE;
+import static android.content.pm.PackageManager.EXTRA_MOVE_ID;
+import static com.android.settings.deviceinfo.StorageSettings.TAG;
+
public class StorageWizardMoveProgress extends StorageWizardBase {
private int mMoveId;
diff --git a/src/com/android/settings/fingerprint/FingerprintEnrollBase.java b/src/com/android/settings/fingerprint/FingerprintEnrollBase.java
index d164800..2843040 100644
--- a/src/com/android/settings/fingerprint/FingerprintEnrollBase.java
+++ b/src/com/android/settings/fingerprint/FingerprintEnrollBase.java
@@ -17,7 +17,6 @@
package com.android.settings.fingerprint;
import android.annotation.Nullable;
-import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
diff --git a/src/com/android/settings/fingerprint/FingerprintEnrollFinish.java b/src/com/android/settings/fingerprint/FingerprintEnrollFinish.java
index 6691e20..80124e0 100644
--- a/src/com/android/settings/fingerprint/FingerprintEnrollFinish.java
+++ b/src/com/android/settings/fingerprint/FingerprintEnrollFinish.java
@@ -18,18 +18,13 @@
import android.content.Context;
import android.content.Intent;
-import android.hardware.fingerprint.Fingerprint;
import android.hardware.fingerprint.FingerprintManager;
import android.os.Bundle;
-import android.preference.Preference;
import android.view.View;
import android.widget.Button;
import com.android.internal.logging.MetricsLogger;
import com.android.settings.R;
-import com.android.settings.fingerprint.FingerprintSettings.FingerprintPreference;
-
-import java.util.List;
/**
* Activity which concludes fingerprint enrollment.
diff --git a/src/com/android/settings/fingerprint/FingerprintEnrollSidecar.java b/src/com/android/settings/fingerprint/FingerprintEnrollSidecar.java
index 5feb08c..da055b0 100644
--- a/src/com/android/settings/fingerprint/FingerprintEnrollSidecar.java
+++ b/src/com/android/settings/fingerprint/FingerprintEnrollSidecar.java
@@ -18,7 +18,6 @@
import android.annotation.Nullable;
import android.app.Activity;
-import android.app.Fragment;
import android.hardware.fingerprint.FingerprintManager;
import android.os.Bundle;
import android.os.CancellationSignal;
diff --git a/src/com/android/settings/fingerprint/FingerprintSettings.java b/src/com/android/settings/fingerprint/FingerprintSettings.java
index cacd5dd..9e90c00 100644
--- a/src/com/android/settings/fingerprint/FingerprintSettings.java
+++ b/src/com/android/settings/fingerprint/FingerprintSettings.java
@@ -37,10 +37,11 @@
import android.os.Bundle;
import android.os.CancellationSignal;
import android.os.Handler;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceChangeListener;
-import android.preference.PreferenceGroup;
-import android.preference.PreferenceScreen;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceChangeListener;
+import android.support.v7.preference.PreferenceGroup;
+import android.support.v7.preference.PreferenceScreen;
+import android.support.v7.preference.PreferenceViewHolder;
import android.text.Annotation;
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
@@ -295,8 +296,7 @@
: R.string.security_settings_fingerprint_enroll_disclaimer),
getString(getHelpResource())));
v.setMovementMethod(new LinkMovementMethod());
- getListView().addFooterView(v);
- getListView().setFooterDividersEnabled(false);
+ setFooterView(v);
}
private boolean isFingerprintDisabled() {
@@ -401,7 +401,7 @@
}
@Override
- public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference pref) {
+ public boolean onPreferenceTreeClick(Preference pref) {
final String key = pref.getKey();
if (KEY_FINGERPRINT_ADD.equals(key)) {
Intent intent = new Intent();
@@ -413,7 +413,7 @@
FingerprintPreference fpref = (FingerprintPreference) pref;
final Fingerprint fp =fpref.getFingerprint();
showRenameDeleteDialog(fp);
- return super.onPreferenceTreeClick(preferenceScreen, pref);
+ return super.onPreferenceTreeClick(pref);
}
return true;
}
@@ -718,9 +718,9 @@
}
@Override
- protected void onBindView(View view) {
- super.onBindView(view);
- mView = view;
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
+ mView = view.itemView;
}
};
diff --git a/src/com/android/settings/fuelgauge/BatteryHistoryChart.java b/src/com/android/settings/fuelgauge/BatteryHistoryChart.java
index 76acf69..5c53fd1 100644
--- a/src/com/android/settings/fuelgauge/BatteryHistoryChart.java
+++ b/src/com/android/settings/fuelgauge/BatteryHistoryChart.java
@@ -16,32 +16,33 @@
package com.android.settings.fuelgauge;
-import android.content.Intent;
-import android.graphics.Bitmap;
-import android.graphics.DashPathEffect;
-import android.os.BatteryManager;
-import android.text.format.DateFormat;
-import android.text.format.Formatter;
-import android.util.Log;
-import android.util.TimeUtils;
-import com.android.settings.R;
-import com.android.settings.Utils;
-
import android.content.Context;
+import android.content.Intent;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
+import android.graphics.Bitmap;
import android.graphics.Canvas;
+import android.graphics.DashPathEffect;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Typeface;
+import android.os.BatteryManager;
import android.os.BatteryStats;
-import android.os.SystemClock;
import android.os.BatteryStats.HistoryItem;
+import android.os.SystemClock;
import android.telephony.ServiceState;
import android.text.TextPaint;
+import android.text.format.DateFormat;
+import android.text.format.Formatter;
import android.util.AttributeSet;
+import android.util.Log;
+import android.util.TimeUtils;
import android.util.TypedValue;
import android.view.View;
+
+import com.android.settings.R;
+import com.android.settings.Utils;
+
import libcore.icu.LocaleData;
import java.util.ArrayList;
diff --git a/src/com/android/settings/fuelgauge/BatteryHistoryPreference.java b/src/com/android/settings/fuelgauge/BatteryHistoryPreference.java
index 0bf85b5..461c498 100644
--- a/src/com/android/settings/fuelgauge/BatteryHistoryPreference.java
+++ b/src/com/android/settings/fuelgauge/BatteryHistoryPreference.java
@@ -20,10 +20,9 @@
import android.content.Intent;
import android.os.BatteryStats;
import android.os.Bundle;
-import android.preference.Preference;
-import android.preference.PreferenceScreen;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceViewHolder;
import android.util.AttributeSet;
-import android.view.View;
import android.view.ViewGroup;
import com.android.internal.os.BatteryStatsHelper;
@@ -48,9 +47,9 @@
public BatteryHistoryPreference(Context context, AttributeSet attrs) {
super(context, attrs);
}
-
+
@Override
- public void performClick(PreferenceScreen preferenceScreen) {
+ protected void onClick() {
if (!isEnabled()) {
return;
}
@@ -84,8 +83,8 @@
}
@Override
- protected void onBindView(View view) {
- super.onBindView(view);
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
if (mStats == null) {
return;
diff --git a/src/com/android/settings/fuelgauge/BatterySaverModeVoiceActivity.java b/src/com/android/settings/fuelgauge/BatterySaverModeVoiceActivity.java
index 3fa0e02..3fc0cd8 100644
--- a/src/com/android/settings/fuelgauge/BatterySaverModeVoiceActivity.java
+++ b/src/com/android/settings/fuelgauge/BatterySaverModeVoiceActivity.java
@@ -16,8 +16,6 @@
package com.android.settings.fuelgauge;
-import static android.provider.Settings.EXTRA_BATTERY_SAVER_MODE_ENABLED;
-
import android.content.Context;
import android.content.Intent;
import android.os.PowerManager;
@@ -25,6 +23,8 @@
import com.android.settings.utils.VoiceSettingsActivity;
+import static android.provider.Settings.EXTRA_BATTERY_SAVER_MODE_ENABLED;
+
/**
* Activity for modifying the {@link android.os.PowerManager} power save mode
* setting using the Voice Interaction API.
diff --git a/src/com/android/settings/fuelgauge/BatterySaverSettings.java b/src/com/android/settings/fuelgauge/BatterySaverSettings.java
index d8a9ca0..63ded30 100644
--- a/src/com/android/settings/fuelgauge/BatterySaverSettings.java
+++ b/src/com/android/settings/fuelgauge/BatterySaverSettings.java
@@ -16,8 +16,6 @@
package com.android.settings.fuelgauge;
-import static android.os.PowerManager.ACTION_POWER_SAVE_MODE_CHANGING;
-
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
@@ -42,6 +40,8 @@
import com.android.settings.notification.SettingPref;
import com.android.settings.widget.SwitchBar;
+import static android.os.PowerManager.ACTION_POWER_SAVE_MODE_CHANGING;
+
public class BatterySaverSettings extends SettingsPreferenceFragment
implements SwitchBar.OnSwitchChangeListener {
private static final String TAG = "BatterySaverSettings";
diff --git a/src/com/android/settings/fuelgauge/FakeUid.java b/src/com/android/settings/fuelgauge/FakeUid.java
index 7fd66c5..eb1e724 100644
--- a/src/com/android/settings/fuelgauge/FakeUid.java
+++ b/src/com/android/settings/fuelgauge/FakeUid.java
@@ -18,7 +18,6 @@
import android.os.BatteryStats.Timer;
import android.os.BatteryStats.Uid;
-import android.os.Process;
import android.util.ArrayMap;
import android.util.SparseArray;
diff --git a/src/com/android/settings/fuelgauge/InactiveApps.java b/src/com/android/settings/fuelgauge/InactiveApps.java
index 52dea5a..336e792 100644
--- a/src/com/android/settings/fuelgauge/InactiveApps.java
+++ b/src/com/android/settings/fuelgauge/InactiveApps.java
@@ -22,9 +22,9 @@
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceClickListener;
-import android.preference.PreferenceGroup;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceClickListener;
+import android.support.v7.preference.PreferenceGroup;
import com.android.internal.logging.MetricsLogger;
import com.android.settings.R;
@@ -68,7 +68,7 @@
List<ResolveInfo> apps = pm.queryIntentActivities(launcherIntent, 0);
for (ResolveInfo app : apps) {
String packageName = app.activityInfo.applicationInfo.packageName;
- Preference p = new Preference(context);
+ Preference p = new Preference(getPrefContext());
p.setTitle(app.loadLabel(pm));
p.setIcon(app.loadIcon(pm));
p.setKey(packageName);
diff --git a/src/com/android/settings/fuelgauge/PowerGaugePreference.java b/src/com/android/settings/fuelgauge/PowerGaugePreference.java
index 0be73d8..5b39a14 100644
--- a/src/com/android/settings/fuelgauge/PowerGaugePreference.java
+++ b/src/com/android/settings/fuelgauge/PowerGaugePreference.java
@@ -19,7 +19,7 @@
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
-import android.view.View;
+import android.support.v7.preference.PreferenceViewHolder;
import android.widget.TextView;
import com.android.settings.AppProgressPreference;
@@ -51,8 +51,8 @@
}
@Override
- protected void onBindView(View view) {
- super.onBindView(view);
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
if (mContentDescription != null) {
final TextView titleView = (TextView) view.findViewById(android.R.id.title);
diff --git a/src/com/android/settings/fuelgauge/PowerUsageDetail.java b/src/com/android/settings/fuelgauge/PowerUsageDetail.java
index b7a0df2..6ede8cc 100644
--- a/src/com/android/settings/fuelgauge/PowerUsageDetail.java
+++ b/src/com/android/settings/fuelgauge/PowerUsageDetail.java
@@ -34,9 +34,9 @@
import android.os.Bundle;
import android.os.Process;
import android.os.UserHandle;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceClickListener;
-import android.preference.PreferenceCategory;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceClickListener;
+import android.support.v7.preference.PreferenceCategory;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
@@ -53,7 +53,6 @@
import com.android.settings.SettingsActivity;
import com.android.settings.Utils;
import com.android.settings.WirelessSettings;
-import com.android.settings.applications.AppInfoWithHeader;
import com.android.settings.applications.InstalledAppDetails;
import com.android.settings.applications.LayoutPreference;
import com.android.settings.bluetooth.BluetoothSettings;
@@ -577,7 +576,7 @@
private void addHorizontalPreference(PreferenceCategory parent, CharSequence title,
CharSequence summary) {
- Preference pref = new Preference(getActivity());
+ Preference pref = new Preference(getPrefContext());
pref.setLayoutResource(R.layout.horizontal_preference);
pref.setTitle(title);
pref.setSummary(summary);
@@ -646,7 +645,7 @@
}
private void addControl(int pageSummary, int actionTitle, final int action) {
- Preference pref = new Preference(getActivity());
+ Preference pref = new Preference(getPrefContext());
pref.setTitle(actionTitle);
pref.setLayoutResource(R.layout.horizontal_preference);
pref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
diff --git a/src/com/android/settings/fuelgauge/PowerUsageSummary.java b/src/com/android/settings/fuelgauge/PowerUsageSummary.java
index bf49208..255270d 100644
--- a/src/com/android/settings/fuelgauge/PowerUsageSummary.java
+++ b/src/com/android/settings/fuelgauge/PowerUsageSummary.java
@@ -25,10 +25,8 @@
import android.os.Message;
import android.os.Process;
import android.os.UserHandle;
-import android.preference.Preference;
-import android.preference.PreferenceGroup;
-import android.preference.PreferenceScreen;
-import android.text.TextUtils;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceGroup;
import android.util.SparseArray;
import android.util.TypedValue;
import android.view.Menu;
@@ -39,11 +37,9 @@
import com.android.internal.os.BatterySipper;
import com.android.internal.os.BatterySipper.DrainType;
import com.android.internal.os.PowerProfile;
-import com.android.settings.HelpUtils;
import com.android.settings.R;
import com.android.settings.Settings.HighPowerApplicationsActivity;
import com.android.settings.SettingsActivity;
-import com.android.settings.Utils;
import com.android.settings.applications.ManageApplications;
import java.util.ArrayList;
@@ -117,7 +113,7 @@
}
@Override
- public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
+ public boolean onPreferenceTreeClick(Preference preference) {
if (!(preference instanceof PowerGaugePreference)) {
return false;
}
@@ -125,7 +121,7 @@
BatteryEntry entry = pgp.getInfo();
PowerUsageDetail.startBatteryDetailPage((SettingsActivity) getActivity(), mStatsHelper,
mStatsType, entry, true, true);
- return super.onPreferenceTreeClick(preferenceScreen, preference);
+ return super.onPreferenceTreeClick(preference);
}
@Override
@@ -177,7 +173,7 @@
}
private void addNotAvailableMessage() {
- Preference notAvailable = new Preference(getActivity());
+ Preference notAvailable = new Preference(getPrefContext());
notAvailable.setTitle(R.string.power_usage_not_available);
mAppListGroup.addPreference(notAvailable);
}
@@ -345,7 +341,7 @@
userHandle);
final CharSequence contentDescription = mUm.getBadgedLabelForUser(entry.getLabel(),
userHandle);
- final PowerGaugePreference pref = new PowerGaugePreference(getActivity(),
+ final PowerGaugePreference pref = new PowerGaugePreference(getPrefContext(),
badgedIcon, contentDescription, entry);
final double percentOfMax = (sipper.totalPowerMah * 100)
diff --git a/src/com/android/settings/fuelgauge/RequestIgnoreBatteryOptimizations.java b/src/com/android/settings/fuelgauge/RequestIgnoreBatteryOptimizations.java
index 1c1e9df..b16fd18 100644
--- a/src/com/android/settings/fuelgauge/RequestIgnoreBatteryOptimizations.java
+++ b/src/com/android/settings/fuelgauge/RequestIgnoreBatteryOptimizations.java
@@ -20,17 +20,17 @@
import android.content.DialogInterface;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
+import android.net.Uri;
+import android.os.Bundle;
import android.os.IDeviceIdleController;
import android.os.PowerManager;
import android.os.RemoteException;
import android.os.ServiceManager;
-import com.android.settings.R;
-
-import android.net.Uri;
-import android.os.Bundle;
import android.util.Log;
+
import com.android.internal.app.AlertActivity;
import com.android.internal.app.AlertController;
+import com.android.settings.R;
public class RequestIgnoreBatteryOptimizations extends AlertActivity implements
DialogInterface.OnClickListener {
diff --git a/src/com/android/settings/fuelgauge/WallOfTextPreference.java b/src/com/android/settings/fuelgauge/WallOfTextPreference.java
index 5577206..096f98a 100644
--- a/src/com/android/settings/fuelgauge/WallOfTextPreference.java
+++ b/src/com/android/settings/fuelgauge/WallOfTextPreference.java
@@ -17,9 +17,9 @@
package com.android.settings.fuelgauge;
import android.content.Context;
-import android.preference.Preference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceViewHolder;
import android.util.AttributeSet;
-import android.view.View;
import android.widget.TextView;
public class WallOfTextPreference extends Preference {
@@ -42,8 +42,8 @@
}
@Override
- protected void onBindView(View view) {
- super.onBindView(view);
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
final TextView summary = (TextView) view.findViewById(android.R.id.summary);
summary.setMaxLines(20);
}
diff --git a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
index e8ef5ef..779944b 100644
--- a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
+++ b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
@@ -32,16 +32,16 @@
import android.hardware.input.KeyboardLayout;
import android.os.Bundle;
import android.os.Handler;
-import android.preference.ListPreference;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceClickListener;
-import android.preference.PreferenceCategory;
-import android.preference.PreferenceManager;
-import android.preference.PreferenceScreen;
-import android.preference.SwitchPreference;
import android.provider.Settings;
import android.provider.Settings.System;
import android.speech.tts.TtsEngines;
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.ListPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceClickListener;
+import android.support.v7.preference.PreferenceCategory;
+import android.support.v7.preference.PreferenceManager;
+import android.support.v7.preference.PreferenceScreen;
import android.text.TextUtils;
import android.view.InputDevice;
import android.view.inputmethod.InputMethodInfo;
@@ -315,7 +315,7 @@
}
@Override
- public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
+ public boolean onPreferenceTreeClick(Preference preference) {
// Input Method stuff
if (Utils.isMonkeyRunning()) {
return false;
@@ -336,7 +336,7 @@
return true;
}
}
- return super.onPreferenceTreeClick(preferenceScreen, preference);
+ return super.onPreferenceTreeClick(preference);
}
private static String getLocaleName(Context context) {
@@ -390,7 +390,7 @@
}
mInputMethodPreferenceList.clear();
List<String> permittedList = mDpm.getPermittedInputMethodsForCurrentUser();
- final Context context = getActivity();
+ final Context context = getPrefContext();
final List<InputMethodInfo> imis = mShowsOnlyFullImeAndKeyboardList
? mInputMethodSettingValues.getInputMethodList()
: mImm.getEnabledInputMethodList();
@@ -530,7 +530,7 @@
final KeyboardLayout keyboardLayout = keyboardLayoutDescriptor != null ?
mIm.getKeyboardLayout(keyboardLayoutDescriptor) : null;
- final PreferenceScreen pref = new PreferenceScreen(getActivity(), null);
+ final PreferenceScreen pref = new PreferenceScreen(getPrefContext(), null);
pref.setTitle(device.getName());
if (keyboardLayout != null) {
pref.setSummary(keyboardLayout.toString());
diff --git a/src/com/android/settings/inputmethod/InputMethodAndSubtypeEnabler.java b/src/com/android/settings/inputmethod/InputMethodAndSubtypeEnabler.java
index c73ccef..fd8591f 100644
--- a/src/com/android/settings/inputmethod/InputMethodAndSubtypeEnabler.java
+++ b/src/com/android/settings/inputmethod/InputMethodAndSubtypeEnabler.java
@@ -21,11 +21,11 @@
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.os.Bundle;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceChangeListener;
-import android.preference.PreferenceCategory;
-import android.preference.PreferenceScreen;
-import android.preference.TwoStatePreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceChangeListener;
+import android.support.v7.preference.PreferenceCategory;
+import android.support.v7.preference.PreferenceScreen;
+import android.support.v7.preference.TwoStatePreference;
import android.text.TextUtils;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodManager;
@@ -159,13 +159,14 @@
private void addInputMethodSubtypePreferences(final InputMethodInfo imi,
final PreferenceScreen root) {
- final Context context = getActivity();
+ final Context context = getPrefContext();
final int subtypeCount = imi.getSubtypeCount();
if (subtypeCount <= 1) {
return;
}
final String imiId = imi.getId();
- final PreferenceCategory keyboardSettingsCategory = new PreferenceCategory(context);
+ final PreferenceCategory keyboardSettingsCategory =
+ new PreferenceCategory(getPrefContext());
root.addPreference(keyboardSettingsCategory);
final PackageManager pm = getPackageManager();
final CharSequence label = imi.loadLabel(pm);
@@ -173,12 +174,14 @@
keyboardSettingsCategory.setTitle(label);
keyboardSettingsCategory.setKey(imiId);
// TODO: Use toggle Preference if images are ready.
- final TwoStatePreference autoSelectionPref = new SwitchWithNoTextPreference(context);
+ final TwoStatePreference autoSelectionPref =
+ new SwitchWithNoTextPreference(getPrefContext());
mAutoSelectionPrefsMap.put(imiId, autoSelectionPref);
keyboardSettingsCategory.addPreference(autoSelectionPref);
autoSelectionPref.setOnPreferenceChangeListener(this);
- final PreferenceCategory activeInputMethodsCategory = new PreferenceCategory(context);
+ final PreferenceCategory activeInputMethodsCategory =
+ new PreferenceCategory(getPrefContext());
activeInputMethodsCategory.setTitle(R.string.active_input_method_subtypes);
root.addPreference(activeInputMethodsCategory);
diff --git a/src/com/android/settings/inputmethod/InputMethodAndSubtypeUtil.java b/src/com/android/settings/inputmethod/InputMethodAndSubtypeUtil.java
index b184066..dfa1634 100644
--- a/src/com/android/settings/inputmethod/InputMethodAndSubtypeUtil.java
+++ b/src/com/android/settings/inputmethod/InputMethodAndSubtypeUtil.java
@@ -18,11 +18,11 @@
import android.content.ContentResolver;
import android.content.SharedPreferences;
-import android.preference.Preference;
-import android.preference.PreferenceScreen;
-import android.preference.TwoStatePreference;
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceScreen;
+import android.support.v7.preference.TwoStatePreference;
import android.text.TextUtils;
import android.util.Log;
import android.view.inputmethod.InputMethodInfo;
diff --git a/src/com/android/settings/inputmethod/InputMethodPreference.java b/src/com/android/settings/inputmethod/InputMethodPreference.java
index 5cf5d6a..0d812e5 100755
--- a/src/com/android/settings/inputmethod/InputMethodPreference.java
+++ b/src/com/android/settings/inputmethod/InputMethodPreference.java
@@ -21,10 +21,10 @@
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceChangeListener;
-import android.preference.Preference.OnPreferenceClickListener;
-import android.preference.SwitchPreference;
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceChangeListener;
+import android.support.v7.preference.Preference.OnPreferenceClickListener;
import android.text.TextUtils;
import android.util.Log;
import android.view.inputmethod.InputMethodInfo;
diff --git a/src/com/android/settings/inputmethod/InputMethodSettingValuesWrapper.java b/src/com/android/settings/inputmethod/InputMethodSettingValuesWrapper.java
index 8f10bdf..c4c889d 100644
--- a/src/com/android/settings/inputmethod/InputMethodSettingValuesWrapper.java
+++ b/src/com/android/settings/inputmethod/InputMethodSettingValuesWrapper.java
@@ -16,9 +16,6 @@
package com.android.settings.inputmethod;
-import com.android.internal.inputmethod.InputMethodUtils;
-import com.android.internal.inputmethod.InputMethodUtils.InputMethodSettings;
-
import android.app.ActivityManagerNative;
import android.content.Context;
import android.os.RemoteException;
@@ -28,6 +25,9 @@
import android.view.inputmethod.InputMethodManager;
import android.view.inputmethod.InputMethodSubtype;
+import com.android.internal.inputmethod.InputMethodUtils;
+import com.android.internal.inputmethod.InputMethodUtils.InputMethodSettings;
+
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
diff --git a/src/com/android/settings/inputmethod/InputMethodSubtypePreference.java b/src/com/android/settings/inputmethod/InputMethodSubtypePreference.java
index 6ded6ad..7321b08 100644
--- a/src/com/android/settings/inputmethod/InputMethodSubtypePreference.java
+++ b/src/com/android/settings/inputmethod/InputMethodSubtypePreference.java
@@ -17,7 +17,7 @@
package com.android.settings.inputmethod;
import android.content.Context;
-import android.preference.Preference;
+import android.support.v7.preference.Preference;
import android.text.TextUtils;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodSubtype;
diff --git a/src/com/android/settings/inputmethod/KeyboardLayoutDialogFragment.java b/src/com/android/settings/inputmethod/KeyboardLayoutDialogFragment.java
index c77b2c9..fef2e9d 100644
--- a/src/com/android/settings/inputmethod/KeyboardLayoutDialogFragment.java
+++ b/src/com/android/settings/inputmethod/KeyboardLayoutDialogFragment.java
@@ -16,10 +16,8 @@
package com.android.settings.inputmethod;
-import com.android.settings.R;
-
-import android.app.AlertDialog;
import android.app.Activity;
+import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.app.LoaderManager.LoaderCallbacks;
@@ -30,8 +28,8 @@
import android.content.Loader;
import android.hardware.input.InputDeviceIdentifier;
import android.hardware.input.InputManager;
-import android.hardware.input.KeyboardLayout;
import android.hardware.input.InputManager.InputDeviceListener;
+import android.hardware.input.KeyboardLayout;
import android.os.Bundle;
import android.view.InputDevice;
import android.view.LayoutInflater;
@@ -42,6 +40,8 @@
import android.widget.RadioButton;
import android.widget.TextView;
+import com.android.settings.R;
+
import java.util.ArrayList;
import java.util.Collections;
diff --git a/src/com/android/settings/inputmethod/KeyboardLayoutPickerFragment.java b/src/com/android/settings/inputmethod/KeyboardLayoutPickerFragment.java
index 69586b9..0dcf9db 100644
--- a/src/com/android/settings/inputmethod/KeyboardLayoutPickerFragment.java
+++ b/src/com/android/settings/inputmethod/KeyboardLayoutPickerFragment.java
@@ -16,20 +16,20 @@
package com.android.settings.inputmethod;
-import com.android.internal.logging.MetricsLogger;
-import com.android.settings.SettingsPreferenceFragment;
-
import android.content.Context;
import android.hardware.input.InputDeviceIdentifier;
import android.hardware.input.InputManager;
import android.hardware.input.InputManager.InputDeviceListener;
import android.hardware.input.KeyboardLayout;
import android.os.Bundle;
-import android.preference.CheckBoxPreference;
-import android.preference.Preference;
-import android.preference.PreferenceScreen;
+import android.support.v7.preference.CheckBoxPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceScreen;
import android.view.InputDevice;
+import com.android.internal.logging.MetricsLogger;
+import com.android.settings.SettingsPreferenceFragment;
+
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
@@ -96,8 +96,7 @@
}
@Override
- public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
- Preference preference) {
+ public boolean onPreferenceTreeClick(Preference preference) {
if (preference instanceof CheckBoxPreference) {
CheckBoxPreference checkboxPref = (CheckBoxPreference)preference;
KeyboardLayout layout = mPreferenceMap.get(checkboxPref);
@@ -113,7 +112,7 @@
return true;
}
}
- return super.onPreferenceTreeClick(preferenceScreen, preference);
+ return super.onPreferenceTreeClick(preference);
}
@Override
@@ -139,7 +138,7 @@
Context context = getActivity();
for (KeyboardLayout layout : mKeyboardLayouts) {
- CheckBoxPreference pref = new CheckBoxPreference(context);
+ CheckBoxPreference pref = new CheckBoxPreference(getPrefContext());
pref.setTitle(layout.getLabel());
pref.setSummary(layout.getCollection());
root.addPreference(pref);
diff --git a/src/com/android/settings/inputmethod/SpellCheckerPreference.java b/src/com/android/settings/inputmethod/SpellCheckerPreference.java
index 3787803..daa26fb 100644
--- a/src/com/android/settings/inputmethod/SpellCheckerPreference.java
+++ b/src/com/android/settings/inputmethod/SpellCheckerPreference.java
@@ -19,7 +19,8 @@
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
-import android.preference.Preference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceViewHolder;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
@@ -80,8 +81,8 @@
}
@Override
- protected void onBindView(View view) {
- super.onBindView(view);
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
mRadioButton = (RadioButton)view.findViewById(R.id.pref_radio);
mPrefLeftButton = view.findViewById(R.id.pref_left_button);
mPrefLeftButton.setOnClickListener(this);
diff --git a/src/com/android/settings/inputmethod/SpellCheckersSettings.java b/src/com/android/settings/inputmethod/SpellCheckersSettings.java
index 729fdc6..f41b364 100644
--- a/src/com/android/settings/inputmethod/SpellCheckersSettings.java
+++ b/src/com/android/settings/inputmethod/SpellCheckersSettings.java
@@ -21,9 +21,9 @@
import android.content.DialogInterface;
import android.content.pm.ApplicationInfo;
import android.os.Bundle;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceClickListener;
-import android.preference.PreferenceScreen;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceClickListener;
+import android.support.v7.preference.PreferenceScreen;
import android.util.Log;
import android.view.textservice.SpellCheckerInfo;
import android.view.textservice.SpellCheckerSubtype;
@@ -79,7 +79,8 @@
final int count = (mEnabledScis == null) ? 0 : mEnabledScis.length;
for (int index = 0; index < count; ++index) {
final SpellCheckerInfo sci = mEnabledScis[index];
- final SpellCheckerPreference pref = new SpellCheckerPreference(context, sci, this);
+ final SpellCheckerPreference pref = new SpellCheckerPreference(getPrefContext(), sci,
+ this);
screen.addPreference(pref);
InputMethodAndSubtypeUtil.removeUnnecessaryNonPersistentPreference(pref);
}
diff --git a/src/com/android/settings/inputmethod/SwitchWithNoTextPreference.java b/src/com/android/settings/inputmethod/SwitchWithNoTextPreference.java
index 677c031..727f56f 100644
--- a/src/com/android/settings/inputmethod/SwitchWithNoTextPreference.java
+++ b/src/com/android/settings/inputmethod/SwitchWithNoTextPreference.java
@@ -17,7 +17,7 @@
package com.android.settings.inputmethod;
import android.content.Context;
-import android.preference.SwitchPreference;
+import android.support.v14.preference.SwitchPreference;
class SwitchWithNoTextPreference extends SwitchPreference {
private static final String EMPTY_TEXT = "";
diff --git a/src/com/android/settings/inputmethod/UserDictionaryAddWordActivity.java b/src/com/android/settings/inputmethod/UserDictionaryAddWordActivity.java
index 2901673..ab5c2d6 100644
--- a/src/com/android/settings/inputmethod/UserDictionaryAddWordActivity.java
+++ b/src/com/android/settings/inputmethod/UserDictionaryAddWordActivity.java
@@ -16,8 +16,6 @@
package com.android.settings.inputmethod;
-import com.android.settings.R;
-
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
@@ -26,6 +24,8 @@
import android.os.RemoteException;
import android.view.View;
+import com.android.settings.R;
+
public class UserDictionaryAddWordActivity extends Activity {
public static final String MODE_EDIT_ACTION = "com.android.settings.USER_DICTIONARY_EDIT";
diff --git a/src/com/android/settings/inputmethod/UserDictionaryList.java b/src/com/android/settings/inputmethod/UserDictionaryList.java
index ab23614..c7e53a3 100644
--- a/src/com/android/settings/inputmethod/UserDictionaryList.java
+++ b/src/com/android/settings/inputmethod/UserDictionaryList.java
@@ -16,24 +16,24 @@
package com.android.settings.inputmethod;
-import com.android.internal.logging.MetricsLogger;
-import com.android.settings.R;
-import com.android.settings.SettingsPreferenceFragment;
-import com.android.settings.Utils;
-
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
-import android.preference.Preference;
-import android.preference.PreferenceGroup;
import android.provider.UserDictionary;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceGroup;
import android.text.TextUtils;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodManager;
import android.view.inputmethod.InputMethodSubtype;
+import com.android.internal.logging.MetricsLogger;
+import com.android.settings.R;
+import com.android.settings.SettingsPreferenceFragment;
+import com.android.settings.Utils;
+
import java.util.List;
import java.util.Locale;
import java.util.TreeSet;
@@ -167,7 +167,7 @@
* @return The corresponding preference.
*/
protected Preference createUserDictionaryPreference(String locale, Activity activity) {
- final Preference newPref = new Preference(getActivity());
+ final Preference newPref = new Preference(getPrefContext());
final Intent intent = new Intent(USER_DICTIONARY_SETTINGS_INTENT_ACTION);
if (null == locale) {
newPref.setTitle(Locale.getDefault().getDisplayName());
diff --git a/src/com/android/settings/inputmethod/UserDictionarySettingsUtils.java b/src/com/android/settings/inputmethod/UserDictionarySettingsUtils.java
index e77f9c5..6138850 100644
--- a/src/com/android/settings/inputmethod/UserDictionarySettingsUtils.java
+++ b/src/com/android/settings/inputmethod/UserDictionarySettingsUtils.java
@@ -16,12 +16,12 @@
package com.android.settings.inputmethod;
-import com.android.settings.R;
-import com.android.settings.Utils;
-
import android.content.Context;
import android.text.TextUtils;
+import com.android.settings.R;
+import com.android.settings.Utils;
+
import java.util.Locale;
/**
diff --git a/src/com/android/settings/location/InjectedSetting.java b/src/com/android/settings/location/InjectedSetting.java
index bb009b9..e5f1e68 100644
--- a/src/com/android/settings/location/InjectedSetting.java
+++ b/src/com/android/settings/location/InjectedSetting.java
@@ -17,9 +17,10 @@
package com.android.settings.location;
import android.content.Intent;
+import android.os.UserHandle;
import android.text.TextUtils;
import android.util.Log;
-import android.os.UserHandle;
+
import com.android.internal.annotations.Immutable;
import com.android.internal.util.Preconditions;
@@ -44,12 +45,12 @@
public final String className;
/**
- * The {@link android.preference.Preference#getTitle()} value.
+ * The {@link android.support.v7.preference.Preference#getTitle()} value.
*/
public final String title;
/**
- * The {@link android.preference.Preference#getIcon()} value.
+ * The {@link android.support.v7.preference.Preference#getIcon()} value.
*/
public final int iconId;
diff --git a/src/com/android/settings/location/LocationMode.java b/src/com/android/settings/location/LocationMode.java
index d203bc4..2bc6655 100644
--- a/src/com/android/settings/location/LocationMode.java
+++ b/src/com/android/settings/location/LocationMode.java
@@ -16,8 +16,8 @@
package com.android.settings.location;
-import android.preference.PreferenceScreen;
import android.provider.Settings;
+import android.support.v7.preference.PreferenceScreen;
import com.android.internal.logging.MetricsLogger;
import com.android.settings.R;
diff --git a/src/com/android/settings/location/LocationSettings.java b/src/com/android/settings/location/LocationSettings.java
index 1091371..df85a55 100644
--- a/src/com/android/settings/location/LocationSettings.java
+++ b/src/com/android/settings/location/LocationSettings.java
@@ -24,15 +24,16 @@
import android.os.Bundle;
import android.os.UserHandle;
import android.os.UserManager;
-import android.preference.Preference;
-import android.preference.PreferenceCategory;
-import android.preference.PreferenceGroup;
-import android.preference.PreferenceScreen;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceCategory;
+import android.support.v7.preference.PreferenceGroup;
+import android.support.v7.preference.PreferenceScreen;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.Switch;
+
import com.android.internal.logging.MetricsLogger;
import com.android.settings.R;
import com.android.settings.SettingsActivity;
@@ -194,13 +195,13 @@
mCategoryRecentLocationRequests =
(PreferenceCategory) root.findPreference(KEY_RECENT_LOCATION_REQUESTS);
- RecentLocationApps recentApps = new RecentLocationApps(activity);
+ RecentLocationApps recentApps = new RecentLocationApps(activity, getPrefContext());
List<Preference> recentLocationRequests = recentApps.getAppList();
if (recentLocationRequests.size() > 0) {
addPreferencesSorted(recentLocationRequests, mCategoryRecentLocationRequests);
} else {
// If there's no item to display, add a "No recent apps" item.
- Preference banner = new Preference(activity);
+ Preference banner = new Preference(getPrefContext());
banner.setLayoutResource(R.layout.location_list_no_item);
banner.setTitle(R.string.location_no_recent_apps);
banner.setSelectable(false);
diff --git a/src/com/android/settings/location/RadioButtonPreference.java b/src/com/android/settings/location/RadioButtonPreference.java
index 5589dfa..9135266 100644
--- a/src/com/android/settings/location/RadioButtonPreference.java
+++ b/src/com/android/settings/location/RadioButtonPreference.java
@@ -17,9 +17,9 @@
package com.android.settings.location;
import android.content.Context;
-import android.preference.CheckBoxPreference;
+import android.support.v7.preference.CheckBoxPreference;
+import android.support.v7.preference.PreferenceViewHolder;
import android.util.AttributeSet;
-import android.view.View;
import android.widget.TextView;
import com.android.settings.R;
@@ -66,8 +66,8 @@
}
@Override
- protected void onBindView(View view) {
- super.onBindView(view);
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
TextView title = (TextView) view.findViewById(android.R.id.title);
if (title != null) {
diff --git a/src/com/android/settings/location/RecentLocationApps.java b/src/com/android/settings/location/RecentLocationApps.java
index 66bdda5..bf62c22 100644
--- a/src/com/android/settings/location/RecentLocationApps.java
+++ b/src/com/android/settings/location/RecentLocationApps.java
@@ -20,8 +20,8 @@
import android.app.AppOpsManager;
import android.content.Context;
import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageManager;
import android.content.pm.IPackageManager;
+import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
@@ -29,7 +29,7 @@
import android.os.RemoteException;
import android.os.UserHandle;
import android.os.UserManager;
-import android.preference.Preference;
+import android.support.v7.preference.Preference;
import android.util.Log;
import com.android.settings.DimmableIconPreference;
@@ -51,9 +51,11 @@
private final SettingsActivity mActivity;
private final PackageManager mPackageManager;
+ private final Context mContext;
- public RecentLocationApps(SettingsActivity activity) {
+ public RecentLocationApps(SettingsActivity activity, Context context) {
mActivity = activity;
+ mContext = context;
mPackageManager = activity.getPackageManager();
}
@@ -84,7 +86,7 @@
boolean isHighBattery,
CharSequence contentDescription,
Preference.OnPreferenceClickListener listener) {
- DimmableIconPreference pref = new DimmableIconPreference(mActivity, contentDescription);
+ DimmableIconPreference pref = new DimmableIconPreference(mContext, contentDescription);
pref.setIcon(icon);
pref.setTitle(label);
if (isHighBattery) {
diff --git a/src/com/android/settings/location/ScanningSettings.java b/src/com/android/settings/location/ScanningSettings.java
index 5eb424d..ba2a9f7 100644
--- a/src/com/android/settings/location/ScanningSettings.java
+++ b/src/com/android/settings/location/ScanningSettings.java
@@ -16,10 +16,10 @@
package com.android.settings.location;
-import android.preference.Preference;
-import android.preference.PreferenceScreen;
-import android.preference.SwitchPreference;
import android.provider.Settings.Global;
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceScreen;
import com.android.internal.logging.MetricsLogger;
import com.android.settings.R;
@@ -66,7 +66,7 @@
}
@Override
- public boolean onPreferenceTreeClick(PreferenceScreen screen, Preference preference) {
+ public boolean onPreferenceTreeClick(Preference preference) {
String key = preference.getKey();
if (KEY_WIFI_SCAN_ALWAYS_AVAILABLE.equals(key)) {
Global.putInt(getContentResolver(),
@@ -77,7 +77,7 @@
Global.BLE_SCAN_ALWAYS_AVAILABLE,
((SwitchPreference) preference).isChecked() ? 1 : 0);
} else {
- return super.onPreferenceTreeClick(screen, preference);
+ return super.onPreferenceTreeClick(preference);
}
return true;
}
diff --git a/src/com/android/settings/location/SettingsInjector.java b/src/com/android/settings/location/SettingsInjector.java
index 153deff..77840fa 100644
--- a/src/com/android/settings/location/SettingsInjector.java
+++ b/src/com/android/settings/location/SettingsInjector.java
@@ -34,7 +34,7 @@
import android.os.SystemClock;
import android.os.UserHandle;
import android.os.UserManager;
-import android.preference.Preference;
+import android.support.v7.preference.Preference;
import android.util.AttributeSet;
import android.util.Log;
import android.util.Xml;
diff --git a/src/com/android/settings/net/DataUsageMeteredSettings.java b/src/com/android/settings/net/DataUsageMeteredSettings.java
index 59a8b92..ef3a705 100644
--- a/src/com/android/settings/net/DataUsageMeteredSettings.java
+++ b/src/com/android/settings/net/DataUsageMeteredSettings.java
@@ -16,11 +16,6 @@
package com.android.settings.net;
-import static android.net.NetworkPolicy.LIMIT_DISABLED;
-import static android.net.wifi.WifiInfo.removeDoubleQuotes;
-import static com.android.settings.DataUsageSummary.hasReadyMobileRadio;
-import static com.android.settings.DataUsageSummary.hasWifiRadio;
-
import android.content.Context;
import android.content.res.Resources;
import android.net.NetworkPolicy;
@@ -29,9 +24,9 @@
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
import android.os.Bundle;
-import android.preference.Preference;
-import android.preference.PreferenceCategory;
-import android.preference.SwitchPreference;
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceCategory;
import android.telephony.TelephonyManager;
import com.android.internal.logging.MetricsLogger;
@@ -45,6 +40,11 @@
import java.util.ArrayList;
import java.util.List;
+import static android.net.NetworkPolicy.LIMIT_DISABLED;
+import static android.net.wifi.WifiInfo.removeDoubleQuotes;
+import static com.android.settings.DataUsageSummary.hasReadyMobileRadio;
+import static com.android.settings.DataUsageSummary.hasWifiRadio;
+
/**
* Panel to configure {@link NetworkPolicy#metered} for networks.
*/
@@ -109,7 +109,7 @@
final TelephonyManager tele = TelephonyManager.from(context);
final NetworkTemplate template = NetworkTemplate.buildTemplateMobileAll(
tele.getSubscriberId());
- final MeteredPreference pref = new MeteredPreference(context, template);
+ final MeteredPreference pref = new MeteredPreference(getPrefContext(), template);
pref.setTitle(tele.getNetworkOperatorName());
return pref;
}
diff --git a/src/com/android/settings/nfc/NfcEnabler.java b/src/com/android/settings/nfc/NfcEnabler.java
index ae61b13..c58c325 100644
--- a/src/com/android/settings/nfc/NfcEnabler.java
+++ b/src/com/android/settings/nfc/NfcEnabler.java
@@ -22,9 +22,9 @@
import android.content.IntentFilter;
import android.nfc.NfcAdapter;
import android.os.UserManager;
-import android.preference.Preference;
-import android.preference.PreferenceScreen;
-import android.preference.SwitchPreference;
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceScreen;
import com.android.settings.R;
diff --git a/src/com/android/settings/nfc/NfcPaymentPreference.java b/src/com/android/settings/nfc/NfcPaymentPreference.java
index e8dcf0b..c918d2f 100644
--- a/src/com/android/settings/nfc/NfcPaymentPreference.java
+++ b/src/com/android/settings/nfc/NfcPaymentPreference.java
@@ -20,7 +20,7 @@
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
-import android.preference.DialogPreference;
+import android.support.v7.preference.PreferenceViewHolder;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@@ -29,13 +29,15 @@
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.RadioButton;
+
+import com.android.settings.CustomDialogPreference;
import com.android.settings.R;
import com.android.settings.nfc.PaymentBackend.PaymentAppInfo;
import java.util.List;
-public class NfcPaymentPreference extends DialogPreference implements
- DialogInterface.OnClickListener, PaymentBackend.Callback, View.OnClickListener {
+public class NfcPaymentPreference extends CustomDialogPreference implements
+ PaymentBackend.Callback, View.OnClickListener {
private static final String TAG = "NfcPaymentPreference";
@@ -61,8 +63,8 @@
}
@Override
- protected void onBindView(View view) {
- super.onBindView(view);
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
mSettingsButtonView = (ImageView) view.findViewById(R.id.settings_button);
mSettingsButtonView.setOnClickListener(this);
@@ -90,10 +92,11 @@
}
@Override
- protected void onPrepareDialogBuilder(AlertDialog.Builder builder) {
- super.onPrepareDialogBuilder(builder);
+ protected void onPrepareDialogBuilder(AlertDialog.Builder builder,
+ DialogInterface.OnClickListener listener) {
+ super.onPrepareDialogBuilder(builder, listener);
- builder.setSingleChoiceItems(mAdapter, 0, this);
+ builder.setSingleChoiceItems(mAdapter, 0, listener);
}
@Override
diff --git a/src/com/android/settings/nfc/PaymentBackend.java b/src/com/android/settings/nfc/PaymentBackend.java
index 8f82f5c..eeb43e2 100644
--- a/src/com/android/settings/nfc/PaymentBackend.java
+++ b/src/com/android/settings/nfc/PaymentBackend.java
@@ -16,7 +16,6 @@
package com.android.settings.nfc;
-import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.pm.PackageManager;
@@ -25,13 +24,11 @@
import android.nfc.NfcAdapter;
import android.nfc.cardemulation.ApduServiceInfo;
import android.nfc.cardemulation.CardEmulation;
-import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
-import android.os.UserHandle;
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
-import android.util.Log;
+
import com.android.internal.content.PackageMonitor;
import java.util.ArrayList;
diff --git a/src/com/android/settings/nfc/PaymentSettings.java b/src/com/android/settings/nfc/PaymentSettings.java
index bc438d1..c0f3ff7 100644
--- a/src/com/android/settings/nfc/PaymentSettings.java
+++ b/src/com/android/settings/nfc/PaymentSettings.java
@@ -18,13 +18,14 @@
import android.content.Intent;
import android.os.Bundle;
-import android.preference.PreferenceManager;
-import android.preference.PreferenceScreen;
+import android.support.v7.preference.PreferenceManager;
+import android.support.v7.preference.PreferenceScreen;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
+
import com.android.internal.logging.MetricsLogger;
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
@@ -56,7 +57,7 @@
View emptyView = getActivity().getLayoutInflater().inflate(
R.layout.nfc_payment_empty, contentRoot, false);
contentRoot.addView(emptyView);
- getListView().setEmptyView(emptyView);
+ setEmptyView(emptyView);
PreferenceManager manager = getPreferenceManager();
PreferenceScreen screen = manager.createPreferenceScreen(getActivity());
@@ -64,9 +65,10 @@
List<PaymentAppInfo> appInfos = mPaymentBackend.getPaymentAppInfos();
if (appInfos != null && appInfos.size() > 0) {
NfcPaymentPreference preference =
- new NfcPaymentPreference(getActivity(), mPaymentBackend);
+ new NfcPaymentPreference(getPrefContext(), mPaymentBackend);
+ preference.setKey("payment");
screen.addPreference(preference);
- NfcForegroundPreference foreground = new NfcForegroundPreference(getActivity(),
+ NfcForegroundPreference foreground = new NfcForegroundPreference(getPrefContext(),
mPaymentBackend);
screen.addPreference(foreground);
}
diff --git a/src/com/android/settings/notification/AppNotificationSettings.java b/src/com/android/settings/notification/AppNotificationSettings.java
index bc89526..d49ecdd 100644
--- a/src/com/android/settings/notification/AppNotificationSettings.java
+++ b/src/com/android/settings/notification/AppNotificationSettings.java
@@ -27,11 +27,11 @@
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.os.UserHandle;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceChangeListener;
-import android.preference.Preference.OnPreferenceClickListener;
-import android.preference.SwitchPreference;
import android.provider.Settings;
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceChangeListener;
+import android.support.v7.preference.Preference.OnPreferenceClickListener;
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.Log;
diff --git a/src/com/android/settings/notification/ManagedServiceSettings.java b/src/com/android/settings/notification/ManagedServiceSettings.java
index 9ed8744..8775933 100644
--- a/src/com/android/settings/notification/ManagedServiceSettings.java
+++ b/src/com/android/settings/notification/ManagedServiceSettings.java
@@ -26,10 +26,10 @@
import android.content.pm.PackageManager;
import android.content.pm.ServiceInfo;
import android.os.Bundle;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceChangeListener;
-import android.preference.PreferenceScreen;
-import android.preference.SwitchPreference;
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceChangeListener;
+import android.support.v7.preference.PreferenceScreen;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -102,7 +102,7 @@
for (ServiceInfo service : services) {
final ComponentName cn = new ComponentName(service.packageName, service.name);
final String title = service.loadLabel(mPM).toString();
- final SwitchPreference pref = new SwitchPreference(mContext);
+ final SwitchPreference pref = new SwitchPreference(getPrefContext());
pref.setPersistent(false);
pref.setIcon(service.loadIcon(mPM));
pref.setTitle(title);
diff --git a/src/com/android/settings/notification/NotificationSettings.java b/src/com/android/settings/notification/NotificationSettings.java
index 37ed34c..46935d0 100644
--- a/src/com/android/settings/notification/NotificationSettings.java
+++ b/src/com/android/settings/notification/NotificationSettings.java
@@ -40,21 +40,22 @@
import android.os.UserHandle;
import android.os.UserManager;
import android.os.Vibrator;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceChangeListener;
-import android.preference.PreferenceCategory;
import android.preference.SeekBarVolumizer;
-import android.preference.TwoStatePreference;
import android.provider.MediaStore;
import android.provider.OpenableColumns;
import android.provider.SearchIndexableResource;
import android.provider.Settings;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceChangeListener;
+import android.support.v7.preference.PreferenceCategory;
+import android.support.v7.preference.TwoStatePreference;
import android.util.Log;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.widget.LockPatternUtils;
import com.android.settings.DropDownPreference;
import com.android.settings.R;
+import com.android.settings.RingtonePreference;
import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.Utils;
import com.android.settings.search.BaseSearchIndexProvider;
@@ -121,6 +122,7 @@
private int mRingerMode = -1;
private UserManager mUserManager;
+ private RingtonePreference mRequestPreference;
@Override
protected int getMetricsCategory() {
@@ -201,11 +203,33 @@
@Override
public void onPause() {
super.onPause();
+ for (VolumeSeekBarPreference volumePref : mVolumePrefs) {
+ volumePref.onActivityPause();
+ }
mVolumeCallback.stopSample();
mSettingsObserver.register(false);
mReceiver.register(false);
}
+ @Override
+ public boolean onPreferenceTreeClick(Preference preference) {
+ if (preference instanceof RingtonePreference) {
+ mRequestPreference = (RingtonePreference) preference;
+ mRequestPreference.onPrepareRingtonePickerIntent(mRequestPreference.getIntent());
+ startActivityForResult(preference.getIntent(), mRequestPreference.getRequestCode());
+ return true;
+ }
+ return super.onPreferenceTreeClick(preference);
+ }
+
+ @Override
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
+ if (mRequestPreference != null) {
+ mRequestPreference.onActivityResult(requestCode, resultCode, data);
+ mRequestPreference = null;
+ }
+ }
+
// === Volumes ===
private VolumeSeekBarPreference initVolumePreference(String key, int stream, int muteIcon) {
diff --git a/src/com/android/settings/notification/NotificationStation.java b/src/com/android/settings/notification/NotificationStation.java
index e6b1ebd..6e62720 100644
--- a/src/com/android/settings/notification/NotificationStation.java
+++ b/src/com/android/settings/notification/NotificationStation.java
@@ -35,15 +35,13 @@
import android.os.UserHandle;
import android.service.notification.NotificationListenerService;
import android.service.notification.StatusBarNotification;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceViewHolder;
+import android.support.v7.widget.RecyclerView;
import android.util.Log;
-import android.view.LayoutInflater;
import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.ViewGroup;
-import android.widget.ArrayAdapter;
import android.widget.DateTimeView;
import android.widget.ImageView;
-import android.widget.ListView;
import android.widget.TextView;
import com.android.internal.logging.MetricsLogger;
@@ -52,6 +50,7 @@
import com.android.settings.Utils;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Comparator;
import java.util.List;
@@ -99,7 +98,6 @@
}
};
- private NotificationHistoryAdapter mAdapter;
private Context mContext;
private final Comparator<HistoricalNotificationInfo> mNotificationSorter
@@ -147,11 +145,8 @@
logd("onActivityCreated(%s)", savedInstanceState);
super.onActivityCreated(savedInstanceState);
- ListView listView = getListView();
+ RecyclerView listView = getListView();
Utils.forceCustomPadding(listView, false /* non additive padding */);
-
- mAdapter = new NotificationHistoryAdapter(mContext);
- listView.setAdapter(mAdapter);
}
@Override
@@ -164,10 +159,17 @@
private void refreshList() {
List<HistoricalNotificationInfo> infos = loadNotifications();
if (infos != null) {
- logd("adding %d infos", infos.size());
- mAdapter.clear();
- mAdapter.addAll(infos);
- mAdapter.sort(mNotificationSorter);
+ final int N = infos.size();
+ logd("adding %d infos", N);
+ Collections.sort(infos, mNotificationSorter);
+ if (getPreferenceScreen() == null) {
+ setPreferenceScreen(getPreferenceManager().createPreferenceScreen(getContext()));
+ }
+ getPreferenceScreen().removeAll();
+ for (int i = 0; i < N; i++) {
+ getPreferenceScreen().addPreference(
+ new HistoricalNotificationPreference(getPrefContext(), infos.get(i)));
+ }
}
}
@@ -291,58 +293,38 @@
return null;
}
- private class NotificationHistoryAdapter extends ArrayAdapter<HistoricalNotificationInfo> {
- private final LayoutInflater mInflater;
+ private static class HistoricalNotificationPreference extends Preference {
+ private final HistoricalNotificationInfo mInfo;
- public NotificationHistoryAdapter(Context context) {
- super(context, 0);
- mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ public HistoricalNotificationPreference(Context context, HistoricalNotificationInfo info) {
+ super(context);
+ setLayoutResource(R.layout.notification_log_row);
+ mInfo = info;
}
@Override
- public View getView(int position, View convertView, ViewGroup parent) {
- final HistoricalNotificationInfo info = getItem(position);
- logd("getView(%s/%s)", info.pkg, info.title);
-
- final View row = convertView != null ? convertView : createRow(parent);
- row.setTag(info);
-
- // bind icon
- if (info.icon != null) {
- ((ImageView) row.findViewById(android.R.id.icon)).setImageDrawable(info.icon);
+ public void onBindViewHolder(PreferenceViewHolder row) {
+ if (mInfo.icon != null) {
+ ((ImageView) row.findViewById(android.R.id.icon)).setImageDrawable(mInfo.icon);
}
- if (info.pkgicon != null) {
- ((ImageView) row.findViewById(R.id.pkgicon)).setImageDrawable(info.pkgicon);
+ if (mInfo.pkgicon != null) {
+ ((ImageView) row.findViewById(R.id.pkgicon)).setImageDrawable(mInfo.pkgicon);
}
- ((DateTimeView) row.findViewById(R.id.timestamp)).setTime(info.timestamp);
- ((TextView) row.findViewById(android.R.id.title)).setText(info.title);
- ((TextView) row.findViewById(R.id.pkgname)).setText(info.pkgname);
+ ((DateTimeView) row.findViewById(R.id.timestamp)).setTime(mInfo.timestamp);
+ ((TextView) row.findViewById(android.R.id.title)).setText(mInfo.title);
+ ((TextView) row.findViewById(R.id.pkgname)).setText(mInfo.pkgname);
row.findViewById(R.id.extra).setVisibility(View.GONE);
- row.setAlpha(info.active ? 1.0f : 0.5f);
-
- // set up click handler
- row.setOnClickListener(new OnClickListener(){
- @Override
- public void onClick(View v) {
- v.setPressed(true);
- startApplicationDetailsActivity(info.pkg);
- }});
-
- return row;
+ row.itemView.setAlpha(mInfo.active ? 1.0f : 0.5f);
}
- private View createRow(ViewGroup parent) {
- return mInflater.inflate(R.layout.notification_log_row, parent, false);
+ @Override
+ public void performClick() {
+ Intent intent = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
+ Uri.fromParts("package", mInfo.pkg, null));
+ intent.setComponent(intent.resolveActivity(getContext().getPackageManager()));
+ getContext().startActivity(intent);
}
-
- }
-
- private void startApplicationDetailsActivity(String packageName) {
- Intent intent = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
- Uri.fromParts("package", packageName, null));
- intent.setComponent(intent.resolveActivity(mPm));
- startActivity(intent);
}
}
diff --git a/src/com/android/settings/notification/OtherSoundSettings.java b/src/com/android/settings/notification/OtherSoundSettings.java
index dcafc65..ecd9896 100644
--- a/src/com/android/settings/notification/OtherSoundSettings.java
+++ b/src/com/android/settings/notification/OtherSoundSettings.java
@@ -16,9 +16,6 @@
package com.android.settings.notification;
-import static com.android.settings.notification.SettingPref.TYPE_GLOBAL;
-import static com.android.settings.notification.SettingPref.TYPE_SYSTEM;
-
import android.content.ContentResolver;
import android.content.Context;
import android.content.res.Resources;
@@ -45,6 +42,9 @@
import java.util.Arrays;
import java.util.List;
+import static com.android.settings.notification.SettingPref.TYPE_GLOBAL;
+import static com.android.settings.notification.SettingPref.TYPE_SYSTEM;
+
public class OtherSoundSettings extends SettingsPreferenceFragment implements Indexable {
private static final String TAG = "OtherSoundSettings";
diff --git a/src/com/android/settings/notification/RedactionInterstitial.java b/src/com/android/settings/notification/RedactionInterstitial.java
index a47b703..93691d8 100644
--- a/src/com/android/settings/notification/RedactionInterstitial.java
+++ b/src/com/android/settings/notification/RedactionInterstitial.java
@@ -16,11 +16,6 @@
package com.android.settings.notification;
-import com.android.internal.logging.MetricsLogger;
-import com.android.settings.R;
-import com.android.settings.SettingsActivity;
-import com.android.settings.SettingsPreferenceFragment;
-
import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.content.Intent;
@@ -32,6 +27,11 @@
import android.widget.RadioButton;
import android.widget.RadioGroup;
+import com.android.internal.logging.MetricsLogger;
+import com.android.settings.R;
+import com.android.settings.SettingsActivity;
+import com.android.settings.SettingsPreferenceFragment;
+
public class RedactionInterstitial extends SettingsActivity {
@Override
diff --git a/src/com/android/settings/notification/RedactionSettingsStandalone.java b/src/com/android/settings/notification/RedactionSettingsStandalone.java
index 26c05c1..8195094 100644
--- a/src/com/android/settings/notification/RedactionSettingsStandalone.java
+++ b/src/com/android/settings/notification/RedactionSettingsStandalone.java
@@ -16,9 +16,9 @@
package com.android.settings.notification;
-import com.android.settings.R;
-
import android.content.Intent;
+
+import com.android.settings.R;
import com.android.settings.SettingsActivity;
import com.android.settings.notification.RedactionInterstitial.RedactionInterstitialFragment;
diff --git a/src/com/android/settings/notification/SettingPref.java b/src/com/android/settings/notification/SettingPref.java
index d78c3e4..99ce3b5 100644
--- a/src/com/android/settings/notification/SettingPref.java
+++ b/src/com/android/settings/notification/SettingPref.java
@@ -20,11 +20,11 @@
import android.content.Context;
import android.content.res.Resources;
import android.net.Uri;
-import android.preference.Preference;
-import android.preference.TwoStatePreference;
-import android.preference.Preference.OnPreferenceChangeListener;
import android.provider.Settings.Global;
import android.provider.Settings.System;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceChangeListener;
+import android.support.v7.preference.TwoStatePreference;
import com.android.settings.DropDownPreference;
import com.android.settings.SettingsPreferenceFragment;
diff --git a/src/com/android/settings/notification/VolumeSeekBarPreference.java b/src/com/android/settings/notification/VolumeSeekBarPreference.java
index 2603016..7b02cae 100644
--- a/src/com/android/settings/notification/VolumeSeekBarPreference.java
+++ b/src/com/android/settings/notification/VolumeSeekBarPreference.java
@@ -20,9 +20,8 @@
import android.content.Context;
import android.media.AudioManager;
import android.net.Uri;
-import android.preference.PreferenceManager;
-import android.preference.SeekBarPreference;
import android.preference.SeekBarVolumizer;
+import android.support.v7.preference.PreferenceViewHolder;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
@@ -32,12 +31,12 @@
import android.widget.TextView;
import com.android.settings.R;
+import com.android.settings.SeekBarPreference;
import java.util.Objects;
/** A slider preference that directly controls an audio stream volume (no dialog) **/
-public class VolumeSeekBarPreference extends SeekBarPreference
- implements PreferenceManager.OnActivityStopListener {
+public class VolumeSeekBarPreference extends SeekBarPreference {
private static final String TAG = "VolumeSeekBarPreference";
private int mStream;
@@ -85,17 +84,16 @@
}
}
- @Override
- public void onActivityStop() {
+ public void onActivityPause() {
mStopped = true;
if (mVolumizer != null) {
mVolumizer.stop();
}
}
-
+
@Override
- protected void onBindView(View view) {
- super.onBindView(view);
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
if (mStream == 0) {
Log.w(TAG, "No stream found, not binding volumizer");
return;
@@ -108,7 +106,6 @@
private void init() {
if (mSeekBar == null) return;
- getPreferenceManager().registerOnActivityStopListener(this);
final SeekBarVolumizer.Callback sbvc = new SeekBarVolumizer.Callback() {
@Override
public void onSampleStarting(SeekBarVolumizer sbv) {
diff --git a/src/com/android/settings/notification/ZenAccessSettings.java b/src/com/android/settings/notification/ZenAccessSettings.java
index 88e6c58..d125d21 100644
--- a/src/com/android/settings/notification/ZenAccessSettings.java
+++ b/src/com/android/settings/notification/ZenAccessSettings.java
@@ -31,11 +31,11 @@
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceChangeListener;
-import android.preference.PreferenceScreen;
-import android.preference.SwitchPreference;
import android.provider.Settings.Secure;
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceChangeListener;
+import android.support.v7.preference.PreferenceScreen;
import android.text.TextUtils;
import android.util.ArraySet;
import android.view.LayoutInflater;
@@ -118,7 +118,7 @@
for (ApplicationInfo app : apps) {
final String pkg = app.packageName;
final CharSequence label = app.loadLabel(mPkgMan);
- final SwitchPreference pref = new SwitchPreference(mContext);
+ final SwitchPreference pref = new SwitchPreference(getPrefContext());
pref.setPersistent(false);
pref.setIcon(app.loadIcon(mPkgMan));
pref.setTitle(label);
diff --git a/src/com/android/settings/notification/ZenModeAutomationSettings.java b/src/com/android/settings/notification/ZenModeAutomationSettings.java
index 1c78915..cd26172 100644
--- a/src/com/android/settings/notification/ZenModeAutomationSettings.java
+++ b/src/com/android/settings/notification/ZenModeAutomationSettings.java
@@ -30,12 +30,13 @@
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Bundle;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceClickListener;
-import android.preference.PreferenceScreen;
import android.provider.Settings;
import android.service.notification.ConditionProviderService;
import android.service.notification.ZenModeConfig;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceClickListener;
+import android.support.v7.preference.PreferenceScreen;
+import android.support.v7.preference.PreferenceViewHolder;
import android.util.Log;
import android.view.View;
@@ -161,9 +162,9 @@
if (mRules.size() == 0) return;
final AutomaticZenRule[] sortedRules = sortedRules();
for (AutomaticZenRule sortedRule : sortedRules) {
- root.addPreference(new ZenRulePreference(mContext, sortedRule));
+ root.addPreference(new ZenRulePreference(getPrefContext(), sortedRule));
}
- final Preference p = new Preference(mContext);
+ final Preference p = new Preference(getPrefContext());
p.setIcon(R.drawable.ic_add);
p.setTitle(R.string.zen_mode_add_rule);
p.setPersistent(false);
@@ -314,8 +315,8 @@
}
@Override
- protected void onBindView(View view) {
- super.onBindView(view);
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
View v = view.findViewById(R.id.delete_zen_rule);
if (v != null) {
diff --git a/src/com/android/settings/notification/ZenModeEventRuleSettings.java b/src/com/android/settings/notification/ZenModeEventRuleSettings.java
index 1e667f9..d8e7ad1 100644
--- a/src/com/android/settings/notification/ZenModeEventRuleSettings.java
+++ b/src/com/android/settings/notification/ZenModeEventRuleSettings.java
@@ -22,13 +22,13 @@
import android.database.Cursor;
import android.os.UserHandle;
import android.os.UserManager;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceChangeListener;
-import android.preference.PreferenceScreen;
import android.provider.CalendarContract.Calendars;
import android.provider.Settings;
import android.service.notification.ZenModeConfig;
import android.service.notification.ZenModeConfig.EventInfo;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceChangeListener;
+import android.support.v7.preference.PreferenceScreen;
import com.android.internal.logging.MetricsLogger;
import com.android.settings.DropDownPreference;
diff --git a/src/com/android/settings/notification/ZenModePrioritySettings.java b/src/com/android/settings/notification/ZenModePrioritySettings.java
index be8e454..6168e57 100644
--- a/src/com/android/settings/notification/ZenModePrioritySettings.java
+++ b/src/com/android/settings/notification/ZenModePrioritySettings.java
@@ -19,11 +19,11 @@
import android.app.NotificationManager;
import android.app.NotificationManager.Policy;
import android.os.Bundle;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceChangeListener;
-import android.preference.PreferenceScreen;
-import android.preference.SwitchPreference;
import android.service.notification.ZenModeConfig;
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceChangeListener;
+import android.support.v7.preference.PreferenceScreen;
import android.util.Log;
import com.android.internal.logging.MetricsLogger;
diff --git a/src/com/android/settings/notification/ZenModeRuleSettingsBase.java b/src/com/android/settings/notification/ZenModeRuleSettingsBase.java
index 46a1634..e8a9c28 100644
--- a/src/com/android/settings/notification/ZenModeRuleSettingsBase.java
+++ b/src/com/android/settings/notification/ZenModeRuleSettingsBase.java
@@ -25,11 +25,11 @@
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceChangeListener;
-import android.preference.Preference.OnPreferenceClickListener;
-import android.preference.PreferenceScreen;
import android.service.notification.ConditionProviderService;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceChangeListener;
+import android.support.v7.preference.Preference.OnPreferenceClickListener;
+import android.support.v7.preference.PreferenceScreen;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
diff --git a/src/com/android/settings/notification/ZenModeScheduleRuleSettings.java b/src/com/android/settings/notification/ZenModeScheduleRuleSettings.java
index adca7cd..2147665 100644
--- a/src/com/android/settings/notification/ZenModeScheduleRuleSettings.java
+++ b/src/com/android/settings/notification/ZenModeScheduleRuleSettings.java
@@ -16,8 +16,6 @@
package com.android.settings.notification;
-import static com.android.settings.notification.ZenModeScheduleDaysSelection.DAYS;
-
import android.app.AlertDialog;
import android.app.AutomaticZenRule;
import android.app.Dialog;
@@ -28,12 +26,12 @@
import android.content.DialogInterface;
import android.content.DialogInterface.OnDismissListener;
import android.os.Bundle;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceClickListener;
-import android.preference.PreferenceScreen;
import android.provider.Settings;
import android.service.notification.ZenModeConfig;
import android.service.notification.ZenModeConfig.ScheduleInfo;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceClickListener;
+import android.support.v7.preference.PreferenceScreen;
import android.text.format.DateFormat;
import android.util.Log;
import android.widget.TimePicker;
@@ -45,6 +43,8 @@
import java.util.Arrays;
import java.util.Calendar;
+import static com.android.settings.notification.ZenModeScheduleDaysSelection.DAYS;
+
public class ZenModeScheduleRuleSettings extends ZenModeRuleSettingsBase {
private static final String KEY_DAYS = "days";
private static final String KEY_START_TIME = "start_time";
@@ -94,7 +94,7 @@
final FragmentManager mgr = getFragmentManager();
- mStart = new TimePickerPreference(mContext, mgr);
+ mStart = new TimePickerPreference(getPrefContext(), mgr);
mStart.setKey(KEY_START_TIME);
mStart.setTitle(R.string.zen_mode_start_time);
mStart.setCallback(new TimePickerPreference.Callback() {
@@ -116,7 +116,7 @@
root.addPreference(mStart);
mStart.setDependency(mDays.getKey());
- mEnd = new TimePickerPreference(mContext, mgr);
+ mEnd = new TimePickerPreference(getPrefContext(), mgr);
mEnd.setKey(KEY_END_TIME);
mEnd.setTitle(R.string.zen_mode_end_time);
mEnd.setCallback(new TimePickerPreference.Callback() {
diff --git a/src/com/android/settings/notification/ZenModeSettings.java b/src/com/android/settings/notification/ZenModeSettings.java
index 3f052b9..3e32abc 100644
--- a/src/com/android/settings/notification/ZenModeSettings.java
+++ b/src/com/android/settings/notification/ZenModeSettings.java
@@ -21,8 +21,8 @@
import android.content.Context;
import android.content.res.Resources;
import android.os.Bundle;
-import android.preference.Preference;
-import android.preference.PreferenceScreen;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceScreen;
import android.util.SparseArray;
import com.android.internal.logging.MetricsLogger;
diff --git a/src/com/android/settings/notification/ZenModeVoiceActivity.java b/src/com/android/settings/notification/ZenModeVoiceActivity.java
index 270633a..db8de69 100644
--- a/src/com/android/settings/notification/ZenModeVoiceActivity.java
+++ b/src/com/android/settings/notification/ZenModeVoiceActivity.java
@@ -16,26 +16,26 @@
package com.android.settings.notification;
-import static android.provider.Settings.EXTRA_DO_NOT_DISTURB_MODE_MINUTES;
-import static android.provider.Settings.EXTRA_DO_NOT_DISTURB_MODE_ENABLED;
-
-import com.android.settings.R;
-import com.android.settings.utils.VoiceSettingsActivity;
-
import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
-import android.os.UserHandle;
import android.media.AudioManager;
+import android.os.UserHandle;
import android.provider.Settings.Global;
import android.service.notification.Condition;
import android.service.notification.ZenModeConfig;
import android.text.format.DateFormat;
import android.util.Log;
+import com.android.settings.R;
+import com.android.settings.utils.VoiceSettingsActivity;
+
import java.util.Locale;
+import static android.provider.Settings.EXTRA_DO_NOT_DISTURB_MODE_ENABLED;
+import static android.provider.Settings.EXTRA_DO_NOT_DISTURB_MODE_MINUTES;
+
/**
* Activity for modifying the Zen mode (Do not disturb) by voice
* using the Voice Interaction API.
diff --git a/src/com/android/settings/notification/ZenRuleNameDialog.java b/src/com/android/settings/notification/ZenRuleNameDialog.java
index 8b093de..2c0ee42 100644
--- a/src/com/android/settings/notification/ZenRuleNameDialog.java
+++ b/src/com/android/settings/notification/ZenRuleNameDialog.java
@@ -17,23 +17,14 @@
package com.android.settings.notification;
import android.app.AlertDialog;
-import android.app.AutomaticZenRule;
import android.content.Context;
import android.content.DialogInterface;
-import android.content.res.ColorStateList;
-import android.text.Editable;
-import android.text.TextUtils;
-import android.text.TextWatcher;
-import android.util.ArraySet;
-import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
import com.android.settings.R;
-import java.util.List;
-
public abstract class ZenRuleNameDialog {
private static final String TAG = "ZenRuleNameDialog";
private static final boolean DEBUG = ZenModeSettings.DEBUG;
diff --git a/src/com/android/settings/notification/ZenRuleSelectionDialog.java b/src/com/android/settings/notification/ZenRuleSelectionDialog.java
index 997180a..26fa40c 100644
--- a/src/com/android/settings/notification/ZenRuleSelectionDialog.java
+++ b/src/com/android/settings/notification/ZenRuleSelectionDialog.java
@@ -16,8 +16,6 @@
package com.android.settings.notification;
-import com.android.settings.R;
-
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
@@ -35,6 +33,8 @@
import android.widget.LinearLayout;
import android.widget.TextView;
+import com.android.settings.R;
+
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
diff --git a/src/com/android/settings/print/PrintJobSettingsFragment.java b/src/com/android/settings/print/PrintJobSettingsFragment.java
index b16c63d..9988cb0 100644
--- a/src/com/android/settings/print/PrintJobSettingsFragment.java
+++ b/src/com/android/settings/print/PrintJobSettingsFragment.java
@@ -19,12 +19,12 @@
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
-import android.preference.Preference;
import android.print.PrintJob;
import android.print.PrintJobId;
import android.print.PrintJobInfo;
import android.print.PrintManager;
import android.print.PrintManager.PrintJobStateChangeListener;
+import android.support.v7.preference.Preference;
import android.text.TextUtils;
import android.text.format.DateUtils;
import android.view.Menu;
@@ -235,10 +235,8 @@
getPreferenceScreen().addPreference(mMessagePreference);
}
mMessagePreference.setSummary(stateReason);
- getListView().setDivider(null);
} else {
getPreferenceScreen().removePreference(mMessagePreference);
- getListView().setDivider(mListDivider);
}
getActivity().invalidateOptionsMenu();
diff --git a/src/com/android/settings/print/PrintServiceSettingsFragment.java b/src/com/android/settings/print/PrintServiceSettingsFragment.java
index 483a36c..fd24edf 100644
--- a/src/com/android/settings/print/PrintServiceSettingsFragment.java
+++ b/src/com/android/settings/print/PrintServiceSettingsFragment.java
@@ -63,15 +63,14 @@
import com.android.settings.R;
import com.android.settings.SettingsActivity;
import com.android.settings.SettingsPreferenceFragment;
+import com.android.settings.widget.SwitchBar;
+import com.android.settings.widget.ToggleSwitch;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import com.android.settings.widget.SwitchBar;
-import com.android.settings.widget.ToggleSwitch;
-
/**
* Fragment with print service settings.
*/
@@ -177,6 +176,8 @@
super.onViewCreated(view, savedInstanceState);
initComponents();
updateUiForArguments();
+ getView().findViewById(R.id.list_container).setVisibility(View.GONE);
+ getBackupListView().setVisibility(View.VISIBLE);
}
@Override
@@ -242,10 +243,13 @@
}
}
+ private ListView getBackupListView() {
+ return (ListView) getView().findViewById(R.id.backup_list);
+ }
+
private void updateEmptyView() {
- ListView listView = getListView();
- ViewGroup contentRoot = (ViewGroup) listView.getParent();
- View emptyView = listView.getEmptyView();
+ ViewGroup contentRoot = (ViewGroup) getListView().getParent();
+ View emptyView = getEmptyView();
if (!mToggleSwitch.isChecked()) {
if (emptyView != null && emptyView.getId() != R.id.empty_print_state) {
contentRoot.removeView(emptyView);
@@ -259,7 +263,7 @@
TextView textView = (TextView) emptyView.findViewById(R.id.message);
textView.setText(R.string.print_service_disabled);
contentRoot.addView(emptyView);
- listView.setEmptyView(emptyView);
+ getBackupListView().setEmptyView(emptyView);
}
} else if (mPrintersAdapter.getUnfilteredCount() <= 0) {
if (emptyView != null
@@ -271,7 +275,7 @@
emptyView = getActivity().getLayoutInflater().inflate(
R.layout.empty_printers_list_service_enabled, contentRoot, false);
contentRoot.addView(emptyView);
- listView.setEmptyView(emptyView);
+ getBackupListView().setEmptyView(emptyView);
}
} else if (mPrintersAdapter.getCount() <= 0) {
if (emptyView != null && emptyView.getId() != R.id.empty_print_state) {
@@ -286,7 +290,7 @@
TextView textView = (TextView) emptyView.findViewById(R.id.message);
textView.setText(R.string.print_no_printers_found);
contentRoot.addView(emptyView);
- listView.setEmptyView(emptyView);
+ getBackupListView().setEmptyView(emptyView);
}
}
}
@@ -333,8 +337,8 @@
}
});
- getListView().setSelector(new ColorDrawable(Color.TRANSPARENT));
- getListView().setAdapter(mPrintersAdapter);
+ getBackupListView().setSelector(new ColorDrawable(Color.TRANSPARENT));
+ getBackupListView().setAdapter(mPrintersAdapter);
}
diff --git a/src/com/android/settings/print/PrintSettingsFragment.java b/src/com/android/settings/print/PrintSettingsFragment.java
index d737282..13b8518 100644
--- a/src/com/android/settings/print/PrintSettingsFragment.java
+++ b/src/com/android/settings/print/PrintSettingsFragment.java
@@ -34,9 +34,6 @@
import android.os.Message;
import android.os.UserHandle;
import android.os.UserManager;
-import android.preference.Preference;
-import android.preference.PreferenceCategory;
-import android.preference.PreferenceScreen;
import android.print.PrintJob;
import android.print.PrintJobId;
import android.print.PrintJobInfo;
@@ -45,6 +42,9 @@
import android.printservice.PrintServiceInfo;
import android.provider.SearchIndexableResource;
import android.provider.Settings;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceCategory;
+import android.support.v7.preference.PreferenceScreen;
import android.text.TextUtils;
import android.text.format.DateUtils;
import android.util.Log;
@@ -188,7 +188,7 @@
}
contentRoot.addView(emptyView);
- getListView().setEmptyView(emptyView);
+ setEmptyView(emptyView);
final UserManager um = (UserManager) getSystemService(Context.USER_SERVICE);
mProfileSpinnerAdapter = Utils.createUserSpinnerAdapter(um, getActivity());
@@ -302,7 +302,7 @@
if (addNewServiceIntent == null) {
return null;
}
- Preference preference = new Preference(getContext());
+ Preference preference = new Preference(getPrefContext());
preference.setTitle(R.string.print_menu_item_add_service);
preference.setIcon(R.drawable.ic_menu_add);
preference.setOrder(ORDER_LAST);
@@ -329,7 +329,7 @@
getArguments().remove(EXTRA_PRINT_SERVICE_COMPONENT_NAME);
Preference prereference = findPreference(componentName);
if (prereference != null) {
- prereference.performClick(getPreferenceScreen());
+ prereference.performClick();
}
}
}
diff --git a/src/com/android/settings/print/PrintSettingsUtils.java b/src/com/android/settings/print/PrintSettingsUtils.java
index ad866a0..d09f345 100644
--- a/src/com/android/settings/print/PrintSettingsUtils.java
+++ b/src/com/android/settings/print/PrintSettingsUtils.java
@@ -22,7 +22,8 @@
import android.text.TextUtils;
import android.text.TextUtils.SimpleStringSplitter;
-import java.util.ArrayList;import java.util.List;
+import java.util.ArrayList;
+import java.util.List;
/**
* Helper methods for reading and writing to print settings.
diff --git a/src/com/android/settings/search/DynamicIndexableContentMonitor.java b/src/com/android/settings/search/DynamicIndexableContentMonitor.java
index 12bb6ef..e54168c 100644
--- a/src/com/android/settings/search/DynamicIndexableContentMonitor.java
+++ b/src/com/android/settings/search/DynamicIndexableContentMonitor.java
@@ -37,6 +37,7 @@
import android.view.accessibility.AccessibilityManager;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodManager;
+
import com.android.internal.content.PackageMonitor;
import com.android.settings.accessibility.AccessibilitySettings;
import com.android.settings.inputmethod.InputMethodAndLanguageSettings;
diff --git a/src/com/android/settings/search/Index.java b/src/com/android/settings/search/Index.java
index 267c6c0..73386fb 100644
--- a/src/com/android/settings/search/Index.java
+++ b/src/com/android/settings/search/Index.java
@@ -41,7 +41,11 @@
import android.util.Log;
import android.util.TypedValue;
import android.util.Xml;
+
import com.android.settings.R;
+import com.android.settings.search.IndexDatabaseHelper.IndexColumns;
+import com.android.settings.search.IndexDatabaseHelper.Tables;
+
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@@ -60,31 +64,27 @@
import java.util.regex.Pattern;
import static android.provider.SearchIndexablesContract.COLUMN_INDEX_NON_INDEXABLE_KEYS_KEY_VALUE;
-import static android.provider.SearchIndexablesContract.COLUMN_INDEX_RAW_RANK;
-import static android.provider.SearchIndexablesContract.COLUMN_INDEX_RAW_TITLE;
-import static android.provider.SearchIndexablesContract.COLUMN_INDEX_RAW_SUMMARY_ON;
-import static android.provider.SearchIndexablesContract.COLUMN_INDEX_RAW_SUMMARY_OFF;
-import static android.provider.SearchIndexablesContract.COLUMN_INDEX_RAW_ENTRIES;
-import static android.provider.SearchIndexablesContract.COLUMN_INDEX_RAW_KEYWORDS;
-import static android.provider.SearchIndexablesContract.COLUMN_INDEX_RAW_SCREEN_TITLE;
import static android.provider.SearchIndexablesContract.COLUMN_INDEX_RAW_CLASS_NAME;
+import static android.provider.SearchIndexablesContract.COLUMN_INDEX_RAW_ENTRIES;
import static android.provider.SearchIndexablesContract.COLUMN_INDEX_RAW_ICON_RESID;
import static android.provider.SearchIndexablesContract.COLUMN_INDEX_RAW_INTENT_ACTION;
-import static android.provider.SearchIndexablesContract.COLUMN_INDEX_RAW_INTENT_TARGET_PACKAGE;
import static android.provider.SearchIndexablesContract.COLUMN_INDEX_RAW_INTENT_TARGET_CLASS;
+import static android.provider.SearchIndexablesContract.COLUMN_INDEX_RAW_INTENT_TARGET_PACKAGE;
import static android.provider.SearchIndexablesContract.COLUMN_INDEX_RAW_KEY;
+import static android.provider.SearchIndexablesContract.COLUMN_INDEX_RAW_KEYWORDS;
+import static android.provider.SearchIndexablesContract.COLUMN_INDEX_RAW_RANK;
+import static android.provider.SearchIndexablesContract.COLUMN_INDEX_RAW_SCREEN_TITLE;
+import static android.provider.SearchIndexablesContract.COLUMN_INDEX_RAW_SUMMARY_OFF;
+import static android.provider.SearchIndexablesContract.COLUMN_INDEX_RAW_SUMMARY_ON;
+import static android.provider.SearchIndexablesContract.COLUMN_INDEX_RAW_TITLE;
import static android.provider.SearchIndexablesContract.COLUMN_INDEX_RAW_USER_ID;
-
-import static android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_RANK;
-import static android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_RESID;
import static android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_CLASS_NAME;
import static android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_ICON_RESID;
import static android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_INTENT_ACTION;
-import static android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_INTENT_TARGET_PACKAGE;
import static android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_INTENT_TARGET_CLASS;
-
-import static com.android.settings.search.IndexDatabaseHelper.Tables;
-import static com.android.settings.search.IndexDatabaseHelper.IndexColumns;
+import static android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_INTENT_TARGET_PACKAGE;
+import static android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_RANK;
+import static android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_RESID;
public class Index {
diff --git a/src/com/android/settings/search/SettingsSearchIndexablesProvider.java b/src/com/android/settings/search/SettingsSearchIndexablesProvider.java
index c0afcaf..b2be146 100644
--- a/src/com/android/settings/search/SettingsSearchIndexablesProvider.java
+++ b/src/com/android/settings/search/SettingsSearchIndexablesProvider.java
@@ -23,16 +23,15 @@
import java.util.Collection;
-import static android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_RANK;
-import static android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_RESID;
import static android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_CLASS_NAME;
import static android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_ICON_RESID;
import static android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_INTENT_ACTION;
-import static android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_INTENT_TARGET_PACKAGE;
import static android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_INTENT_TARGET_CLASS;
-
-import static android.provider.SearchIndexablesContract.INDEXABLES_XML_RES_COLUMNS;
+import static android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_INTENT_TARGET_PACKAGE;
+import static android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_RANK;
+import static android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_RESID;
import static android.provider.SearchIndexablesContract.INDEXABLES_RAW_COLUMNS;
+import static android.provider.SearchIndexablesContract.INDEXABLES_XML_RES_COLUMNS;
import static android.provider.SearchIndexablesContract.NON_INDEXABLES_KEYS_COLUMNS;
public class SettingsSearchIndexablesProvider extends SearchIndexablesProvider {
diff --git a/src/com/android/settings/sim/SimDialogActivity.java b/src/com/android/settings/sim/SimDialogActivity.java
index 03a9daf..dccba13 100644
--- a/src/com/android/settings/sim/SimDialogActivity.java
+++ b/src/com/android/settings/sim/SimDialogActivity.java
@@ -40,7 +40,7 @@
import android.widget.Toast;
import com.android.settings.R;
-import com.android.settings.Utils;
+
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
diff --git a/src/com/android/settings/sim/SimSelectNotification.java b/src/com/android/settings/sim/SimSelectNotification.java
index fd54e9b..35ee346 100644
--- a/src/com/android/settings/sim/SimSelectNotification.java
+++ b/src/com/android/settings/sim/SimSelectNotification.java
@@ -16,10 +16,6 @@
package com.android.settings.sim;
-import com.android.internal.telephony.IccCardConstants;
-import com.android.settings.R;
-import com.android.settings.Settings.SimSettingsActivity;
-
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
@@ -33,6 +29,10 @@
import android.telephony.TelephonyManager;
import android.util.Log;
+import com.android.internal.telephony.IccCardConstants;
+import com.android.settings.R;
+import com.android.settings.Settings.SimSettingsActivity;
+
import java.util.List;
public class SimSelectNotification extends BroadcastReceiver {
diff --git a/src/com/android/settings/sim/SimSettings.java b/src/com/android/settings/sim/SimSettings.java
index 23e6275..cd211ee 100644
--- a/src/com/android/settings/sim/SimSettings.java
+++ b/src/com/android/settings/sim/SimSettings.java
@@ -21,25 +21,26 @@
import android.content.res.Resources;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
-import android.preference.Preference;
-import android.preference.PreferenceScreen;
+import android.os.SystemProperties;
import android.provider.SearchIndexableResource;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceScreen;
+import android.telecom.PhoneAccountHandle;
+import android.telecom.TelecomManager;
import android.telephony.PhoneStateListener;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
-import android.telecom.PhoneAccountHandle;
-import android.telecom.TelecomManager;
import android.text.TextUtils;
import android.util.Log;
+
import com.android.internal.logging.MetricsLogger;
+import com.android.internal.telephony.TelephonyProperties;
+import com.android.settings.R;
import com.android.settings.RestrictedSettingsFragment;
import com.android.settings.Utils;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
-import com.android.settings.R;
-import android.os.SystemProperties;
-import com.android.internal.telephony.TelephonyProperties;
import java.util.ArrayList;
import java.util.List;
@@ -118,7 +119,7 @@
for (int i = 0; i < mNumSlots; ++i) {
final SubscriptionInfo sir = mSubscriptionManager
.getActiveSubscriptionInfoForSimSlotIndex(i);
- SimPreference simPreference = new SimPreference(mContext, sir, i);
+ SimPreference simPreference = new SimPreference(getPrefContext(), sir, i);
simPreference.setOrder(i-mNumSlots);
mSimCards.addPreference(simPreference);
mAvailableSubInfos.add(sir);
@@ -229,8 +230,7 @@
};
@Override
- public boolean onPreferenceTreeClick(final PreferenceScreen preferenceScreen,
- final Preference preference) {
+ public boolean onPreferenceTreeClick(final Preference preference) {
final Context context = mContext;
Intent intent = new Intent(context, SimDialogActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
diff --git a/src/com/android/settings/tts/TextToSpeechSettings.java b/src/com/android/settings/tts/TextToSpeechSettings.java
index c8a4c3d..82c4577 100644
--- a/src/com/android/settings/tts/TextToSpeechSettings.java
+++ b/src/com/android/settings/tts/TextToSpeechSettings.java
@@ -16,8 +16,22 @@
package com.android.settings.tts;
-import static android.provider.Settings.Secure.TTS_DEFAULT_RATE;
-import static android.provider.Settings.Secure.TTS_DEFAULT_SYNTH;
+import android.app.AlertDialog;
+import android.content.ActivityNotFoundException;
+import android.content.ContentResolver;
+import android.content.Intent;
+import android.os.Bundle;
+import android.provider.Settings.SettingNotFoundException;
+import android.speech.tts.TextToSpeech;
+import android.speech.tts.TextToSpeech.EngineInfo;
+import android.speech.tts.TtsEngines;
+import android.speech.tts.UtteranceProgressListener;
+import android.support.v7.preference.ListPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceCategory;
+import android.text.TextUtils;
+import android.util.Log;
+import android.widget.Checkable;
import com.android.internal.logging.MetricsLogger;
import com.android.settings.R;
@@ -25,23 +39,6 @@
import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.tts.TtsEnginePreference.RadioButtonGroupState;
-import android.app.AlertDialog;
-import android.content.ActivityNotFoundException;
-import android.content.ContentResolver;
-import android.content.Intent;
-import android.os.Bundle;
-import android.preference.ListPreference;
-import android.preference.Preference;
-import android.preference.PreferenceCategory;
-import android.provider.Settings.SettingNotFoundException;
-import android.speech.tts.TextToSpeech;
-import android.speech.tts.UtteranceProgressListener;
-import android.speech.tts.TextToSpeech.EngineInfo;
-import android.speech.tts.TtsEngines;
-import android.text.TextUtils;
-import android.util.Log;
-import android.widget.Checkable;
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -50,6 +47,9 @@
import java.util.Objects;
import java.util.Set;
+import static android.provider.Settings.Secure.TTS_DEFAULT_RATE;
+import static android.provider.Settings.Secure.TTS_DEFAULT_SYNTH;
+
public class TextToSpeechSettings extends SettingsPreferenceFragment implements
Preference.OnPreferenceChangeListener, Preference.OnPreferenceClickListener,
RadioButtonGroupState {
@@ -244,7 +244,7 @@
List<EngineInfo> engines = mEnginesHelper.getEngines();
for (EngineInfo engine : engines) {
- TtsEnginePreference enginePref = new TtsEnginePreference(getActivity(), engine,
+ TtsEnginePreference enginePref = new TtsEnginePreference(getPrefContext(), engine,
this, activity);
mEnginePreferenceCategory.addPreference(enginePref);
}
diff --git a/src/com/android/settings/tts/TtsEnginePreference.java b/src/com/android/settings/tts/TtsEnginePreference.java
index ae921f8..35ecf86 100644
--- a/src/com/android/settings/tts/TtsEnginePreference.java
+++ b/src/com/android/settings/tts/TtsEnginePreference.java
@@ -21,16 +21,15 @@
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
-import android.preference.Preference;
import android.speech.tts.TextToSpeech.EngineInfo;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceViewHolder;
import android.util.Log;
import android.view.View;
-import android.view.ViewGroup;
import android.widget.Checkable;
import android.widget.CompoundButton;
import android.widget.RadioButton;
-
import com.android.settings.R;
import com.android.settings.SettingsActivity;
import com.android.settings.Utils;
@@ -107,15 +106,16 @@
setKey(mEngineInfo.name);
setTitle(mEngineInfo.label);
}
-
+
@Override
- public View getView(View convertView, ViewGroup parent) {
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
+
if (mSharedState == null) {
throw new IllegalStateException("Call to getView() before a call to" +
"setSharedState()");
}
- View view = super.getView(convertView, parent);
final RadioButton rb = (RadioButton) view.findViewById(R.id.tts_engine_radiobutton);
rb.setOnCheckedChangeListener(mRadioChangeListener);
@@ -168,8 +168,6 @@
if (mVoiceCheckData != null) {
mSettingsIcon.setEnabled(mRadioButton.isChecked());
}
-
- return view;
}
public void setVoiceDataDetails(Intent data) {
diff --git a/src/com/android/settings/tts/TtsEngineSettingsFragment.java b/src/com/android/settings/tts/TtsEngineSettingsFragment.java
index 691e155..cdb952e 100644
--- a/src/com/android/settings/tts/TtsEngineSettingsFragment.java
+++ b/src/com/android/settings/tts/TtsEngineSettingsFragment.java
@@ -22,13 +22,13 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
-import android.preference.ListPreference;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceChangeListener;
-import android.preference.Preference.OnPreferenceClickListener;
-import android.preference.PreferenceScreen;
import android.speech.tts.TextToSpeech;
import android.speech.tts.TtsEngines;
+import android.support.v7.preference.ListPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceChangeListener;
+import android.support.v7.preference.Preference.OnPreferenceClickListener;
+import android.support.v7.preference.PreferenceScreen;
import android.text.TextUtils;
import android.util.Log;
import android.util.Pair;
diff --git a/src/com/android/settings/users/AppRestrictionsFragment.java b/src/com/android/settings/users/AppRestrictionsFragment.java
index 10e5185..c747de3 100644
--- a/src/com/android/settings/users/AppRestrictionsFragment.java
+++ b/src/com/android/settings/users/AppRestrictionsFragment.java
@@ -40,13 +40,14 @@
import android.os.ServiceManager;
import android.os.UserHandle;
import android.os.UserManager;
-import android.preference.ListPreference;
-import android.preference.MultiSelectListPreference;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceChangeListener;
-import android.preference.Preference.OnPreferenceClickListener;
-import android.preference.PreferenceGroup;
-import android.preference.SwitchPreference;
+import android.support.v14.preference.MultiSelectListPreference;
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.ListPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceChangeListener;
+import android.support.v7.preference.Preference.OnPreferenceClickListener;
+import android.support.v7.preference.PreferenceGroup;
+import android.support.v7.preference.PreferenceViewHolder;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
@@ -62,6 +63,7 @@
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.Utils;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -197,8 +199,8 @@
}
@Override
- protected void onBindView(View view) {
- super.onBindView(view);
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
View appRestrictionsSettings = view.findViewById(R.id.app_restrictions_settings);
appRestrictionsSettings.setVisibility(hasSettings ? View.VISIBLE : View.GONE);
@@ -643,7 +645,7 @@
String packageName = app.packageName;
if (packageName == null) continue;
final boolean isSettingsApp = packageName.equals(context.getPackageName());
- AppRestrictionsPreference p = new AppRestrictionsPreference(context, this);
+ AppRestrictionsPreference p = new AppRestrictionsPreference(getPrefContext(), this);
final boolean hasSettings = resolveInfoListHasPackage(receivers, packageName);
if (isSettingsApp) {
addLocationAppRestrictionsPreference(app, p);
@@ -965,14 +967,14 @@
Preference p = null;
switch (entry.getType()) {
case RestrictionEntry.TYPE_BOOLEAN:
- p = new SwitchPreference(context);
+ p = new SwitchPreference(getPrefContext());
p.setTitle(entry.getTitle());
p.setSummary(entry.getDescription());
((SwitchPreference)p).setChecked(entry.getSelectedState());
break;
case RestrictionEntry.TYPE_CHOICE:
case RestrictionEntry.TYPE_CHOICE_LEVEL:
- p = new ListPreference(context);
+ p = new ListPreference(getPrefContext());
p.setTitle(entry.getTitle());
String value = entry.getSelectedString();
if (value == null) {
@@ -986,7 +988,7 @@
((ListPreference)p).setDialogTitle(entry.getTitle());
break;
case RestrictionEntry.TYPE_MULTI_SELECT:
- p = new MultiSelectListPreference(context);
+ p = new MultiSelectListPreference(getPrefContext());
p.setTitle(entry.getTitle());
((MultiSelectListPreference)p).setEntryValues(entry.getChoiceValues());
((MultiSelectListPreference)p).setEntries(entry.getChoiceEntries());
diff --git a/src/com/android/settings/users/EditUserPhotoController.java b/src/com/android/settings/users/EditUserPhotoController.java
index f9f867d..1ca6928 100644
--- a/src/com/android/settings/users/EditUserPhotoController.java
+++ b/src/com/android/settings/users/EditUserPhotoController.java
@@ -24,16 +24,16 @@
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.graphics.Bitmap;
+import android.graphics.Bitmap.Config;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
-import android.graphics.Bitmap.Config;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.AsyncTask;
-import android.provider.MediaStore;
import android.provider.ContactsContract.DisplayPhoto;
+import android.provider.MediaStore;
import android.support.v4.content.FileProvider;
import android.util.Log;
import android.view.View;
diff --git a/src/com/android/settings/users/ProfileUpdateReceiver.java b/src/com/android/settings/users/ProfileUpdateReceiver.java
index 69484f7..d532089 100644
--- a/src/com/android/settings/users/ProfileUpdateReceiver.java
+++ b/src/com/android/settings/users/ProfileUpdateReceiver.java
@@ -22,6 +22,7 @@
import android.content.SharedPreferences;
import android.os.UserHandle;
import android.os.UserManager;
+
import com.android.settings.Utils;
diff --git a/src/com/android/settings/users/RestrictedProfileSettings.java b/src/com/android/settings/users/RestrictedProfileSettings.java
index 2531aaa..182053f 100644
--- a/src/com/android/settings/users/RestrictedProfileSettings.java
+++ b/src/com/android/settings/users/RestrictedProfileSettings.java
@@ -23,7 +23,6 @@
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
-import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
@@ -64,7 +63,6 @@
mUserNameView = (TextView) mHeaderView.findViewById(android.R.id.title);
mDeleteButton = (ImageView) mHeaderView.findViewById(R.id.delete);
mDeleteButton.setOnClickListener(this);
- getListView().setFastScrollEnabled(true);
// This is going to bind the preferences.
super.onActivityCreated(savedInstanceState);
}
diff --git a/src/com/android/settings/users/UserDetailsSettings.java b/src/com/android/settings/users/UserDetailsSettings.java
index f94e3e4..8bfa48d 100644
--- a/src/com/android/settings/users/UserDetailsSettings.java
+++ b/src/com/android/settings/users/UserDetailsSettings.java
@@ -23,8 +23,8 @@
import android.os.Bundle;
import android.os.UserHandle;
import android.os.UserManager;
-import android.preference.Preference;
-import android.preference.SwitchPreference;
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.Preference;
import com.android.internal.logging.MetricsLogger;
import com.android.settings.R;
diff --git a/src/com/android/settings/users/UserPreference.java b/src/com/android/settings/users/UserPreference.java
index 5079dd2..2daf1ef 100644
--- a/src/com/android/settings/users/UserPreference.java
+++ b/src/com/android/settings/users/UserPreference.java
@@ -16,16 +16,17 @@
package com.android.settings.users;
-import com.android.settings.R;
-
import android.content.Context;
import android.os.UserHandle;
import android.os.UserManager;
-import android.preference.Preference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceViewHolder;
import android.util.AttributeSet;
import android.view.View;
import android.view.View.OnClickListener;
+import com.android.settings.R;
+
import java.util.Comparator;
public class UserPreference extends Preference {
@@ -71,7 +72,7 @@
}
@Override
- protected void onBindView(View view) {
+ public void onBindViewHolder(PreferenceViewHolder view) {
UserManager um = (UserManager) getContext().getSystemService(Context.USER_SERVICE);
View deleteDividerView = view.findViewById(R.id.divider_delete);
View manageDividerView = view.findViewById(R.id.divider_manage);
@@ -99,7 +100,7 @@
manageDividerView.setVisibility(View.GONE);
}
}
- super.onBindView(view);
+ super.onBindViewHolder(view);
}
private int getSerialNumber() {
diff --git a/src/com/android/settings/users/UserSettings.java b/src/com/android/settings/users/UserSettings.java
index d62d672..6a9bb09 100644
--- a/src/com/android/settings/users/UserSettings.java
+++ b/src/com/android/settings/users/UserSettings.java
@@ -16,8 +16,6 @@
package com.android.settings.users;
-import android.accounts.Account;
-import android.accounts.AccountManager;
import android.app.Activity;
import android.app.ActivityManagerNative;
import android.app.AlertDialog;
@@ -40,12 +38,11 @@
import android.os.RemoteException;
import android.os.UserHandle;
import android.os.UserManager;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceClickListener;
-import android.preference.PreferenceGroup;
-import android.preference.PreferenceScreen;
import android.provider.Settings;
-import android.provider.Settings.Secure;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceClickListener;
+import android.support.v7.preference.PreferenceGroup;
+import android.support.v7.preference.PreferenceScreen;
import android.util.Log;
import android.util.SparseArray;
import android.view.Menu;
@@ -206,7 +203,7 @@
addPreferencesFromResource(R.xml.user_settings);
mUserListCategory = (PreferenceGroup) findPreference(KEY_USER_LIST);
- mMePreference = new UserPreference(context, null /* attrs */, myUserId,
+ mMePreference = new UserPreference(getPrefContext(), null /* attrs */, myUserId,
null /* settings icon handler */,
null /* delete icon handler */);
mMePreference.setKey(KEY_USER_ME);
@@ -713,7 +710,7 @@
&& (voiceCapable || user.isRestricted());
final boolean showDelete = mUserCaps.mIsAdmin
&& (!voiceCapable && !user.isRestricted() && !user.isGuest());
- pref = new UserPreference(context, null, user.id,
+ pref = new UserPreference(getPrefContext(), null, user.id,
showSettings ? this : null,
showDelete ? this : null);
pref.setOnPreferenceClickListener(this);
@@ -749,7 +746,7 @@
// Add a temporary entry for the user being created
if (mAddingUser) {
- UserPreference pref = new UserPreference(getActivity(), null,
+ UserPreference pref = new UserPreference(getPrefContext(), null,
UserPreference.USERID_UNKNOWN, null, null);
pref.setEnabled(false);
pref.setTitle(R.string.user_new_user_name);
@@ -759,7 +756,7 @@
if (!mUserCaps.mIsGuest && (mUserCaps.mCanAddGuest || findGuest() != null)) {
// Add a virtual Guest user for guest defaults
- UserPreference pref = new UserPreference(getActivity(), null,
+ UserPreference pref = new UserPreference(getPrefContext(), null,
UserPreference.USERID_GUEST_DEFAULTS,
mUserCaps.mIsAdmin && voiceCapable? this : null /* settings icon handler */,
null /* delete icon handler */);
diff --git a/src/com/android/settings/utils/VoiceSettingsActivity.java b/src/com/android/settings/utils/VoiceSettingsActivity.java
index d8a00c7..5844d22 100644
--- a/src/com/android/settings/utils/VoiceSettingsActivity.java
+++ b/src/com/android/settings/utils/VoiceSettingsActivity.java
@@ -17,14 +17,10 @@
package com.android.settings.utils;
import android.app.Activity;
-import android.app.Fragment;
-import android.app.VoiceInteractor;
import android.app.VoiceInteractor.AbortVoiceRequest;
import android.app.VoiceInteractor.CompleteVoiceRequest;
import android.content.Intent;
import android.os.Bundle;
-import android.view.View;
-import android.widget.TextView;
import android.util.Log;
/**
diff --git a/src/com/android/settings/voice/VoiceInputHelper.java b/src/com/android/settings/voice/VoiceInputHelper.java
index 916e0b4..ac73d84 100644
--- a/src/com/android/settings/voice/VoiceInputHelper.java
+++ b/src/com/android/settings/voice/VoiceInputHelper.java
@@ -33,6 +33,7 @@
import android.util.AttributeSet;
import android.util.Log;
import android.util.Xml;
+
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
diff --git a/src/com/android/settings/vpn2/AppDialog.java b/src/com/android/settings/vpn2/AppDialog.java
index c06de14..e41ffef 100644
--- a/src/com/android/settings/vpn2/AppDialog.java
+++ b/src/com/android/settings/vpn2/AppDialog.java
@@ -20,12 +20,8 @@
import android.content.Context;
import android.content.DialogInterface;
import android.content.pm.PackageInfo;
-import android.content.pm.PackageManager;
import android.os.Bundle;
-import android.view.View;
-import android.widget.TextView;
-import com.android.internal.net.VpnConfig;
import com.android.settings.R;
/**
diff --git a/src/com/android/settings/vpn2/AppDialogFragment.java b/src/com/android/settings/vpn2/AppDialogFragment.java
index 906f896..0e41117 100644
--- a/src/com/android/settings/vpn2/AppDialogFragment.java
+++ b/src/com/android/settings/vpn2/AppDialogFragment.java
@@ -22,7 +22,6 @@
import android.content.Context;
import android.content.DialogInterface;
import android.content.pm.PackageInfo;
-import android.content.pm.PackageManager;
import android.net.IConnectivityManager;
import android.os.Bundle;
import android.os.RemoteException;
diff --git a/src/com/android/settings/vpn2/AppPreference.java b/src/com/android/settings/vpn2/AppPreference.java
index 599c45b..84897be 100644
--- a/src/com/android/settings/vpn2/AppPreference.java
+++ b/src/com/android/settings/vpn2/AppPreference.java
@@ -16,14 +16,12 @@
package com.android.settings.vpn2;
-import android.app.AppGlobals;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
-import android.os.RemoteException;
import android.os.UserHandle;
-import android.preference.Preference;
+import android.support.v7.preference.Preference;
import android.view.View.OnClickListener;
import com.android.internal.net.LegacyVpnInfo;
@@ -31,7 +29,7 @@
import com.android.settings.R;
/**
- * {@link android.preference.Preference} containing information about a VPN
+ * {@link android.support.v7.preference.Preference} containing information about a VPN
* application. Tracks the package name and connection state.
*/
public class AppPreference extends ManageablePreference {
diff --git a/src/com/android/settings/vpn2/ConfigPreference.java b/src/com/android/settings/vpn2/ConfigPreference.java
index 4e6e16f..a2736a0 100644
--- a/src/com/android/settings/vpn2/ConfigPreference.java
+++ b/src/com/android/settings/vpn2/ConfigPreference.java
@@ -17,16 +17,16 @@
package com.android.settings.vpn2;
import android.content.Context;
-import android.preference.Preference;
+import android.support.v7.preference.Preference;
import android.view.View.OnClickListener;
-import static com.android.internal.net.LegacyVpnInfo.STATE_CONNECTED;
-
import com.android.internal.net.VpnProfile;
import com.android.settings.R;
+import static com.android.internal.net.LegacyVpnInfo.STATE_CONNECTED;
+
/**
- * {@link android.preference.Preference} referencing a VPN
+ * {@link android.support.v7.preference.Preference} referencing a VPN
* configuration. Tracks the underlying profile and its connection
* state.
*/
diff --git a/src/com/android/settings/vpn2/LockdownConfigFragment.java b/src/com/android/settings/vpn2/LockdownConfigFragment.java
index f36cb46..581b55d 100644
--- a/src/com/android/settings/vpn2/LockdownConfigFragment.java
+++ b/src/com/android/settings/vpn2/LockdownConfigFragment.java
@@ -35,7 +35,6 @@
import com.android.internal.net.VpnProfile;
import com.android.settings.R;
-import com.google.android.collect.Lists;
import java.util.ArrayList;
import java.util.List;
diff --git a/src/com/android/settings/vpn2/ManageablePreference.java b/src/com/android/settings/vpn2/ManageablePreference.java
index 5e507c1..ec8a37b 100644
--- a/src/com/android/settings/vpn2/ManageablePreference.java
+++ b/src/com/android/settings/vpn2/ManageablePreference.java
@@ -17,7 +17,8 @@
package com.android.settings.vpn2;
import android.content.Context;
-import android.preference.Preference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceViewHolder;
import android.util.AttributeSet;
import android.view.View;
import android.view.View.OnClickListener;
@@ -41,10 +42,10 @@
}
@Override
- protected void onBindView(View view) {
+ public void onBindViewHolder(PreferenceViewHolder view) {
mManageView = view.findViewById(R.id.manage);
mManageView.setOnClickListener(mListener);
mManageView.setTag(this);
- super.onBindView(view);
+ super.onBindViewHolder(view);
}
}
diff --git a/src/com/android/settings/vpn2/VpnSettings.java b/src/com/android/settings/vpn2/VpnSettings.java
index b0a08c8..4192648 100644
--- a/src/com/android/settings/vpn2/VpnSettings.java
+++ b/src/com/android/settings/vpn2/VpnSettings.java
@@ -35,11 +35,11 @@
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
-import android.preference.Preference;
-import android.preference.PreferenceGroup;
-import android.preference.PreferenceScreen;
import android.security.Credentials;
import android.security.KeyStore;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceGroup;
+import android.support.v7.preference.PreferenceScreen;
import android.util.SparseArray;
import android.view.Menu;
import android.view.MenuInflater;
@@ -58,7 +58,6 @@
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import static android.app.AppOpsManager.OP_ACTIVATE_VPN;
@@ -108,7 +107,7 @@
mUserManager = (UserManager) getSystemService(Context.USER_SERVICE);
if (mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_VPN)) {
mUnavailable = true;
- setPreferenceScreen(new PreferenceScreen(getActivity(), null));
+ setPreferenceScreen(new PreferenceScreen(getPrefContext(), null));
setHasOptionsMenu(false);
return;
}
@@ -163,7 +162,7 @@
if (mUnavailable) {
// Show a message to explain that VPN settings have been disabled
TextView emptyView = (TextView) getView().findViewById(android.R.id.empty);
- getListView().setEmptyView(emptyView);
+ setEmptyView(emptyView);
if (emptyView != null) {
emptyView.setText(R.string.vpn_settings_not_available);
}
@@ -215,7 +214,7 @@
// Fetch configured VPN profiles from KeyStore
for (VpnProfile profile : loadVpnProfiles(mKeyStore)) {
- final ConfigPreference pref = new ConfigPreference(getActivity(), mManageListener,
+ final ConfigPreference pref = new ConfigPreference(getPrefContext(), mManageListener,
profile);
pref.setOnPreferenceClickListener(this);
mConfigPreferences.put(profile.key, pref);
@@ -225,7 +224,7 @@
// 3rd-party VPN apps can change elsewhere. Reload them every time.
for (AppOpsManager.PackageOps pkg : getVpnApps()) {
String key = getVpnIdentifier(UserHandle.getUserId(pkg.getUid()), pkg.getPackageName());
- final AppPreference pref = new AppPreference(getActivity(), mManageListener,
+ final AppPreference pref = new AppPreference(getPrefContext(), mManageListener,
pkg.getPackageName(), pkg.getUid());
pref.setOnPreferenceClickListener(this);
mAppPreferences.put(key, pref);
diff --git a/src/com/android/settings/wfd/WifiDisplaySettings.java b/src/com/android/settings/wfd/WifiDisplaySettings.java
index 7c5883a..4bdadbf 100755
--- a/src/com/android/settings/wfd/WifiDisplaySettings.java
+++ b/src/com/android/settings/wfd/WifiDisplaySettings.java
@@ -17,7 +17,6 @@
package com.android.settings.wfd;
import android.app.AlertDialog;
-import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
@@ -30,29 +29,29 @@
import android.media.MediaRouter;
import android.media.MediaRouter.RouteInfo;
import android.net.Uri;
+import android.net.wifi.WpsInfo;
import android.net.wifi.p2p.WifiP2pManager;
import android.net.wifi.p2p.WifiP2pManager.ActionListener;
import android.net.wifi.p2p.WifiP2pManager.Channel;
-import android.net.wifi.WpsInfo;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
-import android.preference.ListPreference;
-import android.preference.Preference;
-import android.preference.PreferenceCategory;
-import android.preference.PreferenceGroup;
-import android.preference.PreferenceScreen;
-import android.preference.SwitchPreference;
import android.provider.Settings;
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.ListPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceChangeListener;
+import android.support.v7.preference.PreferenceCategory;
+import android.support.v7.preference.PreferenceGroup;
+import android.support.v7.preference.PreferenceScreen;
+import android.support.v7.preference.PreferenceViewHolder;
import android.util.Slog;
import android.util.TypedValue;
-import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
-import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
@@ -145,7 +144,7 @@
mEmptyView = (TextView) getView().findViewById(android.R.id.empty);
mEmptyView.setText(R.string.wifi_display_no_devices_found);
- getListView().setEmptyView(mEmptyView);
+ setEmptyView(mEmptyView);
}
@Override
@@ -272,7 +271,7 @@
if (!display.isRemembered() && display.isAvailable()
&& !display.equals(mWifiDisplayStatus.getActiveDisplay())) {
preferenceScreen.addPreference(new UnpairedWifiDisplayPreference(
- getActivity(), display));
+ getPrefContext(), display));
}
}
@@ -291,9 +290,9 @@
private RoutePreference createRoutePreference(MediaRouter.RouteInfo route) {
WifiDisplay display = findWifiDisplay(route.getDeviceAddress());
if (display != null) {
- return new WifiDisplayRoutePreference(getActivity(), route, display);
+ return new WifiDisplayRoutePreference(getPrefContext(), route, display);
} else {
- return new RoutePreference(getActivity(), route);
+ return new RoutePreference(getPrefContext(), route);
}
}
@@ -310,7 +309,7 @@
private void buildCertificationMenu(final PreferenceScreen preferenceScreen) {
if (mCertCategory == null) {
- mCertCategory = new PreferenceCategory(getActivity());
+ mCertCategory = new PreferenceCategory(getPrefContext());
mCertCategory.setTitle(R.string.wifi_display_certification_heading);
mCertCategory.setOrder(ORDER_CERTIFICATION);
} else {
@@ -320,26 +319,19 @@
// display session info if there is an active p2p session
if (!mWifiDisplayStatus.getSessionInfo().getGroupId().isEmpty()) {
- Preference p = new Preference(getActivity());
+ Preference p = new Preference(getPrefContext());
p.setTitle(R.string.wifi_display_session_info);
p.setSummary(mWifiDisplayStatus.getSessionInfo().toString());
mCertCategory.addPreference(p);
// show buttons for Pause/Resume when a WFD session is established
if (mWifiDisplayStatus.getSessionInfo().getSessionId() != 0) {
- mCertCategory.addPreference(new Preference(getActivity()) {
+ mCertCategory.addPreference(new Preference(getPrefContext()) {
@Override
- public View getView(View convertView, ViewGroup parent) {
- final View v;
- if (convertView == null) {
- LayoutInflater li = (LayoutInflater) getActivity().
- getSystemService(Service.LAYOUT_INFLATER_SERVICE);
- v = li.inflate(R.layout.two_buttons_panel, null);
- } else {
- v = convertView;
- }
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
- Button b = (Button)v.findViewById(R.id.left_button);
+ Button b = (Button) view.findViewById(R.id.left_button);
b.setText(R.string.wifi_display_pause);
b.setOnClickListener(new OnClickListener() {
@Override
@@ -348,7 +340,7 @@
}
});
- b = (Button)v.findViewById(R.id.right_button);
+ b = (Button) view.findViewById(R.id.right_button);
b.setText(R.string.wifi_display_resume);
b.setOnClickListener(new OnClickListener() {
@Override
@@ -356,15 +348,14 @@
mDisplayManager.resumeWifiDisplay();
}
});
-
- return v;
}
});
+ mCertCategory.setLayoutResource(R.layout.two_buttons_panel);
}
}
// switch for Listen Mode
- SwitchPreference pref = new SwitchPreference(getActivity()) {
+ SwitchPreference pref = new SwitchPreference(getPrefContext()) {
@Override
protected void onClick() {
mListen = !mListen;
@@ -377,7 +368,7 @@
mCertCategory.addPreference(pref);
// switch for Autonomous GO
- pref = new SwitchPreference(getActivity()) {
+ pref = new SwitchPreference(getPrefContext()) {
@Override
protected void onClick() {
mAutoGO = !mAutoGO;
@@ -394,19 +385,20 @@
mCertCategory.addPreference(pref);
// Drop down list for choosing WPS method (PBC/KEYPAD/DISPLAY)
- ListPreference lp = new ListPreference(getActivity()) {
+ ListPreference lp = new ListPreference(getPrefContext());
+ lp.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
- protected void onDialogClosed(boolean positiveResult) {
- super.onDialogClosed(positiveResult);
- if (positiveResult) {
- mWpsConfig = Integer.parseInt(getValue());
- setSummary("%1$s");
+ public boolean onPreferenceChange(Preference preference, Object value) {
+ int wpsConfig = Integer.parseInt((String) value);
+ if (wpsConfig != mWpsConfig) {
+ mWpsConfig = wpsConfig;
getActivity().invalidateOptionsMenu();
Settings.Global.putInt(getActivity().getContentResolver(),
Settings.Global.WIFI_DISPLAY_WPS_CONFIG, mWpsConfig);
}
+ return true;
}
- };
+ });
mWpsConfig = Settings.Global.getInt(getActivity().getContentResolver(),
Settings.Global.WIFI_DISPLAY_WPS_CONFIG, WpsInfo.INVALID);
String[] wpsEntries = { "Default", "PBC", "KEYPAD", "DISPLAY" };
@@ -415,6 +407,7 @@
"" + WpsInfo.PBC,
"" + WpsInfo.KEYPAD,
"" + WpsInfo.DISPLAY };
+ lp.setKey("wps");
lp.setTitle(R.string.wifi_display_wps_config);
lp.setEntries(wpsEntries);
lp.setEntryValues(wpsValues);
@@ -423,20 +416,22 @@
mCertCategory.addPreference(lp);
// Drop down list for choosing listen channel
- lp = new ListPreference(getActivity()) {
+ lp = new ListPreference(getPrefContext());
+ lp.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
- protected void onDialogClosed(boolean positiveResult) {
- super.onDialogClosed(positiveResult);
- if (positiveResult) {
- mListenChannel = Integer.parseInt(getValue());
- setSummary("%1$s");
+ public boolean onPreferenceChange(Preference preference, Object value) {
+ int channel = Integer.parseInt((String) value);
+ if (channel != mListenChannel) {
+ mListenChannel = channel;
getActivity().invalidateOptionsMenu();
setWifiP2pChannels(mListenChannel, mOperatingChannel);
}
+ return true;
}
- };
+ });
String[] lcEntries = { "Auto", "1", "6", "11" };
String[] lcValues = { "0", "1", "6", "11" };
+ lp.setKey("listening_channel");
lp.setTitle(R.string.wifi_display_listen_channel);
lp.setEntries(lcEntries);
lp.setEntryValues(lcValues);
@@ -445,20 +440,22 @@
mCertCategory.addPreference(lp);
// Drop down list for choosing operating channel
- lp = new ListPreference(getActivity()) {
+ lp = new ListPreference(getPrefContext());
+ lp.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
- protected void onDialogClosed(boolean positiveResult) {
- super.onDialogClosed(positiveResult);
- if (positiveResult) {
- mOperatingChannel = Integer.parseInt(getValue());
- setSummary("%1$s");
+ public boolean onPreferenceChange(Preference preference, Object value) {
+ int channel = Integer.parseInt((String) value);
+ if (channel != mOperatingChannel) {
+ mOperatingChannel = channel;
getActivity().invalidateOptionsMenu();
setWifiP2pChannels(mListenChannel, mOperatingChannel);
}
+ return true;
}
- };
+ });
String[] ocEntries = { "Auto", "1", "6", "11", "36" };
String[] ocValues = { "0", "1", "6", "11", "36" };
+ lp.setKey("operating_channel");
lp.setTitle(R.string.wifi_display_operating_channel);
lp.setEntries(ocEntries);
lp.setEntryValues(ocValues);
@@ -699,8 +696,8 @@
}
@Override
- protected void onBindView(View view) {
- super.onBindView(view);
+ public void onBindViewHolder(PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
ImageView deviceDetails = (ImageView) view.findViewById(R.id.deviceDetails);
if (deviceDetails != null) {
diff --git a/src/com/android/settings/widget/ChartDataUsageView.java b/src/com/android/settings/widget/ChartDataUsageView.java
index cc9acd6..524dd9f 100644
--- a/src/com/android/settings/widget/ChartDataUsageView.java
+++ b/src/com/android/settings/widget/ChartDataUsageView.java
@@ -16,8 +16,6 @@
package com.android.settings.widget;
-import static android.net.TrafficStats.MB_IN_BYTES;
-
import android.content.Context;
import android.content.res.Resources;
import android.net.NetworkPolicy;
@@ -32,7 +30,6 @@
import android.text.format.Formatter.BytesResult;
import android.text.format.Time;
import android.util.AttributeSet;
-import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
@@ -43,6 +40,8 @@
import java.util.Calendar;
import java.util.Objects;
+import static android.net.TrafficStats.MB_IN_BYTES;
+
/**
* Specific {@link ChartView} that displays {@link ChartNetworkSeriesView} along
* with {@link ChartSweepView} for inspection ranges and warning/limits.
diff --git a/src/com/android/settings/widget/ChartGridView.java b/src/com/android/settings/widget/ChartGridView.java
index b9516ab..c85d4fc 100644
--- a/src/com/android/settings/widget/ChartGridView.java
+++ b/src/com/android/settings/widget/ChartGridView.java
@@ -16,8 +16,6 @@
package com.android.settings.widget;
-import static com.android.settings.DataUsageSummary.formatDateRange;
-
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
@@ -34,6 +32,8 @@
import com.android.internal.util.Preconditions;
import com.android.settings.R;
+import static com.android.settings.DataUsageSummary.formatDateRange;
+
/**
* Background of {@link ChartView} that renders grid lines as requested by
* {@link ChartAxis#getTickPoints()}.
diff --git a/src/com/android/settings/widget/ChartNetworkSeriesView.java b/src/com/android/settings/widget/ChartNetworkSeriesView.java
index 7aaba66..07c1479 100644
--- a/src/com/android/settings/widget/ChartNetworkSeriesView.java
+++ b/src/com/android/settings/widget/ChartNetworkSeriesView.java
@@ -16,9 +16,6 @@
package com.android.settings.widget;
-import static android.text.format.DateUtils.DAY_IN_MILLIS;
-import static android.text.format.DateUtils.WEEK_IN_MILLIS;
-
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
@@ -36,6 +33,9 @@
import com.android.internal.util.Preconditions;
import com.android.settings.R;
+import static android.text.format.DateUtils.DAY_IN_MILLIS;
+import static android.text.format.DateUtils.WEEK_IN_MILLIS;
+
/**
* {@link NetworkStatsHistory} series to render inside a {@link ChartView},
* using {@link ChartAxis} to map into screen coordinates.
diff --git a/src/com/android/settings/widget/MatchParentShrinkingLinearLayout.java b/src/com/android/settings/widget/MatchParentShrinkingLinearLayout.java
index 79971e5..c7d4d92 100644
--- a/src/com/android/settings/widget/MatchParentShrinkingLinearLayout.java
+++ b/src/com/android/settings/widget/MatchParentShrinkingLinearLayout.java
@@ -16,8 +16,6 @@
package com.android.settings.widget;
-import com.android.internal.R;
-
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -32,6 +30,8 @@
import android.view.ViewGroup;
import android.view.ViewHierarchyEncoder;
+import com.android.internal.R;
+
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
diff --git a/src/com/android/settings/wifi/AccessPointPreference.java b/src/com/android/settings/wifi/AccessPointPreference.java
index 264f681..ce2601c 100644
--- a/src/com/android/settings/wifi/AccessPointPreference.java
+++ b/src/com/android/settings/wifi/AccessPointPreference.java
@@ -15,6 +15,7 @@
*/
package com.android.settings.wifi;
+import android.app.Fragment;
import android.content.Context;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
@@ -22,7 +23,8 @@
import android.net.wifi.WifiConfiguration;
import android.os.Looper;
import android.os.UserHandle;
-import android.preference.Preference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceViewHolder;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.SparseArray;
@@ -45,6 +47,8 @@
private final int mBadgePadding;
private final UserBadgeCache mBadgeCache;
+ private final Fragment mFragment;
+
private TextView mTitleView;
private boolean mForSavedNetworks = false;
private AccessPoint mAccessPoint;
@@ -65,11 +69,13 @@
mWifiSld = null;
mBadgePadding = 0;
mBadgeCache = null;
+ mFragment = null;
}
public AccessPointPreference(AccessPoint accessPoint, Context context, UserBadgeCache cache,
- boolean forSavedNetworks) {
+ boolean forSavedNetworks, Fragment fragment) {
super(context);
+ mFragment = fragment;
mBadgeCache = cache;
mAccessPoint = accessPoint;
mForSavedNetworks = forSavedNetworks;
@@ -90,8 +96,19 @@
}
@Override
- protected void onBindView(View view) {
- super.onBindView(view);
+ public void onBindViewHolder(final PreferenceViewHolder view) {
+ super.onBindViewHolder(view);
+ if (mFragment != null) {
+ view.itemView.setOnCreateContextMenuListener(mFragment);
+ view.itemView.setTag(this);
+ view.itemView.setOnLongClickListener(new View.OnLongClickListener() {
+ @Override
+ public boolean onLongClick(View v) {
+ view.itemView.showContextMenu();
+ return true;
+ }
+ });
+ }
if (mAccessPoint == null) {
// Used for dummy pref.
return;
@@ -107,7 +124,7 @@
mTitleView.setCompoundDrawablesRelativeWithIntrinsicBounds(null, null, mBadge, null);
mTitleView.setCompoundDrawablePadding(mBadgePadding);
}
- view.setContentDescription(mContentDescription);
+ view.itemView.setContentDescription(mContentDescription);
}
protected void updateIcon(int level, Context context) {
diff --git a/src/com/android/settings/wifi/AdvancedWifiSettings.java b/src/com/android/settings/wifi/AdvancedWifiSettings.java
index 468d3db..aaab0c5 100644
--- a/src/com/android/settings/wifi/AdvancedWifiSettings.java
+++ b/src/com/android/settings/wifi/AdvancedWifiSettings.java
@@ -29,16 +29,14 @@
import android.net.wifi.WifiManager;
import android.net.wifi.WpsInfo;
import android.os.Bundle;
-import android.os.UserHandle;
import android.os.UserManager;
-import android.preference.ListPreference;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceClickListener;
-import android.preference.PreferenceScreen;
-import android.preference.SwitchPreference;
import android.provider.Settings;
import android.provider.Settings.Global;
import android.security.Credentials;
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.ListPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.Preference.OnPreferenceClickListener;
import android.text.TextUtils;
import android.util.Log;
import android.widget.Toast;
@@ -239,7 +237,7 @@
}
@Override
- public boolean onPreferenceTreeClick(PreferenceScreen screen, Preference preference) {
+ public boolean onPreferenceTreeClick(Preference preference) {
String key = preference.getKey();
if (KEY_NOTIFY_OPEN_NETWORKS.equals(key)) {
@@ -247,7 +245,7 @@
Settings.Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,
((SwitchPreference) preference).isChecked() ? 1 : 0);
} else {
- return super.onPreferenceTreeClick(screen, preference);
+ return super.onPreferenceTreeClick(preference);
}
return true;
}
diff --git a/src/com/android/settings/wifi/SavedAccessPointsWifiSettings.java b/src/com/android/settings/wifi/SavedAccessPointsWifiSettings.java
index 45a6828..e0ea23a 100644
--- a/src/com/android/settings/wifi/SavedAccessPointsWifiSettings.java
+++ b/src/com/android/settings/wifi/SavedAccessPointsWifiSettings.java
@@ -21,8 +21,8 @@
import android.content.res.Resources;
import android.net.wifi.WifiManager;
import android.os.Bundle;
-import android.preference.Preference;
-import android.preference.PreferenceScreen;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceScreen;
import android.util.Log;
import com.android.internal.logging.MetricsLogger;
@@ -91,7 +91,7 @@
private void initPreferences() {
PreferenceScreen preferenceScreen = getPreferenceScreen();
- final Context context = getActivity();
+ final Context context = getPrefContext();
final List<AccessPoint> accessPoints = WifiTracker.getCurrentAccessPoints(context, true,
false, true);
@@ -109,7 +109,7 @@
final int accessPointsSize = accessPoints.size();
for (int i = 0; i < accessPointsSize; ++i){
AccessPointPreference preference = new AccessPointPreference(accessPoints.get(i),
- context, mUserBadgeCache, true);
+ context, mUserBadgeCache, true, this);
preference.setIcon(null);
preferenceScreen.addPreference(preference);
}
@@ -183,12 +183,12 @@
}
@Override
- public boolean onPreferenceTreeClick(PreferenceScreen screen, Preference preference) {
+ public boolean onPreferenceTreeClick(Preference preference) {
if (preference instanceof AccessPointPreference) {
showDialog((AccessPointPreference) preference, false);
return true;
} else{
- return super.onPreferenceTreeClick(screen, preference);
+ return super.onPreferenceTreeClick(preference);
}
}
diff --git a/src/com/android/settings/wifi/WifiAPITest.java b/src/com/android/settings/wifi/WifiAPITest.java
index 3dff102..e6bf6b8 100644
--- a/src/com/android/settings/wifi/WifiAPITest.java
+++ b/src/com/android/settings/wifi/WifiAPITest.java
@@ -16,19 +16,18 @@
package com.android.settings.wifi;
-import com.android.settings.R;
-
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.net.wifi.WifiManager;
-
import android.os.Bundle;
-import android.preference.Preference;
-import android.preference.PreferenceActivity;
-import android.preference.PreferenceScreen;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceScreen;
import android.text.Editable;
import android.widget.EditText;
+import com.android.settings.PreferenceActivity;
+import com.android.settings.R;
+
/**
* Provide an interface for testing out the Wifi API
@@ -88,8 +87,8 @@
//============================
@Override
- public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
- super.onPreferenceTreeClick(preferenceScreen, preference);
+ public boolean onPreferenceTreeClick(Preference preference) {
+ super.onPreferenceTreeClick(preference);
return false;
}
diff --git a/src/com/android/settings/wifi/WifiApDialog.java b/src/com/android/settings/wifi/WifiApDialog.java
index 254c386..1316a49 100644
--- a/src/com/android/settings/wifi/WifiApDialog.java
+++ b/src/com/android/settings/wifi/WifiApDialog.java
@@ -27,6 +27,7 @@
import android.text.Editable;
import android.text.InputType;
import android.text.TextWatcher;
+import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
@@ -34,11 +35,10 @@
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
-import java.nio.charset.Charset;
import com.android.settings.R;
-import android.util.Log;
+import java.nio.charset.Charset;
/**
* Dialog to configure the SSID and security settings
diff --git a/src/com/android/settings/wifi/WifiApEnabler.java b/src/com/android/settings/wifi/WifiApEnabler.java
index 741c4a7..cb94732 100644
--- a/src/com/android/settings/wifi/WifiApEnabler.java
+++ b/src/com/android/settings/wifi/WifiApEnabler.java
@@ -23,8 +23,8 @@
import android.net.ConnectivityManager;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
-import android.preference.SwitchPreference;
import android.provider.Settings;
+import android.support.v14.preference.SwitchPreference;
import com.android.settings.R;
import com.android.settingslib.TetherUtil;
diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java
index ac2d02e..abe700e 100644
--- a/src/com/android/settings/wifi/WifiConfigController.java
+++ b/src/com/android/settings/wifi/WifiConfigController.java
@@ -39,8 +39,8 @@
import android.security.KeyStore;
import android.text.Editable;
import android.text.InputType;
-import android.text.TextWatcher;
import android.text.TextUtils;
+import android.text.TextWatcher;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
@@ -58,11 +58,11 @@
import com.android.settings.ProxySelector;
import com.android.settings.R;
-import com.android.settingslib.wifi.AccessPoint;
import com.android.settings.Utils;
+import com.android.settingslib.wifi.AccessPoint;
-import java.net.InetAddress;
import java.net.Inet4Address;
+import java.net.InetAddress;
import java.util.Iterator;
/**
diff --git a/src/com/android/settings/wifi/WifiConfigInfo.java b/src/com/android/settings/wifi/WifiConfigInfo.java
index 9b680a8..f042feb 100644
--- a/src/com/android/settings/wifi/WifiConfigInfo.java
+++ b/src/com/android/settings/wifi/WifiConfigInfo.java
@@ -17,14 +17,15 @@
package com.android.settings.wifi;
import android.app.Activity;
+import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.widget.TextView;
-import android.net.wifi.WifiConfiguration;
-import java.util.List;
import com.android.settings.R;
+import java.util.List;
+
/**
* Configuration details saved by the user on the WifiSettings screen
diff --git a/src/com/android/settings/wifi/WifiDialog.java b/src/com/android/settings/wifi/WifiDialog.java
index cb2a6d8..9b8fd7a 100644
--- a/src/com/android/settings/wifi/WifiDialog.java
+++ b/src/com/android/settings/wifi/WifiDialog.java
@@ -16,17 +16,16 @@
package com.android.settings.wifi;
-import com.android.settings.R;
-import com.android.settingslib.wifi.AccessPoint;
-
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
-import android.view.WindowManager;
import android.widget.Button;
+import com.android.settings.R;
+import com.android.settingslib.wifi.AccessPoint;
+
class WifiDialog extends AlertDialog implements WifiConfigUiBase, DialogInterface.OnClickListener {
public interface WifiDialogListener {
diff --git a/src/com/android/settings/wifi/WifiInfo.java b/src/com/android/settings/wifi/WifiInfo.java
index 291a495..a431a82 100644
--- a/src/com/android/settings/wifi/WifiInfo.java
+++ b/src/com/android/settings/wifi/WifiInfo.java
@@ -16,10 +16,10 @@
package com.android.settings.wifi;
-import com.android.settings.R;
-
import android.os.Bundle;
-import android.preference.PreferenceActivity;
+
+import com.android.settings.PreferenceActivity;
+import com.android.settings.R;
/**
diff --git a/src/com/android/settings/wifi/WifiNoInternetDialog.java b/src/com/android/settings/wifi/WifiNoInternetDialog.java
index b870873..b655344 100644
--- a/src/com/android/settings/wifi/WifiNoInternetDialog.java
+++ b/src/com/android/settings/wifi/WifiNoInternetDialog.java
@@ -22,15 +22,14 @@
import android.net.ConnectivityManager;
import android.net.ConnectivityManager.NetworkCallback;
import android.net.Network;
-import android.net.NetworkInfo;
import android.net.NetworkCapabilities;
+import android.net.NetworkInfo;
import android.net.NetworkRequest;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.CheckBox;
-import android.widget.TextView;
import com.android.internal.app.AlertActivity;
import com.android.internal.app.AlertController;
diff --git a/src/com/android/settings/wifi/WifiPickerActivity.java b/src/com/android/settings/wifi/WifiPickerActivity.java
index 5bdceb9..3f7a5e7 100644
--- a/src/com/android/settings/wifi/WifiPickerActivity.java
+++ b/src/com/android/settings/wifi/WifiPickerActivity.java
@@ -15,15 +15,13 @@
*/
package com.android.settings.wifi;
+import android.content.Intent;
+import android.support.v14.preference.PreferenceFragment;
+
import com.android.settings.ButtonBarHandler;
+import com.android.settings.R;
import com.android.settings.SettingsActivity;
import com.android.settings.wifi.p2p.WifiP2pSettings;
-import com.android.settings.R;
-
-import android.content.Intent;
-import android.preference.PreferenceFragment;
-
-import java.lang.Class;
public class WifiPickerActivity extends SettingsActivity implements ButtonBarHandler {
diff --git a/src/com/android/settings/wifi/WifiScanModeActivity.java b/src/com/android/settings/wifi/WifiScanModeActivity.java
index e495ddd..893aaf4 100644
--- a/src/com/android/settings/wifi/WifiScanModeActivity.java
+++ b/src/com/android/settings/wifi/WifiScanModeActivity.java
@@ -16,8 +16,6 @@
package com.android.settings.wifi;
-import com.android.settings.R;
-
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
@@ -30,6 +28,8 @@
import android.os.Bundle;
import android.provider.Settings;
+import com.android.settings.R;
+
/**
* This activity requests users permission to allow scanning even when Wi-Fi is turned off
*/
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index 6d11612..c9a94b7 100644
--- a/src/com/android/settings/wifi/WifiSettings.java
+++ b/src/com/android/settings/wifi/WifiSettings.java
@@ -16,8 +16,6 @@
package com.android.settings.wifi;
-import static android.os.UserManager.DISALLOW_CONFIG_WIFI;
-
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AppGlobals;
@@ -44,9 +42,8 @@
import android.os.Process;
import android.os.RemoteException;
import android.os.UserHandle;
-import android.preference.Preference;
-import android.preference.PreferenceScreen;
import android.provider.Settings;
+import android.support.v7.preference.Preference;
import android.text.Spannable;
import android.text.style.TextAppearanceSpan;
import android.util.Log;
@@ -57,7 +54,6 @@
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
-import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.TextView.BufferType;
@@ -81,6 +77,8 @@
import java.util.Collection;
import java.util.List;
+import static android.os.UserManager.DISALLOW_CONFIG_WIFI;
+
/**
* Two types of UI are provided here.
*
@@ -450,9 +448,7 @@
@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo info) {
- if (info instanceof AdapterContextMenuInfo) {
- Preference preference = (Preference) getListView().getItemAtPosition(
- ((AdapterContextMenuInfo) info).position);
+ Preference preference = (Preference) view.getTag();
if (preference instanceof AccessPointPreference) {
mSelectedAccessPoint = ((AccessPointPreference) preference).getAccessPoint();
@@ -483,7 +479,6 @@
}
}
}
- }
}
@Override
@@ -521,7 +516,7 @@
}
@Override
- public boolean onPreferenceTreeClick(PreferenceScreen screen, Preference preference) {
+ public boolean onPreferenceTreeClick(Preference preference) {
if (preference instanceof AccessPointPreference) {
mSelectedAccessPoint = ((AccessPointPreference) preference).getAccessPoint();
/** Bypass dialog for unsecured, unsaved, and inactive networks */
@@ -539,7 +534,7 @@
showDialog(mSelectedAccessPoint, WifiConfigUiBase.MODE_CONNECT);
}
} else {
- return super.onPreferenceTreeClick(screen, preference);
+ return super.onPreferenceTreeClick(preference);
}
return true;
}
@@ -661,13 +656,13 @@
continue;
}
AccessPointPreference preference = new AccessPointPreference(accessPoint,
- getActivity(), mUserBadgeCache, false);
+ getPrefContext(), mUserBadgeCache, false, this);
preference.setOrder(index++);
if (mOpenSsid != null && mOpenSsid.equals(accessPoint.getSsidStr())
&& !accessPoint.isSaved()
&& accessPoint.getSecurity() != AccessPoint.SECURITY_NONE) {
- onPreferenceTreeClick(getPreferenceScreen(), preference);
+ onPreferenceTreeClick(preference);
mOpenSsid = null;
}
getPreferenceScreen().addPreference(preference);
@@ -707,7 +702,7 @@
protected TextView initEmptyView() {
TextView emptyView = (TextView) getActivity().findViewById(android.R.id.empty);
emptyView.setGravity(Gravity.START | Gravity.CENTER_VERTICAL);
- getListView().setEmptyView(emptyView);
+ setEmptyView(emptyView);
return emptyView;
}
diff --git a/src/com/android/settings/wifi/WifiSettingsForSetupWizard.java b/src/com/android/settings/wifi/WifiSettingsForSetupWizard.java
index 7007fa3..096847d 100644
--- a/src/com/android/settings/wifi/WifiSettingsForSetupWizard.java
+++ b/src/com/android/settings/wifi/WifiSettingsForSetupWizard.java
@@ -19,7 +19,7 @@
import android.app.Dialog;
import android.net.wifi.WifiConfiguration;
import android.os.Bundle;
-import android.preference.PreferenceScreen;
+import android.support.v7.preference.PreferenceScreen;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.Menu;
@@ -27,6 +27,7 @@
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
+import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
@@ -150,16 +151,15 @@
}
protected void updateFooter(boolean isEmpty) {
- if (isEmpty != mListLastEmpty && hasListView()) {
- final ListView list = getListView();
- list.removeFooterView(mEmptyFooter);
- list.removeFooterView(mAddOtherNetworkItem);
- list.removeFooterView(mMacAddressFooter);
+ if (isEmpty != mListLastEmpty) {
if (isEmpty) {
- list.addFooterView(mEmptyFooter, null, false);
+ setFooterView(mEmptyFooter);
} else {
- list.addFooterView(mAddOtherNetworkItem, null, true);
- list.addFooterView(mMacAddressFooter, null, false);
+ LinearLayout layout = new LinearLayout(getContext());
+ layout.setOrientation(LinearLayout.VERTICAL);
+ layout.addView(mAddOtherNetworkItem);
+ layout.addView(mMacAddressFooter);
+ setFooterView(layout);
}
mListLastEmpty = isEmpty;
}
diff --git a/src/com/android/settings/wifi/WifiSetupActivity.java b/src/com/android/settings/wifi/WifiSetupActivity.java
index 25f6fac..2264546 100644
--- a/src/com/android/settings/wifi/WifiSetupActivity.java
+++ b/src/com/android/settings/wifi/WifiSetupActivity.java
@@ -29,7 +29,7 @@
import android.net.NetworkInfo;
import android.net.wifi.WifiManager;
import android.os.Bundle;
-import android.preference.PreferenceFragment;
+import android.support.v14.preference.PreferenceFragment;
import android.util.Log;
import com.android.settings.ButtonBarHandler;
diff --git a/src/com/android/settings/wifi/WifiStatusTest.java b/src/com/android/settings/wifi/WifiStatusTest.java
index 9789327..38b3a15 100644
--- a/src/com/android/settings/wifi/WifiStatusTest.java
+++ b/src/com/android/settings/wifi/WifiStatusTest.java
@@ -16,20 +16,13 @@
package com.android.settings.wifi;
-import com.android.settings.R;
-import com.android.settingslib.wifi.AccessPoint;
-
-import android.net.wifi.ScanResult;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.util.List;
-
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.NetworkInfo;
+import android.net.wifi.ScanResult;
import android.net.wifi.SupplicantState;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiInfo;
@@ -43,8 +36,14 @@
import android.widget.Button;
import android.widget.TextView;
+import com.android.settings.R;
+import com.android.settingslib.wifi.AccessPoint;
+
import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.URL;
import java.net.UnknownHostException;
+import java.util.List;
/**
diff --git a/src/com/android/settings/wifi/WpsDialog.java b/src/com/android/settings/wifi/WpsDialog.java
index b83ad10..67367ad 100644
--- a/src/com/android/settings/wifi/WpsDialog.java
+++ b/src/com/android/settings/wifi/WpsDialog.java
@@ -32,11 +32,11 @@
import android.widget.ProgressBar;
import android.widget.TextView;
+import com.android.settings.R;
+
import java.util.Timer;
import java.util.TimerTask;
-import com.android.settings.R;
-
/**
* Dialog to show WPS progress.
diff --git a/src/com/android/settings/wifi/p2p/WifiP2pPeer.java b/src/com/android/settings/wifi/p2p/WifiP2pPeer.java
index a364021..d4b50e6 100644
--- a/src/com/android/settings/wifi/p2p/WifiP2pPeer.java
+++ b/src/com/android/settings/wifi/p2p/WifiP2pPeer.java
@@ -16,16 +16,16 @@
package com.android.settings.wifi.p2p;
-import com.android.settings.R;
-
import android.content.Context;
import android.net.wifi.WifiManager;
import android.net.wifi.p2p.WifiP2pDevice;
-import android.preference.Preference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceViewHolder;
import android.text.TextUtils;
-import android.view.View;
import android.widget.ImageView;
+import com.android.settings.R;
+
public class WifiP2pPeer extends Preference {
private static final int[] STATE_SECURED = {R.attr.state_encrypted};
@@ -44,7 +44,7 @@
}
@Override
- protected void onBindView(View view) {
+ public void onBindViewHolder(PreferenceViewHolder view) {
if (TextUtils.isEmpty(device.deviceName)) {
setTitle(device.deviceAddress);
} else {
@@ -58,7 +58,7 @@
mSignal.setImageState(STATE_SECURED, true);
}
refresh();
- super.onBindView(view);
+ super.onBindViewHolder(view);
}
@Override
diff --git a/src/com/android/settings/wifi/p2p/WifiP2pPersistentGroup.java b/src/com/android/settings/wifi/p2p/WifiP2pPersistentGroup.java
index d982653..1869e60 100644
--- a/src/com/android/settings/wifi/p2p/WifiP2pPersistentGroup.java
+++ b/src/com/android/settings/wifi/p2p/WifiP2pPersistentGroup.java
@@ -18,8 +18,8 @@
import android.content.Context;
import android.net.wifi.p2p.WifiP2pGroup;
-import android.preference.Preference;
-import android.view.View;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceViewHolder;
public class WifiP2pPersistentGroup extends Preference {
@@ -31,9 +31,9 @@
}
@Override
- protected void onBindView(View view) {
+ public void onBindViewHolder(PreferenceViewHolder view) {
setTitle(mGroup.getNetworkName());
- super.onBindView(view);
+ super.onBindViewHolder(view);
}
int getNetworkId() {
diff --git a/src/com/android/settings/wifi/p2p/WifiP2pSettings.java b/src/com/android/settings/wifi/p2p/WifiP2pSettings.java
index 81815ae..1ba17f1 100644
--- a/src/com/android/settings/wifi/p2p/WifiP2pSettings.java
+++ b/src/com/android/settings/wifi/p2p/WifiP2pSettings.java
@@ -26,22 +26,22 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.net.NetworkInfo;
+import android.net.wifi.WpsInfo;
import android.net.wifi.p2p.WifiP2pConfig;
-import android.net.wifi.p2p.WifiP2pInfo;
import android.net.wifi.p2p.WifiP2pDevice;
import android.net.wifi.p2p.WifiP2pDeviceList;
import android.net.wifi.p2p.WifiP2pGroup;
import android.net.wifi.p2p.WifiP2pGroupList;
+import android.net.wifi.p2p.WifiP2pInfo;
import android.net.wifi.p2p.WifiP2pManager;
import android.net.wifi.p2p.WifiP2pManager.PeerListListener;
import android.net.wifi.p2p.WifiP2pManager.PersistentGroupInfoListener;
-import android.net.wifi.WpsInfo;
import android.os.Bundle;
import android.os.SystemProperties;
-import android.preference.Preference;
-import android.preference.PreferenceCategory;
-import android.preference.PreferenceGroup;
-import android.preference.PreferenceScreen;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceCategory;
+import android.support.v7.preference.PreferenceGroup;
+import android.support.v7.preference.PreferenceScreen;
import android.text.InputFilter;
import android.text.TextUtils;
import android.util.Log;
@@ -301,16 +301,16 @@
preferenceScreen.removeAll();
preferenceScreen.setOrderingAsAdded(true);
- mThisDevicePref = new Preference(getActivity());
+ mThisDevicePref = new Preference(getPrefContext());
mThisDevicePref.setPersistent(false);
mThisDevicePref.setSelectable(false);
preferenceScreen.addPreference(mThisDevicePref);
- mPeersGroup = new PreferenceCategory(getActivity());
+ mPeersGroup = new PreferenceCategory(getPrefContext());
mPeersGroup.setTitle(R.string.wifi_p2p_peer_devices);
preferenceScreen.addPreference(mPeersGroup);
- mPersistentGroup = new PreferenceCategory(getActivity());
+ mPersistentGroup = new PreferenceCategory(getPrefContext());
mPersistentGroup.setTitle(R.string.wifi_p2p_remembered_groups);
preferenceScreen.addPreference(mPersistentGroup);
@@ -381,7 +381,7 @@
}
@Override
- public boolean onPreferenceTreeClick(PreferenceScreen screen, Preference preference) {
+ public boolean onPreferenceTreeClick(Preference preference) {
if (preference instanceof WifiP2pPeer) {
mSelectedWifiPeer = (WifiP2pPeer) preference;
if (mSelectedWifiPeer.device.status == WifiP2pDevice.CONNECTED) {
@@ -423,7 +423,7 @@
mSelectedGroup = (WifiP2pPersistentGroup) preference;
showDialog(DIALOG_DELETE_GROUP);
}
- return super.onPreferenceTreeClick(screen, preference);
+ return super.onPreferenceTreeClick(preference);
}
@Override