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

Commit 0297200e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Dark grey overflow in dark mode" into rvc-dev am: 77d0f42f am: ef4b8c7d am: 4e8db8e0

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11842538

Change-Id: I42acc45798510b8c905383fcd171117e84110f30
parents f1cba5ba 4e8db8e0
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -203,8 +203,8 @@
    <color name="global_screenshot_background_protection_start">#40000000</color> <!-- 25% black -->

    <!-- Bubbles -->
    <color name="bubbles_pointer_light">#FFFFFF</color>
    <color name="bubbles_pointer_dark">@color/GM2_grey_800</color>
    <color name="bubbles_light">#FFFFFF</color>
    <color name="bubbles_dark">@color/GM2_grey_800</color>

    <!-- GM2 colors -->
    <color name="GM2_grey_50">#F8F9FA</color>
+2 −2
Original line number Diff line number Diff line
@@ -437,10 +437,10 @@ public class BubbleExpandedView extends LinearLayout {
                getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
        switch (mode) {
            case Configuration.UI_MODE_NIGHT_NO:
                mPointerDrawable.setTint(getResources().getColor(R.color.bubbles_pointer_light));
                mPointerDrawable.setTint(getResources().getColor(R.color.bubbles_light));
                break;
            case Configuration.UI_MODE_NIGHT_YES:
                mPointerDrawable.setTint(getResources().getColor(R.color.bubbles_pointer_dark));
                mPointerDrawable.setTint(getResources().getColor(R.color.bubbles_dark));
                break;
        }
        mPointerView.setBackground(mPointerDrawable);
+13 −13
Original line number Diff line number Diff line
@@ -22,9 +22,9 @@ import static android.view.View.GONE;
import static com.android.systemui.bubbles.BadgedImageView.DEFAULT_PATH_SIZE;

import android.content.Context;
import android.content.res.TypedArray;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Path;
import android.graphics.drawable.AdaptiveIconDrawable;
@@ -88,19 +88,23 @@ public class BubbleOverflow implements BubbleViewProvider {
                false /* attachToRoot */);
        mOverflowBtn.setContentDescription(mContext.getResources().getString(
                R.string.bubble_overflow_button_content_description));
        Resources res = mContext.getResources();

        TypedArray ta = mContext.obtainStyledAttributes(
                new int[]{android.R.attr.colorBackgroundFloating});
        int bgColor = ta.getColor(0, Color.WHITE /* default */);
        ta.recycle();

        // Set color for button icon and dot
        TypedValue typedValue = new TypedValue();
        mContext.getTheme().resolveAttribute(android.R.attr.colorAccent, typedValue, true);
        int colorAccent = mContext.getColor(typedValue.resourceId);
        mOverflowBtn.getDrawable().setTint(colorAccent);
        mDotColor = colorAccent;

        ColorDrawable bg = new ColorDrawable(bgColor);
        // Set color for button and activity background
        ColorDrawable bg = new ColorDrawable(res.getColor(R.color.bubbles_light));
        final int mode = res.getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
        if (mode == Configuration.UI_MODE_NIGHT_YES) {
            bg = new ColorDrawable(res.getColor(R.color.bubbles_dark));
        }

        // Apply icon inset
        InsetDrawable fg = new InsetDrawable(mOverflowBtn.getDrawable(),
                mBitmapSize - mIconBitmapSize /* inset */);
        AdaptiveIconDrawable adaptiveIconDrawable = new AdaptiveIconDrawable(bg, fg);
@@ -110,6 +114,7 @@ public class BubbleOverflow implements BubbleViewProvider {
                null /* user */,
                true /* shrinkNonAdaptiveIcons */).icon;

        // Get path with dot location
        float scale = iconFactory.getNormalizer().getScale(mOverflowBtn.getDrawable(),
                null /* outBounds */, null /* path */, null /* outMaskShape */);
        float radius = DEFAULT_PATH_SIZE / 2f;
@@ -120,14 +125,9 @@ public class BubbleOverflow implements BubbleViewProvider {
                radius /* pivot y */);
        mPath.transform(matrix);

        mOverflowBtn.setVisibility(GONE);
        mOverflowBtn.setRenderedBubble(this);
    }

    ImageView getBtn() {
        return mOverflowBtn;
    }

    void setVisible(int visible) {
        mOverflowBtn.setVisibility(visible);
    }
