diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2018-11-14 15:17:26 -0800 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2018-11-20 17:11:13 -0800 |
commit | ab770a10b9d0d81d7753db1690ce9e592bdbeed8 (patch) | |
tree | 3dd423c1c37888999a10de322bc3474fabd217a1 /src/com/android/launcher3/Hotseat.java | |
parent | 373e2534d3434d95fac56c95668b3f2daa982f39 (diff) | |
download | android_packages_apps_Trebuchet-ab770a10b9d0d81d7753db1690ce9e592bdbeed8.tar.gz android_packages_apps_Trebuchet-ab770a10b9d0d81d7753db1690ce9e592bdbeed8.tar.bz2 android_packages_apps_Trebuchet-ab770a10b9d0d81d7753db1690ce9e592bdbeed8.zip |
Making CellLayout inflatable without LauncherActivtiy
This will allow creating cellLayout with a different device profile
or a different activtiy which can be used when displaying multiple
activities in multi-display or generating a preview for changing
display properties.
Change-Id: I386731d95e33c48bdef270ce9c0d3e9feefb6262
Diffstat (limited to 'src/com/android/launcher3/Hotseat.java')
-rw-r--r-- | src/com/android/launcher3/Hotseat.java | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java index 6b5db307b..cbd3fc034 100644 --- a/src/com/android/launcher3/Hotseat.java +++ b/src/com/android/launcher3/Hotseat.java @@ -20,7 +20,6 @@ import android.content.Context; import android.graphics.Rect; import android.util.AttributeSet; import android.view.Gravity; -import android.view.MotionEvent; import android.view.View; import android.view.ViewDebug; import android.view.ViewGroup; @@ -32,8 +31,6 @@ import com.android.launcher3.userevent.nano.LauncherLogProto.Target; public class Hotseat extends CellLayout implements LogContainerProvider, Insettable { - private final Launcher mLauncher; - @ViewDebug.ExportedProperty(category = "launcher") private boolean mHasVerticalHotseat; @@ -47,7 +44,6 @@ public class Hotseat extends CellLayout implements LogContainerProvider, Insetta public Hotseat(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); - mLauncher = Launcher.getLauncher(context); } /* Get the orientation specific coordinates given an invariant order in the hotseat. */ @@ -59,10 +55,10 @@ public class Hotseat extends CellLayout implements LogContainerProvider, Insetta return mHasVerticalHotseat ? (getCountY() - (rank + 1)) : 0; } - void resetLayout(boolean hasVerticalHotseat) { + public void resetLayout(boolean hasVerticalHotseat) { removeAllViewsInLayout(); mHasVerticalHotseat = hasVerticalHotseat; - InvariantDeviceProfile idp = mLauncher.getDeviceProfile().inv; + InvariantDeviceProfile idp = mActivity.getDeviceProfile().inv; if (hasVerticalHotseat) { setGridSize(1, idp.numHotseatIcons); } else { @@ -71,15 +67,6 @@ public class Hotseat extends CellLayout implements LogContainerProvider, Insetta } @Override - public boolean onInterceptTouchEvent(MotionEvent ev) { - // We don't want any clicks to go through to the hotseat unless the workspace is in - // the normal state or an accessible drag is in progress. - return (!mLauncher.getWorkspace().workspaceIconsCanBeDragged() - && !mLauncher.getAccessibilityDelegate().isInAccessibleDrag()) - || super.onInterceptTouchEvent(ev); - } - - @Override public void fillInLogContainerData(View v, ItemInfo info, Target target, Target targetParent) { target.gridX = info.cellX; target.gridY = info.cellY; @@ -89,7 +76,7 @@ public class Hotseat extends CellLayout implements LogContainerProvider, Insetta @Override public void setInsets(Rect insets) { FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) getLayoutParams(); - DeviceProfile grid = mLauncher.getDeviceProfile(); + DeviceProfile grid = mActivity.getDeviceProfile(); if (grid.isVerticalBarLayout()) { lp.height = ViewGroup.LayoutParams.MATCH_PARENT; |