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