From 8af4c1047600499f457a0fbdd6be08c2815d4748 Mon Sep 17 00:00:00 2001 From: Fan Zhang Date: Wed, 21 Dec 2016 17:03:00 +0000 Subject: [PATCH] Revert "Align more prefs for icon space." Bug: 33798492 This reverts commit ded9fc9b0726bae0e7500fa98e6876b6d003d279. Change-Id: I9831858ffda263496617dff29249e243c007fa12 --- .../preference_category_material_settings.xml | 23 +++-------- res/layout/restricted_preference_dropdown.xml | 2 +- res/layout/storage_item.xml | 2 +- res/layout/storage_summary.xml | 2 +- res/layout/work_profile_category.xml | 40 +++++++++++++++++++ res/xml/advanced_apps.xml | 2 +- res/xml/application_settings.xml | 12 +++--- .../automatic_storage_management_settings.xml | 6 ++- res/xml/battery_saver_settings.xml | 9 +++++ res/xml/data_saver.xml | 9 +++++ res/xml/display_settings.xml | 10 ++--- res/xml/language_settings.xml | 10 ++--- res/xml/night_display_settings.xml | 5 +++ res/xml/privacy_settings.xml | 10 ++--- res/xml/security_settings_unencrypted.xml | 2 +- res/xml/special_access.xml | 30 +++++++------- res/xml/virtual_keyboard_settings.xml | 2 +- res/xml/zen_mode_settings.xml | 6 +-- .../settings/WallOfTextPreference.java | 38 ++++++++++++++++++ .../accounts/AccountPreferenceController.java | 2 + .../settings/datausage/DataSaverSummary.java | 2 - .../deviceinfo/PrivateVolumeSettings.java | 10 ++++- .../display/NightDisplaySettings.java | 2 +- .../fuelgauge/BatterySaverSettings.java | 3 +- 24 files changed, 167 insertions(+), 72 deletions(-) create mode 100644 res/layout/work_profile_category.xml create mode 100644 src/com/android/settings/WallOfTextPreference.java diff --git a/res/layout/preference_category_material_settings.xml b/res/layout/preference_category_material_settings.xml index 233f54a33df..2a25bbcef73 100644 --- a/res/layout/preference_category_material_settings.xml +++ b/res/layout/preference_category_material_settings.xml @@ -40,26 +40,13 @@ android:maxHeight="18dp"/> - - - - + android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"/> \ No newline at end of file diff --git a/res/layout/restricted_preference_dropdown.xml b/res/layout/restricted_preference_dropdown.xml index fd0d07da1f1..1a1e19168b2 100644 --- a/res/layout/restricted_preference_dropdown.xml +++ b/res/layout/restricted_preference_dropdown.xml @@ -25,6 +25,6 @@ android:layout_height="wrap_content" android:visibility="invisible" /> - + \ No newline at end of file diff --git a/res/layout/storage_item.xml b/res/layout/storage_item.xml index de735431103..636a4c21ce4 100644 --- a/res/layout/storage_item.xml +++ b/res/layout/storage_item.xml @@ -20,7 +20,7 @@ android:orientation="vertical" android:minHeight="?android:attr/listPreferredItemHeightSmall" android:gravity="center_vertical" - android:paddingStart="@dimen/preference_no_icon_padding_start" + android:paddingStart="?android:attr/listPreferredItemPaddingStart" android:paddingEnd="?android:attr/listPreferredItemPaddingEnd" android:paddingTop="16dip" android:paddingBottom="16dip" diff --git a/res/layout/storage_summary.xml b/res/layout/storage_summary.xml index 1beb49f94d3..7cd5b063988 100644 --- a/res/layout/storage_summary.xml +++ b/res/layout/storage_summary.xml @@ -20,7 +20,7 @@ android:orientation="vertical" android:minHeight="?android:attr/listPreferredItemHeightSmall" android:gravity="center_vertical" - android:paddingStart="@dimen/preference_no_icon_padding_start" + android:paddingStart="?android:attr/listPreferredItemPaddingStart" android:paddingEnd="?android:attr/listPreferredItemPaddingEnd" android:paddingTop="16dip" android:paddingBottom="16dip" diff --git a/res/layout/work_profile_category.xml b/res/layout/work_profile_category.xml new file mode 100644 index 00000000000..8ca99f1f237 --- /dev/null +++ b/res/layout/work_profile_category.xml @@ -0,0 +1,40 @@ + + + + + + + + \ No newline at end of file diff --git a/res/xml/advanced_apps.xml b/res/xml/advanced_apps.xml index 0f9f82b9c4a..c17da057520 100644 --- a/res/xml/advanced_apps.xml +++ b/res/xml/advanced_apps.xml @@ -92,7 +92,7 @@ - diff --git a/res/xml/application_settings.xml b/res/xml/application_settings.xml index 9987fc24fe0..1afe24368f1 100644 --- a/res/xml/application_settings.xml +++ b/res/xml/application_settings.xml @@ -26,26 +26,26 @@ android:summary="@string/applications_settings_summary" android:key="applications_settings"> - - + - - + - - + - + android:selectable="false" + settings:allowDividerAbove="false" + settings:allowDividerBelow="true" /> @@ -24,4 +25,12 @@ android:title="@string/battery_saver_turn_on_automatically_title" android:summary="%s" /> + + + diff --git a/res/xml/data_saver.xml b/res/xml/data_saver.xml index 0244030120b..20ce5c8015a 100644 --- a/res/xml/data_saver.xml +++ b/res/xml/data_saver.xml @@ -15,6 +15,7 @@ --> + + + diff --git a/res/xml/display_settings.xml b/res/xml/display_settings.xml index 2632c785453..1440c3f9832 100644 --- a/res/xml/display_settings.xml +++ b/res/xml/display_settings.xml @@ -19,12 +19,12 @@ android:title="@string/display_settings" settings:keywords="@string/keywords_display"> - - + - @@ -89,7 +89,7 @@ android:title="@string/tap_to_wake" android:summary="@string/tap_to_wake_summary" /> - - - - - - @@ -53,7 +53,7 @@ android:key="voice_category" android:title="@string/voice_category" > - + + \ No newline at end of file diff --git a/res/xml/privacy_settings.xml b/res/xml/privacy_settings.xml index eeef64caacd..f2af8f3fcbd 100644 --- a/res/xml/privacy_settings.xml +++ b/res/xml/privacy_settings.xml @@ -19,24 +19,24 @@ android:title="@string/privacy_settings_title"> - - - + - - + - diff --git a/res/xml/special_access.xml b/res/xml/special_access.xml index 4de167a680e..31789fbff83 100644 --- a/res/xml/special_access.xml +++ b/res/xml/special_access.xml @@ -18,7 +18,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"> - - + - - - - + - - + - - + - - - - - + diff --git a/res/xml/virtual_keyboard_settings.xml b/res/xml/virtual_keyboard_settings.xml index d5f0496a444..e5a5f388e09 100644 --- a/res/xml/virtual_keyboard_settings.xml +++ b/res/xml/virtual_keyboard_settings.xml @@ -16,7 +16,7 @@ - diff --git a/res/xml/zen_mode_settings.xml b/res/xml/zen_mode_settings.xml index b22ad6a9a1b..d8ad10d3ee9 100644 --- a/res/xml/zen_mode_settings.xml +++ b/res/xml/zen_mode_settings.xml @@ -20,19 +20,19 @@ android:title="@string/zen_mode_settings_title" > - - - diff --git a/src/com/android/settings/WallOfTextPreference.java b/src/com/android/settings/WallOfTextPreference.java new file mode 100644 index 00000000000..4cc2f673e10 --- /dev/null +++ b/src/com/android/settings/WallOfTextPreference.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settings.fuelgauge; + +import android.content.Context; +import android.support.v7.preference.Preference; +import android.support.v7.preference.PreferenceViewHolder; +import android.util.AttributeSet; +import android.widget.TextView; +import com.android.settings.DividerPreference; + +public class WallOfTextPreference extends DividerPreference { + + public WallOfTextPreference(Context context, AttributeSet attrs) { + super(context, attrs); + } + + @Override + public void onBindViewHolder(PreferenceViewHolder view) { + super.onBindViewHolder(view); + final TextView summary = (TextView) view.findViewById(android.R.id.summary); + summary.setMaxLines(20); + } +} diff --git a/src/com/android/settings/accounts/AccountPreferenceController.java b/src/com/android/settings/accounts/AccountPreferenceController.java index 723a1ec9cca..219dd3a0034 100644 --- a/src/com/android/settings/accounts/AccountPreferenceController.java +++ b/src/com/android/settings/accounts/AccountPreferenceController.java @@ -271,6 +271,7 @@ public class AccountPreferenceController extends PreferenceController } else { List profiles = mUm.getProfiles(UserHandle.myUserId()); final int profilesCount = profiles.size(); + final boolean addCategory = profilesCount > 1; for (int i = 0; i < profilesCount; i++) { updateProfileUi(profiles.get(i)); } @@ -297,6 +298,7 @@ public class AccountPreferenceController extends PreferenceController preferenceGroup.setContentDescription( mContext.getString(R.string.account_settings)); } else if (userInfo.isManagedProfile()) { + preferenceGroup.setLayoutResource(R.layout.work_profile_category); preferenceGroup.setTitle(R.string.category_work); String workGroupSummary = getWorkGroupSummary(context, userInfo); preferenceGroup.setSummary(workGroupSummary); diff --git a/src/com/android/settings/datausage/DataSaverSummary.java b/src/com/android/settings/datausage/DataSaverSummary.java index b424fa2c1ab..b0304fc1d63 100644 --- a/src/com/android/settings/datausage/DataSaverSummary.java +++ b/src/com/android/settings/datausage/DataSaverSummary.java @@ -54,8 +54,6 @@ public class DataSaverSummary extends SettingsPreferenceFragment super.onCreate(icicle); addPreferencesFromResource(R.xml.data_saver); - mFooterPreferenceMixin.createFooterPreference() - .setTitle(com.android.internal.R.string.data_saver_description); mUnrestrictedAccess = findPreference(KEY_UNRESTRICTED_ACCESS); mApplicationsState = ApplicationsState.getInstance( (Application) getContext().getApplicationContext()); diff --git a/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java b/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java index e63a1df11ca..b0685cfa77f 100644 --- a/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java +++ b/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java @@ -18,6 +18,7 @@ package com.android.settings.deviceinfo; import android.app.AlertDialog; import android.app.Dialog; +import android.app.DialogFragment; import android.app.Fragment; import android.content.ActivityNotFoundException; import android.content.Context; @@ -36,6 +37,7 @@ import android.os.storage.StorageManager; import android.os.storage.VolumeInfo; import android.os.storage.VolumeRecord; import android.provider.DocumentsContract; +import android.provider.Settings; import android.support.v7.preference.Preference; import android.support.v7.preference.PreferenceCategory; import android.support.v7.preference.PreferenceGroup; @@ -63,9 +65,9 @@ import com.android.settings.deviceinfo.StorageSettings.MountTask; import com.android.settingslib.deviceinfo.StorageMeasurement; import com.android.settingslib.deviceinfo.StorageMeasurement.MeasurementDetails; import com.android.settingslib.deviceinfo.StorageMeasurement.MeasurementReceiver; - import com.google.android.collect.Lists; +import java.io.File; import java.util.HashMap; import java.util.List; import java.util.Objects; @@ -105,6 +107,9 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment { R.string.storage_detail_other, }; + private static final int DELETION_HELPER_SETTINGS = 1; + private static final int DELETION_HELPER_CLEAR = 1; + private StorageManager mStorageManager; private UserManager mUserManager; @@ -280,7 +285,8 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment { if (mHeaderPoolIndex < mHeaderPreferencePool.size()) { category = mHeaderPreferencePool.get(mHeaderPoolIndex); } else { - category = new PreferenceCategory(getPrefContext()); + category = new PreferenceCategory(getPrefContext(), null, + com.android.internal.R.attr.preferenceCategoryStyle); mHeaderPreferencePool.add(category); } category.setTitle(title); diff --git a/src/com/android/settings/display/NightDisplaySettings.java b/src/com/android/settings/display/NightDisplaySettings.java index 619c0d4d1cd..1ff4297d3d0 100644 --- a/src/com/android/settings/display/NightDisplaySettings.java +++ b/src/com/android/settings/display/NightDisplaySettings.java @@ -73,7 +73,7 @@ public class NightDisplaySettings extends SettingsPreferenceFragment // Load the preferences from xml. addPreferencesFromResource(R.xml.night_display_settings); - mFooterPreferenceMixin.createFooterPreference().setTitle(R.string.night_display_text); + mAutoModePreference = (DropDownPreference) findPreference(KEY_NIGHT_DISPLAY_AUTO_MODE); mStartTimePreference = findPreference(KEY_NIGHT_DISPLAY_START_TIME); mEndTimePreference = findPreference(KEY_NIGHT_DISPLAY_END_TIME); diff --git a/src/com/android/settings/fuelgauge/BatterySaverSettings.java b/src/com/android/settings/fuelgauge/BatterySaverSettings.java index 6b7ddf95696..4dc8f87a0c8 100644 --- a/src/com/android/settings/fuelgauge/BatterySaverSettings.java +++ b/src/com/android/settings/fuelgauge/BatterySaverSettings.java @@ -78,8 +78,7 @@ public class BatterySaverSettings extends SettingsPreferenceFragment } mCreated = true; addPreferencesFromResource(R.xml.battery_saver_settings); - mFooterPreferenceMixin.createFooterPreference() - .setTitle(com.android.internal.R.string.battery_saver_description); + mContext = getActivity(); mSwitchBar = ((SettingsActivity) mContext).getSwitchBar(); mSwitch = mSwitchBar.getSwitch();