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

Commit c895a44a authored by mpodolian's avatar mpodolian
Browse files

Updated bubble bar expanded bubble menu appearance

Set the appropriate colors for the expanded bubble menu views.

Fixes: 356944031
Flag: com.android.wm.shell.enable_bubble_bar
Test: manual. Light theme screenshot:
https://screenshot.googleplex.com/4F7wGUpPLfGe8V6
dark theme screenshot:
https://screenshot.googleplex.com/Bqp9G7kWjYUfCri

Change-Id: I3664d1b4b2f1a45c35a2bd3d3e6e9d8c87dfdf78
parent 05997f76
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
  -->
<com.android.wm.shell.bubbles.bar.BubbleBarMenuItemView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="@dimen/bubble_bar_manage_menu_item_height"
@@ -35,7 +36,7 @@
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:textColor="?android:attr/textColorPrimary"
        android:textColor="?androidprv:attr/materialColorOnSurface"
        android:textAppearance="@*android:style/TextAppearance.DeviceDefault" />

</com.android.wm.shell.bubbles.bar.BubbleBarMenuItemView>
 No newline at end of file
+3 −2
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
<com.android.wm.shell.bubbles.bar.BubbleBarMenuView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
@@ -51,7 +52,7 @@
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_weight="1"
            android:textColor="?android:attr/textColorPrimary"
            android:textColor="?androidprv:attr/materialColorOnSurface"
            android:textAppearance="@*android:style/TextAppearance.DeviceDefault" />

        <ImageView
@@ -61,7 +62,7 @@
            android:layout_marginStart="8dp"
            android:contentDescription="@null"
            android:src="@drawable/ic_expand_less"
            app:tint="?android:attr/textColorPrimary" />
            app:tint="?androidprv:attr/materialColorOnSurface" />

    </LinearLayout>

+1 −1
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ public class BubbleBarMenuItemView extends LinearLayout {
    void update(Icon icon, String title, @ColorInt int tint) {
        if (tint == Color.TRANSPARENT) {
            final TypedArray typedArray = getContext().obtainStyledAttributes(
                    new int[]{android.R.attr.textColorPrimary});
                    new int[]{com.android.internal.R.attr.materialColorOnSurface});
            mTextView.setTextColor(typedArray.getColor(0, Color.BLACK));
        } else {
            icon.setTint(tint);
+12 −3
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ package com.android.wm.shell.bubbles.bar;

import android.annotation.ColorInt;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.drawable.Icon;
@@ -27,6 +28,8 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.core.widget.ImageViewCompat;

import com.android.wm.shell.R;
import com.android.wm.shell.bubbles.Bubble;

@@ -39,6 +42,7 @@ public class BubbleBarMenuView extends LinearLayout {
    private ViewGroup mBubbleSectionView;
    private ViewGroup mActionsSectionView;
    private ImageView mBubbleIconView;
    private ImageView mBubbleDismissIconView;
    private TextView mBubbleTitleView;

    public BubbleBarMenuView(Context context) {
@@ -65,13 +69,18 @@ public class BubbleBarMenuView extends LinearLayout {
        mActionsSectionView = findViewById(R.id.bubble_bar_manage_menu_actions_section);
        mBubbleIconView = findViewById(R.id.bubble_bar_manage_menu_bubble_icon);
        mBubbleTitleView = findViewById(R.id.bubble_bar_manage_menu_bubble_title);
        updateActionsBackgroundColor();
        mBubbleDismissIconView = findViewById(R.id.bubble_bar_manage_menu_dismiss_icon);
        updateThemeColors();
    }

    private void updateActionsBackgroundColor() {
    private void updateThemeColors() {
        try (TypedArray ta = mContext.obtainStyledAttributes(new int[]{
                com.android.internal.R.attr.materialColorSurfaceBright})) {
                com.android.internal.R.attr.materialColorSurfaceBright,
                com.android.internal.R.attr.materialColorOnSurface
        })) {
            mActionsSectionView.getBackground().setTint(ta.getColor(0, Color.WHITE));
            ImageViewCompat.setImageTintList(mBubbleDismissIconView,
                    ColorStateList.valueOf(ta.getColor(1, Color.BLACK)));
        }
    }

+9 −3
Original line number Diff line number Diff line
@@ -19,12 +19,13 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.drawable.Icon;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.core.content.ContextCompat;
import androidx.dynamicanimation.animation.DynamicAnimation;
import androidx.dynamicanimation.animation.SpringForce;

@@ -172,12 +173,17 @@ class BubbleBarMenuViewController {
    private ArrayList<BubbleBarMenuView.MenuAction> createMenuActions(Bubble bubble) {
        ArrayList<BubbleBarMenuView.MenuAction> menuActions = new ArrayList<>();
        Resources resources = mContext.getResources();

        int tintColor;
        try (TypedArray ta = mContext.obtainStyledAttributes(new int[]{
                com.android.internal.R.attr.materialColorOnSurface})) {
            tintColor = ta.getColor(0, Color.TRANSPARENT);
        }
        if (bubble.isConversation()) {
            // Don't bubble conversation action
            menuActions.add(new BubbleBarMenuView.MenuAction(
                    Icon.createWithResource(mContext, R.drawable.bubble_ic_stop_bubble),
                    resources.getString(R.string.bubbles_dont_bubble_conversation),
                    tintColor,
                    view -> {
                        hideMenu(true /* animated */);
                        if (mListener != null) {
@@ -204,7 +210,7 @@ class BubbleBarMenuViewController {
        menuActions.add(new BubbleBarMenuView.MenuAction(
                Icon.createWithResource(resources, R.drawable.ic_remove_no_shadow),
                resources.getString(R.string.bubble_dismiss_text),
                ContextCompat.getColor(mContext, R.color.bubble_bar_expanded_view_menu_close),
                tintColor,
                view -> {
                    hideMenu(true /* animated */);
                    if (mListener != null) {