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

Commit 738baedd authored by Fabian Kozynski's avatar Fabian Kozynski Committed by Automerger Merge Worker
Browse files

Merge "Use rounded corners background in GA Popup menu" into rvc-dev am: 0a49cd25

Change-Id: If0c5eefc4039a07fc5d0a0f4c967a9c32c4bcad7
parents 551b0792 0a49cd25
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -758,6 +758,7 @@
        <!-- used to override dark/light theming -->
        <item name="*android:colorBackgroundFloating">@color/GM2_grey_800</item>
        <item name="*android:colorPopupBackground">@color/GM2_grey_800</item>
        <item name="*android:dialogCornerRadius">8dp</item>
    </style>

    <style name="TextAppearance.ControlSetup">
+9 −6
Original line number Diff line number Diff line
@@ -107,6 +107,7 @@ class ControlsUiControllerImpl @Inject constructor (
    private var popup: ListPopupWindow? = null
    private var hidden = true
    private lateinit var dismissGlobalActions: Runnable
    private val popupThemedContext = ContextThemeWrapper(context, R.style.Control_ListPopupWindow)

    override val available: Boolean
        get() = controlsController.get().available
@@ -283,7 +284,10 @@ class ControlsUiControllerImpl @Inject constructor (
        val anchor = parent.requireViewById<ImageView>(R.id.controls_more)
        anchor.setOnClickListener(object : View.OnClickListener {
            override fun onClick(v: View) {
                popup = GlobalActionsPopupMenu(context, false /* isDropDownMode */).apply {
                popup = GlobalActionsPopupMenu(
                        popupThemedContext,
                        false /* isDropDownMode */
                ).apply {
                    setAnchorView(anchor)
                    setAdapter(adapter)
                    setOnItemClickListener(object : AdapterView.OnItemClickListener {
@@ -380,13 +384,12 @@ class ControlsUiControllerImpl @Inject constructor (
        val anchor = parent.requireViewById<ViewGroup>(R.id.controls_header)
        anchor.setOnClickListener(object : View.OnClickListener {
            override fun onClick(v: View) {
                popup = GlobalActionsPopupMenu(context, true /* isDropDownMode */).apply {
                popup = GlobalActionsPopupMenu(
                        popupThemedContext,
                        true /* isDropDownMode */
                ).apply {
                    setAnchorView(anchor)
                    setAdapter(adapter)
                    val theme = ContextThemeWrapper(context, R.style.Control_ListPopupWindow)
                        .getTheme()
                    setBackgroundDrawable(
                        context.resources.getDrawable(R.drawable.rounded_bg_full, theme))

                    setOnItemClickListener(object : AdapterView.OnItemClickListener {
                        override fun onItemClick(
+4 −1
Original line number Diff line number Diff line
@@ -2047,7 +2047,10 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,

        private ListPopupWindow createPowerOverflowPopup() {
            ListPopupWindow popup = new GlobalActionsPopupMenu(
                    mContext, false /* isDropDownMode */);
                    new ContextThemeWrapper(
                        mContext,
                        com.android.systemui.R.style.Control_ListPopupWindow
                    ), false /* isDropDownMode */);
            View overflowButton =
                    findViewById(com.android.systemui.R.id.global_actions_overflow_button);
            popup.setAnchorView(overflowButton);
+6 −3
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
import android.content.res.Resources;
import android.view.ContextThemeWrapper;
import android.view.View;
import android.view.View.MeasureSpec;
import android.view.WindowManager;
@@ -32,6 +31,8 @@ import com.android.systemui.R;
/**
 * Customized widget for use in the GlobalActionsDialog. Ensures common positioning and user
 * interactions.
 *
 * It should be created with a {@link Context} with the right theme
 */
public class GlobalActionsPopupMenu extends ListPopupWindow {
    private Context mContext;
@@ -42,15 +43,17 @@ public class GlobalActionsPopupMenu extends ListPopupWindow {
    private ListAdapter mAdapter;

    public GlobalActionsPopupMenu(@NonNull Context context, boolean isDropDownMode) {
        super(new ContextThemeWrapper(context, R.style.Control_ListPopupWindow));
        super(context);
        mContext = context;
        Resources res = mContext.getResources();
        setBackgroundDrawable(
                res.getDrawable(R.drawable.rounded_bg_full, context.getTheme()));
        mIsDropDownMode = isDropDownMode;

        // required to show above the global actions dialog
        setWindowLayoutType(WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY);
        setModal(true);

        Resources res = mContext.getResources();
        mGlobalActionsSidePadding = res.getDimensionPixelSize(R.dimen.global_actions_side_margin);
        if (!isDropDownMode) {
            mMenuVerticalPadding = res.getDimensionPixelSize(R.dimen.control_menu_vertical_padding);