Change TaskIconMenu to lay out vertically
Still lays out horizontally when in phone
landscape.
TODO(b/186583656), need to center view.
Also have all layout be dynamic instead of having
some cases be in XML and some in code.
Bug: 181704764
Test: Task menu visible with all options in
portrait/landscape tablet
portrait phone
fake/real landscape phone
Change-Id: I3632eeb174f3e4baf2c9d69d51c1815c3c512e59
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index 3312915..a799b4a 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -65,6 +65,7 @@
import android.view.View;
import android.view.ViewConfiguration;
import android.view.animation.Interpolator;
+import android.widget.LinearLayout;
import androidx.core.graphics.ColorUtils;
import androidx.core.os.BuildCompat;
@@ -752,6 +753,16 @@
ColorUtils.blendARGB(0, color, tintAmount));
}
+ /**
+ * Sets start margin on the provided {@param view} to be {@param margin}.
+ * Assumes {@param view} is a child of {@link LinearLayout}
+ */
+ public static void setStartMarginForView(View view, int margin) {
+ LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) view.getLayoutParams();
+ lp.setMarginStart(margin);
+ view.setLayoutParams(lp);
+ }
+
private static class FixedSizeEmptyDrawable extends ColorDrawable {
private final int mSize;