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

Commit 10a1bd0e authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Converting PopupContainerWithArrow into a base class so that it is easier

to create other types of popup

Bug: 67585158
Change-Id: I966ae7bb90f941951b26feaf71b3ea30c3f3c0cc
parent 271e219e
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -38,14 +38,14 @@ public abstract class AbstractFloatingView extends LinearLayout implements Touch

    @IntDef(flag = true, value = {
            TYPE_FOLDER,
            TYPE_POPUP_CONTAINER_WITH_ARROW,
            TYPE_ACTION_POPUP,
            TYPE_WIDGETS_BOTTOM_SHEET,
            TYPE_WIDGET_RESIZE_FRAME
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface FloatingViewType {}
    public static final int TYPE_FOLDER = 1 << 0;
    public static final int TYPE_POPUP_CONTAINER_WITH_ARROW = 1 << 1;
    public static final int TYPE_ACTION_POPUP = 1 << 1;
    public static final int TYPE_WIDGETS_BOTTOM_SHEET = 1 << 2;
    public static final int TYPE_WIDGET_RESIZE_FRAME = 1 << 3;

@@ -138,7 +138,7 @@ public abstract class AbstractFloatingView extends LinearLayout implements Touch
    }

    public static AbstractFloatingView getTopOpenView(Launcher launcher) {
        return getOpenView(launcher, TYPE_FOLDER | TYPE_POPUP_CONTAINER_WITH_ARROW
        return getOpenView(launcher, TYPE_FOLDER | TYPE_ACTION_POPUP
                | TYPE_WIDGETS_BOTTOM_SHEET | TYPE_WIDGET_RESIZE_FRAME);
    }
}
+5 −5
Original line number Diff line number Diff line
@@ -87,7 +87,6 @@ import com.android.launcher3.Workspace.ItemOperator;
import com.android.launcher3.accessibility.LauncherAccessibilityDelegate;
import com.android.launcher3.allapps.AllAppsContainerView;
import com.android.launcher3.allapps.AllAppsTransitionController;
import com.android.launcher3.anim.AnimationLayerSet;
import com.android.launcher3.compat.AppWidgetManagerCompat;
import com.android.launcher3.compat.LauncherAppsCompat;
import com.android.launcher3.compat.LauncherAppsCompatVO;
@@ -110,6 +109,7 @@ import com.android.launcher3.model.PackageItemInfo;
import com.android.launcher3.model.WidgetItem;
import com.android.launcher3.notification.NotificationListener;
import com.android.launcher3.pageindicators.PageIndicator;
import com.android.launcher3.popup.BaseActionPopup;
import com.android.launcher3.popup.PopupContainerWithArrow;
import com.android.launcher3.popup.PopupDataProvider;
import com.android.launcher3.shortcuts.DeepShortcutManager;
@@ -1347,9 +1347,9 @@ public class Launcher extends BaseActivity
                mWorkspace.updateIconBadges(updatedBadges);
                mAppsView.updateIconBadges(updatedBadges);

                PopupContainerWithArrow popup = PopupContainerWithArrow.getOpen(Launcher.this);
                if (popup != null) {
                    popup.updateNotificationHeader(updatedBadges);
                BaseActionPopup popup = BaseActionPopup.getOpen(Launcher.this);
                if (popup instanceof PopupContainerWithArrow) {
                    ((PopupContainerWithArrow) popup).updateNotificationHeader(updatedBadges);
                }
            }
        };
@@ -3558,7 +3558,7 @@ public class Launcher extends BaseActivity
                            && mAccessibilityDelegate.performAction(focusedView,
                                    (ItemInfo) focusedView.getTag(),
                                    LauncherAccessibilityDelegate.DEEP_SHORTCUTS)) {
                        PopupContainerWithArrow.getOpen(this).requestFocus();
                        BaseActionPopup.getOpen(this).requestFocus();
                        return true;
                    }
                    break;
+2 −2
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ import android.widget.PopupMenu.OnMenuItemClickListener;
import com.android.launcher3.ItemInfo;
import com.android.launcher3.Launcher;
import com.android.launcher3.accessibility.LauncherAccessibilityDelegate;
import com.android.launcher3.popup.PopupContainerWithArrow;
import com.android.launcher3.popup.BaseActionPopup;

import java.util.ArrayList;
import java.util.Collections;
@@ -46,7 +46,7 @@ public class CustomActionsPopup implements OnMenuItemClickListener {
    public CustomActionsPopup(Launcher launcher, View icon) {
        mLauncher = launcher;
        mIcon = icon;
        PopupContainerWithArrow container = PopupContainerWithArrow.getOpen(launcher);
        BaseActionPopup container = BaseActionPopup.getOpen(launcher);
        if (container != null) {
            mDelegate = container.getAccessibilityDelegate();
        } else {
+6 −4
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.PropertyListBuilder;
import com.android.launcher3.anim.PropertyResetListener;
import com.android.launcher3.popup.BaseActionPopup;
import com.android.launcher3.popup.PopupContainerWithArrow;

import java.util.ArrayList;
@@ -193,16 +194,17 @@ public class NotificationFooterLayout extends FrameLayout {

    private void removeViewFromIconRow(View child) {
        mIconRow.removeView(child);
        mNotifications.remove((NotificationInfo) child.getTag());
        mNotifications.remove(child.getTag());
        updateOverflowEllipsisVisibility();
        if (mIconRow.getChildCount() == 0) {
            // There are no more icons in the footer, so hide it.
            PopupContainerWithArrow popup = PopupContainerWithArrow.getOpen(
            BaseActionPopup popup = BaseActionPopup.getOpen(
                    Launcher.getLauncher(getContext()));
            if (popup != null) {
            if (popup instanceof PopupContainerWithArrow) {
                final int newHeight = getResources().getDimensionPixelSize(
                        R.dimen.notification_empty_footer_height);
                Animator collapseFooter = popup.reduceNotificationViewHeight(getHeight() - newHeight,
                Animator collapseFooter = ((PopupContainerWithArrow) popup)
                        .reduceNotificationViewHeight(getHeight() - newHeight,
                        getResources().getInteger(R.integer.config_removeNotificationViewDuration));
                collapseFooter.addListener(new AnimatorListenerAdapter() {
                    @Override
+1 −2
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.graphics.IconPalette;
import com.android.launcher3.popup.PopupContainerWithArrow;
import com.android.launcher3.util.PackageUserKey;

/**
@@ -110,7 +109,7 @@ public class NotificationInfo implements View.OnClickListener {
            launcher.getPopupDataProvider().cancelNotification(notificationKey);
        }
        AbstractFloatingView.closeOpenContainer(launcher, AbstractFloatingView
                .TYPE_POPUP_CONTAINER_WITH_ARROW);
                .TYPE_ACTION_POPUP);
    }

    public Drawable getIconForBackground(Context context, int background) {
Loading