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

Commit 93ddc7b5 authored by George Lin's avatar George Lin Committed by Android (Google) Code Review
Browse files

Merge "Fix multiple logs of THEMED_ICON_APPLIED" into main

parents 2f68800a a643bee1
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import com.android.customization.picker.themedicon.ThemedIconSectionView;
import com.android.wallpaper.R;
import com.android.wallpaper.model.CustomizationSectionController;

// TODO (b/311712452): Refactor CustomizationSectionController to use recommended arch UI components
/** The {@link CustomizationSectionController} for themed icon section. */
public class ThemedIconSectionController implements
        CustomizationSectionController<ThemedIconSectionView> {
+6 −8
Original line number Diff line number Diff line
@@ -40,18 +40,16 @@ public class ThemedIconSectionView extends SectionView {
    protected void onFinishInflate() {
        super.onFinishInflate();
        mSwitchView = findViewById(R.id.themed_icon_toggle);
        setOnClickListener(v -> mSwitchView.toggle());
        mSwitchView.setOnCheckedChangeListener((buttonView, isChecked) -> viewActivated(isChecked));
        setOnClickListener(v -> {
            mSwitchView.toggle();
            if (mSectionViewListener != null) {
                mSectionViewListener.onViewActivated(getContext(), mSwitchView.isChecked());
            }
        });
    }

    /** Gets the switch view. */
    public Switch getSwitch() {
        return mSwitchView;
    }

    private void viewActivated(boolean isChecked) {
        if (mSectionViewListener != null) {
            mSectionViewListener.onViewActivated(getContext(), isChecked);
        }
    }
}