Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 58d6f27a authored by chihhangchuang's avatar chihhangchuang
Browse files

Add theme info sheet to theme full preview page

parent a8f0930e
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.customization.picker.theme;
import static android.app.Activity.RESULT_OK;

import static com.android.wallpaper.widget.BottomActionBar.BottomAction.APPLY;
import static com.android.wallpaper.widget.BottomActionBar.BottomAction.INFORMATION;

import android.app.Activity;
import android.content.Intent;
@@ -35,6 +36,7 @@ import com.android.customization.model.theme.ThemeBundle;
import com.android.customization.model.theme.ThemeBundleProvider;
import com.android.customization.module.CustomizationInjector;
import com.android.customization.picker.WallpaperPreviewer;
import com.android.customization.widget.ThemeInfoView;
import com.android.wallpaper.R;
import com.android.wallpaper.model.WallpaperInfo;
import com.android.wallpaper.module.InjectorProvider;
@@ -125,8 +127,12 @@ public class ThemeFullPreviewFragment extends AppbarFragment {

    @Override
    protected void onBottomActionBarReady(BottomActionBar bottomActionBar) {
        bottomActionBar.showActionsOnly(APPLY);
        bottomActionBar.showActionsOnly(INFORMATION, APPLY);
        bottomActionBar.setActionClickListener(APPLY, v -> finishActivityWithResultOk());
        ThemeInfoView themeInfoView = (ThemeInfoView) LayoutInflater.from(getContext()).inflate(
                R.layout.theme_info_view, /* root= */ null);
        themeInfoView.populateThemeInfo(mThemeBundle);
        bottomActionBar.attachViewToBottomSheetAndBindAction(themeInfoView, INFORMATION);
        bottomActionBar.show();
    }

+3 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
package com.android.customization.widget;

import android.content.Context;
import android.content.res.ColorStateList;
import android.util.AttributeSet;
import android.widget.ImageView;
import android.widget.LinearLayout;
@@ -76,6 +77,8 @@ public class ThemeInfoView extends LinearLayout {

            if (previewInfo.shapeDrawable != null) {
                mShapePreviewImageView.setImageDrawable(previewInfo.shapeDrawable);
                mShapePreviewImageView.setImageTintList(
                        ColorStateList.valueOf(previewInfo.resolveAccentColor(getResources())));
            }
        }
    }