[automerger skipped] Merge sc-qpr1-dev-plus-aosp-without-vendor@7810918 am: 78c0048d82 -s ours am: dfafe17c59 -s ours
am skip reason: Merged-In I1b7c07dbf6e15baa783199aff5d299859c838ba2 with SHA-1 2b638233f0 is already in history
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/ThemePicker/+/16279014
Change-Id: Ic61c3f475075e7d96f3c553b15f8d29cdbc6a882
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index ccadc12..c6e79a9 100755
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -52,6 +52,7 @@
tools:node="replace"
android:name="com.android.wallpaper.picker.CustomizationPickerActivity"
android:label="@string/app_name"
+ android:relinquishTaskIdentity="true"
android:resizeableActivity="false"
android:theme="@style/CustomizationTheme.NoActionBar"
android:exported="false"/>
diff --git a/res/color-night/check_circle_grey_large_not_select_background_color.xml b/res/color-night/check_circle_grey_large_not_select_background_color.xml
new file mode 100644
index 0000000..ab5c0cd
--- /dev/null
+++ b/res/color-night/check_circle_grey_large_not_select_background_color.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2021 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.
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
+ <item android:color="?androidprv:attr/textColorSecondary" />
+</selector>
\ No newline at end of file
diff --git a/res/color-night/check_circle_grey_large_not_select_color.xml b/res/color-night/check_circle_grey_large_not_select_color.xml
new file mode 100644
index 0000000..6e8db34
--- /dev/null
+++ b/res/color-night/check_circle_grey_large_not_select_color.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2021 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.
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" >
+ <item android:color="?androidprv:attr/textColorOnAccent" />
+</selector>
\ No newline at end of file
diff --git a/res/color-night/option_background_new_selection_color.xml b/res/color-night/option_background_new_selection_color.xml
new file mode 100644
index 0000000..0158ea2
--- /dev/null
+++ b/res/color-night/option_background_new_selection_color.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2021 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.
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
+ <item android:color="?androidprv:attr/colorAccentPrimaryVariant" />
+</selector>
\ No newline at end of file
diff --git a/res/color/check_circle_grey_large_not_select_background_color.xml b/res/color/check_circle_grey_large_not_select_background_color.xml
new file mode 100644
index 0000000..c023611
--- /dev/null
+++ b/res/color/check_circle_grey_large_not_select_background_color.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2021 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.
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
+ <item android:color="?androidprv:attr/textColorSecondaryInverse" />
+</selector>
\ No newline at end of file
diff --git a/res/color/check_circle_grey_large_not_select_color.xml b/res/color/check_circle_grey_large_not_select_color.xml
new file mode 100644
index 0000000..252665f
--- /dev/null
+++ b/res/color/check_circle_grey_large_not_select_color.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2021 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.
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
+ <item android:color="?androidprv:attr/textColorPrimary" />
+</selector>
\ No newline at end of file
diff --git a/res/color/option_background_new_selection_color.xml b/res/color/option_background_new_selection_color.xml
new file mode 100644
index 0000000..0158ea2
--- /dev/null
+++ b/res/color/option_background_new_selection_color.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2021 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.
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
+ <item android:color="?androidprv:attr/colorAccentPrimaryVariant" />
+</selector>
\ No newline at end of file
diff --git a/res/drawable/check_circle_grey_large_not_select.xml b/res/drawable/check_circle_grey_large_not_select.xml
new file mode 100644
index 0000000..544d852
--- /dev/null
+++ b/res/drawable/check_circle_grey_large_not_select.xml
@@ -0,0 +1,32 @@
+<!--
+ Copyright (C) 2021 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.
+-->
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
+ <item>
+ <shape android:shape="oval">
+ <size android:width="@dimen/center_check_size"
+ android:height="@dimen/center_check_size" />
+ <solid android:color="@color/check_circle_grey_large_not_select_background_color" />
+ </shape>
+ </item>
+ <item>
+ <inset android:drawable="@drawable/ic_check_24dp_not_select"
+ android:insetTop="@dimen/center_check_padding"
+ android:insetRight="@dimen/center_check_padding"
+ android:insetBottom="@dimen/center_check_padding"
+ android:insetLeft="@dimen/center_check_padding"/>
+ </item>
+</layer-list>
diff --git a/res/drawable/ic_check_24dp_not_select.xml b/res/drawable/ic_check_24dp_not_select.xml
new file mode 100644
index 0000000..e6af76c
--- /dev/null
+++ b/res/drawable/ic_check_24dp_not_select.xml
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+ <path
+ android:fillColor="@color/check_circle_grey_large_not_select_color"
+ android:pathData="M9,16.17L4.83,12l-1.42,1.41L9,19 21,7l-1.41,-1.41L9,16.17z"/>
+</vector>
diff --git a/res/drawable/option_border_new_selection.xml b/res/drawable/option_border_new_selection.xml
new file mode 100644
index 0000000..6c02caa
--- /dev/null
+++ b/res/drawable/option_border_new_selection.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+ Copyright (C) 2019 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.
+-->
+<ripple xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
+ android:color="?android:attr/colorControlHighlight">
+ <item android:id="@android:id/mask">
+ <shape android:shape="rectangle">
+ <solid android:color="@android:color/white"/>
+ <corners android:radius="@dimen/option_tile_radius" />
+ </shape>
+ </item>
+ <item>
+ <shape android:shape="rectangle">
+ <solid android:color="@color/option_background_new_selection_color" />
+ <corners android:radius="@dimen/option_tile_radius" />
+ </shape>
+ </item>
+</ripple>
diff --git a/res/layout/themed_icon_section_view.xml b/res/layout/themed_icon_section_view.xml
index 97892ee..cf7b842 100644
--- a/res/layout/themed_icon_section_view.xml
+++ b/res/layout/themed_icon_section_view.xml
@@ -28,6 +28,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
@@ -42,7 +43,7 @@
<Switch
android:id="@+id/themed_icon_toggle"
android:layout_width="wrap_content"
- android:layout_height="match_parent"
+ android:layout_height="wrap_content"
android:background="@null"
android:clickable="false"
android:focusable="false"
diff --git a/src/com/android/customization/model/grid/GridOption.java b/src/com/android/customization/model/grid/GridOption.java
index 16a5eb0..19c5d4f 100644
--- a/src/com/android/customization/model/grid/GridOption.java
+++ b/src/com/android/customization/model/grid/GridOption.java
@@ -93,11 +93,18 @@
Context context = view.getContext();
int colorFilter = ResourceUtils.getColorAttr(context,
- view.isActivated() ? android.R.attr.textColorPrimary :
- android.R.attr.textColorTertiary);
+ view.isActivated()
+ ? (mIsCurrent
+ ? android.R.attr.textColorPrimary
+ : android.R.attr.textColorPrimaryInverse)
+ : android.R.attr.textColorTertiary);
mTileDrawable.setColorFilter(colorFilter, Mode.SRC_ATOP);
((ImageView) view.findViewById(R.id.grid_option_thumbnail))
.setImageDrawable(mTileDrawable);
+
+ int backgroundResource = view.isActivated() && !mIsCurrent
+ ? R.drawable.option_border_new_selection : R.drawable.option_border;
+ view.findViewById(R.id.option_tile).setBackgroundResource(backgroundResource);
}
@Override
diff --git a/src/com/android/customization/model/grid/GridSectionController.java b/src/com/android/customization/model/grid/GridSectionController.java
index 5470d77..64a6cce 100644
--- a/src/com/android/customization/model/grid/GridSectionController.java
+++ b/src/com/android/customization/model/grid/GridSectionController.java
@@ -74,8 +74,8 @@
}
}, /* reload= */ true);
- gridSectionView.setOnClickListener(v -> mSectionNavigationController.navigateTo(
- GridFragment.newInstance(context.getString(R.string.grid_title))));
+ gridSectionView.setOnClickListener(
+ v -> mSectionNavigationController.navigateTo(new GridFragment()));
return gridSectionView;
}
diff --git a/src/com/android/customization/picker/grid/GridFragment.java b/src/com/android/customization/picker/grid/GridFragment.java
index bb29d55..d554f72 100644
--- a/src/com/android/customization/picker/grid/GridFragment.java
+++ b/src/com/android/customization/picker/grid/GridFragment.java
@@ -61,12 +61,6 @@
private static final String KEY_STATE_BOTTOM_ACTION_BAR_VISIBLE =
"GridFragment.bottomActionBarVisible";
- public static GridFragment newInstance(CharSequence title) {
- GridFragment fragment = new GridFragment();
- fragment.setArguments(AppbarFragment.createArguments(title));
- return fragment;
- }
-
private WallpaperInfo mHomeWallpaper;
private RecyclerView mOptionsContainer;
private OptionSelectorController<GridOption> mOptionsController;
@@ -166,6 +160,11 @@
}
@Override
+ public CharSequence getDefaultTitle() {
+ return getString(R.string.grid_title);
+ }
+
+ @Override
protected void onBottomActionBarReady(BottomActionBar bottomActionBar) {
super.onBottomActionBarReady(bottomActionBar);
mBottomActionBar = bottomActionBar;
@@ -186,7 +185,8 @@
public void onOptionsLoaded(List<GridOption> options) {
mLoading.hide();
mOptionsController = new OptionSelectorController<>(
- mOptionsContainer, options, /* useGrid= */ false, CheckmarkStyle.CENTER);
+ mOptionsContainer, options, /* useGrid= */ false,
+ CheckmarkStyle.CENTER_CHANGE_COLOR_WHEN_NOT_SELECTED);
mOptionsController.initOptions(mGridManager);
// Find the selected Grid option.
diff --git a/src/com/android/customization/widget/OptionSelectorController.java b/src/com/android/customization/widget/OptionSelectorController.java
index 8e85c01..aa54f4f 100644
--- a/src/com/android/customization/widget/OptionSelectorController.java
+++ b/src/com/android/customization/widget/OptionSelectorController.java
@@ -68,11 +68,13 @@
void onOptionSelected(CustomizationOption selected);
}
- @IntDef({CheckmarkStyle.NONE, CheckmarkStyle.CORNER, CheckmarkStyle.CENTER})
+ @IntDef({CheckmarkStyle.NONE, CheckmarkStyle.CORNER, CheckmarkStyle.CENTER,
+ CheckmarkStyle.CENTER_CHANGE_COLOR_WHEN_NOT_SELECTED})
public @interface CheckmarkStyle {
int NONE = 0;
int CORNER = 1;
int CENTER = 2;
+ int CENTER_CHANGE_COLOR_WHEN_NOT_SELECTED = 3;
}
private static final float LINEAR_LAYOUT_HORIZONTAL_DISPLAY_OPTIONS_MAX = 4.35f;
@@ -243,6 +245,16 @@
mContainer.getContext().getTheme()),
Gravity.CENTER, res.getDimensionPixelSize(R.dimen.center_check_size),
0);
+ } else if (mCheckmarkStyle == CheckmarkStyle.CENTER_CHANGE_COLOR_WHEN_NOT_SELECTED
+ && option.equals(mAppliedOption)) {
+ int drawableRes = option.equals(mSelectedOption)
+ ? R.drawable.check_circle_grey_large
+ : R.drawable.check_circle_grey_large_not_select;
+ drawCheckmark(option, holder,
+ res.getDrawable(drawableRes,
+ mContainer.getContext().getTheme()),
+ Gravity.CENTER, res.getDimensionPixelSize(R.dimen.center_check_size),
+ 0);
} else if (option.equals(mAppliedOption)) {
// Initialize with "previewed" description if we don't show checkmark
holder.setContentDescription(mContainer.getContext(), option,