Loading res/layout/system_shortcut_icons.xml +7 −1 Original line number Diff line number Diff line Loading @@ -22,4 +22,10 @@ android:orientation="horizontal" android:gravity="end|center_vertical" android:background="?attr/popupColorSecondary" android:clipToPadding="true" /> android:clipToPadding="true"> <Space android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:id="@+id/separator"/> </LinearLayout> src/com/android/launcher3/popup/ArrowPopup.java +6 −0 Original line number Diff line number Diff line Loading @@ -126,6 +126,12 @@ public abstract class ArrowPopup extends AbstractFloatingView { return (T) view; } public <T extends View> T inflateAndAdd(int resId, ViewGroup container, int index) { View view = mInflater.inflate(resId, container, false); container.addView(view, index); return (T) view; } /** * Called when all view inflation and reordering in complete. */ Loading src/com/android/launcher3/popup/PopupContainerWithArrow.java +13 −1 Original line number Diff line number Diff line Loading @@ -391,7 +391,8 @@ public class PopupContainerWithArrow extends ArrowPopup implements DragSource, } private void initializeSystemShortcut(int resId, ViewGroup container, SystemShortcut info) { View view = inflateAndAdd(resId, container); View view = inflateAndAdd( resId, container, getInsertIndexForSystemShortcut(container, info)); if (view instanceof DeepShortcutView) { // Expanded system shortcut, with both icon and text shown on white background. final DeepShortcutView shortcutView = (DeepShortcutView) view; Loading @@ -405,6 +406,17 @@ public class PopupContainerWithArrow extends ArrowPopup implements DragSource, (ItemInfo) mOriginalIcon.getTag())); } /** * Returns an index for inserting a shortcut into a container. */ private int getInsertIndexForSystemShortcut(ViewGroup container, SystemShortcut shortcut) { final View separator = container.findViewById(R.id.separator); return separator != null && shortcut.isLeftGroup() ? container.indexOfChild(separator) : container.getChildCount(); } /** * Determines when the deferred drag should be started. * Loading src/com/android/launcher3/popup/RemoteActionShortcut.java +5 −0 Original line number Diff line number Diff line Loading @@ -76,4 +76,9 @@ public class RemoteActionShortcut extends SystemShortcut<Launcher> { LauncherLogProto.ControlType.REMOTE_ACTION_SHORTCUT, view); }; } @Override public boolean isLeftGroup() { return true; } } src/com/android/launcher3/popup/SystemShortcut.java +7 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,13 @@ public abstract class SystemShortcut<T extends BaseDraggingActivity> extends Ite mAccessibilityActionId = other.mAccessibilityActionId; } /** * Should be in the left group of icons in app's context menu header. */ public boolean isLeftGroup() { return false; } public void setIconAndLabelFor(View iconView, TextView labelView) { if (mIcon != null) { mIcon.loadDrawableAsync(iconView.getContext(), Loading Loading
res/layout/system_shortcut_icons.xml +7 −1 Original line number Diff line number Diff line Loading @@ -22,4 +22,10 @@ android:orientation="horizontal" android:gravity="end|center_vertical" android:background="?attr/popupColorSecondary" android:clipToPadding="true" /> android:clipToPadding="true"> <Space android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:id="@+id/separator"/> </LinearLayout>
src/com/android/launcher3/popup/ArrowPopup.java +6 −0 Original line number Diff line number Diff line Loading @@ -126,6 +126,12 @@ public abstract class ArrowPopup extends AbstractFloatingView { return (T) view; } public <T extends View> T inflateAndAdd(int resId, ViewGroup container, int index) { View view = mInflater.inflate(resId, container, false); container.addView(view, index); return (T) view; } /** * Called when all view inflation and reordering in complete. */ Loading
src/com/android/launcher3/popup/PopupContainerWithArrow.java +13 −1 Original line number Diff line number Diff line Loading @@ -391,7 +391,8 @@ public class PopupContainerWithArrow extends ArrowPopup implements DragSource, } private void initializeSystemShortcut(int resId, ViewGroup container, SystemShortcut info) { View view = inflateAndAdd(resId, container); View view = inflateAndAdd( resId, container, getInsertIndexForSystemShortcut(container, info)); if (view instanceof DeepShortcutView) { // Expanded system shortcut, with both icon and text shown on white background. final DeepShortcutView shortcutView = (DeepShortcutView) view; Loading @@ -405,6 +406,17 @@ public class PopupContainerWithArrow extends ArrowPopup implements DragSource, (ItemInfo) mOriginalIcon.getTag())); } /** * Returns an index for inserting a shortcut into a container. */ private int getInsertIndexForSystemShortcut(ViewGroup container, SystemShortcut shortcut) { final View separator = container.findViewById(R.id.separator); return separator != null && shortcut.isLeftGroup() ? container.indexOfChild(separator) : container.getChildCount(); } /** * Determines when the deferred drag should be started. * Loading
src/com/android/launcher3/popup/RemoteActionShortcut.java +5 −0 Original line number Diff line number Diff line Loading @@ -76,4 +76,9 @@ public class RemoteActionShortcut extends SystemShortcut<Launcher> { LauncherLogProto.ControlType.REMOTE_ACTION_SHORTCUT, view); }; } @Override public boolean isLeftGroup() { return true; } }
src/com/android/launcher3/popup/SystemShortcut.java +7 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,13 @@ public abstract class SystemShortcut<T extends BaseDraggingActivity> extends Ite mAccessibilityActionId = other.mAccessibilityActionId; } /** * Should be in the left group of icons in app's context menu header. */ public boolean isLeftGroup() { return false; } public void setIconAndLabelFor(View iconView, TextView labelView) { if (mIcon != null) { mIcon.loadDrawableAsync(iconView.getContext(), Loading