summaryrefslogtreecommitdiff
path: root/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
diff options
context:
space:
mode:
Diffstat (limited to 'quickstep/src/com/android/launcher3/taskbar/TaskbarView.java')
-rw-r--r--quickstep/src/com/android/launcher3/taskbar/TaskbarView.java34
1 files changed, 26 insertions, 8 deletions
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
index bf3b932424..fa5a1ae6fa 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
@@ -18,6 +18,7 @@ package com.android.launcher3.taskbar;
import static android.content.pm.PackageManager.FEATURE_PC;
import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED;
+import static com.android.launcher3.config.FeatureFlags.ENABLE_CURSOR_HOVER_STATES;
import static com.android.launcher3.icons.IconNormalizer.ICON_VISIBLE_AREA_FACTOR;
import android.content.Context;
@@ -87,7 +88,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
private @Nullable IconButtonView mAllAppsButton;
// Only non-null when device supports having an All Apps button.
- private @Nullable View mTaskbarDivider;
+ private @Nullable IconButtonView mTaskbarDivider;
private View mQsb;
@@ -157,8 +158,12 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
mActivityContext.getColor(R.color.all_apps_button_color));
if (FeatureFlags.ENABLE_TASKBAR_PINNING.get()) {
- mTaskbarDivider = LayoutInflater.from(context).inflate(R.layout.taskbar_divider,
+ mTaskbarDivider = (IconButtonView) LayoutInflater.from(context).inflate(
+ R.layout.taskbar_divider,
this, false);
+ mTaskbarDivider.setIconDrawable(
+ resources.getDrawable(R.drawable.taskbar_divider_button));
+ mTaskbarDivider.setPadding(mItemPadding, mItemPadding, mItemPadding, mItemPadding);
}
}
@@ -319,6 +324,9 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
}
}
setClickAndLongClickListenersForIcon(hotseatView);
+ if (ENABLE_CURSOR_HOVER_STATES.get()) {
+ setHoverListenerForIcon(hotseatView);
+ }
nextViewIndex++;
}
// Remove remaining views
@@ -366,16 +374,18 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
icon.setOnLongClickListener(mIconLongClickListener);
}
+ /**
+ * Sets OnHoverListener for the given view.
+ */
+ private void setHoverListenerForIcon(View icon) {
+ icon.setOnHoverListener(mControllerCallbacks.getIconOnHoverListener(icon));
+ }
+
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
int count = getChildCount();
DeviceProfile deviceProfile = mActivityContext.getDeviceProfile();
int spaceNeeded = getIconLayoutWidth();
- // We are removing the margin from taskbar divider item in taskbar,
- // so remove it from spacing also.
- if (FeatureFlags.ENABLE_TASKBAR_PINNING.get() && count > 1) {
- spaceNeeded -= mIconTouchSize;
- }
int navSpaceNeeded = deviceProfile.hotseatBarEndOffset;
boolean layoutRtl = isLayoutRtl();
int centerAlignIconEnd = right - (right - left - spaceNeeded) / 2;
@@ -496,7 +506,15 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
if (deviceProfile.isQsbInline) {
countExcludingQsb--;
}
- return countExcludingQsb * (mItemMarginLeftRight * 2 + mIconTouchSize);
+ int iconLayoutBoundsWidth =
+ countExcludingQsb * (mItemMarginLeftRight * 2 + mIconTouchSize);
+
+ if (FeatureFlags.ENABLE_TASKBAR_PINNING.get() && countExcludingQsb > 1) {
+ // We are removing 4 * mItemMarginLeftRight as there should be no space between
+ // All Apps icon, divider icon, and first app icon in taskbar
+ iconLayoutBoundsWidth -= mItemMarginLeftRight * 4;
+ }
+ return iconLayoutBoundsWidth;
}
/**