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

Commit 81e9beb0 authored by Lucas Dupin's avatar Lucas Dupin
Browse files

Remove foreground color logic from media player

It will always be white from now on. Text colors were moved to the xmls
that define the views.

Test: atest SeekBarObserverTest
Test: atest SeekBarViewModelTest
Bug: 156387556
Change-Id: I4c6e92ed86ef44f80e856d40fccf21203839fcbb
parent 96bdbeeb
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:fontFamily="@*android:string/config_bodyFontFamily"
            android:textColor="@color/media_primary_text"
            android:gravity="left"
            android:textSize="14sp" />

@@ -58,6 +59,7 @@
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:fontFamily="@*android:string/config_bodyFontFamily"
            android:textColor="@color/media_primary_text"
            android:gravity="right"
            android:textSize="14sp" />
    </FrameLayout>
@@ -116,6 +118,7 @@
            android:layout_width="@dimen/qs_seamless_icon_size"
            android:layout_height="@dimen/qs_seamless_icon_size"
            android:layout_marginRight="8dp"
            android:tint="@color/media_primary_text"
            android:src="@*android:drawable/ic_media_seamless" />

        <TextView
@@ -125,6 +128,7 @@
            android:fontFamily="@*android:string/config_bodyFontFamily"
            android:singleLine="true"
            android:text="@*android:string/ext_media_seamless_action"
            android:textColor="@color/media_primary_text"
            android:textSize="14sp" />
    </LinearLayout>

@@ -138,11 +142,15 @@
        android:maxHeight="3dp"
        android:paddingTop="16dp"
        android:paddingBottom="16dp"
        android:thumbTint="@color/media_primary_text"
        android:progressTint="@color/media_seekbar_progress"
        android:progressBackgroundTint="@color/media_disabled"
        android:splitTrack="false" />

    <!-- App name -->
    <TextView
        android:id="@+id/app_name"
        android:textColor="@color/media_primary_text"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:singleLine="true"
@@ -155,6 +163,7 @@
        android:layout_height="wrap_content"
        android:fontFamily="@*android:string/config_headlineFontFamilyMedium"
        android:singleLine="true"
        android:textColor="@color/media_primary_text"
        android:textSize="18sp" />

    <!-- Artist name -->
@@ -164,10 +173,12 @@
        android:layout_height="wrap_content"
        android:fontFamily="@*android:string/config_bodyFontFamily"
        android:singleLine="true"
        android:textColor="@color/media_primary_text"
        android:textSize="14sp" />

    <com.android.internal.widget.CachingIconView
        android:id="@+id/icon"
        android:tint="@color/media_primary_text"
        android:layout_width="16dp"
        android:layout_height="16dp" />

+3 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@
            android:layout_height="18dp"
            android:id="@+id/remove_icon"
            android:layout_marginEnd="16dp"
            android:tint="@color/media_primary_text"
            android:src="@drawable/ic_clear"/>
        <TextView
            android:layout_width="wrap_content"
@@ -43,6 +44,7 @@
            android:id="@+id/remove_text"
            android:fontFamily="@*android:string/config_headlineFontFamilyMedium"
            android:singleLine="true"
            android:textColor="@color/media_primary_text"
            android:text="@string/controls_media_close_session" />
    </LinearLayout>
    <TextView
@@ -54,5 +56,6 @@
        android:layout_gravity="end|bottom"
        android:gravity="bottom"
        android:fontFamily="@*android:string/config_headlineFontFamilyMedium"
        android:textColor="@android:color/white"
        android:text="@string/cancel" />
</LinearLayout>
+5 −0
Original line number Diff line number Diff line
@@ -239,6 +239,11 @@

    <color name="magnification_border_color">#FF9900</color>

    <!-- media -->
    <color name="media_primary_text">@android:color/white</color>
    <color name="media_seekbar_progress">#c0ffffff</color>
    <color name="media_disabled">#80ffffff</color>

    <!-- controls -->
    <color name="control_primary_text">#E6FFFFFF</color>
    <color name="control_secondary_text">#99FFFFFF</color>
+1 −0
Original line number Diff line number Diff line
@@ -622,6 +622,7 @@

    <style name="MediaPlayer.Button" parent="@android:style/Widget.Material.Button.Borderless.Small">
        <item name="android:background">@null</item>
        <item name="android:tint">@android:color/white</item>
    </style>

    <!-- Used to style charging animation AVD animation -->
