Depend on support lib preferences
Bug: 24576551 Change-Id: Ic6190bacd3f7582c9bbc8de972da4612bd92421e
This commit is contained in:
18
Android.mk
18
Android.mk
@@ -2,7 +2,14 @@ LOCAL_PATH:= $(call my-dir)
|
|||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
LOCAL_JAVA_LIBRARIES := bouncycastle conscrypt telephony-common ims-common
|
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
|
LOCAL_MODULE_TAGS := optional
|
||||||
|
|
||||||
@@ -10,7 +17,11 @@ LOCAL_SRC_FILES := \
|
|||||||
$(call all-java-files-under, src) \
|
$(call all-java-files-under, src) \
|
||||||
src/com/android/settings/EventLogTags.logtags
|
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_PACKAGE_NAME := Settings
|
||||||
LOCAL_CERTIFICATE := platform
|
LOCAL_CERTIFICATE := platform
|
||||||
@@ -18,6 +29,9 @@ LOCAL_PRIVILEGED_MODULE := true
|
|||||||
|
|
||||||
LOCAL_PROGUARD_FLAG_FILES := proguard.flags
|
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),)
|
ifneq ($(INCREMENTAL_BUILDS),)
|
||||||
LOCAL_PROGUARD_ENABLED := disabled
|
LOCAL_PROGUARD_ENABLED := disabled
|
||||||
LOCAL_JACK_ENABLED := incremental
|
LOCAL_JACK_ENABLED := incremental
|
||||||
|
|||||||
@@ -13,21 +13,14 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
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_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
|
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||||
|
|
||||||
<!-- Dream selectable row (icon, caption, radio button) -->
|
|
||||||
|
|
||||||
<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:clickable="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
|
android:orientation="horizontal"
|
||||||
android:background="?android:attr/selectableItemBackground" >
|
android:background="?android:attr/selectableItemBackground" >
|
||||||
|
|
||||||
<!-- Dream icon -->
|
<!-- Dream icon -->
|
||||||
@@ -50,13 +43,13 @@
|
|||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@android:id/title"
|
android:id="@android:id/title"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:layout_toStartOf="@android:id/button1"
|
|
||||||
android:layout_toEndOf="@android:id/icon"
|
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
|
android:gravity="center_vertical"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
android:textAlignment="viewStart"
|
android:textAlignment="viewStart"
|
||||||
android:labelFor="@android:id/button2" />
|
android:labelFor="@android:id/button2" />
|
||||||
@@ -72,16 +65,14 @@
|
|||||||
android:duplicateParentState="true"
|
android:duplicateParentState="true"
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:focusable="false" />
|
android:focusable="false" />
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<!-- Divider -->
|
<!-- Divider -->
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@id/divider"
|
android:id="@+id/divider"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:layout_toStartOf="@android:id/button2"
|
|
||||||
android:contentDescription="@null"
|
android:contentDescription="@null"
|
||||||
android:src="@drawable/nav_divider" />
|
android:src="@drawable/nav_divider" />
|
||||||
|
|
||||||
@@ -91,9 +82,6 @@
|
|||||||
android:id="@android:id/button2"
|
android:id="@android:id/button2"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
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_centerVertical="true"
|
||||||
android:layout_margin="0dip"
|
android:layout_margin="0dip"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
@@ -103,4 +91,4 @@
|
|||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:src="@drawable/ic_bt_config" />
|
android:src="@drawable/ic_bt_config" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</LinearLayout>
|
||||||
|
|||||||
18
res/layout/layout_preference_frame.xml
Normal file
18
res/layout/layout_preference_frame.xml
Normal file
@@ -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" />
|
||||||
@@ -29,11 +29,13 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<FrameLayout android:layout_height="0px"
|
<FrameLayout
|
||||||
|
android:id="@id/list_container"
|
||||||
|
android:layout_height="0px"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_width="match_parent">
|
android:layout_width="match_parent">
|
||||||
|
|
||||||
<ListView android:id="@android:id/list"
|
<ListView android:id="@+id/backup_list"
|
||||||
style="@style/PreferenceFragmentListSinglePane"
|
style="@style/PreferenceFragmentListSinglePane"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
@@ -45,6 +47,7 @@
|
|||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:drawSelectorOnTop="false"
|
android:drawSelectorOnTop="false"
|
||||||
android:elevation="@dimen/dashboard_category_elevation"
|
android:elevation="@dimen/dashboard_category_elevation"
|
||||||
|
android:visibility="gone"
|
||||||
android:scrollbarAlwaysDrawVerticalTrack="true" />
|
android:scrollbarAlwaysDrawVerticalTrack="true" />
|
||||||
|
|
||||||
<include layout="@layout/loading_container" />
|
<include layout="@layout/loading_container" />
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
android:clipToPadding="false">
|
android:clipToPadding="false">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@*android:id/icon_frame"
|
android:id="@id/icon_frame"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:minWidth="60dp"
|
android:minWidth="60dp"
|
||||||
|
|||||||
18
res/layout/space_preference.xml
Normal file
18
res/layout/space_preference.xml
Normal file
@@ -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" />
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
<attr name="state_encrypted" format="boolean" />
|
<attr name="state_encrypted" format="boolean" />
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
<declare-styleable name="IconPreferenceScreen">
|
<declare-styleable name="IconPreferenceScreen">
|
||||||
<attr name="icon" format="reference" />
|
<attr name="icon" />
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
|
|
||||||
<declare-styleable name="BatteryHistoryChart">
|
<declare-styleable name="BatteryHistoryChart">
|
||||||
|
|||||||
@@ -89,6 +89,7 @@
|
|||||||
<style name="Theme.SettingsBase" parent="@android:style/Theme.Material.Settings" />
|
<style name="Theme.SettingsBase" parent="@android:style/Theme.Material.Settings" />
|
||||||
|
|
||||||
<style name="Theme.Settings" parent="Theme.SettingsBase">
|
<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:preferenceStyle">@style/Preference</item>
|
||||||
<item name="@*android:preferenceHeaderPanelStyle">@style/PreferenceHeaderPanelSinglePane</item>
|
<item name="@*android:preferenceHeaderPanelStyle">@style/PreferenceHeaderPanelSinglePane</item>
|
||||||
<item name="@*android:preferencePanelStyle">@style/PreferencePanelSinglePane</item>
|
<item name="@*android:preferencePanelStyle">@style/PreferencePanelSinglePane</item>
|
||||||
@@ -171,6 +172,7 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Theme.SubSettingsDialogWhenLarge" parent="Theme.DialogWhenLarge">
|
<style name="Theme.SubSettingsDialogWhenLarge" parent="Theme.DialogWhenLarge">
|
||||||
|
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
|
||||||
<item name="android:actionBarWidgetTheme">@null</item>
|
<item name="android:actionBarWidgetTheme">@null</item>
|
||||||
<item name="android:actionBarTheme">@android:style/ThemeOverlay.Material.Dark.ActionBar</item>
|
<item name="android:actionBarTheme">@android:style/ThemeOverlay.Material.Dark.ActionBar</item>
|
||||||
|
|
||||||
@@ -188,7 +190,7 @@
|
|||||||
<item name="android:actionBarStyle">@style/Theme.ActionBar</item>
|
<item name="android:actionBarStyle">@style/Theme.ActionBar</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Theme.NotificationStation" parent="@android:style/Theme.Material">
|
<style name="Theme.NotificationStation" parent="@style/Theme.Settings">
|
||||||
<!-- Redefine the ActionBar style for contentInsetStart -->
|
<!-- Redefine the ActionBar style for contentInsetStart -->
|
||||||
<item name="android:actionBarStyle">@style/Theme.ActionBar.SubSettings</item>
|
<item name="android:actionBarStyle">@style/Theme.ActionBar.SubSettings</item>
|
||||||
<item name="@*android:actionBarSize">@dimen/actionbar_size</item>
|
<item name="@*android:actionBarSize">@dimen/actionbar_size</item>
|
||||||
|
|||||||
@@ -67,49 +67,57 @@
|
|||||||
|
|
||||||
<!-- Device hardware model -->
|
<!-- Device hardware model -->
|
||||||
<Preference android:key="device_model"
|
<Preference android:key="device_model"
|
||||||
style="?android:preferenceInformationStyle"
|
android:enabled="false"
|
||||||
|
android:shouldDisableView="false"
|
||||||
android:title="@string/model_number"
|
android:title="@string/model_number"
|
||||||
android:summary="@string/device_info_default"/>
|
android:summary="@string/device_info_default"/>
|
||||||
|
|
||||||
<!-- Device firmware version -->
|
<!-- Device firmware version -->
|
||||||
<Preference android:key="firmware_version"
|
<Preference android:key="firmware_version"
|
||||||
style="?android:preferenceInformationStyle"
|
android:enabled="false"
|
||||||
|
android:shouldDisableView="false"
|
||||||
android:title="@string/firmware_version"
|
android:title="@string/firmware_version"
|
||||||
android:summary="@string/device_info_default"/>
|
android:summary="@string/device_info_default"/>
|
||||||
|
|
||||||
<!-- Security patch level -->
|
<!-- Security patch level -->
|
||||||
<Preference android:key="security_patch"
|
<Preference android:key="security_patch"
|
||||||
style="?android:preferenceInformationStyle"
|
android:enabled="false"
|
||||||
|
android:shouldDisableView="false"
|
||||||
android:title="@string/security_patch"
|
android:title="@string/security_patch"
|
||||||
android:summary="@string/device_info_default"/>
|
android:summary="@string/device_info_default"/>
|
||||||
|
|
||||||
<!-- Device FCC equipment id -->
|
<!-- Device FCC equipment id -->
|
||||||
<Preference android:key="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:title="@string/fcc_equipment_id"
|
||||||
android:summary="@string/device_info_default"/>
|
android:summary="@string/device_info_default"/>
|
||||||
|
|
||||||
<!-- Device Baseband version -->
|
<!-- Device Baseband version -->
|
||||||
<Preference android:key="baseband_version"
|
<Preference android:key="baseband_version"
|
||||||
style="?android:preferenceInformationStyle"
|
android:enabled="false"
|
||||||
|
android:shouldDisableView="false"
|
||||||
android:title="@string/baseband_version"
|
android:title="@string/baseband_version"
|
||||||
android:summary="@string/device_info_default"/>
|
android:summary="@string/device_info_default"/>
|
||||||
|
|
||||||
<!-- Device Kernel version -->
|
<!-- Device Kernel version -->
|
||||||
<Preference android:key="kernel_version"
|
<Preference android:key="kernel_version"
|
||||||
style="?android:preferenceInformationStyle"
|
android:enabled="false"
|
||||||
|
android:shouldDisableView="false"
|
||||||
android:title="@string/kernel_version"
|
android:title="@string/kernel_version"
|
||||||
android:summary="@string/device_info_default"/>
|
android:summary="@string/device_info_default"/>
|
||||||
|
|
||||||
<!-- Detailed build version -->
|
<!-- Detailed build version -->
|
||||||
<Preference android:key="build_number"
|
<Preference android:key="build_number"
|
||||||
style="?android:preferenceInformationStyle"
|
android:enabled="false"
|
||||||
|
android:shouldDisableView="false"
|
||||||
android:title="@string/build_number"
|
android:title="@string/build_number"
|
||||||
android:summary="@string/device_info_default"/>
|
android:summary="@string/device_info_default"/>
|
||||||
|
|
||||||
<!-- SELinux status information -->
|
<!-- SELinux status information -->
|
||||||
<Preference android:key="selinux_status"
|
<Preference android:key="selinux_status"
|
||||||
style="?android:preferenceInformationStyle"
|
android:enabled="false"
|
||||||
|
android:shouldDisableView="false"
|
||||||
android:title="@string/selinux_status"
|
android:title="@string/selinux_status"
|
||||||
android:summary="@string/selinux_status_enforcing"/>
|
android:summary="@string/selinux_status_enforcing"/>
|
||||||
|
|
||||||
|
|||||||
@@ -18,61 +18,71 @@
|
|||||||
android:title="@string/sim_status_title">
|
android:title="@string/sim_status_title">
|
||||||
|
|
||||||
<Preference android:key="operator_name"
|
<Preference android:key="operator_name"
|
||||||
style="?android:attr/preferenceInformationStyle"
|
android:enabled="false"
|
||||||
|
android:shouldDisableView="false"
|
||||||
android:title="@string/status_operator"
|
android:title="@string/status_operator"
|
||||||
android:summary="@string/device_info_not_available"
|
android:summary="@string/device_info_not_available"
|
||||||
android:persistent="false" />
|
android:persistent="false" />
|
||||||
|
|
||||||
<Preference android:key="signal_strength"
|
<Preference android:key="signal_strength"
|
||||||
style="?android:attr/preferenceInformationStyle"
|
android:enabled="false"
|
||||||
|
android:shouldDisableView="false"
|
||||||
android:title="@string/status_signal_strength"
|
android:title="@string/status_signal_strength"
|
||||||
android:summary="@string/device_info_not_available"
|
android:summary="@string/device_info_not_available"
|
||||||
android:persistent="false" />
|
android:persistent="false" />
|
||||||
|
|
||||||
<Preference android:key="network_type"
|
<Preference android:key="network_type"
|
||||||
style="?android:attr/preferenceInformationStyle"
|
android:enabled="false"
|
||||||
|
android:shouldDisableView="false"
|
||||||
android:title="@string/status_network_type"
|
android:title="@string/status_network_type"
|
||||||
android:summary="@string/device_info_not_available"
|
android:summary="@string/device_info_not_available"
|
||||||
android:persistent="false" />
|
android:persistent="false" />
|
||||||
|
|
||||||
<Preference android:key="latest_area_info"
|
<Preference android:key="latest_area_info"
|
||||||
style="?android:attr/preferenceInformationStyle"
|
android:enabled="false"
|
||||||
|
android:shouldDisableView="false"
|
||||||
android:title="@string/status_latest_area_info"
|
android:title="@string/status_latest_area_info"
|
||||||
android:summary="@string/device_info_not_available"
|
android:summary="@string/device_info_not_available"
|
||||||
android:persistent="false" />
|
android:persistent="false" />
|
||||||
|
|
||||||
<Preference android:key="service_state"
|
<Preference android:key="service_state"
|
||||||
style="?android:attr/preferenceInformationStyle"
|
android:enabled="false"
|
||||||
|
android:shouldDisableView="false"
|
||||||
android:title="@string/status_service_state"
|
android:title="@string/status_service_state"
|
||||||
android:summary="@string/device_info_not_available"
|
android:summary="@string/device_info_not_available"
|
||||||
android:persistent="false" />
|
android:persistent="false" />
|
||||||
|
|
||||||
<Preference android:key="roaming_state"
|
<Preference android:key="roaming_state"
|
||||||
style="?android:attr/preferenceInformationStyle"
|
android:enabled="false"
|
||||||
|
android:shouldDisableView="false"
|
||||||
android:title="@string/status_roaming"
|
android:title="@string/status_roaming"
|
||||||
android:summary="@string/device_info_not_available"
|
android:summary="@string/device_info_not_available"
|
||||||
android:persistent="false" />
|
android:persistent="false" />
|
||||||
|
|
||||||
<Preference android:key="data_state"
|
<Preference android:key="data_state"
|
||||||
style="?android:attr/preferenceInformationStyle"
|
android:enabled="false"
|
||||||
|
android:shouldDisableView="false"
|
||||||
android:title="@string/status_data_state"
|
android:title="@string/status_data_state"
|
||||||
android:summary="@string/device_info_not_available"
|
android:summary="@string/device_info_not_available"
|
||||||
android:persistent="false" />
|
android:persistent="false" />
|
||||||
|
|
||||||
<Preference android:key="number"
|
<Preference android:key="number"
|
||||||
style="?android:attr/preferenceInformationStyle"
|
android:enabled="false"
|
||||||
|
android:shouldDisableView="false"
|
||||||
android:title="@string/status_number"
|
android:title="@string/status_number"
|
||||||
android:summary="@string/device_info_not_available"
|
android:summary="@string/device_info_not_available"
|
||||||
android:persistent="false" />
|
android:persistent="false" />
|
||||||
|
|
||||||
<Preference android:key="imei"
|
<Preference android:key="imei"
|
||||||
style="?android:attr/preferenceInformationStyle"
|
android:enabled="false"
|
||||||
|
android:shouldDisableView="false"
|
||||||
android:title="@string/status_imei"
|
android:title="@string/status_imei"
|
||||||
android:summary="@string/device_info_not_available"
|
android:summary="@string/device_info_not_available"
|
||||||
android:persistent="false" />
|
android:persistent="false" />
|
||||||
|
|
||||||
<Preference android:key="imei_sv"
|
<Preference android:key="imei_sv"
|
||||||
style="?android:attr/preferenceInformationStyle"
|
android:enabled="false"
|
||||||
|
android:shouldDisableView="false"
|
||||||
android:title="@string/status_imei_sv"
|
android:title="@string/status_imei_sv"
|
||||||
android:summary="@string/device_info_not_available"
|
android:summary="@string/device_info_not_available"
|
||||||
android:persistent="false" />
|
android:persistent="false" />
|
||||||
|
|||||||
@@ -17,13 +17,15 @@
|
|||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:title="@string/device_status_activity_title">
|
android:title="@string/device_status_activity_title">
|
||||||
|
|
||||||
<Preference android:key="battery_status"
|
<com.android.settings.CopyablePreference android:key="battery_status"
|
||||||
style="?android:attr/preferenceInformationStyle"
|
android:enabled="false"
|
||||||
|
android:shouldDisableView="false"
|
||||||
android:title="@string/battery_status_title"
|
android:title="@string/battery_status_title"
|
||||||
android:summary="@string/device_info_not_available"
|
android:summary="@string/device_info_not_available"
|
||||||
android:persistent="false" />
|
android:persistent="false" />
|
||||||
<Preference android:key="battery_level"
|
<com.android.settings.CopyablePreference android:key="battery_level"
|
||||||
style="?android:attr/preferenceInformationStyle"
|
android:enabled="false"
|
||||||
|
android:shouldDisableView="false"
|
||||||
android:title="@string/battery_level_title"
|
android:title="@string/battery_level_title"
|
||||||
android:summary="@string/device_info_not_available"
|
android:summary="@string/device_info_not_available"
|
||||||
android:persistent="false" />
|
android:persistent="false" />
|
||||||
@@ -39,33 +41,39 @@
|
|||||||
<intent android:targetPackage="com.android.settings"
|
<intent android:targetPackage="com.android.settings"
|
||||||
android:targetClass="com.android.settings.deviceinfo.ImeiInformation" />
|
android:targetClass="com.android.settings.deviceinfo.ImeiInformation" />
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
<Preference android:key="wifi_ip_address"
|
<com.android.settings.CopyablePreference android:key="wifi_ip_address"
|
||||||
style="?android:attr/preferenceInformationStyle"
|
android:enabled="false"
|
||||||
|
android:shouldDisableView="false"
|
||||||
android:title="@string/wifi_advanced_ip_address_title"
|
android:title="@string/wifi_advanced_ip_address_title"
|
||||||
android:summary="@string/device_info_not_available"
|
android:summary="@string/device_info_not_available"
|
||||||
android:persistent="false" />
|
android:persistent="false" />
|
||||||
<Preference android:key="wifi_mac_address"
|
<com.android.settings.CopyablePreference android:key="wifi_mac_address"
|
||||||
style="?android:attr/preferenceInformationStyle"
|
android:enabled="false"
|
||||||
|
android:shouldDisableView="false"
|
||||||
android:title="@string/status_wifi_mac_address"
|
android:title="@string/status_wifi_mac_address"
|
||||||
android:summary="@string/device_info_not_available"
|
android:summary="@string/device_info_not_available"
|
||||||
android:persistent="false" />
|
android:persistent="false" />
|
||||||
<Preference android:key="bt_address"
|
<com.android.settings.CopyablePreference android:key="bt_address"
|
||||||
style="?android:attr/preferenceInformationStyle"
|
android:enabled="false"
|
||||||
|
android:shouldDisableView="false"
|
||||||
android:title="@string/status_bt_address"
|
android:title="@string/status_bt_address"
|
||||||
android:summary="@string/device_info_not_available"
|
android:summary="@string/device_info_not_available"
|
||||||
android:persistent="false" />
|
android:persistent="false" />
|
||||||
<Preference android:key="serial_number"
|
<com.android.settings.CopyablePreference android:key="serial_number"
|
||||||
style="?android:attr/preferenceInformationStyle"
|
android:enabled="false"
|
||||||
|
android:shouldDisableView="false"
|
||||||
android:title="@string/status_serial_number"
|
android:title="@string/status_serial_number"
|
||||||
android:summary="@string/device_info_not_available"
|
android:summary="@string/device_info_not_available"
|
||||||
android:persistent="false" />
|
android:persistent="false" />
|
||||||
<Preference android:key="up_time"
|
<com.android.settings.CopyablePreference android:key="up_time"
|
||||||
style="?android:attr/preferenceInformationStyle"
|
android:enabled="false"
|
||||||
|
android:shouldDisableView="false"
|
||||||
android:title="@string/status_up_time"
|
android:title="@string/status_up_time"
|
||||||
android:summary="@string/device_info_not_available"
|
android:summary="@string/device_info_not_available"
|
||||||
android:persistent="false" />
|
android:persistent="false" />
|
||||||
<Preference android:key="wimax_mac_address"
|
<com.android.settings.CopyablePreference android:key="wimax_mac_address"
|
||||||
style="?android:attr/preferenceInformationStyle"
|
android:enabled="false"
|
||||||
|
android:shouldDisableView="false"
|
||||||
android:title="@string/status_wimax_mac_address"
|
android:title="@string/status_wimax_mac_address"
|
||||||
android:summary="@string/device_info_not_available"
|
android:summary="@string/device_info_not_available"
|
||||||
android:persistent="false" />
|
android:persistent="false" />
|
||||||
|
|||||||
@@ -24,7 +24,8 @@
|
|||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="print_job_message_preference"
|
android:key="print_job_message_preference"
|
||||||
android:layout="@layout/print_job_summary">
|
android:layout="@layout/print_job_summary"
|
||||||
|
android:selectable="false">
|
||||||
</Preference>
|
</Preference>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|||||||
@@ -22,7 +22,8 @@
|
|||||||
android:title="@string/crypt_keeper_settings_title">
|
android:title="@string/crypt_keeper_settings_title">
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
style="?android:preferenceInformationStyle"
|
android:enabled="false"
|
||||||
|
android:shouldDisableView="false"
|
||||||
android:key="crypt_keeper_encrypt_title"
|
android:key="crypt_keeper_encrypt_title"
|
||||||
android:title="@string/crypt_keeper_encrypt_title"
|
android:title="@string/crypt_keeper_encrypt_title"
|
||||||
android:summary="@string/crypt_keeper_encrypted_summary"/>
|
android:summary="@string/crypt_keeper_encrypted_summary"/>
|
||||||
|
|||||||
@@ -66,7 +66,8 @@
|
|||||||
|
|
||||||
<Preference android:key="credential_storage_type"
|
<Preference android:key="credential_storage_type"
|
||||||
android:title="@string/credential_storage_type"
|
android:title="@string/credential_storage_type"
|
||||||
style="?android:attr/preferenceInformationStyle"
|
android:enabled="false"
|
||||||
|
android:shouldDisableView="false"
|
||||||
android:persistent="false" />
|
android:persistent="false" />
|
||||||
|
|
||||||
<Preference android:key="trusted_credentials"
|
<Preference android:key="trusted_credentials"
|
||||||
|
|||||||
@@ -39,7 +39,8 @@
|
|||||||
android:summary="@string/tts_play_example_summary" />
|
android:summary="@string/tts_play_example_summary" />
|
||||||
|
|
||||||
<Preference android:key="tts_status"
|
<Preference android:key="tts_status"
|
||||||
style="?android:attr/preferenceInformationStyle"
|
android:enabled="false"
|
||||||
|
android:shouldDisableView="false"
|
||||||
android:persistent="false"
|
android:persistent="false"
|
||||||
android:title="@string/tts_status_title"/>
|
android:title="@string/tts_status_title"/>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.preference.PreferenceCategory;
|
import android.support.v7.preference.PreferenceCategory;
|
||||||
import android.view.View;
|
import android.support.v7.preference.PreferenceViewHolder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Preference category that accepts a content description for accessibility.
|
* Preference category that accepts a content description for accessibility.
|
||||||
@@ -35,9 +35,9 @@ public class AccessiblePreferenceCategory extends PreferenceCategory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onBindView(View view) {
|
public void onBindViewHolder(PreferenceViewHolder view) {
|
||||||
super.onBindView(view);
|
super.onBindViewHolder(view);
|
||||||
|
|
||||||
view.setContentDescription(mContentDescription);
|
view.itemView.setContentDescription(mContentDescription);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,16 +16,16 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import android.accounts.Account;
|
import android.accounts.Account;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.drawable.Drawable;
|
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.util.Log;
|
||||||
import android.view.View;
|
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AccountPreference is used to display a username, status and provider icon for an account on
|
* AccountPreference is used to display a username, status and provider icon for an account on
|
||||||
* the device.
|
* the device.
|
||||||
@@ -68,8 +68,8 @@ public class AccountPreference extends Preference {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onBindView(View view) {
|
public void onBindViewHolder(PreferenceViewHolder view) {
|
||||||
super.onBindView(view);
|
super.onBindViewHolder(view);
|
||||||
if (!mShowTypeIcon) {
|
if (!mShowTypeIcon) {
|
||||||
mSyncStatusIcon = (ImageView) view.findViewById(android.R.id.icon);
|
mSyncStatusIcon = (ImageView) view.findViewById(android.R.id.icon);
|
||||||
mSyncStatusIcon.setImageResource(getSyncStatusIcon(mStatus));
|
mSyncStatusIcon.setImageResource(getSyncStatusIcon(mStatus));
|
||||||
|
|||||||
@@ -16,22 +16,18 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
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.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.Intent.ShortcutIconResource;
|
import android.content.Intent.ShortcutIconResource;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.ResolveInfo;
|
|
||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
|
import android.content.pm.ResolveInfo;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.ColorFilter;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.PaintFlagsDrawFilter;
|
import android.graphics.PaintFlagsDrawFilter;
|
||||||
import android.graphics.PixelFormat;
|
import android.graphics.PixelFormat;
|
||||||
@@ -41,12 +37,16 @@ import android.graphics.drawable.Drawable;
|
|||||||
import android.graphics.drawable.PaintDrawable;
|
import android.graphics.drawable.PaintDrawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
import android.util.DisplayMetrics;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.BaseAdapter;
|
import android.widget.BaseAdapter;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.android.internal.app.AlertActivity;
|
||||||
|
import com.android.internal.app.AlertController;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@@ -23,9 +23,9 @@ import android.os.Handler;
|
|||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.os.SystemProperties;
|
import android.os.SystemProperties;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.preference.Preference;
|
|
||||||
import android.preference.SwitchPreference;
|
|
||||||
import android.provider.Settings;
|
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.logging.MetricsLogger;
|
||||||
import com.android.internal.telephony.PhoneStateIntentReceiver;
|
import com.android.internal.telephony.PhoneStateIntentReceiver;
|
||||||
|
|||||||
@@ -26,13 +26,12 @@ import android.content.res.Resources;
|
|||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
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.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.ServiceState;
|
||||||
import android.telephony.SubscriptionManager;
|
import android.telephony.SubscriptionManager;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
@@ -41,6 +40,7 @@ import android.util.Log;
|
|||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
|
||||||
import com.android.internal.logging.MetricsLogger;
|
import com.android.internal.logging.MetricsLogger;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|||||||
@@ -20,12 +20,12 @@ import android.content.ContentUris;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.preference.Preference;
|
|
||||||
import android.provider.Telephony;
|
import android.provider.Telephony;
|
||||||
|
import android.support.v7.preference.Preference;
|
||||||
|
import android.support.v7.preference.PreferenceViewHolder;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
import android.widget.RadioButton;
|
import android.widget.RadioButton;
|
||||||
@@ -53,8 +53,8 @@ public class ApnPreference extends Preference implements
|
|||||||
private boolean mSelectable = true;
|
private boolean mSelectable = true;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View getView(View convertView, ViewGroup parent) {
|
public void onBindViewHolder(PreferenceViewHolder view) {
|
||||||
View view = super.getView(convertView, parent);
|
super.onBindViewHolder(view);
|
||||||
|
|
||||||
View widget = view.findViewById(R.id.apn_radiobutton);
|
View widget = view.findViewById(R.id.apn_radiobutton);
|
||||||
if ((widget != null) && widget instanceof RadioButton) {
|
if ((widget != null) && widget instanceof RadioButton) {
|
||||||
@@ -81,8 +81,6 @@ public class ApnPreference extends Preference implements
|
|||||||
if ((textLayout != null) && textLayout instanceof RelativeLayout) {
|
if ((textLayout != null) && textLayout instanceof RelativeLayout) {
|
||||||
textLayout.setOnClickListener(this);
|
textLayout.setOnClickListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return view;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isChecked() {
|
public boolean isChecked() {
|
||||||
|
|||||||
@@ -34,15 +34,15 @@ import android.os.HandlerThread;
|
|||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.os.PersistableBundle;
|
import android.os.PersistableBundle;
|
||||||
import android.os.UserHandle;
|
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
import android.preference.Preference;
|
|
||||||
import android.preference.PreferenceGroup;
|
|
||||||
import android.preference.PreferenceScreen;
|
|
||||||
import android.provider.Telephony;
|
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.CarrierConfigManager;
|
||||||
import android.telephony.SubscriptionInfo;
|
import android.telephony.SubscriptionInfo;
|
||||||
import android.telephony.SubscriptionManager;
|
import android.telephony.SubscriptionManager;
|
||||||
|
import android.telephony.TelephonyManager;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
@@ -58,8 +58,6 @@ import com.android.internal.telephony.dataconnection.ApnSetting;
|
|||||||
import com.android.internal.telephony.uicc.IccRecords;
|
import com.android.internal.telephony.uicc.IccRecords;
|
||||||
import com.android.internal.telephony.uicc.UiccController;
|
import com.android.internal.telephony.uicc.UiccController;
|
||||||
|
|
||||||
import android.telephony.TelephonyManager;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class ApnSettings extends SettingsPreferenceFragment implements
|
public class ApnSettings extends SettingsPreferenceFragment implements
|
||||||
@@ -180,19 +178,17 @@ public class ApnSettings extends SettingsPreferenceFragment implements
|
|||||||
TextView empty = (TextView) getView().findViewById(android.R.id.empty);
|
TextView empty = (TextView) getView().findViewById(android.R.id.empty);
|
||||||
if (empty != null) {
|
if (empty != null) {
|
||||||
empty.setText(R.string.apn_settings_not_available);
|
empty.setText(R.string.apn_settings_not_available);
|
||||||
getListView().setEmptyView(empty);
|
setEmptyView(empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)
|
if (mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)
|
||||||
|| !mUm.isAdminUser()) {
|
|| !mUm.isAdminUser()) {
|
||||||
mUnavailable = true;
|
mUnavailable = true;
|
||||||
setPreferenceScreen(new PreferenceScreen(getActivity(), null));
|
setPreferenceScreen(new PreferenceScreen(getPrefContext(), null));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
addPreferencesFromResource(R.xml.apn_settings);
|
addPreferencesFromResource(R.xml.apn_settings);
|
||||||
|
|
||||||
getListView().setItemsCanFocus(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -270,7 +266,7 @@ public class ApnSettings extends SettingsPreferenceFragment implements
|
|||||||
String mvnoType = cursor.getString(MVNO_TYPE_INDEX);
|
String mvnoType = cursor.getString(MVNO_TYPE_INDEX);
|
||||||
String mvnoMatchData = cursor.getString(MVNO_MATCH_DATA_INDEX);
|
String mvnoMatchData = cursor.getString(MVNO_MATCH_DATA_INDEX);
|
||||||
|
|
||||||
ApnPreference pref = new ApnPreference(getActivity());
|
ApnPreference pref = new ApnPreference(getPrefContext());
|
||||||
|
|
||||||
pref.setKey(key);
|
pref.setKey(key);
|
||||||
pref.setTitle(name);
|
pref.setTitle(name);
|
||||||
@@ -365,7 +361,7 @@ public class ApnSettings extends SettingsPreferenceFragment implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
|
public boolean onPreferenceTreeClick(Preference preference) {
|
||||||
int pos = Integer.parseInt(preference.getKey());
|
int pos = Integer.parseInt(preference.getKey());
|
||||||
Uri url = ContentUris.withAppendedId(Telephony.Carriers.CONTENT_URI, pos);
|
Uri url = ContentUris.withAppendedId(Telephony.Carriers.CONTENT_URI, pos);
|
||||||
startActivity(new Intent(Intent.ACTION_EDIT, url));
|
startActivity(new Intent(Intent.ACTION_EDIT, url));
|
||||||
|
|||||||
@@ -17,15 +17,15 @@
|
|||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog.Builder;
|
import android.app.AlertDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.preference.ListPreference;
|
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -43,7 +43,7 @@ import java.util.List;
|
|||||||
* because the names of applications are very similar and the user may not be able to determine what
|
* 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.
|
* app they are selecting without an icon.
|
||||||
*/
|
*/
|
||||||
public class AppListPreference extends ListPreference {
|
public class AppListPreference extends CustomListPreference {
|
||||||
|
|
||||||
public static final String ITEM_NONE_VALUE = "";
|
public static final String ITEM_NONE_VALUE = "";
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ public class AppListPreference extends ListPreference {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
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);
|
View view = inflater.inflate(R.layout.app_preference_item, parent, false);
|
||||||
TextView textView = (TextView) view.findViewById(R.id.app_label);
|
TextView textView = (TextView) view.findViewById(R.id.app_label);
|
||||||
textView.setText(getItem(position));
|
textView.setText(getItem(position));
|
||||||
@@ -141,9 +141,9 @@ public class AppListPreference extends ListPreference {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPrepareDialogBuilder(Builder builder) {
|
protected void onPrepareDialogBuilder(AlertDialog.Builder builder,
|
||||||
builder.setAdapter(createListAdapter(), this);
|
DialogInterface.OnClickListener listener) {
|
||||||
super.onPrepareDialogBuilder(builder);
|
builder.setAdapter(createListAdapter(), listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.android.settings;
|
|||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.support.v7.preference.PreferenceViewHolder;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@@ -21,8 +22,8 @@ public class AppListPreferenceWithSettings extends AppListPreference {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onBindView(View view) {
|
public void onBindViewHolder(PreferenceViewHolder view) {
|
||||||
super.onBindView(view);
|
super.onBindViewHolder(view);
|
||||||
|
|
||||||
mSettingsIcon = view.findViewById(R.id.settings_button);
|
mSettingsIcon = view.findViewById(R.id.settings_button);
|
||||||
mSettingsIcon.setOnClickListener(new View.OnClickListener() {
|
mSettingsIcon.setOnClickListener(new View.OnClickListener() {
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.support.v7.preference.PreferenceViewHolder;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
|
||||||
import android.widget.Checkable;
|
import android.widget.Checkable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -23,14 +22,14 @@ public class AppListSwitchPreference extends AppListPreference {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onBindView(View view) {
|
public void onBindViewHolder(PreferenceViewHolder view) {
|
||||||
super.onBindView(view);
|
super.onBindViewHolder(view);
|
||||||
mSwitch = (Checkable) view.findViewById(com.android.internal.R.id.switchWidget);
|
mSwitch = (Checkable) view.findViewById(com.android.internal.R.id.switchWidget);
|
||||||
mSwitch.setChecked(getValue() != null);
|
mSwitch.setChecked(getValue() != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void showDialog(Bundle state) {
|
protected void onClick() {
|
||||||
if (getValue() != null) {
|
if (getValue() != null) {
|
||||||
// Turning off the current value.
|
// Turning off the current value.
|
||||||
if (callChangeListener(null)) {
|
if (callChangeListener(null)) {
|
||||||
@@ -45,7 +44,7 @@ public class AppListSwitchPreference extends AppListPreference {
|
|||||||
setValue(value);
|
setValue(value);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
super.showDialog(state);
|
super.onClick();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,20 +16,12 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
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.app.ListActivity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
|
import android.content.pm.PackageInfo;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Process;
|
import android.os.Process;
|
||||||
@@ -39,6 +31,14 @@ import android.view.ViewGroup;
|
|||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.ListView;
|
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 {
|
public class AppPicker extends ListActivity {
|
||||||
private AppListAdapter mAdapter;
|
private AppListAdapter mAdapter;
|
||||||
|
|
||||||
|
|||||||
@@ -16,8 +16,8 @@
|
|||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.support.v7.preference.PreferenceViewHolder;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.View;
|
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
|
|
||||||
public class AppProgressPreference extends TintablePreference {
|
public class AppProgressPreference extends TintablePreference {
|
||||||
@@ -36,8 +36,8 @@ public class AppProgressPreference extends TintablePreference {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onBindView(View view) {
|
public void onBindViewHolder(PreferenceViewHolder view) {
|
||||||
super.onBindView(view);
|
super.onBindViewHolder(view);
|
||||||
|
|
||||||
final ProgressBar progress = (ProgressBar) view.findViewById(android.R.id.progress);
|
final ProgressBar progress = (ProgressBar) view.findViewById(android.R.id.progress);
|
||||||
progress.setProgress(mProgress);
|
progress.setProgress(mProgress);
|
||||||
|
|||||||
@@ -18,12 +18,12 @@ package com.android.settings;
|
|||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
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.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;
|
import com.android.internal.logging.MetricsLogger;
|
||||||
|
|
||||||
public class ApplicationSettings extends SettingsPreferenceFragment {
|
public class ApplicationSettings extends SettingsPreferenceFragment {
|
||||||
@@ -101,13 +101,13 @@ public class ApplicationSettings extends SettingsPreferenceFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
|
public boolean onPreferenceTreeClick(Preference preference) {
|
||||||
if (preference == mToggleAdvancedSettings) {
|
if (preference == mToggleAdvancedSettings) {
|
||||||
boolean value = mToggleAdvancedSettings.isChecked();
|
boolean value = mToggleAdvancedSettings.isChecked();
|
||||||
setAdvancedSettingsEnabled(value);
|
setAdvancedSettingsEnabled(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.onPreferenceTreeClick(preferenceScreen, preference);
|
return super.onPreferenceTreeClick(preference);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isAdvancedSettingsEnabled() {
|
private boolean isAdvancedSettingsEnabled() {
|
||||||
|
|||||||
@@ -2,20 +2,21 @@ package com.android.settings;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
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.Phone;
|
||||||
import com.android.internal.telephony.PhoneFactory;
|
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;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ package com.android.settings;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.preference.Preference;
|
import android.support.v7.preference.Preference;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
|
||||||
public class BrightnessPreference extends Preference {
|
public class BrightnessPreference extends Preference {
|
||||||
|
|||||||
@@ -19,41 +19,23 @@ package com.android.settings;
|
|||||||
import android.app.AlertDialog.Builder;
|
import android.app.AlertDialog.Builder;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
|
||||||
import android.os.SystemProperties;
|
import android.os.SystemProperties;
|
||||||
import android.preference.DialogPreference;
|
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.View;
|
|
||||||
|
|
||||||
public class BugreportPreference extends DialogPreference {
|
public class BugreportPreference extends CustomDialogPreference {
|
||||||
public BugreportPreference(Context context, AttributeSet attrs) {
|
public BugreportPreference(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPrepareDialogBuilder(Builder builder) {
|
protected void onPrepareDialogBuilder(Builder builder, DialogInterface.OnClickListener listener) {
|
||||||
super.onPrepareDialogBuilder(builder);
|
super.onPrepareDialogBuilder(builder, listener);
|
||||||
builder.setPositiveButton(com.android.internal.R.string.report, this);
|
builder.setPositiveButton(com.android.internal.R.string.report, listener);
|
||||||
builder.setMessage(com.android.internal.R.string.bugreport_message);
|
builder.setMessage(com.android.internal.R.string.bugreport_message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void showDialog(Bundle state) {
|
protected void onClick(DialogInterface dialog, int which) {
|
||||||
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) {
|
|
||||||
if (which == DialogInterface.BUTTON_POSITIVE) {
|
if (which == DialogInterface.BUTTON_POSITIVE) {
|
||||||
SystemProperties.set("ctl.start", "bugreport");
|
SystemProperties.set("ctl.start", "bugreport");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,8 @@
|
|||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import android.content.Context;
|
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.util.AttributeSet;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
@@ -47,8 +48,8 @@ public class CancellablePreference extends Preference implements OnClickListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onBindView(View view) {
|
public void onBindViewHolder(PreferenceViewHolder view) {
|
||||||
super.onBindView(view);
|
super.onBindViewHolder(view);
|
||||||
|
|
||||||
ImageView cancel = (ImageView) view.findViewById(R.id.cancel);
|
ImageView cancel = (ImageView) view.findViewById(R.id.cancel);
|
||||||
cancel.setVisibility(mCancellable ? View.VISIBLE : View.INVISIBLE);
|
cancel.setVisibility(mCancellable ? View.VISIBLE : View.INVISIBLE);
|
||||||
|
|||||||
@@ -27,21 +27,19 @@ import android.app.admin.DevicePolicyManager;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
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.Fingerprint;
|
||||||
import android.hardware.fingerprint.FingerprintManager;
|
import android.hardware.fingerprint.FingerprintManager;
|
||||||
import android.hardware.fingerprint.FingerprintManager.RemovalCallback;
|
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.EventLog;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.accessibility.AccessibilityManager;
|
import android.view.accessibility.AccessibilityManager;
|
||||||
import android.widget.ListView;
|
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.android.internal.logging.MetricsLogger;
|
import com.android.internal.logging.MetricsLogger;
|
||||||
@@ -181,17 +179,12 @@ public class ChooseLockGeneric extends SettingsActivity {
|
|||||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
if (mForFingerprint) {
|
if (mForFingerprint) {
|
||||||
final LayoutInflater inflater = LayoutInflater.from(getContext());
|
setHeaderView(R.layout.choose_lock_generic_fingerprint_header);
|
||||||
final ListView listView = getListView();
|
|
||||||
final View fingerprintHeader = inflater.inflate(
|
|
||||||
R.layout.choose_lock_generic_fingerprint_header, listView, false);
|
|
||||||
listView.addHeaderView(fingerprintHeader, null, false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
|
public boolean onPreferenceTreeClick(Preference preference) {
|
||||||
Preference preference) {
|
|
||||||
final String key = preference.getKey();
|
final String key = preference.getKey();
|
||||||
|
|
||||||
if (!isUnlockMethodSecure(key) && mLockPatternUtils.isSecure(UserHandle.myUserId())) {
|
if (!isUnlockMethodSecure(key) && mLockPatternUtils.isSecure(UserHandle.myUserId())) {
|
||||||
|
|||||||
@@ -16,14 +16,6 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
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.Activity;
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
import android.app.admin.DevicePolicyManager;
|
import android.app.admin.DevicePolicyManager;
|
||||||
@@ -44,13 +36,21 @@ import android.util.Log;
|
|||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
|
import android.view.ViewGroup;
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.TextView.OnEditorActionListener;
|
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 class ChooseLockPassword extends SettingsActivity {
|
||||||
public static final String PASSWORD_MIN_KEY = "lockscreen.password_min";
|
public static final String PASSWORD_MIN_KEY = "lockscreen.password_min";
|
||||||
public static final String PASSWORD_MAX_KEY = "lockscreen.password_max";
|
public static final String PASSWORD_MAX_KEY = "lockscreen.password_max";
|
||||||
|
|||||||
@@ -16,17 +16,6 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
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.Activity;
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -40,6 +29,16 @@ import android.view.View;
|
|||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.TextView;
|
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.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import android.app.Activity;
|
|||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
import android.app.admin.DevicePolicyManager;
|
import android.app.admin.DevicePolicyManager;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.UserHandle;
|
|
||||||
|
|
||||||
import com.android.internal.widget.LockPatternUtils;
|
import com.android.internal.widget.LockPatternUtils;
|
||||||
|
|
||||||
|
|||||||
@@ -15,24 +15,16 @@
|
|||||||
*/
|
*/
|
||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import android.app.AlertDialog.Builder;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.hardware.display.DisplayManager;
|
import android.hardware.display.DisplayManager;
|
||||||
import android.hardware.display.DisplayManager.DisplayListener;
|
import android.hardware.display.DisplayManager.DisplayListener;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.preference.DialogPreference;
|
import android.support.v14.preference.SwitchPreference;
|
||||||
import android.preference.SwitchPreference;
|
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.Display;
|
import android.view.Display;
|
||||||
import android.view.Display.ColorTransform;
|
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;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
|||||||
@@ -16,18 +16,10 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
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.Fragment;
|
||||||
import android.app.admin.DevicePolicyManager;
|
import android.app.admin.DevicePolicyManager;
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.CountDownTimer;
|
import android.os.CountDownTimer;
|
||||||
@@ -35,6 +27,7 @@ import android.os.Handler;
|
|||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.os.storage.StorageManager;
|
import android.os.storage.StorageManager;
|
||||||
import android.text.InputType;
|
import android.text.InputType;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -46,6 +39,13 @@ import android.view.inputmethod.InputMethodManager;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.TextView.OnEditorActionListener;
|
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;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
|
public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
|
||||||
|
|||||||
@@ -16,30 +16,30 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
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.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.LinearLayoutWithDefaultTouchRecepient;
|
||||||
import com.android.internal.widget.LockPatternChecker;
|
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.internal.widget.LockPatternView.Cell;
|
||||||
import com.android.settingslib.animation.AppearAnimationCreator;
|
import com.android.settingslib.animation.AppearAnimationCreator;
|
||||||
import com.android.settingslib.animation.AppearAnimationUtils;
|
import com.android.settingslib.animation.AppearAnimationUtils;
|
||||||
import com.android.settingslib.animation.DisappearAnimationUtils;
|
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.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
55
src/com/android/settings/CopyablePreference.java
Normal file
55
src/com/android/settings/CopyablePreference.java
Normal file
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -27,13 +27,13 @@ import android.content.pm.UserInfo;
|
|||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.RemoteException;
|
|
||||||
import android.os.Process;
|
import android.os.Process;
|
||||||
|
import android.os.RemoteException;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
import android.security.Credentials;
|
import android.security.Credentials;
|
||||||
import android.security.KeyChain.KeyChainConnection;
|
|
||||||
import android.security.KeyChain;
|
import android.security.KeyChain;
|
||||||
|
import android.security.KeyChain.KeyChainConnection;
|
||||||
import android.security.KeyStore;
|
import android.security.KeyStore;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|||||||
@@ -65,11 +65,10 @@ import com.android.internal.telephony.PhoneConstants;
|
|||||||
import com.android.internal.widget.LockPatternUtils;
|
import com.android.internal.widget.LockPatternUtils;
|
||||||
import com.android.internal.widget.LockPatternView;
|
import com.android.internal.widget.LockPatternView;
|
||||||
import com.android.internal.widget.LockPatternView.Cell;
|
import com.android.internal.widget.LockPatternView.Cell;
|
||||||
|
import com.android.internal.widget.LockPatternView.DisplayMode;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.android.internal.widget.LockPatternView.DisplayMode;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Settings screens to show the UI flows for encrypting/decrypting the device.
|
* Settings screens to show the UI flows for encrypting/decrypting the device.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Fragment;
|
|
||||||
import android.app.StatusBarManager;
|
import android.app.StatusBarManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ package com.android.settings;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Fragment;
|
|
||||||
import android.app.admin.DevicePolicyManager;
|
import android.app.admin.DevicePolicyManager;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -29,12 +28,13 @@ import android.os.BatteryManager;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.os.storage.StorageManager;
|
import android.os.storage.StorageManager;
|
||||||
import android.preference.Preference;
|
import android.support.v7.preference.Preference;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
|
||||||
import com.android.internal.logging.MetricsLogger;
|
import com.android.internal.logging.MetricsLogger;
|
||||||
|
|
||||||
public class CryptKeeperSettings extends InstrumentedFragment {
|
public class CryptKeeperSettings extends InstrumentedFragment {
|
||||||
@@ -193,7 +193,7 @@ public class CryptKeeperSettings extends InstrumentedFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void showFinalConfirmation(int type, String password) {
|
private void showFinalConfirmation(int type, String password) {
|
||||||
Preference preference = new Preference(getActivity());
|
Preference preference = new Preference(getPreferenceManager().getContext());
|
||||||
preference.setFragment(CryptKeeperConfirm.class.getName());
|
preference.setFragment(CryptKeeperConfirm.class.getName());
|
||||||
preference.setTitle(R.string.crypt_keeper_confirm_title);
|
preference.setTitle(R.string.crypt_keeper_confirm_title);
|
||||||
addEncryptionInfoToPreference(preference, type, password);
|
addEncryptionInfoToPreference(preference, type, password);
|
||||||
|
|||||||
101
src/com/android/settings/CustomDialogPreference.java
Normal file
101
src/com/android/settings/CustomDialogPreference.java
Normal file
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
117
src/com/android/settings/CustomEditTextPreference.java
Normal file
117
src/com/android/settings/CustomEditTextPreference.java
Normal file
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
70
src/com/android/settings/CustomListPreference.java
Normal file
70
src/com/android/settings/CustomListPreference.java
Normal file
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,37 +16,6 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
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.animation.LayoutTransition;
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
@@ -55,6 +24,8 @@ import android.app.DialogFragment;
|
|||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
import android.app.FragmentTransaction;
|
import android.app.FragmentTransaction;
|
||||||
import android.app.LoaderManager.LoaderCallbacks;
|
import android.app.LoaderManager.LoaderCallbacks;
|
||||||
|
import android.icu.impl.ICUResourceBundle;
|
||||||
|
import android.icu.util.UResourceBundle;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
@@ -68,8 +39,6 @@ import android.content.res.Resources;
|
|||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.icu.impl.ICUResourceBundle;
|
|
||||||
import android.icu.util.UResourceBundle;
|
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.INetworkPolicyManager;
|
import android.net.INetworkPolicyManager;
|
||||||
import android.net.INetworkStatsService;
|
import android.net.INetworkStatsService;
|
||||||
@@ -88,7 +57,7 @@ import android.os.ServiceManager;
|
|||||||
import android.os.SystemProperties;
|
import android.os.SystemProperties;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
import android.preference.Preference;
|
import android.support.v7.preference.Preference;
|
||||||
import android.telephony.SubscriptionInfo;
|
import android.telephony.SubscriptionInfo;
|
||||||
import android.telephony.SubscriptionManager;
|
import android.telephony.SubscriptionManager;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
@@ -156,6 +125,37 @@ import java.util.Locale;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
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
|
* Panel showing data usage history across various networks, including options
|
||||||
* to inspect based on usage cycle and control through {@link NetworkPolicy}.
|
* to inspect based on usage cycle and control through {@link NetworkPolicy}.
|
||||||
|
|||||||
@@ -29,11 +29,10 @@ import android.content.IntentFilter;
|
|||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.Preference;
|
|
||||||
import android.preference.PreferenceScreen;
|
|
||||||
import android.preference.SwitchPreference;
|
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.provider.Settings.SettingNotFoundException;
|
import android.provider.Settings.SettingNotFoundException;
|
||||||
|
import android.support.v14.preference.SwitchPreference;
|
||||||
|
import android.support.v7.preference.Preference;
|
||||||
import android.text.format.DateFormat;
|
import android.text.format.DateFormat;
|
||||||
import android.widget.DatePicker;
|
import android.widget.DatePicker;
|
||||||
import android.widget.TimePicker;
|
import android.widget.TimePicker;
|
||||||
@@ -270,7 +269,7 @@ public class DateTimeSettings extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
|
public boolean onPreferenceTreeClick(Preference preference) {
|
||||||
if (preference == mDatePref) {
|
if (preference == mDatePref) {
|
||||||
showDialog(DIALOG_DATEPICKER);
|
showDialog(DIALOG_DATEPICKER);
|
||||||
} else if (preference == mTimePref) {
|
} else if (preference == mTimePref) {
|
||||||
@@ -283,7 +282,7 @@ public class DateTimeSettings extends SettingsPreferenceFragment
|
|||||||
updateTimeAndDateDisplay(getActivity());
|
updateTimeAndDateDisplay(getActivity());
|
||||||
timeUpdated(is24Hour);
|
timeUpdated(is24Hour);
|
||||||
}
|
}
|
||||||
return super.onPreferenceTreeClick(preferenceScreen, preference);
|
return super.onPreferenceTreeClick(preference);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -23,10 +23,10 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.Preference;
|
|
||||||
import android.preference.PreferenceFragment;
|
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.provider.Settings.SettingNotFoundException;
|
import android.provider.Settings.SettingNotFoundException;
|
||||||
|
import android.support.v14.preference.PreferenceFragment;
|
||||||
|
import android.support.v7.preference.Preference;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.media.RingtoneManager;
|
import android.media.RingtoneManager;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.preference.RingtonePreference;
|
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
|
||||||
public class DefaultRingtonePreference extends RingtonePreference {
|
public class DefaultRingtonePreference extends RingtonePreference {
|
||||||
@@ -32,7 +31,7 @@ public class DefaultRingtonePreference extends RingtonePreference {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPrepareRingtonePickerIntent(Intent ringtonePickerIntent) {
|
public void onPrepareRingtonePickerIntent(Intent ringtonePickerIntent) {
|
||||||
super.onPrepareRingtonePickerIntent(ringtonePickerIntent);
|
super.onPrepareRingtonePickerIntent(ringtonePickerIntent);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -52,16 +52,15 @@ import android.os.RemoteException;
|
|||||||
import android.os.ServiceManager;
|
import android.os.ServiceManager;
|
||||||
import android.os.StrictMode;
|
import android.os.StrictMode;
|
||||||
import android.os.SystemProperties;
|
import android.os.SystemProperties;
|
||||||
import android.os.UserHandle;
|
|
||||||
import android.os.UserManager;
|
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.SearchIndexableResource;
|
||||||
import android.provider.Settings;
|
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.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.HardwareRenderer;
|
import android.view.HardwareRenderer;
|
||||||
@@ -294,7 +293,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
if (!mUm.isAdminUser()
|
if (!mUm.isAdminUser()
|
||||||
|| mUm.hasUserRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES)) {
|
|| mUm.hasUserRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES)) {
|
||||||
mUnavailable = true;
|
mUnavailable = true;
|
||||||
setPreferenceScreen(new PreferenceScreen(getActivity(), null));
|
setPreferenceScreen(new PreferenceScreen(getPrefContext(), null));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -500,7 +499,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
if (mUnavailable) {
|
if (mUnavailable) {
|
||||||
// Show error message
|
// Show error message
|
||||||
TextView emptyView = (TextView) getView().findViewById(android.R.id.empty);
|
TextView emptyView = (TextView) getView().findViewById(android.R.id.empty);
|
||||||
getListView().setEmptyView(emptyView);
|
setEmptyView(emptyView);
|
||||||
if (emptyView != null) {
|
if (emptyView != null) {
|
||||||
emptyView.setText(R.string.development_settings_not_available);
|
emptyView.setText(R.string.development_settings_not_available);
|
||||||
}
|
}
|
||||||
@@ -645,7 +644,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
SwitchPreference cb = mResetSwitchPrefs.get(i);
|
SwitchPreference cb = mResetSwitchPrefs.get(i);
|
||||||
if (cb.isChecked()) {
|
if (cb.isChecked()) {
|
||||||
cb.setChecked(false);
|
cb.setChecked(false);
|
||||||
onPreferenceTreeClick(null, cb);
|
onPreferenceTreeClick(cb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resetDebuggerOptions();
|
resetDebuggerOptions();
|
||||||
@@ -1570,7 +1569,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
|
public boolean onPreferenceTreeClick(Preference preference) {
|
||||||
if (Utils.isMonkeyRunning()) {
|
if (Utils.isMonkeyRunning()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1690,7 +1689,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
} else if (INACTIVE_APPS_KEY.equals(preference.getKey())) {
|
} else if (INACTIVE_APPS_KEY.equals(preference.getKey())) {
|
||||||
startInactiveAppsFragment();
|
startInactiveAppsFragment();
|
||||||
} else {
|
} else {
|
||||||
return super.onPreferenceTreeClick(preferenceScreen, preference);
|
return super.onPreferenceTreeClick(preference);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -16,13 +16,10 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import android.app.AppOpsManager;
|
|
||||||
|
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.ActivityManagerNative;
|
import android.app.ActivityManagerNative;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
|
import android.app.AppOpsManager;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.app.admin.DeviceAdminInfo;
|
import android.app.admin.DeviceAdminInfo;
|
||||||
import android.app.admin.DeviceAdminReceiver;
|
import android.app.admin.DeviceAdminReceiver;
|
||||||
@@ -57,6 +54,8 @@ import android.widget.Button;
|
|||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import org.xmlpull.v1.XmlPullParserException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.ListFragment;
|
import android.app.ListFragment;
|
||||||
@@ -47,6 +45,8 @@ import android.widget.ImageView;
|
|||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import org.xmlpull.v1.XmlPullParserException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|||||||
@@ -28,13 +28,11 @@ import android.os.PersistableBundle;
|
|||||||
import android.os.SELinux;
|
import android.os.SELinux;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.os.SystemProperties;
|
import android.os.SystemProperties;
|
||||||
import android.os.UserHandle;
|
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
import android.preference.Preference;
|
|
||||||
import android.preference.PreferenceGroup;
|
|
||||||
import android.preference.PreferenceScreen;
|
|
||||||
import android.provider.SearchIndexableResource;
|
import android.provider.SearchIndexableResource;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
import android.support.v7.preference.Preference;
|
||||||
|
import android.support.v7.preference.PreferenceGroup;
|
||||||
import android.telephony.CarrierConfigManager;
|
import android.telephony.CarrierConfigManager;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.text.format.DateFormat;
|
import android.text.format.DateFormat;
|
||||||
@@ -208,7 +206,7 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment implements In
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
|
public boolean onPreferenceTreeClick(Preference preference) {
|
||||||
if (preference.getKey().equals(KEY_FIRMWARE_VERSION)) {
|
if (preference.getKey().equals(KEY_FIRMWARE_VERSION)) {
|
||||||
System.arraycopy(mHits, 1, mHits, 0, mHits.length-1);
|
System.arraycopy(mHits, 1, mHits, 0, mHits.length-1);
|
||||||
mHits[mHits.length-1] = SystemClock.uptimeMillis();
|
mHits[mHits.length-1] = SystemClock.uptimeMillis();
|
||||||
@@ -278,7 +276,7 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment implements In
|
|||||||
ciActionOnSysUpdate(b);
|
ciActionOnSysUpdate(b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return super.onPreferenceTreeClick(preferenceScreen, preference);
|
return super.onPreferenceTreeClick(preference);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,10 +19,10 @@ package com.android.settings;
|
|||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.drawable.Drawable;
|
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.text.TextUtils;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.View;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -66,8 +66,8 @@ public class DimmableIconPreference extends Preference {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onBindView(View view) {
|
public void onBindViewHolder(PreferenceViewHolder view) {
|
||||||
super.onBindView(view);
|
super.onBindViewHolder(view);
|
||||||
if (!TextUtils.isEmpty(mContentDescription)) {
|
if (!TextUtils.isEmpty(mContentDescription)) {
|
||||||
final TextView titleView = (TextView) view.findViewById(android.R.id.title);
|
final TextView titleView = (TextView) view.findViewById(android.R.id.title);
|
||||||
titleView.setContentDescription(mContentDescription);
|
titleView.setContentDescription(mContentDescription);
|
||||||
|
|||||||
@@ -16,19 +16,8 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
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.Activity;
|
||||||
import android.app.ActivityManagerNative;
|
import android.app.ActivityManagerNative;
|
||||||
import android.app.Dialog;
|
|
||||||
import android.app.UiModeManager;
|
import android.app.UiModeManager;
|
||||||
import android.app.admin.DevicePolicyManager;
|
import android.app.admin.DevicePolicyManager;
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
@@ -41,14 +30,12 @@ import android.os.Build;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.SystemProperties;
|
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.SearchIndexableResource;
|
||||||
import android.provider.Settings;
|
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.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
@@ -60,6 +47,16 @@ import com.android.settings.search.Indexable;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
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
|
public class DisplaySettings extends SettingsPreferenceFragment implements
|
||||||
Preference.OnPreferenceChangeListener, Indexable {
|
Preference.OnPreferenceChangeListener, Indexable {
|
||||||
private static final String TAG = "DisplaySettings";
|
private static final String TAG = "DisplaySettings";
|
||||||
@@ -420,11 +417,6 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
|
|
||||||
return super.onPreferenceTreeClick(preferenceScreen, preference);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceChange(Preference preference, Object objValue) {
|
public boolean onPreferenceChange(Preference preference, Object objValue) {
|
||||||
final String key = preference.getKey();
|
final String key = preference.getKey();
|
||||||
|
|||||||
@@ -25,8 +25,9 @@ import android.content.DialogInterface;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.v7.preference.Preference;
|
||||||
|
import android.support.v7.preference.PreferenceViewHolder;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
@@ -35,10 +36,7 @@ import android.view.MotionEvent;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.view.View.OnTouchListener;
|
import android.view.View.OnTouchListener;
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.ArrayAdapter;
|
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.ListView;
|
|
||||||
import android.widget.RadioButton;
|
import android.widget.RadioButton;
|
||||||
import android.widget.Switch;
|
import android.widget.Switch;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@@ -46,6 +44,7 @@ import android.widget.TextView;
|
|||||||
import com.android.internal.logging.MetricsLogger;
|
import com.android.internal.logging.MetricsLogger;
|
||||||
import com.android.settings.widget.SwitchBar;
|
import com.android.settings.widget.SwitchBar;
|
||||||
import com.android.settingslib.dream.DreamBackend;
|
import com.android.settingslib.dream.DreamBackend;
|
||||||
|
import com.android.settingslib.dream.DreamBackend.DreamInfo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -60,7 +59,6 @@ public class DreamSettings extends SettingsPreferenceFragment implements
|
|||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private DreamBackend mBackend;
|
private DreamBackend mBackend;
|
||||||
private DreamInfoAdapter mAdapter;
|
|
||||||
private SwitchBar mSwitchBar;
|
private SwitchBar mSwitchBar;
|
||||||
private MenuItem[] mMenuItemsWhenEnabled;
|
private MenuItem[] mMenuItemsWhenEnabled;
|
||||||
private boolean mRefreshing;
|
private boolean mRefreshing;
|
||||||
@@ -120,15 +118,9 @@ public class DreamSettings extends SettingsPreferenceFragment implements
|
|||||||
logd("onActivityCreated(%s)", savedInstanceState);
|
logd("onActivityCreated(%s)", savedInstanceState);
|
||||||
super.onActivityCreated(savedInstanceState);
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
|
||||||
ListView listView = getListView();
|
|
||||||
listView.setItemsCanFocus(true);
|
|
||||||
|
|
||||||
TextView emptyView = (TextView) getView().findViewById(android.R.id.empty);
|
TextView emptyView = (TextView) getView().findViewById(android.R.id.empty);
|
||||||
emptyView.setText(R.string.screensaver_settings_disabled_prompt);
|
emptyView.setText(R.string.screensaver_settings_disabled_prompt);
|
||||||
listView.setEmptyView(emptyView);
|
setEmptyView(emptyView);
|
||||||
|
|
||||||
mAdapter = new DreamInfoAdapter(mContext);
|
|
||||||
listView.setAdapter(mAdapter);
|
|
||||||
|
|
||||||
final SettingsActivity sa = (SettingsActivity) getActivity();
|
final SettingsActivity sa = (SettingsActivity) getActivity();
|
||||||
mSwitchBar = sa.getSwitchBar();
|
mSwitchBar = sa.getSwitchBar();
|
||||||
@@ -269,10 +261,17 @@ public class DreamSettings extends SettingsPreferenceFragment implements
|
|||||||
if (mSwitchBar.isChecked() != dreamsEnabled)
|
if (mSwitchBar.isChecked() != dreamsEnabled)
|
||||||
mSwitchBar.setChecked(dreamsEnabled);
|
mSwitchBar.setChecked(dreamsEnabled);
|
||||||
|
|
||||||
mAdapter.clear();
|
if (getPreferenceScreen() == null) {
|
||||||
|
setPreferenceScreen(getPreferenceManager().createPreferenceScreen(getContext()));
|
||||||
|
}
|
||||||
|
getPreferenceScreen().removeAll();
|
||||||
if (dreamsEnabled) {
|
if (dreamsEnabled) {
|
||||||
List<DreamBackend.DreamInfo> dreamInfos = mBackend.getDreamInfos();
|
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)
|
if (mMenuItemsWhenEnabled != null)
|
||||||
for (MenuItem menuItem : mMenuItemsWhenEnabled)
|
for (MenuItem menuItem : mMenuItemsWhenEnabled)
|
||||||
@@ -285,85 +284,63 @@ public class DreamSettings extends SettingsPreferenceFragment implements
|
|||||||
Log.d(TAG, args == null || args.length == 0 ? msg : String.format(msg, args));
|
Log.d(TAG, args == null || args.length == 0 ? msg : String.format(msg, args));
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DreamInfoAdapter extends ArrayAdapter<DreamBackend.DreamInfo> {
|
private class DreamInfoPreference extends Preference {
|
||||||
private final LayoutInflater mInflater;
|
|
||||||
|
|
||||||
public DreamInfoAdapter(Context context) {
|
private final DreamInfo mInfo;
|
||||||
super(context, 0);
|
|
||||||
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
public DreamInfoPreference(Context context, DreamInfo info) {
|
||||||
|
super(context);
|
||||||
|
mInfo = info;
|
||||||
|
setLayoutResource(R.layout.dream_info_row);
|
||||||
|
setTitle(mInfo.caption);
|
||||||
|
setIcon(mInfo.icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void onBindViewHolder(final PreferenceViewHolder holder) {
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
super.onBindViewHolder(holder);
|
||||||
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);
|
|
||||||
|
|
||||||
// bind radio button
|
// bind radio button
|
||||||
RadioButton radioButton = (RadioButton) row.findViewById(android.R.id.button1);
|
RadioButton radioButton = (RadioButton) holder.findViewById(android.R.id.button1);
|
||||||
radioButton.setChecked(dreamInfo.isActive);
|
radioButton.setChecked(mInfo.isActive);
|
||||||
radioButton.setOnTouchListener(new OnTouchListener() {
|
radioButton.setOnTouchListener(new OnTouchListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouch(View v, MotionEvent event) {
|
public boolean onTouch(View v, MotionEvent event) {
|
||||||
row.onTouchEvent(event);
|
holder.itemView.onTouchEvent(event);
|
||||||
return false;
|
return false;
|
||||||
}});
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// bind settings button + divider
|
// bind settings button + divider
|
||||||
boolean showSettings = dreamInfo.settingsComponentName != null;
|
boolean showSettings = mInfo.settingsComponentName != null;
|
||||||
View settingsDivider = row.findViewById(R.id.divider);
|
View settingsDivider = holder.findViewById(R.id.divider);
|
||||||
settingsDivider.setVisibility(showSettings ? View.VISIBLE : View.INVISIBLE);
|
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.setVisibility(showSettings ? View.VISIBLE : View.INVISIBLE);
|
||||||
settingsButton.setAlpha(dreamInfo.isActive ? 1f : Utils.DISABLED_ALPHA);
|
settingsButton.setAlpha(mInfo.isActive ? 1f : Utils.DISABLED_ALPHA);
|
||||||
settingsButton.setEnabled(dreamInfo.isActive);
|
settingsButton.setEnabled(mInfo.isActive);
|
||||||
settingsButton.setFocusable(dreamInfo.isActive);
|
settingsButton.setFocusable(mInfo.isActive);
|
||||||
settingsButton.setOnClickListener(new OnClickListener(){
|
settingsButton.setOnClickListener(new OnClickListener(){
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
mBackend.launchSettings((DreamBackend.DreamInfo) row.getTag());
|
mBackend.launchSettings(mInfo);
|
||||||
}});
|
}
|
||||||
|
});
|
||||||
return row;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
@Override
|
||||||
public void onClick(View v) {
|
public void performClick() {
|
||||||
v.setPressed(true);
|
if (mInfo.isActive)
|
||||||
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()))
|
|
||||||
return;
|
return;
|
||||||
for (int i = 0; i < getCount(); i++) {
|
for (int i = 0; i < getPreferenceScreen().getPreferenceCount(); i++) {
|
||||||
getItem(i).isActive = false;
|
DreamInfoPreference preference =
|
||||||
|
(DreamInfoPreference) getPreferenceScreen().getPreference(i);
|
||||||
|
preference.mInfo.isActive = false;
|
||||||
|
preference.notifyChanged();
|
||||||
}
|
}
|
||||||
dreamInfo.isActive = true;
|
mInfo.isActive = true;
|
||||||
mBackend.setActiveDream(dreamInfo.componentName);
|
mBackend.setActiveDream(mInfo.componentName);
|
||||||
notifyDataSetChanged();
|
notifyChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,9 +17,9 @@
|
|||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import android.content.Context;
|
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.AttributeSet;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
@@ -27,8 +27,6 @@ import android.widget.AdapterView.OnItemSelectedListener;
|
|||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
|
|
||||||
import libcore.util.Objects;
|
|
||||||
|
|
||||||
public class DropDownPreference extends ListPreference {
|
public class DropDownPreference extends ListPreference {
|
||||||
|
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
@@ -105,13 +103,13 @@ public class DropDownPreference extends ListPreference {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onBindView(View view) {
|
public void onBindViewHolder(PreferenceViewHolder view) {
|
||||||
super.onBindView(view);
|
super.onBindViewHolder(view);
|
||||||
if (view.equals(mSpinner.getParent())) return;
|
if (view.equals(mSpinner.getParent())) return;
|
||||||
if (mSpinner.getParent() != null) {
|
if (mSpinner.getParent() != null) {
|
||||||
((ViewGroup) mSpinner.getParent()).removeView(mSpinner);
|
((ViewGroup) mSpinner.getParent()).removeView(mSpinner);
|
||||||
}
|
}
|
||||||
final ViewGroup vg = (ViewGroup) view;
|
final ViewGroup vg = (ViewGroup) view.itemView;
|
||||||
vg.addView(mSpinner, 0);
|
vg.addView(mSpinner, 0);
|
||||||
final ViewGroup.LayoutParams lp = mSpinner.getLayoutParams();
|
final ViewGroup.LayoutParams lp = mSpinner.getLayoutParams();
|
||||||
lp.width = 0;
|
lp.width = 0;
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ package com.android.settings;
|
|||||||
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.preference.EditTextPreference;
|
|
||||||
import android.text.InputType;
|
import android.text.InputType;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -27,7 +26,7 @@ import android.widget.EditText;
|
|||||||
/**
|
/**
|
||||||
* TODO: Add a soft dialpad for PIN entry.
|
* TODO: Add a soft dialpad for PIN entry.
|
||||||
*/
|
*/
|
||||||
class EditPinPreference extends EditTextPreference {
|
class EditPinPreference extends CustomEditTextPreference {
|
||||||
|
|
||||||
interface OnPinEnteredListener {
|
interface OnPinEnteredListener {
|
||||||
void onPinEntered(EditPinPreference preference, boolean positiveResult);
|
void onPinEntered(EditPinPreference preference, boolean positiveResult);
|
||||||
@@ -75,7 +74,7 @@ class EditPinPreference extends EditTextPreference {
|
|||||||
public void showPinDialog() {
|
public void showPinDialog() {
|
||||||
Dialog dialog = getDialog();
|
Dialog dialog = getDialog();
|
||||||
if (dialog == null || !dialog.isShowing()) {
|
if (dialog == null || !dialog.isShowing()) {
|
||||||
showDialog(null);
|
onClick();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,14 +16,6 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
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.accessibilityservice.AccessibilityServiceInfo;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
@@ -41,6 +33,11 @@ import android.view.accessibility.AccessibilityManager;
|
|||||||
import android.widget.RadioButton;
|
import android.widget.RadioButton;
|
||||||
import android.widget.TextView;
|
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 {
|
public class EncryptionInterstitial extends SettingsActivity {
|
||||||
|
|
||||||
protected static final String EXTRA_PASSWORD_QUALITY = "extra_password_quality";
|
protected static final String EXTRA_PASSWORD_QUALITY = "extra_password_quality";
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import android.app.Fragment;
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|||||||
@@ -16,9 +16,6 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
@@ -32,8 +29,8 @@ import android.content.pm.ApplicationInfo;
|
|||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.ResolveInfo;
|
import android.content.pm.ResolveInfo;
|
||||||
import android.content.res.Resources;
|
|
||||||
import android.content.pm.UserInfo;
|
import android.content.pm.UserInfo;
|
||||||
|
import android.content.res.Resources;
|
||||||
import android.graphics.ColorFilter;
|
import android.graphics.ColorFilter;
|
||||||
import android.graphics.ColorMatrix;
|
import android.graphics.ColorMatrix;
|
||||||
import android.graphics.ColorMatrixColorFilter;
|
import android.graphics.ColorMatrixColorFilter;
|
||||||
@@ -43,20 +40,25 @@ import android.os.Build;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
import android.preference.Preference;
|
import android.support.v7.preference.Preference;
|
||||||
import android.preference.PreferenceGroup;
|
import android.support.v7.preference.PreferenceGroup;
|
||||||
|
import android.support.v7.preference.PreferenceViewHolder;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.RadioButton;
|
import android.widget.RadioButton;
|
||||||
|
|
||||||
import com.android.internal.logging.MetricsLogger;
|
import com.android.internal.logging.MetricsLogger;
|
||||||
import com.android.settings.search.BaseSearchIndexProvider;
|
import com.android.settings.search.BaseSearchIndexProvider;
|
||||||
import com.android.settings.search.Index;
|
import com.android.settings.search.Index;
|
||||||
import com.android.settings.search.Indexable;
|
import com.android.settings.search.Indexable;
|
||||||
import com.android.settings.search.SearchIndexableRaw;
|
import com.android.settings.search.SearchIndexableRaw;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class HomeSettings extends SettingsPreferenceFragment implements Indexable {
|
public class HomeSettings extends SettingsPreferenceFragment implements Indexable {
|
||||||
static final String TAG = "HomeSettings";
|
static final String TAG = "HomeSettings";
|
||||||
|
|
||||||
@@ -176,7 +178,7 @@ public class HomeSettings extends SettingsPreferenceFragment implements Indexabl
|
|||||||
ArrayList<ResolveInfo> homeActivities = new ArrayList<ResolveInfo>();
|
ArrayList<ResolveInfo> homeActivities = new ArrayList<ResolveInfo>();
|
||||||
ComponentName currentDefaultHome = mPm.getHomeActivities(homeActivities);
|
ComponentName currentDefaultHome = mPm.getHomeActivities(homeActivities);
|
||||||
|
|
||||||
Context context = getActivity();
|
Context context = getPrefContext();
|
||||||
mCurrentHome = null;
|
mCurrentHome = null;
|
||||||
mPrefGroup.removeAll();
|
mPrefGroup.removeAll();
|
||||||
mPrefs = new ArrayList<HomeAppPreference>();
|
mPrefs = new ArrayList<HomeAppPreference>();
|
||||||
@@ -350,8 +352,8 @@ public class HomeSettings extends SettingsPreferenceFragment implements Indexabl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onBindView(View view) {
|
public void onBindViewHolder(PreferenceViewHolder view) {
|
||||||
super.onBindView(view);
|
super.onBindViewHolder(view);
|
||||||
|
|
||||||
RadioButton radio = (RadioButton) view.findViewById(R.id.home_radio);
|
RadioButton radio = (RadioButton) view.findViewById(R.id.home_radio);
|
||||||
radio.setChecked(isChecked);
|
radio.setChecked(isChecked);
|
||||||
|
|||||||
@@ -25,10 +25,9 @@ import android.os.AsyncResult;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.preference.Preference;
|
import android.support.v14.preference.SwitchPreference;
|
||||||
import android.preference.PreferenceActivity;
|
import android.support.v7.preference.Preference;
|
||||||
import android.preference.PreferenceScreen;
|
import android.support.v7.preference.PreferenceScreen;
|
||||||
import android.preference.SwitchPreference;
|
|
||||||
import android.telephony.SubscriptionInfo;
|
import android.telephony.SubscriptionInfo;
|
||||||
import android.telephony.SubscriptionManager;
|
import android.telephony.SubscriptionManager;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ package com.android.settings;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.drawable.Drawable;
|
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.util.AttributeSet;
|
||||||
import android.view.View;
|
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
@@ -45,8 +45,8 @@ public class IconPreferenceScreen extends Preference {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindView(View view) {
|
public void onBindViewHolder(PreferenceViewHolder view) {
|
||||||
super.onBindView(view);
|
super.onBindViewHolder(view);
|
||||||
ImageView imageView = (ImageView) view.findViewById(R.id.icon);
|
ImageView imageView = (ImageView) view.findViewById(R.id.icon);
|
||||||
if (imageView != null && mIcon != null) {
|
if (imageView != null && mIcon != null) {
|
||||||
imageView.setImageDrawable(mIcon);
|
imageView.setImageDrawable(mIcon);
|
||||||
|
|||||||
@@ -16,10 +16,10 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import com.android.internal.logging.MetricsLogger;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
|
||||||
|
import com.android.internal.logging.MetricsLogger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instrumented activity that logs visibility state.
|
* Instrumented activity that logs visibility state.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -16,7 +16,9 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import android.preference.PreferenceFragment;
|
import android.os.Bundle;
|
||||||
|
import android.support.v14.preference.PreferenceFragment;
|
||||||
|
|
||||||
import com.android.internal.logging.MetricsLogger;
|
import com.android.internal.logging.MetricsLogger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,6 +39,10 @@ public abstract class InstrumentedFragment extends PreferenceFragment {
|
|||||||
*/
|
*/
|
||||||
protected abstract int getMetricsCategory();
|
protected abstract int getMetricsCategory();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import android.preference.PreferenceActivity;
|
|
||||||
import com.android.internal.logging.MetricsLogger;
|
import com.android.internal.logging.MetricsLogger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -16,7 +16,8 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import android.preference.PreferenceFragment;
|
import android.support.v14.preference.PreferenceFragment;
|
||||||
|
|
||||||
import com.android.internal.logging.MetricsLogger;
|
import com.android.internal.logging.MetricsLogger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ import android.content.pm.ApplicationInfo;
|
|||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.ResolveInfo;
|
import android.content.pm.ResolveInfo;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceGroup;
|
|
||||||
import android.provider.SearchIndexableResource;
|
import android.provider.SearchIndexableResource;
|
||||||
|
import android.support.v7.preference.PreferenceGroup;
|
||||||
|
|
||||||
import com.android.internal.logging.MetricsLogger;
|
import com.android.internal.logging.MetricsLogger;
|
||||||
import com.android.settings.search.BaseSearchIndexProvider;
|
import com.android.settings.search.BaseSearchIndexProvider;
|
||||||
|
|||||||
@@ -23,7 +23,9 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
|
|
||||||
import com.android.settings.SettingsPreferenceFragment.SettingsDialogFragment;
|
import com.android.settings.SettingsPreferenceFragment.SettingsDialogFragment;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
public class LocalePicker extends com.android.internal.app.LocalePicker
|
public class LocalePicker extends com.android.internal.app.LocalePicker
|
||||||
|
|||||||
@@ -23,9 +23,9 @@ import android.content.Intent;
|
|||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.ResolveInfo;
|
import android.content.pm.ResolveInfo;
|
||||||
import android.content.pm.UserInfo;
|
import android.content.pm.UserInfo;
|
||||||
import android.util.Log;
|
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import android.accounts.Account;
|
|||||||
import android.accounts.AccountManager;
|
import android.accounts.AccountManager;
|
||||||
import android.accounts.AuthenticatorDescription;
|
import android.accounts.AuthenticatorDescription;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Fragment;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
@@ -29,7 +28,6 @@ import android.content.res.Resources;
|
|||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.os.Process;
|
|
||||||
import android.os.SystemProperties;
|
import android.os.SystemProperties;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
@@ -41,6 +39,7 @@ import android.widget.Button;
|
|||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.android.internal.logging.MetricsLogger;
|
import com.android.internal.logging.MetricsLogger;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@@ -18,21 +18,20 @@ package com.android.settings;
|
|||||||
|
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
import android.os.AsyncTask;
|
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.Bundle;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
|
import android.service.persistentdata.PersistentDataBlockManager;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.TextView;
|
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"
|
* 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
|
* state. Multiple confirmations are required: first, a general "are you sure
|
||||||
|
|||||||
75
src/com/android/settings/PreferenceActivity.java
Normal file
75
src/com/android/settings/PreferenceActivity.java
Normal file
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -21,22 +21,22 @@ import android.content.ContentResolver;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Process;
|
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.ServiceManager;
|
import android.os.ServiceManager;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.os.UserManager;
|
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.SearchIndexableResource;
|
||||||
import android.provider.Settings;
|
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 android.util.Log;
|
||||||
|
|
||||||
import com.android.internal.logging.MetricsLogger;
|
import com.android.internal.logging.MetricsLogger;
|
||||||
import com.android.settings.search.BaseSearchIndexProvider;
|
import com.android.settings.search.BaseSearchIndexProvider;
|
||||||
import com.android.settings.search.Indexable;
|
import com.android.settings.search.Indexable;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|||||||
@@ -17,7 +17,8 @@
|
|||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import android.content.Context;
|
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.util.AttributeSet;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
@@ -54,8 +55,8 @@ public class ProgressCategory extends ProgressCategoryBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindView(View view) {
|
public void onBindViewHolder(PreferenceViewHolder view) {
|
||||||
super.onBindView(view);
|
super.onBindViewHolder(view);
|
||||||
final View progressBar = view.findViewById(R.id.scanning_progress);
|
final View progressBar = view.findViewById(R.id.scanning_progress);
|
||||||
|
|
||||||
boolean noDeviceFound = (getPreferenceCount() == 0 ||
|
boolean noDeviceFound = (getPreferenceCount() == 0 ||
|
||||||
@@ -70,7 +71,7 @@ public class ProgressCategory extends ProgressCategoryBase {
|
|||||||
} else {
|
} else {
|
||||||
if (!mNoDeviceFoundAdded) {
|
if (!mNoDeviceFoundAdded) {
|
||||||
if (mNoDeviceFoundPreference == null) {
|
if (mNoDeviceFoundPreference == null) {
|
||||||
mNoDeviceFoundPreference = new Preference(getContext());
|
mNoDeviceFoundPreference = new Preference(getPreferenceManager().getContext());
|
||||||
mNoDeviceFoundPreference.setLayoutResource(R.layout.preference_empty_list);
|
mNoDeviceFoundPreference.setLayoutResource(R.layout.preference_empty_list);
|
||||||
mNoDeviceFoundPreference.setTitle(mEmptyTextRes);
|
mNoDeviceFoundPreference.setTitle(mEmptyTextRes);
|
||||||
mNoDeviceFoundPreference.setSelectable(false);
|
mNoDeviceFoundPreference.setSelectable(false);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.preference.PreferenceCategory;
|
import android.support.v7.preference.PreferenceCategory;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
|
||||||
public abstract class ProgressCategoryBase extends PreferenceCategory {
|
public abstract class ProgressCategoryBase extends PreferenceCategory {
|
||||||
|
|||||||
@@ -16,13 +16,9 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import com.android.internal.logging.MetricsLogger;
|
|
||||||
import com.android.settings.SettingsPreferenceFragment.SettingsDialogFragment;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.app.Fragment;
|
|
||||||
import android.app.admin.DevicePolicyManager;
|
import android.app.admin.DevicePolicyManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@@ -43,6 +39,9 @@ import android.widget.Button;
|
|||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.android.internal.logging.MetricsLogger;
|
||||||
|
import com.android.settings.SettingsPreferenceFragment.SettingsDialogFragment;
|
||||||
|
|
||||||
public class ProxySelector extends InstrumentedFragment implements DialogCreatable {
|
public class ProxySelector extends InstrumentedFragment implements DialogCreatable {
|
||||||
private static final String TAG = "ProxySelector";
|
private static final String TAG = "ProxySelector";
|
||||||
|
|
||||||
|
|||||||
@@ -32,10 +32,10 @@ import android.os.SystemProperties;
|
|||||||
import android.telephony.CellInfo;
|
import android.telephony.CellInfo;
|
||||||
import android.telephony.CellLocation;
|
import android.telephony.CellLocation;
|
||||||
import android.telephony.DataConnectionRealTimeInfo;
|
import android.telephony.DataConnectionRealTimeInfo;
|
||||||
|
import android.telephony.NeighboringCellInfo;
|
||||||
import android.telephony.PhoneStateListener;
|
import android.telephony.PhoneStateListener;
|
||||||
import android.telephony.ServiceState;
|
import android.telephony.ServiceState;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
import android.telephony.NeighboringCellInfo;
|
|
||||||
import android.telephony.cdma.CdmaCellLocation;
|
import android.telephony.cdma.CdmaCellLocation;
|
||||||
import android.telephony.gsm.GsmCellLocation;
|
import android.telephony.gsm.GsmCellLocation;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -46,22 +46,22 @@ import android.view.View.OnClickListener;
|
|||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
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.Phone;
|
||||||
import com.android.internal.telephony.PhoneConstants;
|
import com.android.internal.telephony.PhoneConstants;
|
||||||
import com.android.internal.telephony.PhoneFactory;
|
import com.android.internal.telephony.PhoneFactory;
|
||||||
import com.android.internal.telephony.PhoneStateIntentReceiver;
|
import com.android.internal.telephony.PhoneStateIntentReceiver;
|
||||||
import com.android.internal.telephony.TelephonyProperties;
|
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.io.IOException;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@@ -17,32 +17,19 @@
|
|||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Fragment;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
|
||||||
import android.os.SystemProperties;
|
|
||||||
import android.os.Process;
|
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
import android.preference.Preference;
|
|
||||||
import android.preference.PreferenceActivity;
|
|
||||||
import android.telephony.SubscriptionInfo;
|
import android.telephony.SubscriptionInfo;
|
||||||
import android.telephony.SubscriptionManager;
|
import android.telephony.SubscriptionManager;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.CheckBox;
|
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import com.android.internal.logging.MetricsLogger;
|
import com.android.internal.logging.MetricsLogger;
|
||||||
import com.android.internal.telephony.PhoneConstants;
|
import com.android.internal.telephony.PhoneConstants;
|
||||||
|
|||||||
@@ -16,9 +16,8 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import android.app.Fragment;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.bluetooth.BluetoothManager;
|
import android.bluetooth.BluetoothManager;
|
||||||
|
import android.content.Context;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.NetworkPolicyManager;
|
import android.net.NetworkPolicyManager;
|
||||||
import android.net.wifi.WifiManager;
|
import android.net.wifi.WifiManager;
|
||||||
@@ -29,17 +28,12 @@ import android.telephony.TelephonyManager;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ArrayAdapter;
|
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.Spinner;
|
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.android.internal.logging.MetricsLogger;
|
import com.android.internal.logging.MetricsLogger;
|
||||||
import com.android.internal.telephony.PhoneConstants;
|
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"
|
* 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
|
* state. Multiple confirmations are required: first, a general "are you sure
|
||||||
|
|||||||
236
src/com/android/settings/RingtonePreference.java
Normal file
236
src/com/android/settings/RingtonePreference.java
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -21,14 +21,13 @@ import android.content.Intent;
|
|||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.UserHandle;
|
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.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.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.Switch;
|
import android.widget.Switch;
|
||||||
|
|
||||||
import com.android.internal.logging.MetricsLogger;
|
import com.android.internal.logging.MetricsLogger;
|
||||||
@@ -68,8 +67,7 @@ public class ScreenPinningSettings extends SettingsPreferenceFragment
|
|||||||
|
|
||||||
View emptyView = LayoutInflater.from(activity)
|
View emptyView = LayoutInflater.from(activity)
|
||||||
.inflate(R.layout.screen_pinning_instructions, null);
|
.inflate(R.layout.screen_pinning_instructions, null);
|
||||||
((ViewGroup) getListView().getParent()).addView(emptyView);
|
setEmptyView(emptyView);
|
||||||
getListView().setEmptyView(emptyView);
|
|
||||||
|
|
||||||
mSwitchBar = activity.getSwitchBar();
|
mSwitchBar = activity.getSwitchBar();
|
||||||
mSwitchBar.addOnSwitchChangeListener(this);
|
mSwitchBar.addOnSwitchChangeListener(this);
|
||||||
|
|||||||
@@ -33,17 +33,17 @@ import android.os.Bundle;
|
|||||||
import android.os.PersistableBundle;
|
import android.os.PersistableBundle;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.os.UserManager;
|
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.SearchIndexableResource;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.security.KeyStore;
|
import android.security.KeyStore;
|
||||||
import android.service.trust.TrustAgentService;
|
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.CarrierConfigManager;
|
||||||
import android.telephony.SubscriptionInfo;
|
import android.telephony.SubscriptionInfo;
|
||||||
import android.telephony.SubscriptionManager;
|
import android.telephony.SubscriptionManager;
|
||||||
@@ -637,7 +637,7 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
|
public boolean onPreferenceTreeClick(Preference preference) {
|
||||||
final String key = preference.getKey();
|
final String key = preference.getKey();
|
||||||
if (KEY_UNLOCK_SET_OR_CHANGE.equals(key)) {
|
if (KEY_UNLOCK_SET_OR_CHANGE.equals(key)) {
|
||||||
startFragment(this, "com.android.settings.ChooseLockGeneric$ChooseLockGenericFragment",
|
startFragment(this, "com.android.settings.ChooseLockGeneric$ChooseLockGenericFragment",
|
||||||
@@ -655,7 +655,7 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// If we didn't handle it, let preferences handle it.
|
// If we didn't handle it, let preferences handle it.
|
||||||
return super.onPreferenceTreeClick(preferenceScreen, preference);
|
return super.onPreferenceTreeClick(preference);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
260
src/com/android/settings/SeekBarPreference.java
Normal file
260
src/com/android/settings/SeekBarPreference.java
Normal file
@@ -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];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,13 +17,12 @@
|
|||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.preference.EditTextPreference;
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
|
||||||
public class SelectableEditTextPreference extends EditTextPreference {
|
public class SelectableEditTextPreference extends CustomEditTextPreference {
|
||||||
|
|
||||||
private int mSelectionMode;
|
private int mSelectionMode;
|
||||||
|
|
||||||
|
|||||||
@@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import static com.android.settings.dashboard.DashboardTile.TILE_ID_UNDEFINED;
|
|
||||||
|
|
||||||
import android.app.ActionBar;
|
import android.app.ActionBar;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
@@ -42,10 +40,9 @@ import android.os.Handler;
|
|||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
import android.preference.Preference;
|
import android.support.v14.preference.PreferenceFragment;
|
||||||
import android.preference.PreferenceFragment;
|
import android.support.v7.preference.Preference;
|
||||||
import android.preference.PreferenceManager;
|
import android.support.v7.preference.PreferenceManager;
|
||||||
import android.preference.PreferenceScreen;
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.transition.TransitionManager;
|
import android.transition.TransitionManager;
|
||||||
import android.util.ArrayMap;
|
import android.util.ArrayMap;
|
||||||
@@ -107,8 +104,8 @@ import com.android.settings.notification.ZenAccessSettings;
|
|||||||
import com.android.settings.notification.ZenModeAutomationSettings;
|
import com.android.settings.notification.ZenModeAutomationSettings;
|
||||||
import com.android.settings.notification.ZenModeEventRuleSettings;
|
import com.android.settings.notification.ZenModeEventRuleSettings;
|
||||||
import com.android.settings.notification.ZenModePrioritySettings;
|
import com.android.settings.notification.ZenModePrioritySettings;
|
||||||
import com.android.settings.notification.ZenModeSettings;
|
|
||||||
import com.android.settings.notification.ZenModeScheduleRuleSettings;
|
import com.android.settings.notification.ZenModeScheduleRuleSettings;
|
||||||
|
import com.android.settings.notification.ZenModeSettings;
|
||||||
import com.android.settings.print.PrintJobSettingsFragment;
|
import com.android.settings.print.PrintJobSettingsFragment;
|
||||||
import com.android.settings.print.PrintSettingsFragment;
|
import com.android.settings.print.PrintSettingsFragment;
|
||||||
import com.android.settings.search.DynamicIndexableContentMonitor;
|
import com.android.settings.search.DynamicIndexableContentMonitor;
|
||||||
@@ -133,6 +130,8 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import static com.android.settings.dashboard.DashboardTile.TILE_ID_UNDEFINED;
|
||||||
|
|
||||||
public class SettingsActivity extends Activity
|
public class SettingsActivity extends Activity
|
||||||
implements PreferenceManager.OnPreferenceTreeClickListener,
|
implements PreferenceManager.OnPreferenceTreeClickListener,
|
||||||
PreferenceFragment.OnPreferenceStartFragmentCallback,
|
PreferenceFragment.OnPreferenceStartFragmentCallback,
|
||||||
@@ -438,17 +437,17 @@ public class SettingsActivity extends Activity
|
|||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceStartFragment(PreferenceFragment caller, Preference pref) {
|
public boolean onPreferenceStartFragment(PreferenceFragment caller, Preference pref) {
|
||||||
// Override the fragment title for Wallpaper settings
|
// Override the fragment title for Wallpaper settings
|
||||||
int titleRes = pref.getTitleRes();
|
CharSequence title = pref.getTitle();
|
||||||
if (pref.getFragment().equals(WallpaperTypeSettings.class.getName())) {
|
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);
|
null, 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
|
public boolean onPreferenceTreeClick(Preference preference) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -795,7 +794,7 @@ public class SettingsActivity extends Activity
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
if (mIsShowingDashboard) {
|
if (mIsShowingDashboard) {
|
||||||
MetricsLogger.visible(this, MetricsLogger.MAIN_SETTINGS);
|
MetricsLogger.visible(this, MetricsLogger.MAIN_SETTINGS);
|
||||||
@@ -826,7 +825,7 @@ public class SettingsActivity extends Activity
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
protected void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
if (mIsShowingDashboard) {
|
if (mIsShowingDashboard) {
|
||||||
MetricsLogger.hidden(this, MetricsLogger.MAIN_SETTINGS);
|
MetricsLogger.hidden(this, MetricsLogger.MAIN_SETTINGS);
|
||||||
|
|||||||
@@ -24,26 +24,26 @@ import android.content.ContentResolver;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.database.DataSetObserver;
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.Preference;
|
import android.support.v7.preference.Preference;
|
||||||
import android.preference.PreferenceActivity;
|
import android.support.v7.preference.PreferenceGroupAdapter;
|
||||||
import android.preference.PreferenceGroupAdapter;
|
import android.support.v7.preference.PreferenceScreen;
|
||||||
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
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 com.android.settings.widget.FloatingActionButton;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for Settings fragments, with some helper functions and dialog management.
|
* Base class for Settings fragments, with some helper functions and dialog management.
|
||||||
*/
|
*/
|
||||||
@@ -67,17 +67,13 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF
|
|||||||
private boolean mPreferenceHighlighted = false;
|
private boolean mPreferenceHighlighted = false;
|
||||||
private Drawable mHighlightDrawable;
|
private Drawable mHighlightDrawable;
|
||||||
|
|
||||||
private ListAdapter mCurrentRootAdapter;
|
private RecyclerView.Adapter mCurrentRootAdapter;
|
||||||
private boolean mIsDataSetObserverRegistered = false;
|
private boolean mIsDataSetObserverRegistered = false;
|
||||||
private DataSetObserver mDataSetObserver = new DataSetObserver() {
|
private RecyclerView.AdapterDataObserver mDataSetObserver =
|
||||||
|
new RecyclerView.AdapterDataObserver() {
|
||||||
@Override
|
@Override
|
||||||
public void onChanged() {
|
public void onChanged() {
|
||||||
highlightPreferenceIfNeeded();
|
onDataSetChanged();
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onInvalidated() {
|
|
||||||
highlightPreferenceIfNeeded();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -85,6 +81,11 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF
|
|||||||
private FloatingActionButton mFloatingActionButton;
|
private FloatingActionButton mFloatingActionButton;
|
||||||
private ViewGroup mButtonBar;
|
private ViewGroup mButtonBar;
|
||||||
|
|
||||||
|
private LayoutPreference mHeader;
|
||||||
|
|
||||||
|
private LayoutPreference mFooter;
|
||||||
|
private View mEmptyView;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle icicle) {
|
public void onCreate(Bundle icicle) {
|
||||||
super.onCreate(icicle);
|
super.onCreate(icicle);
|
||||||
@@ -110,6 +111,10 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF
|
|||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||||
|
}
|
||||||
|
|
||||||
public FloatingActionButton getFloatingActionButton() {
|
public FloatingActionButton getFloatingActionButton() {
|
||||||
return mFloatingActionButton;
|
return mFloatingActionButton;
|
||||||
}
|
}
|
||||||
@@ -176,16 +181,16 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF
|
|||||||
|
|
||||||
public void showLoadingWhenEmpty() {
|
public void showLoadingWhenEmpty() {
|
||||||
View loading = getView().findViewById(R.id.loading_container);
|
View loading = getView().findViewById(R.id.loading_container);
|
||||||
getListView().setEmptyView(loading);
|
setEmptyView(loading);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerObserverIfNeeded() {
|
public void registerObserverIfNeeded() {
|
||||||
if (!mIsDataSetObserverRegistered) {
|
if (!mIsDataSetObserverRegistered) {
|
||||||
if (mCurrentRootAdapter != null) {
|
if (mCurrentRootAdapter != null) {
|
||||||
mCurrentRootAdapter.unregisterDataSetObserver(mDataSetObserver);
|
mCurrentRootAdapter.unregisterAdapterDataObserver(mDataSetObserver);
|
||||||
}
|
}
|
||||||
mCurrentRootAdapter = getPreferenceScreen().getRootAdapter();
|
mCurrentRootAdapter = getListView().getAdapter();
|
||||||
mCurrentRootAdapter.registerDataSetObserver(mDataSetObserver);
|
mCurrentRootAdapter.registerAdapterDataObserver(mDataSetObserver);
|
||||||
mIsDataSetObserverRegistered = true;
|
mIsDataSetObserverRegistered = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -193,7 +198,7 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF
|
|||||||
public void unregisterObserverIfNeeded() {
|
public void unregisterObserverIfNeeded() {
|
||||||
if (mIsDataSetObserverRegistered) {
|
if (mIsDataSetObserverRegistered) {
|
||||||
if (mCurrentRootAdapter != null) {
|
if (mCurrentRootAdapter != null) {
|
||||||
mCurrentRootAdapter.unregisterDataSetObserver(mDataSetObserver);
|
mCurrentRootAdapter.unregisterAdapterDataObserver(mDataSetObserver);
|
||||||
mCurrentRootAdapter = null;
|
mCurrentRootAdapter = null;
|
||||||
}
|
}
|
||||||
mIsDataSetObserverRegistered = false;
|
mIsDataSetObserverRegistered = false;
|
||||||
@@ -206,6 +211,11 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onDataSetChanged() {
|
||||||
|
highlightPreferenceIfNeeded();
|
||||||
|
updateEmptyView();
|
||||||
|
}
|
||||||
|
|
||||||
private Drawable getHighlightDrawable() {
|
private Drawable getHighlightDrawable() {
|
||||||
if (mHighlightDrawable == null) {
|
if (mHighlightDrawable == null) {
|
||||||
mHighlightDrawable = getActivity().getDrawable(R.drawable.preference_highlight);
|
mHighlightDrawable = getActivity().getDrawable(R.drawable.preference_highlight);
|
||||||
@@ -213,19 +223,92 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF
|
|||||||
return mHighlightDrawable;
|
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
|
* Return a valid ListView position or -1 if none is found
|
||||||
*/
|
*/
|
||||||
private int canUseListViewForHighLighting(String key) {
|
private int canUseListViewForHighLighting(String key) {
|
||||||
if (!hasListView()) {
|
if (getListView() == null) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ListView listView = getListView();
|
RecyclerView listView = getListView();
|
||||||
ListAdapter adapter = listView.getAdapter();
|
RecyclerView.Adapter adapter = listView.getAdapter();
|
||||||
|
|
||||||
if (adapter != null && adapter instanceof PreferenceGroupAdapter) {
|
if (adapter != null && adapter instanceof PreferenceGroupAdapter) {
|
||||||
return findListPositionFromKey(adapter, key);
|
return findListPositionFromKey((PreferenceGroupAdapter) adapter, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
@@ -238,47 +321,46 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF
|
|||||||
if (position >= 0) {
|
if (position >= 0) {
|
||||||
mPreferenceHighlighted = true;
|
mPreferenceHighlighted = true;
|
||||||
|
|
||||||
final ListView listView = getListView();
|
// TODO: Need to find a way to scroll to and highlight search items now
|
||||||
final ListAdapter adapter = listView.getAdapter();
|
// that we are using RecyclerView instead.
|
||||||
|
// final RecyclerView listView = getListView();
|
||||||
((PreferenceGroupAdapter) adapter).setHighlightedDrawable(highlight);
|
// final RecyclerView.Adapter adapter = listView.getAdapter();
|
||||||
((PreferenceGroupAdapter) adapter).setHighlighted(position);
|
//
|
||||||
|
//// ((PreferenceGroupAdapter) adapter).setHighlightedDrawable(highlight);
|
||||||
listView.post(new Runnable() {
|
//// ((PreferenceGroupAdapter) adapter).setHighlighted(position);
|
||||||
@Override
|
//
|
||||||
public void run() {
|
// listView.post(new Runnable() {
|
||||||
listView.setSelection(position);
|
// @Override
|
||||||
listView.postDelayed(new Runnable() {
|
// public void run() {
|
||||||
@Override
|
// listView.setSelection(position);
|
||||||
public void run() {
|
// listView.postDelayed(new Runnable() {
|
||||||
final int index = position - listView.getFirstVisiblePosition();
|
// @Override
|
||||||
if (index >= 0 && index < listView.getChildCount()) {
|
// public void run() {
|
||||||
final View v = listView.getChildAt(index);
|
// final int index = position - listView.getFirstVisiblePosition();
|
||||||
final int centerX = v.getWidth() / 2;
|
// if (index >= 0 && index < listView.getChildCount()) {
|
||||||
final int centerY = v.getHeight() / 2;
|
// final View v = listView.getChildAt(index);
|
||||||
highlight.setHotspot(centerX, centerY);
|
// final int centerX = v.getWidth() / 2;
|
||||||
v.setPressed(true);
|
// final int centerY = v.getHeight() / 2;
|
||||||
v.setPressed(false);
|
// highlight.setHotspot(centerX, centerY);
|
||||||
}
|
// v.setPressed(true);
|
||||||
}
|
// v.setPressed(false);
|
||||||
}, DELAY_HIGHLIGHT_DURATION_MILLIS);
|
// }
|
||||||
}
|
// }
|
||||||
});
|
// }, DELAY_HIGHLIGHT_DURATION_MILLIS);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int findListPositionFromKey(ListAdapter adapter, String key) {
|
private int findListPositionFromKey(PreferenceGroupAdapter adapter, String key) {
|
||||||
final int count = adapter.getCount();
|
final int count = adapter.getItemCount();
|
||||||
for (int n = 0; n < count; n++) {
|
for (int n = 0; n < count; n++) {
|
||||||
final Object item = adapter.getItem(n);
|
final Preference preference = adapter.getItem(n);
|
||||||
if (item instanceof Preference) {
|
|
||||||
Preference preference = (Preference) item;
|
|
||||||
final String preferenceKey = preference.getKey();
|
final String preferenceKey = preference.getKey();
|
||||||
if (preferenceKey != null && preferenceKey.equals(key)) {
|
if (preferenceKey != null && preferenceKey.equals(key)) {
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -400,6 +482,31 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF
|
|||||||
// override in subclass to attach a dismiss listener, for instance
|
// 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 {
|
public static class SettingsDialogFragment extends DialogFragment {
|
||||||
private static final String KEY_DIALOG_ID = "key_dialog_id";
|
private static final String KEY_DIALOG_ID = "key_dialog_id";
|
||||||
private static final String KEY_PARENT_FRAGMENT_ID = "key_parent_fragment_id";
|
private static final String KEY_PARENT_FRAGMENT_ID = "key_parent_fragment_id";
|
||||||
@@ -517,6 +624,10 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected final Context getPrefContext() {
|
||||||
|
return getPreferenceManager().getContext();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean startFragment(Fragment caller, String fragmentClass, int titleRes,
|
public boolean startFragment(Fragment caller, String fragmentClass, int titleRes,
|
||||||
int requestCode, Bundle extras) {
|
int requestCode, Bundle extras) {
|
||||||
final Activity activity = getActivity();
|
final Activity activity = getActivity();
|
||||||
|
|||||||
@@ -16,10 +16,6 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
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.Activity;
|
||||||
import android.app.admin.DevicePolicyManager;
|
import android.app.admin.DevicePolicyManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -27,11 +23,15 @@ import android.content.Intent;
|
|||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.preference.PreferenceFragment;
|
import android.support.v14.preference.PreferenceFragment;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
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
|
* 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
|
* from ChooseLockGeneric class, and should remain similar to that behaviorally. This class should
|
||||||
|
|||||||
@@ -16,10 +16,6 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
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.Activity;
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -30,6 +26,10 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
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
|
* 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
|
* from ChooseLockPassword class, and should remain similar to that behaviorally. This class should
|
||||||
|
|||||||
@@ -16,9 +16,6 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import com.android.setupwizardlib.SetupWizardLayout;
|
|
||||||
import com.android.setupwizardlib.view.NavigationBar;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -30,6 +27,9 @@ import android.view.View;
|
|||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
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
|
* 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
|
* from ChooseLockPattern class, and should remain similar to that behaviorally. This class should
|
||||||
|
|||||||
@@ -16,9 +16,6 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import com.android.setupwizardlib.SetupWizardLayout;
|
|
||||||
import com.android.setupwizardlib.view.NavigationBar;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@@ -28,6 +25,9 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
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
|
* 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
|
* structure from EncryptionInterstitial class, and should remain similar to that behaviorally. This
|
||||||
|
|||||||
@@ -16,13 +16,13 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import com.android.setupwizardlib.util.SystemBarHelper;
|
|
||||||
import com.android.setupwizardlib.util.WizardManagerHelper;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
|
||||||
|
import com.android.setupwizardlib.util.SystemBarHelper;
|
||||||
|
import com.android.setupwizardlib.util.WizardManagerHelper;
|
||||||
|
|
||||||
public class SetupWizardUtils {
|
public class SetupWizardUtils {
|
||||||
private static final String TAG = "SetupWizardUtils";
|
private static final String TAG = "SetupWizardUtils";
|
||||||
|
|
||||||
|
|||||||
@@ -16,10 +16,10 @@
|
|||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import android.content.Context;
|
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.text.TextUtils.TruncateAt;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.View;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
public class SingleLineSummaryPreference extends Preference {
|
public class SingleLineSummaryPreference extends Preference {
|
||||||
@@ -29,8 +29,8 @@ public class SingleLineSummaryPreference extends Preference {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onBindView(View view) {
|
public void onBindViewHolder(PreferenceViewHolder view) {
|
||||||
super.onBindView(view);
|
super.onBindViewHolder(view);
|
||||||
|
|
||||||
final TextView summaryView = (TextView) view.findViewById(
|
final TextView summaryView = (TextView) view.findViewById(
|
||||||
com.android.internal.R.id.summary);
|
com.android.internal.R.id.summary);
|
||||||
|
|||||||
@@ -18,8 +18,7 @@ package com.android.settings;
|
|||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
import android.preference.PreferenceActivity;
|
import android.support.v7.preference.PreferenceScreen;
|
||||||
import android.preference.PreferenceScreen;
|
|
||||||
|
|
||||||
public class TestingSettings extends PreferenceActivity {
|
public class TestingSettings extends PreferenceActivity {
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.android.settings;
|
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.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.BroadcastReceiver;
|
|
||||||
|
import static com.android.internal.telephony.TelephonyIntents.SECRET_CODE_ACTION;
|
||||||
|
|
||||||
|
|
||||||
public class TestingSettingsBroadcastReceiver extends BroadcastReceiver {
|
public class TestingSettingsBroadcastReceiver extends BroadcastReceiver {
|
||||||
|
|||||||
@@ -16,11 +16,6 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
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.Activity;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.bluetooth.BluetoothAdapter;
|
import android.bluetooth.BluetoothAdapter;
|
||||||
@@ -38,11 +33,10 @@ import android.net.wifi.WifiConfiguration;
|
|||||||
import android.net.wifi.WifiManager;
|
import android.net.wifi.WifiManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.os.UserHandle;
|
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
import android.preference.Preference;
|
import android.support.v14.preference.SwitchPreference;
|
||||||
import android.preference.PreferenceScreen;
|
import android.support.v7.preference.Preference;
|
||||||
import android.preference.SwitchPreference;
|
import android.support.v7.preference.PreferenceScreen;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.android.internal.logging.MetricsLogger;
|
import com.android.internal.logging.MetricsLogger;
|
||||||
@@ -53,6 +47,11 @@ import com.android.settingslib.TetherUtil;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
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.
|
* Displays preferences for Tethering.
|
||||||
*/
|
*/
|
||||||
@@ -127,7 +126,7 @@ public class TetherSettings extends SettingsPreferenceFragment
|
|||||||
if (mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_TETHERING)
|
if (mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_TETHERING)
|
||||||
|| !mUm.isAdminUser()) {
|
|| !mUm.isAdminUser()) {
|
||||||
mUnavailable = true;
|
mUnavailable = true;
|
||||||
setPreferenceScreen(new PreferenceScreen(getActivity(), null));
|
setPreferenceScreen(new PreferenceScreen(getPrefContext(), null));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -286,7 +285,7 @@ public class TetherSettings extends SettingsPreferenceFragment
|
|||||||
|
|
||||||
if (mUnavailable) {
|
if (mUnavailable) {
|
||||||
TextView emptyView = (TextView) getView().findViewById(android.R.id.empty);
|
TextView emptyView = (TextView) getView().findViewById(android.R.id.empty);
|
||||||
getListView().setEmptyView(emptyView);
|
setEmptyView(emptyView);
|
||||||
if (emptyView != null) {
|
if (emptyView != null) {
|
||||||
emptyView.setText(R.string.tethering_settings_not_available);
|
emptyView.setText(R.string.tethering_settings_not_available);
|
||||||
}
|
}
|
||||||
@@ -561,7 +560,7 @@ public class TetherSettings extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceTreeClick(PreferenceScreen screen, Preference preference) {
|
public boolean onPreferenceTreeClick(Preference preference) {
|
||||||
ConnectivityManager cm =
|
ConnectivityManager cm =
|
||||||
(ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
|
(ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
|
|
||||||
@@ -606,7 +605,7 @@ public class TetherSettings extends SettingsPreferenceFragment
|
|||||||
showDialog(DIALOG_AP_SETTINGS);
|
showDialog(DIALOG_AP_SETTINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.onPreferenceTreeClick(screen, preference);
|
return super.onPreferenceTreeClick(preference);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String findIface(String[] ifaces, String[] regexes) {
|
private static String findIface(String[] ifaces, String[] regexes) {
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ package com.android.settings;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.ColorStateList;
|
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.util.AttributeSet;
|
||||||
import android.view.View;
|
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
|
||||||
public class TintablePreference extends Preference {
|
public class TintablePreference extends Preference {
|
||||||
@@ -36,8 +36,8 @@ public class TintablePreference extends Preference {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onBindView(View view) {
|
public void onBindViewHolder(PreferenceViewHolder view) {
|
||||||
super.onBindView(view);
|
super.onBindViewHolder(view);
|
||||||
|
|
||||||
if (mTintColor != 0) {
|
if (mTintColor != 0) {
|
||||||
((ImageView) view.findViewById(android.R.id.icon)).setImageTintList(
|
((ImageView) view.findViewById(android.R.id.icon)).setImageTintList(
|
||||||
|
|||||||
@@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import android.app.admin.DevicePolicyManager;
|
import android.app.admin.DevicePolicyManager;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -27,16 +25,18 @@ import android.content.pm.ResolveInfo;
|
|||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.preference.Preference;
|
|
||||||
import android.preference.PreferenceGroup;
|
|
||||||
import android.preference.SwitchPreference;
|
|
||||||
import android.service.trust.TrustAgentService;
|
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.ArrayMap;
|
||||||
import android.util.ArraySet;
|
import android.util.ArraySet;
|
||||||
|
|
||||||
import com.android.internal.logging.MetricsLogger;
|
import com.android.internal.logging.MetricsLogger;
|
||||||
import com.android.internal.widget.LockPatternUtils;
|
import com.android.internal.widget.LockPatternUtils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class TrustAgentSettings extends SettingsPreferenceFragment implements
|
public class TrustAgentSettings extends SettingsPreferenceFragment implements
|
||||||
Preference.OnPreferenceChangeListener {
|
Preference.OnPreferenceChangeListener {
|
||||||
private static final String SERVICE_INTERFACE = TrustAgentService.SERVICE_INTERFACE;
|
private static final String SERVICE_INTERFACE = TrustAgentService.SERVICE_INTERFACE;
|
||||||
@@ -102,7 +102,7 @@ public class TrustAgentSettings extends SettingsPreferenceFragment implements
|
|||||||
final int count = mAvailableAgents.size();
|
final int count = mAvailableAgents.size();
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
AgentInfo agent = mAvailableAgents.valueAt(i);
|
AgentInfo agent = mAvailableAgents.valueAt(i);
|
||||||
final SwitchPreference preference = new SwitchPreference(context);
|
final SwitchPreference preference = new SwitchPreference(getPrefContext());
|
||||||
agent.preference = preference;
|
agent.preference = preference;
|
||||||
preference.setPersistent(false);
|
preference.setPersistent(false);
|
||||||
preference.setTitle(agent.label);
|
preference.setTitle(agent.label);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user