Loading res/drawable/theme_cover_scrim.xml 0 → 100644 +26 −0 Original line number Diff line number Diff line <?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. --> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:angle="90" android:startColor="@android:color/transparent" android:centerColor="@android:color/transparent" android:endColor="@color/translucent_black_darker" android:type="linear" /> </shape> No newline at end of file res/drawable/theme_cover_scrim_custom.xml 0 → 100644 +32 −0 Original line number Diff line number Diff line <?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. --> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:drawable="@drawable/theme_cover_scrim"/> <item> <shape android:shape="rectangle"> <gradient android:angle="90" android:centerY="25%" android:startColor="@color/black_67_alpha" android:centerColor="@android:color/transparent" android:endColor="@android:color/transparent" android:type="linear" /> </shape> </item> </layer-list> No newline at end of file res/values/colors.xml +1 −1 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ <color name="system_navigation_bar_divider">#1f000000</color> <color name="shape_thumbnail_color">#b2b2b2</color> <color name="icon_thumbnail_color">@android:color/black</color> <color name="icon_thumbnail_color">@color/white_70_alpha</color> <color name="clockface_preview_background">@android:color/black</color> Loading res/values/styles.xml +2 −0 Original line number Diff line number Diff line Loading @@ -90,6 +90,7 @@ <style name="CoverTitleTextAppearance" parent="CardTitleTextAppearance"> <item name="android:textSize">@dimen/card_cover_title_text_size</item> <item name="android:textColor">@color/white_70_alpha</item> </style> <style name="FontCardTitleStyle" parent="HeaderTextAppearance"> Loading @@ -105,6 +106,7 @@ <style name="EditLabelStyle"> <item name="android:textAppearance">@android:style/TextAppearance.DeviceDefault</item> <item name="android:textColor">@color/material_white_100</item> </style> <style name="CustomThemeNameEditText" parent="@android:style/Widget.DeviceDefault.EditText"> Loading src/com/android/customization/picker/theme/CustomThemeNameFragment.java +17 −8 Original line number Diff line number Diff line Loading @@ -15,11 +15,12 @@ */ package com.android.customization.picker.theme; import android.app.WallpaperColors; import android.content.res.ColorStateList; import android.content.Context; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; Loading @@ -35,7 +36,6 @@ import androidx.annotation.Nullable; import androidx.cardview.widget.CardView; import com.android.customization.model.theme.ThemeBundle.PreviewInfo; import com.android.customization.model.theme.custom.CustomTheme; import com.android.customization.picker.theme.ThemePreviewPage.ThemeCoverPage; import com.android.wallpaper.R; import com.android.wallpaper.asset.Asset; Loading Loading @@ -107,13 +107,14 @@ public class CustomThemeNameFragment extends CustomThemeStepFragment { } private void bindCover(CardView card) { PreviewInfo previewInfo = mCustomThemeManager.buildCustomThemePreviewInfo(getContext()); mCoverPage = new ThemeCoverPage(getContext(), getThemeName(), Context context = getContext(); PreviewInfo previewInfo = mCustomThemeManager.buildCustomThemePreviewInfo(context); mCoverPage = new ThemeCoverPage(context, getThemeName(), previewInfo.resolveAccentColor(getResources()), previewInfo.icons, previewInfo.headlineFontFamily, previewInfo.bottomSheeetCornerRadius, previewInfo.shapeDrawable, previewInfo.shapeAppIcons, null, mColorButtonIds, mColorTileIds, mColorTileIconIds, mShapeIconIds, new WallpaperLayoutListener()); new WallpaperLayoutListener(context)); mCoverPage.setCard(card); mCoverPage.bindPreviewContent(); mNameEditor.addTextChangedListener(new TextWatcher() { Loading @@ -135,6 +136,12 @@ public class CustomThemeNameFragment extends CustomThemeStepFragment { } private class WallpaperLayoutListener implements OnLayoutChangeListener { private final Drawable mScrim; WallpaperLayoutListener(Context context) { mScrim = context.getResources() .getDrawable(R.drawable.theme_cover_scrim, context.getTheme()); } @Override public void onLayoutChange(View view, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) { Loading @@ -152,8 +159,10 @@ public class CustomThemeNameFragment extends CustomThemeStepFragment { private void setWallpaperBitmap(View view, Bitmap bitmap) { Resources res = view.getContext().getResources(); BitmapDrawable background = new BitmapDrawable(res, bitmap); background.setAlpha(128); Drawable background = new BitmapDrawable(res, bitmap); if (mScrim != null) { background = new LayerDrawable(new Drawable[]{background, mScrim}); } view.findViewById(R.id.theme_preview_card_background).setBackground(background); } } Loading Loading
res/drawable/theme_cover_scrim.xml 0 → 100644 +26 −0 Original line number Diff line number Diff line <?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. --> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:angle="90" android:startColor="@android:color/transparent" android:centerColor="@android:color/transparent" android:endColor="@color/translucent_black_darker" android:type="linear" /> </shape> No newline at end of file
res/drawable/theme_cover_scrim_custom.xml 0 → 100644 +32 −0 Original line number Diff line number Diff line <?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. --> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:drawable="@drawable/theme_cover_scrim"/> <item> <shape android:shape="rectangle"> <gradient android:angle="90" android:centerY="25%" android:startColor="@color/black_67_alpha" android:centerColor="@android:color/transparent" android:endColor="@android:color/transparent" android:type="linear" /> </shape> </item> </layer-list> No newline at end of file
res/values/colors.xml +1 −1 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ <color name="system_navigation_bar_divider">#1f000000</color> <color name="shape_thumbnail_color">#b2b2b2</color> <color name="icon_thumbnail_color">@android:color/black</color> <color name="icon_thumbnail_color">@color/white_70_alpha</color> <color name="clockface_preview_background">@android:color/black</color> Loading
res/values/styles.xml +2 −0 Original line number Diff line number Diff line Loading @@ -90,6 +90,7 @@ <style name="CoverTitleTextAppearance" parent="CardTitleTextAppearance"> <item name="android:textSize">@dimen/card_cover_title_text_size</item> <item name="android:textColor">@color/white_70_alpha</item> </style> <style name="FontCardTitleStyle" parent="HeaderTextAppearance"> Loading @@ -105,6 +106,7 @@ <style name="EditLabelStyle"> <item name="android:textAppearance">@android:style/TextAppearance.DeviceDefault</item> <item name="android:textColor">@color/material_white_100</item> </style> <style name="CustomThemeNameEditText" parent="@android:style/Widget.DeviceDefault.EditText"> Loading
src/com/android/customization/picker/theme/CustomThemeNameFragment.java +17 −8 Original line number Diff line number Diff line Loading @@ -15,11 +15,12 @@ */ package com.android.customization.picker.theme; import android.app.WallpaperColors; import android.content.res.ColorStateList; import android.content.Context; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; Loading @@ -35,7 +36,6 @@ import androidx.annotation.Nullable; import androidx.cardview.widget.CardView; import com.android.customization.model.theme.ThemeBundle.PreviewInfo; import com.android.customization.model.theme.custom.CustomTheme; import com.android.customization.picker.theme.ThemePreviewPage.ThemeCoverPage; import com.android.wallpaper.R; import com.android.wallpaper.asset.Asset; Loading Loading @@ -107,13 +107,14 @@ public class CustomThemeNameFragment extends CustomThemeStepFragment { } private void bindCover(CardView card) { PreviewInfo previewInfo = mCustomThemeManager.buildCustomThemePreviewInfo(getContext()); mCoverPage = new ThemeCoverPage(getContext(), getThemeName(), Context context = getContext(); PreviewInfo previewInfo = mCustomThemeManager.buildCustomThemePreviewInfo(context); mCoverPage = new ThemeCoverPage(context, getThemeName(), previewInfo.resolveAccentColor(getResources()), previewInfo.icons, previewInfo.headlineFontFamily, previewInfo.bottomSheeetCornerRadius, previewInfo.shapeDrawable, previewInfo.shapeAppIcons, null, mColorButtonIds, mColorTileIds, mColorTileIconIds, mShapeIconIds, new WallpaperLayoutListener()); new WallpaperLayoutListener(context)); mCoverPage.setCard(card); mCoverPage.bindPreviewContent(); mNameEditor.addTextChangedListener(new TextWatcher() { Loading @@ -135,6 +136,12 @@ public class CustomThemeNameFragment extends CustomThemeStepFragment { } private class WallpaperLayoutListener implements OnLayoutChangeListener { private final Drawable mScrim; WallpaperLayoutListener(Context context) { mScrim = context.getResources() .getDrawable(R.drawable.theme_cover_scrim, context.getTheme()); } @Override public void onLayoutChange(View view, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) { Loading @@ -152,8 +159,10 @@ public class CustomThemeNameFragment extends CustomThemeStepFragment { private void setWallpaperBitmap(View view, Bitmap bitmap) { Resources res = view.getContext().getResources(); BitmapDrawable background = new BitmapDrawable(res, bitmap); background.setAlpha(128); Drawable background = new BitmapDrawable(res, bitmap); if (mScrim != null) { background = new LayerDrawable(new Drawable[]{background, mScrim}); } view.findViewById(R.id.theme_preview_card_background).setBackground(background); } } Loading