+6 −20
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.content.pm.ResolveInfo;
import android.content.res.ColorStateList;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
@@ -98,7 +99,6 @@ public class MediaControlPanel {
    private PlayerViewHolder mViewHolder;
    private MediaSession.Token mToken;
    private MediaController mController;
    private int mForegroundColor;
    private int mBackgroundColor;
    private MediaDevice mDevice;
    protected ComponentName mServiceComponent;
@@ -243,7 +243,6 @@ public class MediaControlPanel {
            return;
        }
        MediaSession.Token token = data.getToken();
        mForegroundColor = data.getForegroundColor();
        mBackgroundColor = data.getBackgroundColor();
        if (mToken == null || !mToken.equals(token)) {
            if (mQSMediaBrowser != null) {
@@ -304,24 +303,19 @@ public class MediaControlPanel {

        // App icon
        ImageView appIcon = mViewHolder.getAppIcon();
        Drawable iconDrawable = data.getAppIcon().mutate();
        iconDrawable.setTint(mForegroundColor);
        appIcon.setImageDrawable(iconDrawable);
        appIcon.setImageDrawable(data.getAppIcon());

        // Song name
        TextView titleText = mViewHolder.getTitleText();
        titleText.setText(data.getSong());
        titleText.setTextColor(data.getForegroundColor());

        // App title
        TextView appName = mViewHolder.getAppName();
        appName.setText(data.getApp());
        appName.setTextColor(mForegroundColor);

        // Artist name
        TextView artistText = mViewHolder.getArtistText();
        artistText.setText(data.getArtist());
        artistText.setTextColor(mForegroundColor);

        // Transfer chip
        if (mLocalMediaManager != null) {
@@ -358,7 +352,6 @@ public class MediaControlPanel {
            MediaAction mediaAction = actionIcons.get(i);
            button.setImageDrawable(mediaAction.getDrawable());
            button.setContentDescription(mediaAction.getContentDescription());
            button.setImageTintList(ColorStateList.valueOf(mForegroundColor));
            PendingIntent actionIntent = mediaAction.getIntent();

            if (mViewHolder.getBackground().getBackground() instanceof IlluminationDrawable) {
@@ -389,8 +382,7 @@ public class MediaControlPanel {

        // Seek Bar
        final MediaController controller = getController();
        mBackgroundExecutor.execute(
                () -> mSeekBarViewModel.updateController(controller, data.getForegroundColor()));
        mBackgroundExecutor.execute(() -> mSeekBarViewModel.updateController(controller));

        // Set up long press menu
        // TODO: b/156036025 bring back media guts
@@ -541,32 +533,27 @@ public class MediaControlPanel {
        if (mViewHolder == null) {
            return;
        }
        ColorStateList fgTintList = ColorStateList.valueOf(mForegroundColor);
        ImageView iconView = mViewHolder.getSeamlessIcon();
        TextView deviceName = mViewHolder.getSeamlessText();

        // Update the outline color
        LinearLayout viewLayout = (LinearLayout) mViewHolder.getSeamless();
        RippleDrawable bkgDrawable = (RippleDrawable) viewLayout.getBackground();
        GradientDrawable rect = (GradientDrawable) bkgDrawable.getDrawable(0);
        rect.setStroke(2, mForegroundColor);
        rect.setStroke(2, deviceName.getCurrentTextColor());
        rect.setColor(mBackgroundColor);

        ImageView iconView = mViewHolder.getSeamlessIcon();
        TextView deviceName = mViewHolder.getSeamlessText();
        deviceName.setTextColor(fgTintList);

        if (mIsRemotePlayback) {
            mViewHolder.getSeamless().setEnabled(false);
            mViewHolder.getSeamless().setAlpha(0.38f);
            iconView.setImageResource(R.drawable.ic_hardware_speaker);
            iconView.setVisibility(View.VISIBLE);
            iconView.setImageTintList(fgTintList);
            deviceName.setText(R.string.media_seamless_remote_device);
        } else if (device != null) {
            mViewHolder.getSeamless().setEnabled(true);
            mViewHolder.getSeamless().setAlpha(1f);
            Drawable icon = device.getIcon();
            iconView.setVisibility(View.VISIBLE);
            iconView.setImageTintList(fgTintList);

            if (icon instanceof AdaptiveIcon) {
                AdaptiveIcon aIcon = (AdaptiveIcon) icon;
@@ -639,7 +626,6 @@ public class MediaControlPanel {
            mQSMediaBrowser.restart();
        });
        btn.setImageDrawable(mContext.getResources().getDrawable(R.drawable.lb_ic_play));
        btn.setImageTintList(ColorStateList.valueOf(mForegroundColor));
        setVisibleAndAlpha(expandedSet, ACTION_IDS[0], true /*visible */);
        setVisibleAndAlpha(collapsedSet, ACTION_IDS[0], true /*visible */);

Loading