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

Commit 1144c971 authored by Fabian Kozynski's avatar Fabian Kozynski
Browse files

Use rounded corners background in GA Popup menu

Test: manual
Fixes: 156660115
Change-Id: I24827bb0b83668faf6b193d0e6c3bfc407218a0d
parent f7b69012
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -757,6 +757,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
@@ -105,6 +105,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
@@ -284,7 +285,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 {
@@ -381,13 +385,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
@@ -2050,7 +2050,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);