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

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

Merge "Dark pointer for dark mode" into rvc-dev am: 11b58473

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

Change-Id: I711212bc668807c5f0555421b31a9aed4ce8687c
parents ee9897eb 11b58473
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -202,6 +202,10 @@
    <color name="global_screenshot_dismiss_foreground">@color/GM2_grey_500</color>
    <color name="global_screenshot_dismiss_foreground">@color/GM2_grey_500</color>
    <color name="global_screenshot_background_protection_start">#40000000</color> <!-- 25% black -->
    <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>

    <!-- GM2 colors -->
    <!-- GM2 colors -->
    <color name="GM2_grey_50">#F8F9FA</color>
    <color name="GM2_grey_50">#F8F9FA</color>
    <color name="GM2_grey_100">#F1F3F4</color>
    <color name="GM2_grey_100">#F1F3F4</color>
+13 −2
Original line number Original line Diff line number Diff line
@@ -42,6 +42,7 @@ import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.ComponentName;
import android.content.Context;
import android.content.Context;
import android.content.Intent;
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.Color;
@@ -274,8 +275,6 @@ public class BubbleExpandedView extends LinearLayout {


        mPointerDrawable = new ShapeDrawable(TriangleShape.create(
        mPointerDrawable = new ShapeDrawable(TriangleShape.create(
                mPointerWidth, mPointerHeight, true /* pointUp */));
                mPointerWidth, mPointerHeight, true /* pointUp */));
        mPointerDrawable.setTint(Color.WHITE);
        mPointerView.setBackground(mPointerDrawable);
        mPointerView.setVisibility(INVISIBLE);
        mPointerView.setVisibility(INVISIBLE);


        mSettingsIconHeight = getContext().getResources().getDimensionPixelSize(
        mSettingsIconHeight = getContext().getResources().getDimensionPixelSize(
@@ -425,6 +424,18 @@ public class BubbleExpandedView extends LinearLayout {
                mContext.getResources())) {
                mContext.getResources())) {
            mActivityView.setCornerRadius(mCornerRadius);
            mActivityView.setCornerRadius(mCornerRadius);
        }
        }

        final int mode =
                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));
                break;
            case Configuration.UI_MODE_NIGHT_YES:
                mPointerDrawable.setTint(getResources().getColor(R.color.bubbles_pointer_dark));
                break;
        }
        mPointerView.setBackground(mPointerDrawable);
    }
    }


    /**
    /**
+1 −2
Original line number Original line Diff line number Diff line
@@ -62,13 +62,12 @@ public class BubbleOverflow implements BubbleViewProvider {


    void setUpOverflow(ViewGroup parentViewGroup, BubbleStackView stackView) {
    void setUpOverflow(ViewGroup parentViewGroup, BubbleStackView stackView) {
        updateDimensions();
        updateDimensions();

        mExpandedView = (BubbleExpandedView) mInflater.inflate(
        mExpandedView = (BubbleExpandedView) mInflater.inflate(
                R.layout.bubble_expanded_view, parentViewGroup /* root */,
                R.layout.bubble_expanded_view, parentViewGroup /* root */,
                false /* attachToRoot */);
                false /* attachToRoot */);
        mExpandedView.setOverflow(true);
        mExpandedView.setOverflow(true);
        mExpandedView.setStackView(stackView);
        mExpandedView.setStackView(stackView);

        mExpandedView.applyThemeAttrs();
        updateIcon(mContext, parentViewGroup);
        updateIcon(mContext, parentViewGroup);
    }
    }


+14 −3
Original line number Original line Diff line number Diff line
@@ -1100,13 +1100,11 @@ public class BubbleStackView extends FrameLayout
            mBubbleOverflow.setUpOverflow(mBubbleContainer, this);
            mBubbleOverflow.setUpOverflow(mBubbleContainer, this);
        } else {
        } else {
            mBubbleContainer.removeView(mBubbleOverflow.getBtn());
            mBubbleContainer.removeView(mBubbleOverflow.getBtn());
            mBubbleOverflow.updateDimensions();
            mBubbleOverflow.setUpOverflow(mBubbleContainer, this);
            mBubbleOverflow.updateIcon(mContext,this);
            overflowBtnIndex = mBubbleContainer.getChildCount();
            overflowBtnIndex = mBubbleContainer.getChildCount();
        }
        }
        mBubbleContainer.addView(mBubbleOverflow.getBtn(), overflowBtnIndex,
        mBubbleContainer.addView(mBubbleOverflow.getBtn(), overflowBtnIndex,
                new FrameLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT));
                new FrameLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT));

        mBubbleOverflow.getBtn().setOnClickListener(v -> setSelectedBubble(mBubbleOverflow));
        mBubbleOverflow.getBtn().setOnClickListener(v -> setSelectedBubble(mBubbleOverflow));
    }
    }
    /**
    /**
@@ -1117,6 +1115,7 @@ public class BubbleStackView extends FrameLayout
        setUpOverflow();
        setUpOverflow();
        setUpUserEducation();
        setUpUserEducation();
        setUpManageMenu();
        setUpManageMenu();
        updateExpandedViewTheme();
    }
    }


    /** Respond to the phone being rotated by repositioning the stack and hiding any flyouts. */
    /** Respond to the phone being rotated by repositioning the stack and hiding any flyouts. */
@@ -1218,6 +1217,18 @@ public class BubbleStackView extends FrameLayout
        setupLocalMenu(info);
        setupLocalMenu(info);
    }
    }


    void updateExpandedViewTheme() {
        final List<Bubble> bubbles = mBubbleData.getBubbles();
        if (bubbles.isEmpty()) {
            return;
        }
        bubbles.forEach(bubble -> {
            if (bubble.getExpandedView() != null) {
                bubble.getExpandedView().applyThemeAttrs();
            }
        });
    }

    void setupLocalMenu(AccessibilityNodeInfo info) {
    void setupLocalMenu(AccessibilityNodeInfo info) {
        Resources res = mContext.getResources();
        Resources res = mContext.getResources();