Loading packages/SystemUI/res/layout-land/global_actions_grid.xml +1 −1 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ android:clipToPadding="false" android:theme="@style/qs_theme" android:paddingLeft="@dimen/global_actions_top_padding" android:gravity="top|left" android:gravity="right" android:clipChildren="false" > <LinearLayout Loading packages/SystemUI/res/layout-land/global_actions_grid_seascape.xml +1 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ android:orientation="horizontal" android:clipToPadding="false" android:theme="@style/qs_theme" android:gravity="top|right" android:gravity="left" android:paddingRight="@dimen/global_actions_top_padding" android:clipChildren="false" > Loading packages/SystemUI/res/layout/global_actions_grid.xml +1 −2 Original line number Diff line number Diff line Loading @@ -6,9 +6,8 @@ android:layout_height="match_parent" android:orientation="horizontal" android:clipToPadding="false" android:paddingTop="@dimen/global_actions_top_padding" android:theme="@style/qs_theme" android:gravity="top|center" android:gravity="bottom" android:clipChildren="false" > <LinearLayout Loading packages/SystemUI/src/com/android/systemui/HardwareUiLayout.java +4 −13 Original line number Diff line number Diff line Loading @@ -32,13 +32,10 @@ import android.view.ViewOutlineProvider; import android.view.ViewTreeObserver; import android.widget.LinearLayout; import com.android.systemui.globalactions.GlobalActionsDialog; import com.android.systemui.tuner.TunerService; import com.android.systemui.tuner.TunerService.Tunable; import com.android.systemui.util.leak.RotationUtils; import java.util.ArrayList; /** * Layout for placing two containers at a specific physical position on the device, relative to the * device's hardware, regardless of screen rotation. Loading Loading @@ -258,24 +255,16 @@ public class HardwareUiLayout extends MultiListLayout implements Tunable { @Override public void onUpdateList() { super.onUpdateList(); ArrayList<GlobalActionsDialog.Action> separatedActions = mAdapter.getSeparatedItems(); ArrayList<GlobalActionsDialog.Action> listActions = mAdapter.getListItems(); for (int i = 0; i < mAdapter.getCount(); i++) { Object action = mAdapter.getItem(i); int separatedIndex = separatedActions.indexOf(action); ViewGroup parent; if (separatedIndex != -1) { boolean separated = mAdapter.shouldBeSeparated(i); if (separated) { parent = getSeparatedView(); } else { int listIndex = listActions.indexOf(action); parent = getListView(); } View v = mAdapter.getView(i, null, parent); final int pos = i; v.setOnClickListener(view -> mAdapter.onClickItem(pos)); v.setOnLongClickListener(view -> mAdapter.onLongClickItem(pos)); parent.addView(v); } } Loading Loading @@ -421,7 +410,9 @@ public class HardwareUiLayout extends MultiListLayout implements Tunable { @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); post(() -> updatePosition()); } private void animateChild(int oldHeight, int newHeight) { Loading packages/SystemUI/src/com/android/systemui/MultiListLayout.java +13 −19 Original line number Diff line number Diff line Loading @@ -26,16 +26,12 @@ import android.widget.LinearLayout; import com.android.systemui.util.leak.RotationUtils; import java.util.ArrayList; /** * Layout class representing the Global Actions menu which appears when the power button is held. */ public abstract class MultiListLayout extends LinearLayout { protected boolean mHasOutsideTouch; protected MultiListAdapter mAdapter; protected boolean mSnapToEdge; protected int mRotation; protected RotationListener mRotationListener; Loading @@ -51,7 +47,7 @@ public abstract class MultiListLayout extends LinearLayout { /** * Removes all child items from the separated and list views, if they exist. */ public abstract void removeAllItems(); protected abstract void removeAllItems(); /** * Sets the divided view, which may have a differently-colored background. Loading @@ -69,13 +65,6 @@ public abstract class MultiListLayout extends LinearLayout { getSeparatedView().setVisibility(visible ? View.VISIBLE : View.GONE); } /** * Sets whether the GlobalActions view should snap to the edge of the screen. */ public void setSnapToEdge(boolean snap) { mSnapToEdge = snap; } /** * Sets the adapter used to inflate items. */ Loading Loading @@ -122,6 +111,7 @@ public abstract class MultiListLayout extends LinearLayout { } protected void onUpdateList() { removeAllItems(); setSeparatedViewVisibility(mAdapter.hasSeparatedItems()); } Loading Loading @@ -163,16 +153,14 @@ public abstract class MultiListLayout extends LinearLayout { */ public abstract static class MultiListAdapter extends BaseAdapter { /** * Creates an ArrayList of items which should be rendered in the separated view. * @param useSeparatedView is true if the separated view will be used, false otherwise. * Counts the number of items to be rendered in the separated view. */ public abstract ArrayList getSeparatedItems(); public abstract int countSeparatedItems(); /** * Creates an ArrayList of items which should be rendered in the list view. * @param useSeparatedView True if the separated view will be used, false otherwise. * Counts the number of items be rendered in the list view. */ public abstract ArrayList getListItems(); public abstract int countListItems(); /** * Callback to run when an individual item is clicked or pressed. Loading @@ -192,7 +180,13 @@ public abstract class MultiListLayout extends LinearLayout { * or not to hide the separated list from view. */ public boolean hasSeparatedItems() { return getSeparatedItems().size() > 0; return countSeparatedItems() > 0; } /** * Determines whether the item at the given index should be rendered in the separarted view. * @param position The index of the item. */ public abstract boolean shouldBeSeparated(int position); } } Loading
packages/SystemUI/res/layout-land/global_actions_grid.xml +1 −1 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ android:clipToPadding="false" android:theme="@style/qs_theme" android:paddingLeft="@dimen/global_actions_top_padding" android:gravity="top|left" android:gravity="right" android:clipChildren="false" > <LinearLayout Loading
packages/SystemUI/res/layout-land/global_actions_grid_seascape.xml +1 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ android:orientation="horizontal" android:clipToPadding="false" android:theme="@style/qs_theme" android:gravity="top|right" android:gravity="left" android:paddingRight="@dimen/global_actions_top_padding" android:clipChildren="false" > Loading
packages/SystemUI/res/layout/global_actions_grid.xml +1 −2 Original line number Diff line number Diff line Loading @@ -6,9 +6,8 @@ android:layout_height="match_parent" android:orientation="horizontal" android:clipToPadding="false" android:paddingTop="@dimen/global_actions_top_padding" android:theme="@style/qs_theme" android:gravity="top|center" android:gravity="bottom" android:clipChildren="false" > <LinearLayout Loading
packages/SystemUI/src/com/android/systemui/HardwareUiLayout.java +4 −13 Original line number Diff line number Diff line Loading @@ -32,13 +32,10 @@ import android.view.ViewOutlineProvider; import android.view.ViewTreeObserver; import android.widget.LinearLayout; import com.android.systemui.globalactions.GlobalActionsDialog; import com.android.systemui.tuner.TunerService; import com.android.systemui.tuner.TunerService.Tunable; import com.android.systemui.util.leak.RotationUtils; import java.util.ArrayList; /** * Layout for placing two containers at a specific physical position on the device, relative to the * device's hardware, regardless of screen rotation. Loading Loading @@ -258,24 +255,16 @@ public class HardwareUiLayout extends MultiListLayout implements Tunable { @Override public void onUpdateList() { super.onUpdateList(); ArrayList<GlobalActionsDialog.Action> separatedActions = mAdapter.getSeparatedItems(); ArrayList<GlobalActionsDialog.Action> listActions = mAdapter.getListItems(); for (int i = 0; i < mAdapter.getCount(); i++) { Object action = mAdapter.getItem(i); int separatedIndex = separatedActions.indexOf(action); ViewGroup parent; if (separatedIndex != -1) { boolean separated = mAdapter.shouldBeSeparated(i); if (separated) { parent = getSeparatedView(); } else { int listIndex = listActions.indexOf(action); parent = getListView(); } View v = mAdapter.getView(i, null, parent); final int pos = i; v.setOnClickListener(view -> mAdapter.onClickItem(pos)); v.setOnLongClickListener(view -> mAdapter.onLongClickItem(pos)); parent.addView(v); } } Loading Loading @@ -421,7 +410,9 @@ public class HardwareUiLayout extends MultiListLayout implements Tunable { @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); post(() -> updatePosition()); } private void animateChild(int oldHeight, int newHeight) { Loading
packages/SystemUI/src/com/android/systemui/MultiListLayout.java +13 −19 Original line number Diff line number Diff line Loading @@ -26,16 +26,12 @@ import android.widget.LinearLayout; import com.android.systemui.util.leak.RotationUtils; import java.util.ArrayList; /** * Layout class representing the Global Actions menu which appears when the power button is held. */ public abstract class MultiListLayout extends LinearLayout { protected boolean mHasOutsideTouch; protected MultiListAdapter mAdapter; protected boolean mSnapToEdge; protected int mRotation; protected RotationListener mRotationListener; Loading @@ -51,7 +47,7 @@ public abstract class MultiListLayout extends LinearLayout { /** * Removes all child items from the separated and list views, if they exist. */ public abstract void removeAllItems(); protected abstract void removeAllItems(); /** * Sets the divided view, which may have a differently-colored background. Loading @@ -69,13 +65,6 @@ public abstract class MultiListLayout extends LinearLayout { getSeparatedView().setVisibility(visible ? View.VISIBLE : View.GONE); } /** * Sets whether the GlobalActions view should snap to the edge of the screen. */ public void setSnapToEdge(boolean snap) { mSnapToEdge = snap; } /** * Sets the adapter used to inflate items. */ Loading Loading @@ -122,6 +111,7 @@ public abstract class MultiListLayout extends LinearLayout { } protected void onUpdateList() { removeAllItems(); setSeparatedViewVisibility(mAdapter.hasSeparatedItems()); } Loading Loading @@ -163,16 +153,14 @@ public abstract class MultiListLayout extends LinearLayout { */ public abstract static class MultiListAdapter extends BaseAdapter { /** * Creates an ArrayList of items which should be rendered in the separated view. * @param useSeparatedView is true if the separated view will be used, false otherwise. * Counts the number of items to be rendered in the separated view. */ public abstract ArrayList getSeparatedItems(); public abstract int countSeparatedItems(); /** * Creates an ArrayList of items which should be rendered in the list view. * @param useSeparatedView True if the separated view will be used, false otherwise. * Counts the number of items be rendered in the list view. */ public abstract ArrayList getListItems(); public abstract int countListItems(); /** * Callback to run when an individual item is clicked or pressed. Loading @@ -192,7 +180,13 @@ public abstract class MultiListLayout extends LinearLayout { * or not to hide the separated list from view. */ public boolean hasSeparatedItems() { return getSeparatedItems().size() > 0; return countSeparatedItems() > 0; } /** * Determines whether the item at the given index should be rendered in the separarted view. * @param position The index of the item. */ public abstract boolean shouldBeSeparated(int position); } }