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

Commit b8bfc0a0 authored by Shaowei Shen's avatar Shaowei Shen Committed by Android (Google) Code Review
Browse files

Merge "[Output Switcher] Update Text Color"

parents 9aa2d825 d97c5a6b
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -67,10 +67,10 @@


    <!-- media output dialog-->
    <!-- media output dialog-->
    <color name="media_dialog_background">@android:color/system_neutral1_900</color>
    <color name="media_dialog_background">@android:color/system_neutral1_900</color>
    <color name="media_dialog_active_item_main_content">@android:color/system_accent2_800</color>
    <color name="media_dialog_active_item_main_content">@android:color/system_neutral1_900</color>
    <color name="media_dialog_inactive_item_main_content">@android:color/system_accent1_100</color>
    <color name="media_dialog_inactive_item_main_content">@android:color/system_neutral1_900</color>
    <color name="media_dialog_item_status">@android:color/system_accent1_100</color>
    <color name="media_dialog_item_status">@android:color/system_neutral1_900</color>
    <color name="media_dialog_item_background">@android:color/system_neutral2_800</color>
    <color name="media_dialog_item_background">@android:color/system_accent2_50</color>


    <!-- Biometric dialog colors -->
    <!-- Biometric dialog colors -->
    <color name="biometric_dialog_gray">#ffcccccc</color>
    <color name="biometric_dialog_gray">#ffcccccc</color>
+10 −2
Original line number Original line Diff line number Diff line
@@ -177,6 +177,9 @@ public abstract class MediaOutputBaseAdapter extends
                                    .mutate() : mContext.getDrawable(
                                    .mutate() : mContext.getDrawable(
                            R.drawable.media_output_item_background)
                            R.drawable.media_output_item_background)
                            .mutate();
                            .mutate();
            backgroundDrawable.setColorFilter(new PorterDuffColorFilter(
                    mController.getColorItemBackground(),
                    PorterDuff.Mode.SRC_IN));
            mItemLayout.setBackground(backgroundDrawable);
            mItemLayout.setBackground(backgroundDrawable);
            mProgressBar.setVisibility(showProgressBar ? View.VISIBLE : View.GONE);
            mProgressBar.setVisibility(showProgressBar ? View.VISIBLE : View.GONE);
            mSeekBar.setAlpha(1);
            mSeekBar.setAlpha(1);
@@ -212,8 +215,13 @@ public abstract class MediaOutputBaseAdapter extends
            mStatusIcon.setVisibility(showStatus ? View.VISIBLE : View.GONE);
            mStatusIcon.setVisibility(showStatus ? View.VISIBLE : View.GONE);
            mSeekBar.setAlpha(1);
            mSeekBar.setAlpha(1);
            mSeekBar.setVisibility(showSeekBar ? View.VISIBLE : View.GONE);
            mSeekBar.setVisibility(showSeekBar ? View.VISIBLE : View.GONE);
            mItemLayout.setBackground(mContext.getDrawable(R.drawable.media_output_item_background)
            final Drawable backgroundDrawable = mContext.getDrawable(
                    .mutate());
                            R.drawable.media_output_item_background)
                    .mutate();
            backgroundDrawable.setColorFilter(new PorterDuffColorFilter(
                    mController.getColorItemBackground(),
                    PorterDuff.Mode.SRC_IN));
            mItemLayout.setBackground(backgroundDrawable);
            mProgressBar.setVisibility(showProgressBar ? View.VISIBLE : View.GONE);
            mProgressBar.setVisibility(showProgressBar ? View.VISIBLE : View.GONE);
            mSubTitleText.setVisibility(showSubtitle ? View.VISIBLE : View.GONE);
            mSubTitleText.setVisibility(showSubtitle ? View.VISIBLE : View.GONE);
            mTwoLineTitleText.setTranslationY(0);
            mTwoLineTitleText.setTranslationY(0);
+12 −3
Original line number Original line Diff line number Diff line
@@ -111,6 +111,7 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback {
    private int mColorInactiveItem;
    private int mColorInactiveItem;
    private int mColorSeekbarProgress;
    private int mColorSeekbarProgress;
    private int mColorButtonBackground;
    private int mColorButtonBackground;
    private int mColorItemBackground;


    @Inject
    @Inject
    public MediaOutputController(@NonNull Context context, String packageName,
    public MediaOutputController(@NonNull Context context, String packageName,
@@ -142,6 +143,8 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback {
                android.R.color.system_accent1_200);
                android.R.color.system_accent1_200);
        mColorButtonBackground = Utils.getColorStateListDefaultColor(mContext,
        mColorButtonBackground = Utils.getColorStateListDefaultColor(mContext,
                R.color.media_dialog_item_background);
                R.color.media_dialog_item_background);
        mColorItemBackground = Utils.getColorStateListDefaultColor(mContext,
                android.R.color.system_accent2_50);
    }
    }


    void start(@NonNull Callback cb) {
    void start(@NonNull Callback cb) {
@@ -350,14 +353,16 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback {
                isDarkTheme);
                isDarkTheme);
        if (isDarkTheme) {
        if (isDarkTheme) {
            mColorActiveItem = mCurrentColorScheme.getNeutral1().get(10);
            mColorActiveItem = mCurrentColorScheme.getNeutral1().get(10);
            mColorInactiveItem = mCurrentColorScheme.getAccent1().get(2);
            mColorInactiveItem = mCurrentColorScheme.getNeutral1().get(10);
            mColorSeekbarProgress = mCurrentColorScheme.getAccent1().get(3);
            mColorSeekbarProgress = mCurrentColorScheme.getAccent1().get(2);
            mColorButtonBackground = mCurrentColorScheme.getAccent1().get(2);
            mColorButtonBackground = mCurrentColorScheme.getAccent1().get(2);
            mColorItemBackground = mCurrentColorScheme.getAccent2().get(0);
        } else {
        } else {
            mColorActiveItem = mCurrentColorScheme.getNeutral1().get(10);
            mColorActiveItem = mCurrentColorScheme.getNeutral1().get(10);
            mColorInactiveItem = mCurrentColorScheme.getAccent1().get(7);
            mColorInactiveItem = mCurrentColorScheme.getAccent1().get(7);
            mColorSeekbarProgress = mCurrentColorScheme.getAccent1().get(3);
            mColorSeekbarProgress = mCurrentColorScheme.getAccent1().get(3);
            mColorButtonBackground = mCurrentColorScheme.getAccent2().get(1);
            mColorButtonBackground = mCurrentColorScheme.getAccent1().get(3);
            mColorItemBackground = mCurrentColorScheme.getAccent2().get(0);
        }
        }
    }
    }


@@ -377,6 +382,10 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback {
        return mColorButtonBackground;
        return mColorButtonBackground;
    }
    }


    public int getColorItemBackground() {
        return mColorItemBackground;
    }

    private void buildMediaDevices(List<MediaDevice> devices) {
    private void buildMediaDevices(List<MediaDevice> devices) {
        // For the first time building list, to make sure the top device is the connected device.
        // For the first time building list, to make sure the top device is the connected device.
        if (mMediaDevices.isEmpty()) {
        if (mMediaDevices.isEmpty()) {