+12 −21
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.util.Log;
@@ -100,7 +101,6 @@ public class BubbleOverflowActivity extends Activity {
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.bubble_overflow_activity);
        setBackgroundColor();

        mEmptyState = findViewById(R.id.bubble_overflow_empty_state);
        mRecyclerView = findViewById(R.id.bubble_overflow_recycler);
@@ -141,34 +141,25 @@ public class BubbleOverflowActivity extends Activity {
     * Handle theme changes.
     */
    void updateTheme() {
        final int mode =
                getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
        Resources res = getResources();
        final int mode = res.getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
        switch (mode) {
            case Configuration.UI_MODE_NIGHT_NO:
                if (DEBUG_OVERFLOW) {
                    Log.d(TAG, "Set overflow UI to light mode");
                }
            case Configuration.UI_MODE_NIGHT_YES:
                mEmptyStateImage.setImageDrawable(
                        getResources().getDrawable(R.drawable.ic_empty_bubble_overflow_light));
                        res.getDrawable(R.drawable.ic_empty_bubble_overflow_dark));
                findViewById(android.R.id.content)
                        .setBackgroundColor(res.getColor(R.color.bubbles_dark));
                break;
            case Configuration.UI_MODE_NIGHT_YES:
                if (DEBUG_OVERFLOW) {
                    Log.d(TAG, "Set overflow UI to dark mode");
                }

            case Configuration.UI_MODE_NIGHT_NO:
                mEmptyStateImage.setImageDrawable(
                        getResources().getDrawable(R.drawable.ic_empty_bubble_overflow_dark));
                        res.getDrawable(R.drawable.ic_empty_bubble_overflow_light));
                findViewById(android.R.id.content)
                        .setBackgroundColor(res.getColor(R.color.bubbles_light));
                break;
        }
    }

    void setBackgroundColor() {
        final TypedArray ta = getApplicationContext().obtainStyledAttributes(
                new int[]{android.R.attr.colorBackgroundFloating});
        int bgColor = ta.getColor(0, Color.WHITE);
        ta.recycle();
        findViewById(android.R.id.content).setBackgroundColor(bgColor);
    }

    void onDataChanged(List<Bubble> bubbles) {
        mOverflowBubbles.clear();
        mOverflowBubbles.addAll(bubbles);
+4 −3
Original line number Diff line number Diff line
@@ -1100,16 +1100,17 @@ public class BubbleStackView extends FrameLayout
            mBubbleOverflow = new BubbleOverflow(getContext());
            mBubbleOverflow.setUpOverflow(mBubbleContainer, this);
        } else {
            mBubbleContainer.removeView(mBubbleOverflow.getBtn());
            mBubbleContainer.removeView(mBubbleOverflow.getIconView());
            mBubbleOverflow.setUpOverflow(mBubbleContainer, this);
            overflowBtnIndex = mBubbleContainer.getChildCount();
        }
        mBubbleContainer.addView(mBubbleOverflow.getBtn(), overflowBtnIndex,
        mBubbleContainer.addView(mBubbleOverflow.getIconView(), overflowBtnIndex,
                new FrameLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT));
        mBubbleOverflow.getBtn().setOnClickListener(v -> {
        mBubbleOverflow.getIconView().setOnClickListener(v -> {
            setSelectedBubble(mBubbleOverflow);
            showManageMenu(false);
        });
        updateOverflowVisibility();
    }
    /**
     * Handle theme changes.