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

Commit 8e5af14b authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Overflow labels: higher contrast" into rvc-dev am: 8f73970e

Change-Id: I9edb6e87e2e6ebfcc870404db544a2512bcc2281
parents 898aff9e 8f73970e
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -30,9 +30,8 @@

    <TextView
        android:id="@+id/bubble_view_name"
        android:fontFamily="@*android:string/config_bodyFontFamily"
        android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body2"
        android:textColor="?android:attr/textColorSecondary"
        android:textAppearance="@*android:style/TextAppearance.DeviceDefault.ListItem"
        android:textSize="13sp"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:maxLines="1"
+15 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import android.widget.TextView;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.android.internal.util.ContrastColorUtil;
import com.android.systemui.R;

import java.util.ArrayList;
@@ -214,6 +215,8 @@ class BubbleOverflowAdapter extends RecyclerView.Adapter<BubbleOverflowAdapter.V
    @Override
    public BubbleOverflowAdapter.ViewHolder onCreateViewHolder(ViewGroup parent,
            int viewType) {

        // Set layout for overflow bubble view.
        LinearLayout overflowView = (LinearLayout) LayoutInflater.from(parent.getContext())
                .inflate(R.layout.bubble_overflow_view, parent, false);
        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
@@ -222,6 +225,18 @@ class BubbleOverflowAdapter extends RecyclerView.Adapter<BubbleOverflowAdapter.V
        params.width = mWidth;
        params.height = mHeight;
        overflowView.setLayoutParams(params);

        // Ensure name has enough contrast.
        final TypedArray ta = mContext.obtainStyledAttributes(
                new int[]{android.R.attr.colorBackgroundFloating, android.R.attr.textColorPrimary});
        final int bgColor = ta.getColor(0, Color.WHITE);
        int textColor = ta.getColor(1, Color.BLACK);
        textColor = ContrastColorUtil.ensureTextContrast(textColor, bgColor, true);
        ta.recycle();

        TextView viewName = overflowView.findViewById(R.id.bubble_view_name);
        viewName.setTextColor(textColor);

        return new ViewHolder(overflowView);
    }