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

Commit 23f4cc03 authored by Adam Powell's avatar Adam Powell
Browse files

Fix bug 5099037 - No delete option when multiple videos are selected

Fix some bugs related to how action item slots are allocated in menus.

Fix some padding/margins in ActivityChooserView.

Change-Id: I12096b0165daca902c5bc8e24c1e8d54a35e9557
parent a8993e10
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -156,7 +156,7 @@ public class ActivityChooserView extends ViewGroup implements ActivityChooserMod
     * @param attrs A collection of attributes.
     */
    public ActivityChooserView(Context context, AttributeSet attrs) {
        this(context, attrs, R.attr.actionButtonStyle);
        this(context, attrs, 0);
    }

    /**
+4 −1
Original line number Diff line number Diff line
@@ -391,7 +391,6 @@ public class ActionMenuPresenter extends BaseMenuPresenter {
                final boolean inGroup = seenGroups.get(groupId);
                boolean isAction = (maxActions > 0 || inGroup) && widthLimit > 0 &&
                        (!mStrictWidthLimit || cellsRemaining > 0);
                maxActions--;

                if (isAction) {
                    View v = getItemView(item, mScrapActionButtonView, parent);
@@ -430,11 +429,15 @@ public class ActionMenuPresenter extends BaseMenuPresenter {
                    for (int j = 0; j < i; j++) {
                        MenuItemImpl areYouMyGroupie = visibleItems.get(j);
                        if (areYouMyGroupie.getGroupId() == groupId) {
                            // Give back the action slot
                            if (areYouMyGroupie.isActionButton()) maxActions++;
                            areYouMyGroupie.setIsActionButton(false);
                        }
                    }
                }

                if (isAction) maxActions--;

                item.setIsActionButton(isAction);
            }
        }
+4 −3
Original line number Diff line number Diff line
@@ -567,7 +567,7 @@ public class MenuBuilder implements Menu {
            }
        }

        if (changedAtLeastOneItem) onItemsChanged(false);
        if (changedAtLeastOneItem) onItemsChanged(true);
    }

    public void setGroupEnabled(int group, boolean enabled) {
@@ -929,6 +929,7 @@ public class MenuBuilder implements Menu {
     * 
     * @param structureChanged true if the menu structure changed,
     *                         false if only item properties changed.
     *                         (Visibility is a structural property since it affects layout.)
     */
    void onItemsChanged(boolean structureChanged) {
        if (!mPreventDispatchingItemsChanged) {
@@ -971,7 +972,7 @@ public class MenuBuilder implements Menu {
    void onItemVisibleChanged(MenuItemImpl item) {
        // Notify of items being changed
        mIsVisibleItemsStale = true;
        onItemsChanged(false);
        onItemsChanged(true);
    }
    
    /**
@@ -981,7 +982,7 @@ public class MenuBuilder implements Menu {
    void onItemActionRequestChanged(MenuItemImpl item) {
        // Notify of items being changed
        mIsActionItemsStale = true;
        onItemsChanged(false);
        onItemsChanged(true);
    }
    
    ArrayList<MenuItemImpl> getVisibleItems() {
+1 −1
Original line number Diff line number Diff line
@@ -585,7 +585,7 @@ public final class MenuItemImpl implements MenuItem {
    public MenuItem setActionProvider(ActionProvider actionProvider) {
        mActionView = null;
        mActionProvider = actionProvider;
        mMenu.onItemsChanged(false);
        mMenu.onItemsChanged(true); // Measurement can be changed
        return this;
    }

+4 −3
Original line number Diff line number Diff line
@@ -22,7 +22,8 @@
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:gravity="center"
    style="?android:attr/actionButtonStyle">
    style="?android:attr/actionButtonStyle"
    android:padding="0dip">

    <FrameLayout
        android:id="@+id/default_activity_button"
@@ -31,7 +32,7 @@
        android:layout_gravity="center"
        android:focusable="true"
        android:addStatesFromChildren="true"
        android:background="?android:attr/selectableItemBackground">
        android:background="?android:attr/actionBarItemBackground">

        <ImageView android:id="@+id/image"
            android:layout_width="32dip"
@@ -53,7 +54,7 @@
        android:layout_gravity="center"
        android:focusable="true"
        android:addStatesFromChildren="true"
        android:background="?android:attr/selectableItemBackground">
        android:background="?android:attr/actionBarItemBackground">

        <ImageView android:id="@+id/image"
            android:layout_width="32dip"