diff options
author | Joey Rizzoli <joey@lineageos.org> | 2017-11-30 21:59:30 +0100 |
---|---|---|
committer | Arne Coucheron <arco68@gmail.com> | 2018-01-19 00:27:13 +0100 |
commit | 0fb16bbd36976824ebf1d32a3dfd2fbfc565a6f7 (patch) | |
tree | a148ffa9977bc98261e33e1e88f70d706115fd72 | |
parent | c6b85822544de5194cff97d7fe07236f5c7a5b32 (diff) | |
download | android_packages_apps_Trebuchet-0fb16bbd36976824ebf1d32a3dfd2fbfc565a6f7.tar.gz android_packages_apps_Trebuchet-0fb16bbd36976824ebf1d32a3dfd2fbfc565a6f7.tar.bz2 android_packages_apps_Trebuchet-0fb16bbd36976824ebf1d32a3dfd2fbfc565a6f7.zip |
Trebuchet: quick settings & settings reorganization
Signed-off-by: Joey Rizzoli <joey@lineageos.org>
27 files changed, 686 insertions, 209 deletions
diff --git a/Android.mk b/Android.mk index 036f7dc21..ed770c0af 100644 --- a/Android.mk +++ b/Android.mk @@ -25,6 +25,8 @@ LOCAL_MODULE_TAGS := optional LOCAL_STATIC_JAVA_LIBRARIES := \ android-support-v4 \ + android-support-design \ + android-support-v7-appcompat \ android-support-v7-recyclerview \ android-support-v7-palette \ android-support-dynamic-animation @@ -38,6 +40,8 @@ LOCAL_SRC_FILES := \ LOCAL_RESOURCE_DIR := \ $(LOCAL_PATH)/res \ + frameworks/support/design/res \ + frameworks/support/v7/appcompat/res \ prebuilts/sdk/current/support/v7/recyclerview/res \ LOCAL_PROGUARD_FLAG_FILES := proguard.flags @@ -48,6 +52,8 @@ LOCAL_PROTO_JAVA_OUTPUT_PARAMS := enum_style=java LOCAL_AAPT_FLAGS := \ --auto-add-overlay \ + --extra-packages android.support.design \ + --extra-packages android.support.v7.appcompat \ --extra-packages android.support.v7.recyclerview \ LOCAL_SDK_VERSION := current diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 2cd6bf396..8343f4e08 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -169,5 +169,11 @@ android:label="@string/icon_pack_picker" android:autoRemoveFromRecents="true" android:theme="@android:style/Theme.DeviceDefault.Settings" /> + + <activity + android:name=".QuickSettingsActivity" + android:autoRemoveFromRecents="true" + android:label="@string/settings_button_text" + android:theme="@style/QuickSettingsTheme" /> </application> </manifest> diff --git a/build.gradle b/build.gradle index 5c6f6b274..f0dbc2592 100644 --- a/build.gradle +++ b/build.gradle @@ -14,12 +14,12 @@ apply plugin: 'com.android.application' apply plugin: 'com.google.protobuf' android { - compileSdkVersion 26 - buildToolsVersion '26.0.2' + compileSdkVersion 27 + buildToolsVersion '27.0.1' defaultConfig { minSdkVersion 23 - targetSdkVersion 26 + targetSdkVersion 27 versionCode 1 versionName "1.0" @@ -98,12 +98,14 @@ repositories { google() } -final String SUPPORT_LIBS_VERSION = '26.1.0' +final String SUPPORT_LIBS_VERSION = '27.0.2' dependencies { compile "com.android.support:support-v4:${SUPPORT_LIBS_VERSION}" compile "com.android.support:support-dynamic-animation:${SUPPORT_LIBS_VERSION}" compile "com.android.support:recyclerview-v7:${SUPPORT_LIBS_VERSION}" compile "com.android.support:palette-v7:${SUPPORT_LIBS_VERSION}" + compile "com.android.support:appcompat-v7:${SUPPORT_LIBS_VERSION}" + compile "com.android.support:design:${SUPPORT_LIBS_VERSION}" compile 'com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-7' testCompile 'junit:junit:4.12' diff --git a/proguard.flags b/proguard.flags index 51abccae9..a9cc86a9d 100644 --- a/proguard.flags +++ b/proguard.flags @@ -102,3 +102,13 @@ -keep interface com.android.launcher3.model.nano.LauncherDumpProto.** { *; } + +-keep class android.support.design.widget.** { + *; +} + +-keep interface android.support.design.widget.** { + *; +} + +-dontwarn android.support.design.** diff --git a/res/drawable/ic_settings_add_shortcut.xml b/res/drawable/ic_settings_add_shortcut.xml new file mode 100644 index 000000000..0798a858d --- /dev/null +++ b/res/drawable/ic_settings_add_shortcut.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2017 The LineageOS 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. +--> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="@dimen/settings_icon_size" + android:height="@dimen/settings_icon_size" + android:viewportHeight="24.0" + android:viewportWidth="24.0"> + + <path + android:fillColor="@color/settings_icons" + android:pathData="M19,19V5H5V19H19M19,3A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21H5A2,2 0 0,1 3,19V5C3,3.89 3.9,3 5,3H19M11,7H13V11H17V13H13V17H11V13H7V11H11V7Z" /> +</vector> diff --git a/res/drawable/ic_settings_grid.xml b/res/drawable/ic_settings_grid.xml new file mode 100644 index 000000000..b0ce8e333 --- /dev/null +++ b/res/drawable/ic_settings_grid.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2017 The LineageOS 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. +--> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="@dimen/settings_icon_size" + android:height="@dimen/settings_icon_size" + android:viewportHeight="24.0" + android:viewportWidth="24.0"> + + <path + android:fillColor="@color/settings_icons" + android:pathData="M3,11H11V3H3M3,21H11V13H3M13,21H21V13H13M13,3V11H21V3" /> +</vector> diff --git a/res/drawable/ic_settings_label_drawer.xml b/res/drawable/ic_settings_label_drawer.xml new file mode 100644 index 000000000..6bad443c7 --- /dev/null +++ b/res/drawable/ic_settings_label_drawer.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2017 The LineageOS 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. +--> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="@dimen/settings_icon_size" + android:height="@dimen/settings_icon_size" + android:viewportHeight="24.0" + android:viewportWidth="24.0"> + + <path + android:fillColor="@color/settings_icons" + android:pathData="M16,17H5V7H16L19.55,12M17.63,5.84C17.27,5.33 16.67,5 16,5H5A2,2 0 0,0 3,7V17A2,2 0 0,0 5,19H16C16.67,19 17.27,18.66 17.63,18.15L22,12L17.63,5.84Z" /> +</vector> diff --git a/res/drawable/ic_settings_label_workspace.xml b/res/drawable/ic_settings_label_workspace.xml new file mode 100644 index 000000000..d97f4a6dd --- /dev/null +++ b/res/drawable/ic_settings_label_workspace.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2017 The LineageOS 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. +--> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="@dimen/settings_icon_size" + android:height="@dimen/settings_icon_size" + android:viewportHeight="24.0" + android:viewportWidth="24.0"> + + <path + android:fillColor="@color/settings_icons" + android:pathData="M17.63,5.84C17.27,5.33 16.67,5 16,5H5A2,2 0 0,0 3,7V17A2,2 0 0,0 5,19H16C16.67,19 17.27,18.66 17.63,18.15L22,12L17.63,5.84Z" /> +</vector> diff --git a/res/drawable/ic_settings_more.xml b/res/drawable/ic_settings_more.xml new file mode 100644 index 000000000..079b7f3cf --- /dev/null +++ b/res/drawable/ic_settings_more.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2017 The LineageOS 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. +--> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + + <path + android:fillColor="@color/settings_icons" + android:pathData="M6,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM18,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM12,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2z"/> +</vector> diff --git a/res/drawable/ic_settings_notification.xml b/res/drawable/ic_settings_notification.xml new file mode 100644 index 000000000..05ad075ca --- /dev/null +++ b/res/drawable/ic_settings_notification.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2017 The LineageOS 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. +--> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="@dimen/settings_icon_size" + android:height="@dimen/settings_icon_size" + android:viewportHeight="24.0" + android:viewportWidth="24.0"> + + <path + android:fillColor="@color/settings_icons" + android:pathData="M16.66,15H17C18,15 19,14.8 19.87,14.46C19.17,18.73 15.47,22 11,22C6,22 2,17.97 2,13C2,8.53 5.27,4.83 9.54,4.13C9.2,5 9,6 9,7V7.34C6.68,8.16 5,10.38 5,13A6,6 0 0,0 11,19C13.62,19 15.84,17.32 16.66,15M17,10A3,3 0 0,0 20,7A3,3 0 0,0 17,4A3,3 0 0,0 14,7A3,3 0 0,0 17,10M17,1A6,6 0 0,1 23,7A6,6 0 0,1 17,13A6,6 0 0,1 11,7C11,3.68 13.69,1 17,1Z" /> +</vector> diff --git a/res/drawable/ic_settings_predictive.xml b/res/drawable/ic_settings_predictive.xml new file mode 100644 index 000000000..ecbc6cf69 --- /dev/null +++ b/res/drawable/ic_settings_predictive.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2017 The LineageOS 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. +--> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="@dimen/settings_icon_size" + android:height="@dimen/settings_icon_size" + android:viewportHeight="24.0" + android:viewportWidth="24.0"> + + <path + android:fillColor="@color/settings_icons" + android:pathData="M23,12L20.56,9.22L20.9,5.54L17.29,4.72L15.4,1.54L12,3L8.6,1.54L6.71,4.72L3.1,5.53L3.44,9.21L1,12L3.44,14.78L3.1,18.47L6.71,19.29L8.6,22.47L12,21L15.4,22.46L17.29,19.28L20.9,18.46L20.56,14.78L23,12M13,17H11V15H13V17M13,13H11V7H13V13Z" /> +</vector> diff --git a/res/drawable/ic_settings_rotation.xml b/res/drawable/ic_settings_rotation.xml new file mode 100644 index 000000000..9bbe5000a --- /dev/null +++ b/res/drawable/ic_settings_rotation.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2017 The LineageOS 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. +--> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="@dimen/settings_icon_size" + android:height="@dimen/settings_icon_size" + android:viewportHeight="24.0" + android:viewportWidth="24.0"> + + <path + android:fillColor="@color/settings_icons" + android:pathData="M16.89,15.5L18.31,16.89C19.21,15.73 19.76,14.39 19.93,13H17.91C17.77,13.87 17.43,14.72 16.89,15.5M13,17.9V19.92C14.39,19.75 15.74,19.21 16.9,18.31L15.46,16.87C14.71,17.41 13.87,17.76 13,17.9M19.93,11C19.76,9.61 19.21,8.27 18.31,7.11L16.89,8.53C17.43,9.28 17.77,10.13 17.91,11M15.55,5.55L11,1V4.07C7.06,4.56 4,7.92 4,12C4,16.08 7.05,19.44 11,19.93V17.91C8.16,17.43 6,14.97 6,12C6,9.03 8.16,6.57 11,6.09V10L15.55,5.55Z" /> +</vector> diff --git a/res/drawable/ic_settings_shape.xml b/res/drawable/ic_settings_shape.xml new file mode 100644 index 000000000..e0d326616 --- /dev/null +++ b/res/drawable/ic_settings_shape.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2017 The LineageOS 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. +--> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="@dimen/settings_icon_size" + android:height="@dimen/settings_icon_size" + android:viewportHeight="24.0" + android:viewportWidth="24.0"> + + <path + android:fillColor="@color/settings_icons" + android:pathData="M2,2H11V11H2V2M17.5,2C20,2 22,4 22,6.5C22,9 20,11 17.5,11C15,11 13,9 13,6.5C13,4 15,2 17.5,2M6.5,14L11,22H2L6.5,14M19,17H22V19H19V22H17V19H14V17H17V14H19V17Z" /> +</vector> diff --git a/res/drawable/ic_settings_swipe_down.xml b/res/drawable/ic_settings_swipe_down.xml new file mode 100644 index 000000000..d96aa2aea --- /dev/null +++ b/res/drawable/ic_settings_swipe_down.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2017 The LineageOS 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. +--> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="@dimen/settings_icon_size" + android:height="@dimen/settings_icon_size" + android:viewportHeight="24.0" + android:viewportWidth="24.0"> + + <path + android:fillColor="@color/settings_icons" + android:pathData="M10,9A1,1 0 0,1 11,8A1,1 0 0,1 12,9V13.47L13.21,13.6L18.15,15.79C18.68,16.03 19,16.56 19,17.14V21.5C18.97,22.32 18.32,22.97 17.5,23H11C10.62,23 10.26,22.85 10,22.57L5.1,18.37L5.84,17.6C6.03,17.39 6.3,17.28 6.58,17.28H6.8L10,19V9M1,9L4,12L7,9H5V3H3V9H1Z" /> +</vector> diff --git a/res/layout/activity_quick_settings.xml b/res/layout/activity_quick_settings.xml new file mode 100644 index 000000000..a9181e709 --- /dev/null +++ b/res/layout/activity_quick_settings.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2017 The LineageOS 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. +--> +<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <View + android:id="@+id/quick_settings_touch_outside" + android:layout_width="match_parent" + android:layout_height="match_parent" /> + + <FrameLayout + android:id="@+id/quick_settings_content" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="@color/settings_sheet_background" + android:paddingBottom="48dp" + app:behavior_hideable="true" + app:layout_behavior="android.support.design.widget.BottomSheetBehavior" /> +</android.support.design.widget.CoordinatorLayout>
\ No newline at end of file diff --git a/res/values/lineage_colors.xml b/res/values/lineage_colors.xml index 27cc41a82..5dcf57277 100644 --- a/res/values/lineage_colors.xml +++ b/res/values/lineage_colors.xml @@ -15,6 +15,8 @@ limitations under the License. --> <resources> + <color name="colorAccent">#167c80</color> + <color name="icon_settings_background">#333333</color> <color name="icon_settings_text">#f5f5f5</color> @@ -23,4 +25,9 @@ <color name="dialog_background_light">#ffffff</color> <color name="dialog_background_dark">#424242</color> + + <!-- Settings --> + <color name="settings_sheet_background">#f5f5f5</color> + <color name="settings_statusbar_dim">#bdbdbd</color> + <color name="settings_icons">#424242</color> </resources>
\ No newline at end of file diff --git a/res/values/lineage_dimens.xml b/res/values/lineage_dimens.xml index 89d39c6e6..66e8bec40 100644 --- a/res/values/lineage_dimens.xml +++ b/res/values/lineage_dimens.xml @@ -20,4 +20,5 @@ <dimen name="icon_pack_vertical_margin">8dp</dimen> <dimen name="edit_dialog_min_width">200dp</dimen> <dimen name="grid_item_spacing">16dp</dimen> + <dimen name="settings_icon_size">36dp</dimen> </resources>
\ No newline at end of file diff --git a/res/values/lineage_strings.xml b/res/values/lineage_strings.xml index 8f8ac099c..a03ccec17 100644 --- a/res/values/lineage_strings.xml +++ b/res/values/lineage_strings.xml @@ -53,4 +53,15 @@ <!-- Default icon pack package name. Override to set a default icon pack, use "Default" to use system icons --> <string name="icon_pack_default" translatable="false">Default</string> + + <!-- Preferences --> + <string name="settings_category_home">Home screen settings</string> + <string name="settings_category_drawer">Drawer settings</string> + <string name="settings_category_icons">Icon settings</string> + <string name="settings_more">More</string> + <string name="settings_rotation_title">Rotation</string> + <string name="settings_allow_rotation_desc">Allow using the homescreen in landscape when the device is rotated</string> + <string name="settings_icon_shape">Icons shape</string> + <string name="settings_icon_badging_desc_on">A bubble will be displayed above the icon when there\'s a notification</string> + <string name="settings_icon_badging_desc_off">No bubble will be displayed above the icon when there\'s a notification</string> </resources> diff --git a/res/values/lineage_styles.xml b/res/values/lineage_styles.xml index 330f235ff..7c6eb5f28 100644 --- a/res/values/lineage_styles.xml +++ b/res/values/lineage_styles.xml @@ -16,9 +16,19 @@ --> <resources> <style name="ChooseIconTheme" parent="android:style/Theme.DeviceDefault.Settings"> + <item name="android:colorAccent">@color/colorAccent</item> <item name="android:colorBackground">@color/icon_settings_background</item> </style> <style name="TextAppearance.Switch" parent="@android:style/TextAppearance.Material.Title" /> + <style name="QuickSettingsTheme" parent="Theme.AppCompat.Light.NoActionBar"> + <item name="android:colorAccent">@color/colorAccent</item> + <item name="android:windowIsTranslucent">true</item> + <item name="android:windowBackground">@android:color/transparent</item> + <item name="android:backgroundDimEnabled">true</item> + <item name="android:statusBarColor">@android:color/transparent</item> + <item name="android:windowTranslucentNavigation">true</item> + </style> + </resources>
\ No newline at end of file diff --git a/res/values/styles.xml b/res/values/styles.xml index 8129e810f..211427f3e 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -26,6 +26,7 @@ <item name="android:windowNoTitle">true</item> <item name="android:colorEdgeEffect">#FF757575</item> <item name="android:keyboardLayout">@layout/search_container_all_apps</item> + <item name="android:colorAccent">@color/colorAccent</item> </style> <style name="BaseLauncherThemeWithCustomAttrs" parent="@style/BaseLauncherTheme"> diff --git a/res/xml/launcher_preferences.xml b/res/xml/launcher_preferences.xml index 22bd3e514..a130e3c07 100644 --- a/res/xml/launcher_preferences.xml +++ b/res/xml/launcher_preferences.xml @@ -1,5 +1,4 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2015 Google Inc. +<?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2015 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -15,76 +14,85 @@ --> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> + <PreferenceCategory + android:key="category_home" + android:title="@string/settings_category_home"> - <com.android.launcher3.views.ButtonPreference - android:key="pref_icon_badging" - android:title="@string/icon_badging_title" - android:persistent="false" - android:widgetLayout="@layout/notification_pref_warning" > - <intent android:action="android.settings.NOTIFICATION_SETTINGS"> - <!-- This extra highlights the "Allow icon badges" field in Notification settings --> - <extra - android:name=":settings:fragment_args_key" - android:value="notification_badging" /> - </intent> - </com.android.launcher3.views.ButtonPreference> + <SwitchPreference + android:defaultValue="@bool/allow_rotation" + android:icon="@drawable/ic_settings_rotation" + android:key="pref_allowRotation" + android:persistent="true" + android:title="@string/settings_rotation_title" /> - <SwitchPreference - android:key="pref_add_icon_to_home" - android:title="@string/auto_add_shortcuts_label" - android:summary="@string/auto_add_shortcuts_description" - android:defaultValue="true" - android:persistent="true" - /> + <SwitchPreference + android:defaultValue="true" + android:icon="@drawable/ic_settings_swipe_down" + android:key="pref_expand_statusbar" + android:persistent="true" + android:title="@string/statusbar_expand" /> - <SwitchPreference - android:key="pref_allowRotation" - android:title="@string/allow_rotation_title" - android:defaultValue="@bool/allow_rotation" - android:persistent="true" - /> + <SwitchPreference + android:defaultValue="true" + android:icon="@drawable/ic_settings_add_shortcut" + android:key="pref_add_icon_to_home" + android:persistent="true" + android:summary="@string/auto_add_shortcuts_description" + android:title="@string/auto_add_shortcuts_label" /> - <ListPreference - android:key="pref_override_icon_shape" - android:title="@string/icon_shape_override_label" - android:summary="%s" - android:entries="@array/icon_shape_override_paths_names" - android:entryValues="@array/icon_shape_override_paths_values" - android:defaultValue="" - android:persistent="false" /> + <SwitchPreference + android:defaultValue="true" + android:icon="@drawable/ic_settings_label_workspace" + android:key="pref_desktop_show_labels" + android:persistent="true" + android:title="@string/desktop_show_labels" /> + </PreferenceCategory> - <SwitchPreference - android:key="pref_expand_statusbar" - android:title="@string/statusbar_expand" - android:defaultValue="true" - android:persistent="true" /> + <PreferenceCategory android:title="@string/settings_category_drawer"> - <SwitchPreference - android:key="pref_predictive_apps" - android:title="@string/predictive_apps_title" - android:summaryOn="@string/predictive_apps_summary_on" - android:summaryOff="@string/predictive_apps_summary_off" - android:defaultValue="true" - android:persistent="true" /> + <SwitchPreference + android:defaultValue="true" + android:icon="@drawable/ic_settings_predictive" + android:key="pref_predictive_apps" + android:persistent="true" + android:summaryOff="@string/predictive_apps_summary_off" + android:summaryOn="@string/predictive_apps_summary_on" + android:title="@string/predictive_apps_title" /> - <Preference - android:key="pref_grid_size" - android:title="@string/grid_size_text" - android:persistent="true" /> + <SwitchPreference + android:defaultValue="true" + android:icon="@drawable/ic_settings_label_drawer" + android:key="pref_drawer_show_labels" + android:persistent="true" + android:title="@string/drawer_show_labels" /> + </PreferenceCategory> - <SwitchPreference - android:key="pref_desktop_show_labels" - android:title="@string/desktop_show_labels" - android:defaultValue="true" - android:persistent="true" /> + <PreferenceCategory + android:key="category_icons" + android:title="@string/settings_category_icons"> - <SwitchPreference - android:key="pref_drawer_show_labels" - android:title="@string/drawer_show_labels" - android:defaultValue="true" - android:persistent="true" /> + <ListPreference + android:defaultValue="" + android:entries="@array/icon_shape_override_paths_names" + android:entryValues="@array/icon_shape_override_paths_values" + android:icon="@drawable/ic_settings_shape" + android:key="pref_override_icon_shape" + android:persistent="false" + android:summary="%s" + android:title="@string/settings_icon_shape" /> - <Preference - android:key="pref_icon_pack" - android:title="@string/icon_pack_title" /> + <com.android.launcher3.views.ButtonPreference + android:key="pref_icon_badging" + android:title="@string/icon_badging_title" + android:persistent="false" + android:icon="@drawable/ic_settings_notification" + android:widgetLayout="@layout/notification_pref_warning" > + <intent android:action="android.settings.NOTIFICATION_SETTINGS"> + <!-- This extra highlights the "Allow icon badges" field in Notification settings --> + <extra + android:name=":settings:fragment_args_key" + android:value="notification_badging" /> + </intent> + </com.android.launcher3.views.ButtonPreference> + </PreferenceCategory> </PreferenceScreen> diff --git a/res/xml/launcher_quick_preferences.xml b/res/xml/launcher_quick_preferences.xml new file mode 100644 index 000000000..559e7825a --- /dev/null +++ b/res/xml/launcher_quick_preferences.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2015 Google Inc. + + 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. +--> + +<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> + + <Preference + android:defaultValue="default" + android:key="pref_grid_size" + android:persistent="true" + android:icon="@drawable/ic_settings_grid" + android:title="@string/grid_size_text" /> + + <Preference + android:key="pref_icon_pack" + android:title="@string/icon_pack_title" /> + + <Preference + android:key="pref_more" + android:icon="@drawable/ic_settings_more" + android:title="@string/settings_more" /> + +</PreferenceScreen> diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 108f6e5cc..e7cfc6955 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -2562,8 +2562,7 @@ public class Launcher extends BaseActivity */ public void onClickSettingsButton(View v) { if (LOGD) Log.d(TAG, "onClickSettingsButton"); - Intent intent = new Intent(Intent.ACTION_APPLICATION_PREFERENCES) - .setPackage(getPackageName()); + Intent intent = new Intent(this, QuickSettingsActivity.class); intent.setSourceBounds(getViewBounds(v)); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent, getActivityLaunchOptions(v)); diff --git a/src/com/android/launcher3/QuickSettingsActivity.java b/src/com/android/launcher3/QuickSettingsActivity.java new file mode 100644 index 000000000..0304ccb05 --- /dev/null +++ b/src/com/android/launcher3/QuickSettingsActivity.java @@ -0,0 +1,202 @@ +package com.android.launcher3; + +import android.app.AlarmManager; +import android.app.AlertDialog; +import android.app.PendingIntent; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.content.pm.ApplicationInfo; +import android.content.pm.PackageManager; +import android.graphics.drawable.Drawable; +import android.os.Bundle; +import android.preference.Preference; +import android.preference.PreferenceFragment; +import android.support.v7.app.AppCompatActivity; +import android.util.Pair; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.NumberPicker; + +import com.android.launcher3.icons.IconsHandler; + +public class QuickSettingsActivity extends AppCompatActivity { + private static final String KEY_GRID_SIZE = "pref_grid_size"; + public static final String KEY_ICON_PACK = "pref_icon_pack"; + + @Override + protected void onCreate(Bundle savedInstance) { + super.onCreate(savedInstance); + + setContentView(R.layout.activity_quick_settings); + + View touchOutSide = findViewById(R.id.quick_settings_touch_outside); + touchOutSide.setOnClickListener(v -> onBackPressed()); + + getFragmentManager().beginTransaction() + .replace(R.id.quick_settings_content, new QuickSettingsFragment()) + .commit(); + } + + + public static class QuickSettingsFragment extends PreferenceFragment + implements SharedPreferences.OnSharedPreferenceChangeListener { + private Preference mGridPref; + private Preference mIconPackPref; + + private SharedPreferences mPrefs; + private IconsHandler mIconsHandler; + private PackageManager mPackageManager; + + private String mDefaultIconPack; + private boolean mShouldRestart = false; + + @Override + public void onCreate(Bundle savedInstance) { + super.onCreate(savedInstance); + getPreferenceManager().setSharedPreferencesName(LauncherFiles.SHARED_PREFERENCES_KEY); + addPreferencesFromResource(R.xml.launcher_quick_preferences); + + mPrefs = Utilities.getPrefs(getActivity().getApplicationContext()); + mPrefs.registerOnSharedPreferenceChangeListener(this); + + mIconPackPref = findPreference(KEY_ICON_PACK); + mIconPackPref.setOnPreferenceClickListener(preference -> { + mIconsHandler.showDialog(getActivity()); + return true; + }); + + mPackageManager = getActivity().getPackageManager(); + mDefaultIconPack = mPrefs.getString(KEY_ICON_PACK, getString(R.string.icon_pack_default)); + mIconsHandler = IconCache.getIconsHandler(getActivity().getApplicationContext()); + updateIconPackEntry(); + + mGridPref = findPreference(KEY_GRID_SIZE); + if (mGridPref != null) { + mGridPref.setOnPreferenceClickListener(preference -> { + setCustomGridSize(); + return true; + }); + + mGridPref.setSummary(mPrefs.getString(KEY_GRID_SIZE, getDefaulGridSize())); + } + + Preference more = findPreference("pref_more"); + if (more != null) { + more.setOnPreferenceClickListener(preference -> { + Intent intent = new Intent(getActivity(), SettingsActivity.class); + getActivity().startActivity(intent); + // Don't kill the upcoming settings activity + mShouldRestart = false; + getActivity().finish(); + return true; + }); + } + } + + @Override + public void onPause() { + super.onPause(); + mIconsHandler.hideDialog(); + } + + @Override + public void onDestroy() { + mPrefs.unregisterOnSharedPreferenceChangeListener(this); + + if (mShouldRestart) { + triggerRestart(); + } + super.onDestroy(); + } + + + @Override + public void onSharedPreferenceChanged(SharedPreferences prefs, String key) { + switch (key) { + case KEY_GRID_SIZE: + mGridPref.setSummary(mPrefs.getString(KEY_GRID_SIZE, getDefaulGridSize())); + mShouldRestart = true; + break; + case KEY_ICON_PACK: + updateIconPackEntry(); + break; + } + } + + private void setCustomGridSize() { + int minValue = 3; + int maxValue = 9; + + String storedValue = mPrefs.getString(KEY_GRID_SIZE, "4x5"); + Pair<Integer, Integer> currentValues = Utilities.extractCustomGrid(storedValue); + + LayoutInflater inflater = (LayoutInflater) + getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); + if (inflater == null) { + return; + } + View contentView = inflater.inflate(R.layout.dialog_custom_grid, null); + NumberPicker columnPicker = (NumberPicker) + contentView.findViewById(R.id.dialog_grid_column); + NumberPicker rowPicker = (NumberPicker) + contentView.findViewById(R.id.dialog_grid_row); + + columnPicker.setMinValue(minValue); + rowPicker.setMinValue(minValue); + columnPicker.setMaxValue(maxValue); + rowPicker.setMaxValue(maxValue); + columnPicker.setValue(currentValues.first); + rowPicker.setValue(currentValues.second); + + new AlertDialog.Builder(getActivity()) + .setTitle(R.string.grid_size_text) + .setView(contentView) + .setPositiveButton(R.string.grid_size_custom_positive, (dialog, i) -> { + String newValues = Utilities.getGridValue(columnPicker.getValue(), + rowPicker.getValue()); + mPrefs.edit().putString(KEY_GRID_SIZE, newValues).apply(); + }) + .setNegativeButton(android.R.string.cancel, null) + .show(); + } + + private String getDefaulGridSize() { + InvariantDeviceProfile profile = new InvariantDeviceProfile(getActivity()); + return Utilities.getGridValue(profile.numColumns, profile.numRows); + } + + private void updateIconPackEntry() { + ApplicationInfo info = null; + String iconPack = mPrefs.getString(KEY_ICON_PACK, mDefaultIconPack); + String summary = getString(R.string.icon_pack_system); + Drawable icon = getResources().getDrawable(android.R.mipmap.sym_def_app_icon); + + if (!mIconsHandler.isDefaultIconPack()) { + try { + info = mPackageManager.getApplicationInfo(iconPack, PackageManager.GET_META_DATA); + } catch (PackageManager.NameNotFoundException ignored) { + } + if (info != null) { + summary = mPackageManager.getApplicationLabel(info).toString(); + icon = mPackageManager.getApplicationIcon(info); + } + } + + mIconPackPref.setSummary(summary); + mIconPackPref.setIcon(icon); + } + + private void triggerRestart() { + Context context = getActivity().getApplicationContext(); + Intent intent = new Intent(Intent.ACTION_MAIN); + intent.addCategory(Intent.CATEGORY_HOME); + intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + PendingIntent pi = PendingIntent.getActivity(context, 41, intent, + PendingIntent.FLAG_CANCEL_CURRENT); + AlarmManager manager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); + manager.set(AlarmManager.RTC, java.lang.System.currentTimeMillis() + 1, pi); + java.lang.System.exit(0); + } + } +}
\ No newline at end of file diff --git a/src/com/android/launcher3/SettingsActivity.java b/src/com/android/launcher3/SettingsActivity.java index 5fe69f457..765879946 100644 --- a/src/com/android/launcher3/SettingsActivity.java +++ b/src/com/android/launcher3/SettingsActivity.java @@ -30,21 +30,14 @@ import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; -import android.content.pm.ApplicationInfo; -import android.content.pm.PackageManager; -import android.graphics.drawable.Drawable; import android.os.Bundle; import android.preference.ListPreference; import android.preference.Preference; import android.preference.PreferenceFragment; +import android.preference.PreferenceGroup; import android.provider.Settings; -import android.util.Pair; -import android.view.LayoutInflater; -import android.view.View; -import android.widget.NumberPicker; import com.android.launcher3.graphics.IconShapeOverride; -import com.android.launcher3.icons.IconsHandler; import com.android.launcher3.notification.NotificationListener; import com.android.launcher3.util.SettingsObserver; import com.android.launcher3.views.ButtonPreference; @@ -60,26 +53,23 @@ public class SettingsActivity extends Activity { /** Hidden field Settings.Secure.ENABLED_NOTIFICATION_LISTENERS */ private static final String NOTIFICATION_ENABLED_LISTENERS = "enabled_notification_listeners"; - // Grid size - private static final String KEY_GRID_SIZE = "pref_grid_size"; - // Hide labels private static final String KEY_SHOW_DESKTOP_LABELS = "pref_desktop_show_labels"; private static final String KEY_SHOW_DRAWER_LABELS = "pref_drawer_show_labels"; - // Icon pack - public static final String KEY_ICON_PACK = "pref_icon_pack"; + static final String EXTRA_SCHEDULE_RESTART = "extraScheduleRestart"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - if (savedInstanceState == null) { - // Display the fragment as the main content. - getFragmentManager().beginTransaction() - .replace(android.R.id.content, new LauncherSettingsFragment()) - .commit(); - } + LauncherSettingsFragment fragment = new LauncherSettingsFragment(); + fragment.mShouldRestart = getIntent().getBooleanExtra(EXTRA_SCHEDULE_RESTART, false); + + // Display the fragment as the main content. + getFragmentManager().beginTransaction() + .replace(android.R.id.content, fragment) + .commit(); } /** @@ -93,16 +83,8 @@ public class SettingsActivity extends Activity { private SharedPreferences mPrefs; - private Preference mGridPref; - private boolean mShouldRestart = false; - // Icon pack - private Preference mIconPackPref; - private String mDefaultIconPack; - private IconsHandler mIconsHandler; - private PackageManager mPackageManager; - @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -113,11 +95,14 @@ public class SettingsActivity extends Activity { mPrefs = Utilities.getPrefs(getActivity().getApplicationContext()); mPrefs.registerOnSharedPreferenceChangeListener(this); + PreferenceGroup homeGroup = (PreferenceGroup) findPreference("category_home"); + PreferenceGroup iconGroup = (PreferenceGroup) findPreference("category_icons"); + // Setup allow rotation preference Preference rotationPref = findPreference(Utilities.ALLOW_ROTATION_PREFERENCE_KEY); if (getResources().getBoolean(R.bool.allow_rotation)) { // Launcher supports rotation by default. No need to show this setting. - getPreferenceScreen().removePreference(rotationPref); + homeGroup.removePreference(rotationPref); } else { mRotationLockObserver = new SystemDisplayRotationLockObserver(rotationPref, resolver); @@ -132,12 +117,12 @@ public class SettingsActivity extends Activity { ButtonPreference iconBadgingPref = (ButtonPreference) findPreference(ICON_BADGING_PREFERENCE_KEY); if (!Utilities.ATLEAST_OREO) { - getPreferenceScreen().removePreference( + homeGroup.removePreference( findPreference(SessionCommitReceiver.ADD_ICON_PREFERENCE_KEY)); - getPreferenceScreen().removePreference(iconBadgingPref); + iconGroup.removePreference(iconBadgingPref); } else if (!getResources().getBoolean(R.bool.notification_badging_enabled) || getContext().getSystemService(ActivityManager.class).isLowRamDevice()) { - getPreferenceScreen().removePreference(iconBadgingPref); + iconGroup.removePreference(iconBadgingPref); } else { // Listen to system notification badge settings while this UI is active. mIconBadgingObserver = new IconBadgingObserver( @@ -150,32 +135,9 @@ public class SettingsActivity extends Activity { if (IconShapeOverride.isSupported(getActivity())) { IconShapeOverride.handlePreferenceUi((ListPreference) iconShapeOverride); } else { - getPreferenceScreen().removePreference(iconShapeOverride); + iconGroup.removePreference(iconShapeOverride); } } - - mGridPref = findPreference(KEY_GRID_SIZE); - if (mGridPref != null) { - mGridPref.setOnPreferenceClickListener(preference -> { - setCustomGridSize(); - return true; - }); - - mGridPref.setSummary(mPrefs.getString(KEY_GRID_SIZE, getDefaulGridSize())); - } - - mPrefs = Utilities.getPrefs(getActivity().getApplicationContext()); - mPrefs.registerOnSharedPreferenceChangeListener(this); - - mIconPackPref = findPreference(KEY_ICON_PACK); - mIconPackPref.setOnPreferenceClickListener(preference -> { - mIconsHandler.showDialog(getActivity()); - return true; - }); - mPackageManager = getActivity().getPackageManager(); - mDefaultIconPack = mPrefs.getString(KEY_ICON_PACK, getString(R.string.icon_pack_default)); - mIconsHandler = IconCache.getIconsHandler(getActivity().getApplicationContext()); - updateIconPackEntry(); } @Override @@ -199,13 +161,6 @@ public class SettingsActivity extends Activity { @Override public void onSharedPreferenceChanged(SharedPreferences prefs, String key) { switch (key) { - case KEY_GRID_SIZE: - mGridPref.setSummary(mPrefs.getString(KEY_GRID_SIZE, getDefaulGridSize())); - mShouldRestart = true; - break; - case KEY_ICON_PACK: - updateIconPackEntry(); - break; case KEY_SHOW_DESKTOP_LABELS: case KEY_SHOW_DRAWER_LABELS: mShouldRestart = true; @@ -213,76 +168,6 @@ public class SettingsActivity extends Activity { } } - @Override - public void onPause() { - super.onPause(); - mIconsHandler.hideDialog(); - } - - private void setCustomGridSize() { - int minValue = 3; - int maxValue = 9; - - String storedValue = mPrefs.getString(KEY_GRID_SIZE, "4x4"); - Pair<Integer, Integer> currentValues = Utilities.extractCustomGrid(storedValue); - - LayoutInflater inflater = (LayoutInflater) - getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); - if (inflater == null) { - return; - } - View contentView = inflater.inflate(R.layout.dialog_custom_grid, null); - NumberPicker columnPicker = (NumberPicker) - contentView.findViewById(R.id.dialog_grid_column); - NumberPicker rowPicker = (NumberPicker) - contentView.findViewById(R.id.dialog_grid_row); - - columnPicker.setMinValue(minValue); - rowPicker.setMinValue(minValue); - columnPicker.setMaxValue(maxValue); - rowPicker.setMaxValue(maxValue); - columnPicker.setValue(currentValues.first); - rowPicker.setValue(currentValues.second); - - new AlertDialog.Builder(getActivity()) - .setTitle(R.string.grid_size_text) - .setMessage(R.string.grid_size_custom_message) - .setView(contentView) - .setPositiveButton(R.string.grid_size_custom_positive, (dialog, i) -> { - String newValues = Utilities.getGridValue(columnPicker.getValue(), - rowPicker.getValue()); - mPrefs.edit().putString(KEY_GRID_SIZE, newValues).apply(); - }) - .show(); - } - - - private String getDefaulGridSize() { - InvariantDeviceProfile profile = new InvariantDeviceProfile(getActivity()); - return Utilities.getGridValue(profile.numColumns, profile.numRows); - } - - private void updateIconPackEntry() { - ApplicationInfo info = null; - String iconPack = mPrefs.getString(KEY_ICON_PACK, mDefaultIconPack); - String summary = getString(R.string.icon_pack_system); - Drawable icon = getResources().getDrawable(android.R.mipmap.sym_def_app_icon); - - if (!mIconsHandler.isDefaultIconPack()) { - try { - info = mPackageManager.getApplicationInfo(iconPack, PackageManager.GET_META_DATA); - } catch (PackageManager.NameNotFoundException ignored) { - } - if (info != null) { - summary = mPackageManager.getApplicationLabel(info).toString(); - icon = mPackageManager.getApplicationIcon(info); - } - } - - mIconPackPref.setSummary(summary); - mIconPackPref.setIcon(icon); - } - private void triggerRestart() { Context context = getActivity().getApplicationContext(); Intent intent = new Intent(Intent.ACTION_MAIN); @@ -314,7 +199,7 @@ public class SettingsActivity extends Activity { public void onSettingChanged(boolean enabled) { mRotationPref.setEnabled(enabled); mRotationPref.setSummary(enabled - ? R.string.allow_rotation_desc : R.string.allow_rotation_blocked_desc); + ? R.string.settings_allow_rotation_desc : R.string.allow_rotation_blocked_desc); } } diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java index cab693d80..52e1e48dd 100644 --- a/src/com/android/launcher3/Utilities.java +++ b/src/com/android/launcher3/Utilities.java @@ -694,7 +694,7 @@ public final class Utilities { SharedPreferences prefs = Utilities.getPrefs(context.getApplicationContext()); String defaultPack = context.getString(R.string.icon_pack_default); String defaultLocalziedPack = context.getString(R.string.icon_pack_system); - String currentPack = prefs.getString(SettingsActivity.KEY_ICON_PACK, defaultPack); + String currentPack = prefs.getString(QuickSettingsActivity.KEY_ICON_PACK, defaultPack); return !currentPack.equals(defaultPack) && !currentPack.equals(defaultLocalziedPack); } diff --git a/src/com/android/launcher3/icons/IconsHandler.java b/src/com/android/launcher3/icons/IconsHandler.java index 3a923dac9..914d357fc 100644 --- a/src/com/android/launcher3/icons/IconsHandler.java +++ b/src/com/android/launcher3/icons/IconsHandler.java @@ -52,8 +52,8 @@ import android.widget.TextView; import com.android.launcher3.IconCache; import com.android.launcher3.LauncherAppState; +import com.android.launcher3.QuickSettingsActivity; import com.android.launcher3.R; -import com.android.launcher3.SettingsActivity; import com.android.launcher3.Utilities; import com.android.launcher3.graphics.LauncherIcons; @@ -110,7 +110,7 @@ public class IconsHandler { mDefaultIconPack = context.getString(R.string.icon_pack_default); SharedPreferences prefs = Utilities.getPrefs(context.getApplicationContext()); - String iconPack = prefs.getString(SettingsActivity.KEY_ICON_PACK, mDefaultIconPack); + String iconPack = prefs.getString(QuickSettingsActivity.KEY_ICON_PACK, mDefaultIconPack); loadAvailableIconPacks(); loadIconPack(iconPack, false); } @@ -506,7 +506,7 @@ public class IconsHandler { .setAdapter(adapter, (dialog, position) -> { String selected = adapter.getItem(position); String current = Utilities.getPrefs(mContext.getApplicationContext()) - .getString(SettingsActivity.KEY_ICON_PACK, mDefaultIconPack); + .getString(QuickSettingsActivity.KEY_ICON_PACK, mDefaultIconPack); if (!selected.equals(current)) { switchIconPacks(selected); } @@ -559,7 +559,7 @@ public class IconsHandler { mSupportedPackages.add(0, new IconPackInfo(defaultLabel, icon, defaultLabel)); mCurrentIconPack = Utilities.getPrefs(context.getApplicationContext()) - .getString(SettingsActivity.KEY_ICON_PACK, + .getString(QuickSettingsActivity.KEY_ICON_PACK, res.getString(R.string.icon_pack_default)); } @@ -611,7 +611,7 @@ public class IconsHandler { @Override protected void onPostExecute(Void aVoid) { Utilities.getPrefs(mContext.getApplicationContext()).edit() - .putString(SettingsActivity.KEY_ICON_PACK, mIconPackPackageName).apply(); + .putString(QuickSettingsActivity.KEY_ICON_PACK, mIconPackPackageName).apply(); mIconCache.clearIconDataBase(); mIconCache.flush(); LauncherAppState.getInstance(mContext).getModel().forceReload(); |