Enable new theme picker preveiw
Also add customize button for customize themes.
Screenshot:
- Portrait: https://screenshot.googleplex.com/HWmnWEACFdW.png
- Landscape: https://screenshot.googleplex.com/1NcOQNLoLvE.png
Next: cleanup for res/
Test: Manually
Bug: 146475648
Change-Id: I7624f7404949398dee3782317f0ce0ece8194007
diff --git a/res/layout-land/fragment_theme_picker.xml b/res/layout-land/fragment_theme_picker.xml
index dc30232..915fb47 100644
--- a/res/layout-land/fragment_theme_picker.xml
+++ b/res/layout-land/fragment_theme_picker.xml
@@ -31,39 +31,28 @@
android:layout_height="match_parent"
android:orientation="horizontal">
- <com.android.wallpaper.widget.PreviewPager
- android:id="@+id/theme_preview_pager"
+ <FrameLayout
android:layout_width="0dp"
android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@color/secondary_color"/>
- <View
- android:layout_width="1dp"
- android:layout_height="match_parent"
- android:background="@color/divider_color"/>
- <LinearLayout
- android:id="@+id/options_section"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:paddingVertical="10dp"
- android:orientation="vertical">
-
- <androidx.recyclerview.widget.RecyclerView
- android:id="@+id/options_container"
+ android:layout_weight="1">
+ <FrameLayout
+ android:id="@+id/preview_card_container"
android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1"/>
+ android:layout_height="@dimen/preview_content_height"
+ android:paddingTop="@dimen/preview_content_padding_top"
+ android:paddingBottom="@dimen/preview_content_padding_bottom"
+ android:clipToPadding="false"
+ android:background="@color/fullscreen_preview_background">
+ <include layout="@layout/theme_preview_card_v2"/>
+ </FrameLayout>
+ </FrameLayout>
- <Button
- android:id="@+id/apply_button"
- style="@style/ActionPrimaryButton"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="end"
- android:paddingHorizontal="10dp"
- android:text="@string/apply_theme_btn"/>
- </LinearLayout>
+ <androidx.recyclerview.widget.RecyclerView
+ android:id="@+id/options_container"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:paddingVertical="10dp" />
</LinearLayout>
<androidx.core.widget.ContentLoadingProgressBar
diff --git a/res/layout/fragment_theme_picker.xml b/res/layout/fragment_theme_picker.xml
index 93606ea..704114f 100644
--- a/res/layout/fragment_theme_picker.xml
+++ b/res/layout/fragment_theme_picker.xml
@@ -32,7 +32,6 @@
android:layout_height="match_parent"
android:orientation="vertical">
- <!-- The V2 preview card. -->
<FrameLayout
android:id="@+id/preview_card_container"
android:layout_width="match_parent"
@@ -40,18 +39,10 @@
android:paddingTop="@dimen/preview_content_padding_top"
android:paddingBottom="@dimen/preview_content_padding_bottom"
android:clipToPadding="false"
- android:background="@color/fullscreen_preview_background"
- android:visibility="gone">
+ android:background="@color/fullscreen_preview_background">
<include layout="@layout/theme_preview_card_v2"/>
</FrameLayout>
- <!-- Will remove it later. -->
- <com.android.wallpaper.widget.PreviewPager
- android:id="@+id/theme_preview_pager"
- android:layout_width="match_parent"
- android:layout_height="@dimen/preview_content_height"
- android:background="@color/preview_pager_background"/>
-
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/options_container"
android:layout_width="match_parent"
diff --git a/src/com/android/customization/picker/theme/ThemeFragment.java b/src/com/android/customization/picker/theme/ThemeFragment.java
index 52814c5..4cb330e 100644
--- a/src/com/android/customization/picker/theme/ThemeFragment.java
+++ b/src/com/android/customization/picker/theme/ThemeFragment.java
@@ -22,31 +22,16 @@
import static com.android.customization.picker.theme.ThemeFullPreviewFragment.EXTRA_THEME_OPTION_TITLE;
import static com.android.customization.picker.theme.ThemeFullPreviewFragment.EXTRA_WALLPAPER_INFO;
import static com.android.wallpaper.widget.BottomActionBar.BottomAction.APPLY;
+import static com.android.wallpaper.widget.BottomActionBar.BottomAction.CUSTOMIZE;
import static com.android.wallpaper.widget.BottomActionBar.BottomAction.INFORMATION;
-import android.app.Activity;
-import android.app.WallpaperColors;
import android.content.Context;
import android.content.Intent;
-import android.content.res.ColorStateList;
-import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.Bitmap.Config;
-import android.graphics.drawable.BitmapDrawable;
-import android.graphics.drawable.Drawable;
-import android.graphics.drawable.LayerDrawable;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.View.OnLayoutChangeListener;
import android.view.ViewGroup;
-import android.widget.CompoundButton;
-import android.widget.ImageView;
-import android.widget.SeekBar;
-import android.widget.Switch;
-import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
@@ -57,28 +42,19 @@
import com.android.customization.model.CustomizationManager.Callback;
import com.android.customization.model.CustomizationManager.OptionsFetchedListener;
import com.android.customization.model.theme.ThemeBundle;
-import com.android.customization.model.theme.ThemeBundle.PreviewInfo;
import com.android.customization.model.theme.ThemeManager;
import com.android.customization.model.theme.custom.CustomTheme;
import com.android.customization.module.ThemesUserEventLogger;
-import com.android.customization.picker.BasePreviewAdapter;
-import com.android.customization.picker.TimeTicker;
import com.android.customization.picker.ViewOnlyFullPreviewActivity;
import com.android.customization.picker.WallpaperPreviewer;
-import com.android.customization.picker.theme.ThemePreviewPage.ThemeCoverPage;
-import com.android.customization.picker.theme.ThemePreviewPage.TimeContainer;
import com.android.customization.widget.OptionSelectorController;
import com.android.customization.widget.ThemeInfoView;
import com.android.wallpaper.R;
-import com.android.wallpaper.asset.Asset;
-import com.android.wallpaper.asset.Asset.CenterCropBitmapTask;
-import com.android.wallpaper.asset.BitmapCachingAsset;
import com.android.wallpaper.model.WallpaperInfo;
import com.android.wallpaper.module.CurrentWallpaperInfoFactory;
import com.android.wallpaper.module.InjectorProvider;
import com.android.wallpaper.picker.AppbarFragment;
import com.android.wallpaper.widget.BottomActionBar;
-import com.android.wallpaper.widget.PreviewPager;
import java.util.List;
@@ -91,8 +67,6 @@
private static final String KEY_SELECTED_THEME = "ThemeFragment.SelectedThemeBundle";
private static final int FULL_PREVIEW_REQUEST_CODE = 1000;
- private static final boolean USE_NEW_PREVIEW = false;
-
/**
* Interface to be implemented by an Activity hosting a {@link ThemeFragment}
*/
@@ -110,16 +84,11 @@
private ThemeManager mThemeManager;
private ThemesUserEventLogger mEventLogger;
private ThemeBundle mSelectedTheme;
- private ThemePreviewAdapter mAdapter;
- private PreviewPager mPreviewPager;
private ContentLoadingProgressBar mLoading;
private View mContent;
private View mError;
- private boolean mUseMyWallpaper = true;
private WallpaperInfo mCurrentHomeWallpaper;
- private Asset mCurrentWallpaperThumbAsset;
private CurrentWallpaperInfoFactory mCurrentWallpaperFactory;
- private TimeTicker mTicker;
private BottomActionBar mBottomActionBar;
private WallpaperPreviewer mWallpaperPreviewer;
private ThemeOptionPreviewer mThemeOptionPreviewer;
@@ -146,39 +115,34 @@
mError = view.findViewById(R.id.error_section);
mCurrentWallpaperFactory = InjectorProvider.getInjector()
.getCurrentWallpaperFactory(getActivity().getApplicationContext());
- mPreviewPager = view.findViewById(R.id.theme_preview_pager);
mOptionsContainer = view.findViewById(R.id.options_container);
- if (USE_NEW_PREVIEW) {
- mPreviewPager.setVisibility(View.GONE);
- view.findViewById(R.id.preview_card_container).setVisibility(View.VISIBLE);
- // Set Wallpaper background.
- mWallpaperPreviewer = new WallpaperPreviewer(
- getLifecycle(),
- getActivity(),
- view.findViewById(R.id.wallpaper_preview_image),
- view.findViewById(R.id.wallpaper_preview_surface));
- mCurrentWallpaperFactory.createCurrentWallpaperInfos(
- (homeWallpaper, lockWallpaper, presentationMode) -> {
- mCurrentHomeWallpaper = homeWallpaper;
- mWallpaperPreviewer.setWallpaper(mCurrentHomeWallpaper);
- }, false);
- view.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
- @Override
- public void onLayoutChange(View v, int left, int top, int right, int bottom,
- int oldLeft, int oldTop, int oldRight, int oldBottom) {
- mWallpaperPreviewer.updatePreviewCardRadius();
- view.removeOnLayoutChangeListener(this);
- }
- });
+ // Set Wallpaper background.
+ mWallpaperPreviewer = new WallpaperPreviewer(
+ getLifecycle(),
+ getActivity(),
+ view.findViewById(R.id.wallpaper_preview_image),
+ view.findViewById(R.id.wallpaper_preview_surface));
+ mCurrentWallpaperFactory.createCurrentWallpaperInfos(
+ (homeWallpaper, lockWallpaper, presentationMode) -> {
+ mCurrentHomeWallpaper = homeWallpaper;
+ mWallpaperPreviewer.setWallpaper(mCurrentHomeWallpaper);
+ }, false);
+ view.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
+ @Override
+ public void onLayoutChange(View v, int left, int top, int right, int bottom,
+ int oldLeft, int oldTop, int oldRight, int oldBottom) {
+ mWallpaperPreviewer.updatePreviewCardRadius();
+ view.removeOnLayoutChangeListener(this);
+ }
+ });
- ViewGroup previewContainer = view.findViewById(R.id.theme_preview_container);
- previewContainer.setOnClickListener(v -> showFullPreview());
- mThemeOptionPreviewer = new ThemeOptionPreviewer(
- getLifecycle(),
- getContext(),
- previewContainer);
- }
+ ViewGroup previewContainer = view.findViewById(R.id.theme_preview_container);
+ previewContainer.setOnClickListener(v -> showFullPreview());
+ mThemeOptionPreviewer = new ThemeOptionPreviewer(
+ getLifecycle(),
+ getContext(),
+ previewContainer);
return view;
}
@@ -193,6 +157,7 @@
mThemeInfoView = (ThemeInfoView) LayoutInflater.from(getContext()).inflate(
R.layout.theme_info_view, /* root= */ null);
mBottomActionBar.attachViewToBottomSheetAndBindAction(mThemeInfoView, INFORMATION);
+ mBottomActionBar.setActionClickListener(CUSTOMIZE, this::onCustomizeClicked);
}
@Override
@@ -227,30 +192,6 @@
}
@Override
- public void onResume() {
- super.onResume();
- if (!USE_NEW_PREVIEW) {
- mTicker = TimeTicker.registerNewReceiver(getContext(), this::updateTime);
- reloadWallpaper();
- updateTime();
- }
- }
-
- private void updateTime() {
- if (mAdapter != null) {
- mAdapter.updateTime();
- }
- }
-
- @Override
- public void onPause() {
- super.onPause();
- if (getContext() != null && !USE_NEW_PREVIEW) {
- getContext().unregisterReceiver(mTicker);
- }
- }
-
- @Override
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
if (mSelectedTheme != null && !mSelectedTheme.isActive(mThemeManager)) {
@@ -282,27 +223,7 @@
super.onActivityResult(requestCode, resultCode, data);
}
- private void reloadWallpaper() {
- mCurrentWallpaperFactory.createCurrentWallpaperInfos(
- (homeWallpaper, lockWallpaper, presentationMode) -> {
- mCurrentHomeWallpaper = homeWallpaper;
- mCurrentWallpaperThumbAsset = new BitmapCachingAsset(getContext(),
- mCurrentHomeWallpaper.getThumbAsset(getContext()));
- if (mSelectedTheme != null && mAdapter != null) {
- mAdapter.setWallpaperAsset(mCurrentWallpaperThumbAsset);
- mAdapter.rebindWallpaperIfAvailable();
- }
- }, false);
- }
-
- private void createAdapter(List<ThemeBundle> options) {
- mAdapter = new ThemePreviewAdapter(getActivity(), mSelectedTheme,
- mCurrentWallpaperThumbAsset,
- mSelectedTheme instanceof CustomTheme ? this::onEditClicked : null);
- mPreviewPager.setAdapter(mAdapter);
- }
-
- private void onEditClicked(View view) {
+ private void onCustomizeClicked(View view) {
if (mSelectedTheme instanceof CustomTheme) {
navigateToCustomTheme((CustomTheme) mSelectedTheme);
}
@@ -332,21 +253,19 @@
navigateToCustomTheme((CustomTheme) selected);
} else {
mSelectedTheme = (ThemeBundle) selected;
- if (mUseMyWallpaper || mSelectedTheme instanceof CustomTheme) {
- mSelectedTheme.setOverrideThemeWallpaper(mCurrentHomeWallpaper);
- } else {
- mSelectedTheme.setOverrideThemeWallpaper(null);
- }
+ mSelectedTheme.setOverrideThemeWallpaper(mCurrentHomeWallpaper);
mEventLogger.logThemeSelected(mSelectedTheme,
selected instanceof CustomTheme);
- if (USE_NEW_PREVIEW) {
- mThemeOptionPreviewer.setThemeBundle(mSelectedTheme);
- } else {
- createAdapter(options);
- }
+ mThemeOptionPreviewer.setThemeBundle(mSelectedTheme);
if (mThemeInfoView != null && mSelectedTheme != null) {
mThemeInfoView.populateThemeInfo(mSelectedTheme);
}
+
+ if (selected instanceof CustomTheme) {
+ mBottomActionBar.showActionsOnly(INFORMATION, CUSTOMIZE, APPLY);
+ } else {
+ mBottomActionBar.showActionsOnly(INFORMATION, APPLY);
+ }
mBottomActionBar.show();
}
});
@@ -435,242 +354,4 @@
Intent intent = ViewOnlyFullPreviewActivity.newIntent(getContext(), SECTION_STYLE, bundle);
startActivityForResult(intent, FULL_PREVIEW_REQUEST_CODE);
}
-
- /**
- * Adapter class for mPreviewPager.
- * This is a ViewPager as it allows for a nice pagination effect (ie, pages snap on swipe,
- * we don't want to just scroll)
- */
- private static class ThemePreviewAdapter extends BasePreviewAdapter<ThemePreviewPage> {
-
- private int[] mIconIds = {
- R.id.preview_icon_0, R.id.preview_icon_1, R.id.preview_icon_2, R.id.preview_icon_3,
- R.id.preview_icon_4, R.id.preview_icon_5
- };
- private int[] mColorButtonIds = {
- R.id.preview_check_selected, R.id.preview_radio_selected, R.id.preview_toggle_selected
- };
- private int[] mColorTileIds = {
- R.id.preview_color_qs_0_bg, R.id.preview_color_qs_1_bg, R.id.preview_color_qs_2_bg
- };
- private int[][] mColorTileIconIds = {
- new int[]{ R.id.preview_color_qs_0_icon, 0},
- new int[]{ R.id.preview_color_qs_1_icon, 1},
- new int[] { R.id.preview_color_qs_2_icon, 3}
- };
-
- private int[] mShapeIconIds = {
- R.id.shape_preview_icon_0, R.id.shape_preview_icon_1, R.id.shape_preview_icon_2,
- R.id.shape_preview_icon_3, R.id.shape_preview_icon_4, R.id.shape_preview_icon_5
- };
- private Asset mWallpaperAsset;
-
- ThemePreviewAdapter(Activity activity, ThemeBundle theme, @Nullable Asset wallpaperAsset,
- @Nullable OnClickListener editClickListener) {
- super(activity, R.layout.theme_preview_card);
- mWallpaperAsset = wallpaperAsset;
- final Resources res = activity.getResources();
- final PreviewInfo previewInfo = theme.getPreviewInfo();
-
- Drawable coverScrim = theme instanceof CustomTheme
- ? res.getDrawable(R.drawable.theme_cover_scrim, activity.getTheme())
- : null;
-
- WallpaperPreviewLayoutListener wallpaperListener = new WallpaperPreviewLayoutListener(
- () -> mWallpaperAsset, previewInfo, coverScrim, true);
-
- addPage(new ThemeCoverPage(activity, theme.getTitle(),
- previewInfo.resolveAccentColor(res), previewInfo.icons,
- previewInfo.headlineFontFamily, previewInfo.bottomSheeetCornerRadius,
- previewInfo.shapeDrawable, previewInfo.shapeAppIcons, editClickListener,
- mColorButtonIds, mColorTileIds, mColorTileIconIds, mShapeIconIds,
- wallpaperListener));
- addPage(new ThemePreviewPage(activity, R.string.preview_name_font, R.drawable.ic_font,
- R.layout.preview_card_font_content,
- previewInfo.resolveAccentColor(res)) {
- @Override
- protected void bindBody(boolean forceRebind) {
- TextView title = card.findViewById(R.id.font_card_title);
- title.setTypeface(previewInfo.headlineFontFamily);
- TextView body = card.findViewById(R.id.font_card_body);
- body.setTypeface(previewInfo.bodyFontFamily);
- card.findViewById(R.id.font_card_divider).setBackgroundColor(accentColor);
- }
- });
- if (previewInfo.icons.size() >= mIconIds.length) {
- addPage(new ThemePreviewPage(activity, R.string.preview_name_icon,
- R.drawable.ic_wifi_24px, R.layout.preview_card_icon_content,
- previewInfo.resolveAccentColor(res)) {
- @Override
- protected void bindBody(boolean forceRebind) {
- for (int i = 0; i < mIconIds.length && i < previewInfo.icons.size(); i++) {
- ((ImageView) card.findViewById(mIconIds[i]))
- .setImageDrawable(previewInfo.icons.get(i)
- .getConstantState().newDrawable().mutate());
- }
- }
- });
- }
- if (previewInfo.colorAccentDark != -1 && previewInfo.colorAccentLight != -1) {
- addPage(new ThemePreviewPage(activity, R.string.preview_name_color,
- R.drawable.ic_colorize_24px, R.layout.preview_card_color_content,
- previewInfo.resolveAccentColor(res)) {
- @Override
- protected void bindBody(boolean forceRebind) {
- int controlGreyColor = res.getColor(R.color.control_grey);
- ColorStateList tintList = new ColorStateList(
- new int[][]{
- new int[]{android.R.attr.state_selected},
- new int[]{android.R.attr.state_checked},
- new int[]{-android.R.attr.state_enabled},
- },
- new int[] {
- accentColor,
- accentColor,
- controlGreyColor
- }
- );
-
- for (int i = 0; i < mColorButtonIds.length; i++) {
- CompoundButton button = card.findViewById(mColorButtonIds[i]);
- button.setButtonTintList(tintList);
- }
-
- Switch enabledSwitch = card.findViewById(R.id.preview_toggle_selected);
- enabledSwitch.setThumbTintList(tintList);
- enabledSwitch.setTrackTintList(tintList);
-
- ColorStateList seekbarTintList = ColorStateList.valueOf(accentColor);
- SeekBar seekbar = card.findViewById(R.id.preview_seekbar);
- seekbar.setThumbTintList(seekbarTintList);
- seekbar.setProgressTintList(seekbarTintList);
- seekbar.setProgressBackgroundTintList(seekbarTintList);
- // Disable seekbar
- seekbar.setOnTouchListener((view, motionEvent) -> true);
-
- int iconFgColor = res.getColor(R.color.tile_enabled_icon_color, null);
- for (int i = 0; i < mColorTileIds.length && i < previewInfo.icons.size();
- i++) {
- Drawable icon = previewInfo.icons.get(mColorTileIconIds[i][1])
- .getConstantState().newDrawable().mutate();
- icon.setTint(iconFgColor);
- Drawable bgShape =
- previewInfo.shapeDrawable.getConstantState().newDrawable();
- bgShape.setTint(accentColor);
-
- ImageView bg = card.findViewById(mColorTileIds[i]);
- bg.setImageDrawable(bgShape);
- ImageView fg = card.findViewById(mColorTileIconIds[i][0]);
- fg.setImageDrawable(icon);
- }
- }
- });
- }
- if (!previewInfo.shapeAppIcons.isEmpty()) {
- addPage(new ThemePreviewPage(activity, R.string.preview_name_shape,
- R.drawable.ic_shapes_24px, R.layout.preview_card_shape_content,
- previewInfo.resolveAccentColor(res)) {
- @Override
- protected void bindBody(boolean forceRebind) {
- for (int i = 0; i < mShapeIconIds.length
- && i < previewInfo.shapeAppIcons.size(); i++) {
- ImageView iconView = card.findViewById(mShapeIconIds[i]);
- iconView.setBackground(
- previewInfo.shapeAppIcons.get(i));
- }
- }
- });
- }
- }
-
- public void rebindWallpaperIfAvailable() {
- for (ThemePreviewPage page : mPages) {
- if (page.containsWallpaper()) {
- page.bindBody(true);
- }
- }
- }
-
- public void updateTime() {
- for (ThemePreviewPage page : mPages) {
- if (page instanceof TimeContainer) {
- ((TimeContainer)page).updateTime();
- }
- }
- }
-
- public void setWallpaperAsset(Asset wallpaperAsset) {
- mWallpaperAsset = wallpaperAsset;
- }
-
- private static class WallpaperPreviewLayoutListener implements OnLayoutChangeListener {
- interface WallpaperPreviewAssetProvider {
- Asset getAsset();
- }
- private final WallpaperPreviewAssetProvider mWallpaperPreviewAssetProvider;
- private final PreviewInfo mPreviewInfo;
- private final Drawable mScrim;
- private final boolean mIsTranslucent;
-
- WallpaperPreviewLayoutListener(
- WallpaperPreviewAssetProvider wallpaperPreviewAssetProvider,
- PreviewInfo previewInfo, Drawable scrim, boolean translucent) {
- mWallpaperPreviewAssetProvider = wallpaperPreviewAssetProvider;
- mPreviewInfo = previewInfo;
- mScrim = scrim;
- mIsTranslucent = translucent;
- }
-
- @Override
- public void onLayoutChange(View view, int left, int top, int right,
- int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
- int targetWidth = right - left;
- int targetHeight = bottom - top;
- if (targetWidth > 0 && targetHeight > 0) {
- Asset wallpaperPreviewAsset = mWallpaperPreviewAssetProvider.getAsset();
- if (wallpaperPreviewAsset != null) {
- wallpaperPreviewAsset.decodeBitmap(
- targetWidth, targetHeight,
- bitmap -> new CenterCropBitmapTask(bitmap, view,
- croppedBitmap -> setWallpaperBitmap(view, croppedBitmap))
- .execute());
- }
- view.removeOnLayoutChangeListener(this);
- }
- }
-
- private void setWallpaperBitmap(View view, Bitmap bitmap) {
- Resources res = view.getContext().getResources();
- Drawable background = new BitmapDrawable(res, bitmap);
- if (mIsTranslucent) {
- background.setAlpha(ThemeCoverPage.COVER_PAGE_WALLPAPER_ALPHA);
- }
- if (mScrim != null) {
- background = new LayerDrawable(new Drawable[]{background, mScrim});
- }
- view.findViewById(R.id.theme_preview_card_background).setBackground(background);
- if (mScrim == null && !mIsTranslucent) {
- boolean shouldRecycle = false;
- if (bitmap.getConfig() == Config.HARDWARE) {
- bitmap = bitmap.copy(Config.ARGB_8888, false);
- shouldRecycle = true;
- }
- int colorsHint = WallpaperColors.fromBitmap(bitmap).getColorHints();
- if (shouldRecycle) {
- bitmap.recycle();
- }
- TextView header = view.findViewById(R.id.theme_preview_card_header);
- if ((colorsHint & WallpaperColors.HINT_SUPPORTS_DARK_TEXT) == 0) {
- int colorLight = res.getColor(R.color.text_color_light, null);
- header.setTextColor(colorLight);
- header.setCompoundDrawableTintList(ColorStateList.valueOf(colorLight));
- } else {
- header.setTextColor(res.getColor(R.color.text_color_dark, null));
- header.setCompoundDrawableTintList(ColorStateList.valueOf(
- mPreviewInfo.colorAccentLight));
- }
- }
- }
- }
- }
}