blob: 1c181794c40e9798fadc64f8dd2875d43d96c3cf [file] [log] [blame]
Winson Chung3d503fb2011-07-13 17:25:49 -07001/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Daniel Sandler325dc232013-06-05 22:57:57 -040017package com.android.launcher3;
Winson Chung3d503fb2011-07-13 17:25:49 -070018
Liran Binyamina833af32023-08-02 16:30:27 -040019import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_X;
20import static com.android.launcher3.util.MultiTranslateDelegate.INDEX_BUBBLE_ADJUSTMENT_ANIM;
21
22import android.animation.AnimatorSet;
23import android.animation.ObjectAnimator;
24import android.animation.ValueAnimator;
Winson Chung3d503fb2011-07-13 17:25:49 -070025import android.content.Context;
Tony Wickhamd6b40372015-09-23 18:37:57 -070026import android.graphics.Rect;
Winson Chung3d503fb2011-07-13 17:25:49 -070027import android.util.AttributeSet;
Sunny Goyal07b69292018-01-08 14:19:34 -080028import android.view.Gravity;
Sunny Goyalc373e1c2021-03-09 17:27:53 -080029import android.view.LayoutInflater;
Sunny Goyald1580972019-04-09 11:52:49 -070030import android.view.MotionEvent;
Tony Wickham39938cb2021-02-26 09:15:31 -080031import android.view.View;
Sunny Goyal4ffec482016-02-09 11:28:52 -080032import android.view.ViewDebug;
Sunny Goyal07b69292018-01-08 14:19:34 -080033import android.view.ViewGroup;
Winson Chung3d503fb2011-07-13 17:25:49 -070034import android.widget.FrameLayout;
35
Liran Binyamin69f49742024-03-04 09:39:53 -050036import androidx.annotation.IntDef;
mpodoliandfb48212024-09-13 17:43:11 -070037import androidx.annotation.Nullable;
Liran Binyamin69f49742024-03-04 09:39:53 -050038
mpodolian06fb33c2024-12-06 14:55:21 -080039import com.android.launcher3.ShortcutAndWidgetContainer.TranslationProvider;
mpodolian2fd98272024-12-04 16:23:00 -080040import com.android.launcher3.celllayout.CellLayoutLayoutParams;
Liran Binyamina833af32023-08-02 16:30:27 -040041import com.android.launcher3.util.HorizontalInsettableView;
mpodoliandfb48212024-09-13 17:43:11 -070042import com.android.launcher3.util.MultiPropertyFactory;
Liran Binyamin69f49742024-03-04 09:39:53 -050043import com.android.launcher3.util.MultiPropertyFactory.MultiProperty;
Liran Binyamina833af32023-08-02 16:30:27 -040044import com.android.launcher3.util.MultiTranslateDelegate;
Liran Binyamin69f49742024-03-04 09:39:53 -050045import com.android.launcher3.util.MultiValueAlpha;
Liran Binyamina833af32023-08-02 16:30:27 -040046import com.android.launcher3.views.ActivityContext;
47
Liran Binyamin69f49742024-03-04 09:39:53 -050048import java.io.PrintWriter;
49import java.lang.annotation.Retention;
50import java.lang.annotation.RetentionPolicy;
51
Hyunyoung Song95786e02020-09-15 00:34:10 -070052/**
53 * View class that represents the bottom row of the home screen.
54 */
55public class Hotseat extends CellLayout implements Insettable {
Winson Chung3d503fb2011-07-13 17:25:49 -070056
Liran Binyamin69f49742024-03-04 09:39:53 -050057 public static final int ALPHA_CHANNEL_TASKBAR_ALIGNMENT = 0;
58 public static final int ALPHA_CHANNEL_PREVIEW_RENDERER = 1;
59 public static final int ALPHA_CHANNEL_TASKBAR_STASH = 2;
60 public static final int ALPHA_CHANNEL_CHANNELS_COUNT = 3;
61
62 @Retention(RetentionPolicy.RUNTIME)
63 @IntDef({ALPHA_CHANNEL_TASKBAR_ALIGNMENT, ALPHA_CHANNEL_PREVIEW_RENDERER,
64 ALPHA_CHANNEL_TASKBAR_STASH})
65 public @interface HotseatQsbAlphaId {
66 }
67
mpodoliandfb48212024-09-13 17:43:11 -070068 public static final int ICONS_TRANSLATION_X_NAV_BAR_ALIGNMENT = 0;
69 public static final int ICONS_TRANSLATION_X_CHANNELS_COUNT = 1;
70
71 @Retention(RetentionPolicy.RUNTIME)
72 @IntDef({ICONS_TRANSLATION_X_NAV_BAR_ALIGNMENT})
73 public @interface IconsTranslationX {
74 }
75
Sunny Goyalc373e1c2021-03-09 17:27:53 -080076 // Ratio of empty space, qsb should take up to appear visually centered.
77 public static final float QSB_CENTER_FACTOR = .325f;
Liran Binyamina833af32023-08-02 16:30:27 -040078 private static final int BUBBLE_BAR_ADJUSTMENT_ANIMATION_DURATION_MS = 250;
Sunny Goyalc373e1c2021-03-09 17:27:53 -080079
Sunny Goyal4ffec482016-02-09 11:28:52 -080080 @ViewDebug.ExportedProperty(category = "launcher")
Sunny Goyal12069e62018-01-16 14:17:20 -080081 private boolean mHasVerticalHotseat;
Shikha Malhotraf78da1b2022-04-11 10:23:18 +000082 private Workspace<?> mWorkspace;
Adam Cohenb66675a2020-05-15 16:16:17 -070083 private boolean mSendTouchToWorkspace;
Liran Binyamin69f49742024-03-04 09:39:53 -050084 private final MultiValueAlpha mIconsAlphaChannels;
85 private final MultiValueAlpha mQsbAlphaChannels;
Winson Chung3d503fb2011-07-13 17:25:49 -070086
mpodoliandfb48212024-09-13 17:43:11 -070087 private @Nullable MultiProperty mQsbTranslationX;
88
89 private final MultiPropertyFactory mIconsTranslationXFactory;
90
Sunny Goyalc373e1c2021-03-09 17:27:53 -080091 private final View mQsb;
Tony Wickhamae72b462021-03-10 16:18:40 -080092
Winson Chung3d503fb2011-07-13 17:25:49 -070093 public Hotseat(Context context) {
94 this(context, null);
95 }
96
97 public Hotseat(Context context, AttributeSet attrs) {
98 this(context, attrs, 0);
99 }
100
101 public Hotseat(Context context, AttributeSet attrs, int defStyle) {
102 super(context, attrs, defStyle);
Sunny Goyalc373e1c2021-03-09 17:27:53 -0800103 mQsb = LayoutInflater.from(context).inflate(R.layout.search_container_hotseat, this, false);
Sunny Goyalc373e1c2021-03-09 17:27:53 -0800104 addView(mQsb);
Liran Binyamin69f49742024-03-04 09:39:53 -0500105 mIconsAlphaChannels = new MultiValueAlpha(getShortcutsAndWidgets(),
106 ALPHA_CHANNEL_CHANNELS_COUNT);
mpodoliandfb48212024-09-13 17:43:11 -0700107 if (mQsb instanceof Reorderable qsbReorderable) {
108 mQsbTranslationX = qsbReorderable.getTranslateDelegate()
109 .getTranslationX(MultiTranslateDelegate.INDEX_NAV_BAR_ANIM);
110 }
111 mIconsTranslationXFactory = new MultiPropertyFactory<>(getShortcutsAndWidgets(),
112 VIEW_TRANSLATE_X, ICONS_TRANSLATION_X_CHANNELS_COUNT, Float::sum);
Liran Binyamin69f49742024-03-04 09:39:53 -0500113 mQsbAlphaChannels = new MultiValueAlpha(mQsb, ALPHA_CHANNEL_CHANNELS_COUNT);
Winson Chung3d503fb2011-07-13 17:25:49 -0700114 }
115
mpodoliandfb48212024-09-13 17:43:11 -0700116 /** Provides translation X for hotseat icons for the channel. */
117 public MultiProperty getIconsTranslationX(@IconsTranslationX int channelId) {
118 return mIconsTranslationXFactory.get(channelId);
119 }
120
121 /** Provides translation X for hotseat Qsb. */
122 @Nullable
123 public MultiProperty getQsbTranslationX() {
124 return mQsbTranslationX;
125 }
126
Samuel Fufaaed008d2019-12-19 10:57:40 -0800127 /**
128 * Returns orientation specific cell X given invariant order in the hotseat
129 */
130 public int getCellXFromOrder(int rank) {
Sunny Goyal4f3e9382015-06-05 00:13:25 -0700131 return mHasVerticalHotseat ? 0 : rank;
Winson Chung3d503fb2011-07-13 17:25:49 -0700132 }
Hyunyoung Song31178b82015-02-24 14:12:51 -0800133
Samuel Fufaaed008d2019-12-19 10:57:40 -0800134 /**
135 * Returns orientation specific cell Y given invariant order in the hotseat
136 */
137 public int getCellYFromOrder(int rank) {
Sunny Goyal876e4622018-11-02 13:50:40 -0700138 return mHasVerticalHotseat ? (getCountY() - (rank + 1)) : 0;
Winson Chung3d503fb2011-07-13 17:25:49 -0700139 }
140
Sihua Maa44f4ac2024-06-03 18:35:39 +0000141 boolean isHasVerticalHotseat() {
142 return mHasVerticalHotseat;
143 }
144
Sunny Goyalab770a12018-11-14 15:17:26 -0800145 public void resetLayout(boolean hasVerticalHotseat) {
Liran Binyamina833af32023-08-02 16:30:27 -0400146 ActivityContext activityContext = ActivityContext.lookupContext(getContext());
147 boolean bubbleBarEnabled = activityContext.isBubbleBarEnabled();
148 boolean hasBubbles = activityContext.hasBubbles();
Sunny Goyal876e4622018-11-02 13:50:40 -0700149 removeAllViewsInLayout();
Sunny Goyal11e96492018-03-23 17:06:00 -0700150 mHasVerticalHotseat = hasVerticalHotseat;
Sunny Goyal19ff7282021-04-22 10:12:54 -0700151 DeviceProfile dp = mActivity.getDeviceProfile();
Liran Binyamina833af32023-08-02 16:30:27 -0400152
153 if (bubbleBarEnabled) {
mpodolian51e2bb32024-10-08 14:15:49 -0700154 if (dp.shouldAdjustHotseatForBubbleBar(getContext(), hasBubbles)) {
155 getShortcutsAndWidgets().setTranslationProvider(
156 cellX -> dp.getHotseatAdjustedTranslation(getContext(), cellX));
Liran Binyamina833af32023-08-02 16:30:27 -0400157 if (mQsb instanceof HorizontalInsettableView) {
158 HorizontalInsettableView insettableQsb = (HorizontalInsettableView) mQsb;
159 final float insetFraction = (float) dp.iconSizePx / dp.hotseatQsbWidth;
160 // post this to the looper so that QSB has a chance to redraw itself, e.g.
161 // after device rotation
162 mQsb.post(() -> insettableQsb.setHorizontalInsets(insetFraction));
163 }
164 } else {
165 getShortcutsAndWidgets().setTranslationProvider(null);
166 if (mQsb instanceof HorizontalInsettableView) {
167 ((HorizontalInsettableView) mQsb).setHorizontalInsets(0);
168 }
169 }
170 }
171
Thales Lima8cd020b2022-03-15 20:15:14 +0000172 resetCellSize(dp);
Sunny Goyal11e96492018-03-23 17:06:00 -0700173 if (hasVerticalHotseat) {
Sunny Goyal19ff7282021-04-22 10:12:54 -0700174 setGridSize(1, dp.numShownHotseatIcons);
Sunny Goyal11e96492018-03-23 17:06:00 -0700175 } else {
Sunny Goyal19ff7282021-04-22 10:12:54 -0700176 setGridSize(dp.numShownHotseatIcons, 1);
Sunny Goyal11e96492018-03-23 17:06:00 -0700177 }
Winson Chung3d503fb2011-07-13 17:25:49 -0700178 }
Adam Cohene25af792013-06-06 23:08:25 -0700179
Liran Binyamina833af32023-08-02 16:30:27 -0400180 /**
181 * Adjust the hotseat icons for the bubble bar.
182 *
183 * <p>When the bubble bar becomes visible, if needed, this method animates the hotseat icons
184 * to reduce the spacing between them and make room for the bubble bar. The QSB width is
185 * animated as well to align with the hotseat icons.
186 *
187 * <p>When the bubble bar goes away, any adjustments that were previously made are reversed.
188 */
189 public void adjustForBubbleBar(boolean isBubbleBarVisible) {
190 DeviceProfile dp = mActivity.getDeviceProfile();
mpodolian28907bc2024-11-25 11:40:35 -0800191 boolean shouldAdjust = isBubbleBarVisible
192 && dp.shouldAdjustHotseatOrQsbForBubbleBar(getContext());
193 boolean shouldAdjustHotseat = shouldAdjust
194 && dp.shouldAlignBubbleBarWithHotseat();
Liran Binyamina833af32023-08-02 16:30:27 -0400195 ShortcutAndWidgetContainer icons = getShortcutsAndWidgets();
Liran Binyamina833af32023-08-02 16:30:27 -0400196 // update the translation provider for future layout passes of hotseat icons.
mpodolianb5632712024-11-13 15:17:59 -0800197 if (shouldAdjustHotseat) {
mpodolian51e2bb32024-10-08 14:15:49 -0700198 icons.setTranslationProvider(
199 cellX -> dp.getHotseatAdjustedTranslation(getContext(), cellX));
Liran Binyamina833af32023-08-02 16:30:27 -0400200 } else {
201 icons.setTranslationProvider(null);
202 }
mpodolian5bf8bff2024-11-06 16:11:35 -0800203 AnimatorSet animatorSet = new AnimatorSet();
Liran Binyamina833af32023-08-02 16:30:27 -0400204 for (int i = 0; i < icons.getChildCount(); i++) {
205 View child = icons.getChildAt(i);
mpodolian2fd98272024-12-04 16:23:00 -0800206 if (child.getLayoutParams() instanceof CellLayoutLayoutParams lp) {
207 float tx = shouldAdjustHotseat
208 ? dp.getHotseatAdjustedTranslation(getContext(), lp.getCellX()) : 0;
209 if (child instanceof Reorderable) {
210 MultiTranslateDelegate mtd = ((Reorderable) child).getTranslateDelegate();
211 animatorSet.play(
212 mtd.getTranslationX(INDEX_BUBBLE_ADJUSTMENT_ANIM).animateToValue(tx));
213 } else {
214 animatorSet.play(ObjectAnimator.ofFloat(child, VIEW_TRANSLATE_X, tx));
215 }
Liran Binyamina833af32023-08-02 16:30:27 -0400216 }
217 }
mpodolian28907bc2024-11-25 11:40:35 -0800218 //TODO(b/381109832) refactor & simplify adjustment logic
219 boolean shouldAdjustQsb =
220 shouldAdjustHotseat || (shouldAdjust && dp.shouldAlignBubbleBarWithQSB());
Liran Binyamin2a47a4a2024-07-24 12:25:09 -0400221 if (mQsb instanceof HorizontalInsettableView horizontalInsettableQsb) {
222 final float currentInsetFraction = horizontalInsettableQsb.getHorizontalInsets();
mpodolian28907bc2024-11-25 11:40:35 -0800223 final float targetInsetFraction = shouldAdjustQsb
mpodolianb5632712024-11-13 15:17:59 -0800224 ? (float) dp.iconSizePx / dp.hotseatQsbWidth : 0;
Liran Binyamin2a47a4a2024-07-24 12:25:09 -0400225 ValueAnimator qsbAnimator =
226 ValueAnimator.ofFloat(currentInsetFraction, targetInsetFraction);
Liran Binyamina833af32023-08-02 16:30:27 -0400227 qsbAnimator.addUpdateListener(animation -> {
Liran Binyamin2a47a4a2024-07-24 12:25:09 -0400228 float insetFraction = (float) animation.getAnimatedValue();
Liran Binyamina833af32023-08-02 16:30:27 -0400229 horizontalInsettableQsb.setHorizontalInsets(insetFraction);
230 });
231 animatorSet.play(qsbAnimator);
232 }
233 animatorSet.setDuration(BUBBLE_BAR_ADJUSTMENT_ANIMATION_DURATION_MS).start();
234 }
235
Adam Cohena5f4e482013-10-11 12:10:28 -0700236 @Override
mpodolian06fb33c2024-12-06 14:55:21 -0800237 protected int getTranslationXForCell(int cellX, int cellY) {
238 TranslationProvider translationProvider = getShortcutsAndWidgets().getTranslationProvider();
239 if (translationProvider == null) return 0;
240 return (int) translationProvider.getTranslationX(cellX);
241 }
242
243 @Override
Sunny Goyal07b69292018-01-08 14:19:34 -0800244 public void setInsets(Rect insets) {
245 FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) getLayoutParams();
Sunny Goyalc4d32012020-04-03 17:10:11 -0700246 DeviceProfile grid = mActivity.getDeviceProfile();
Sunny Goyal12069e62018-01-16 14:17:20 -0800247
Sunny Goyal11e96492018-03-23 17:06:00 -0700248 if (grid.isVerticalBarLayout()) {
Sunny Goyalc373e1c2021-03-09 17:27:53 -0800249 mQsb.setVisibility(View.GONE);
Sunny Goyal07b69292018-01-08 14:19:34 -0800250 lp.height = ViewGroup.LayoutParams.MATCH_PARENT;
Sunny Goyal7e2e67f2018-01-26 13:40:08 -0800251 if (grid.isSeascape()) {
Sunny Goyal07b69292018-01-08 14:19:34 -0800252 lp.gravity = Gravity.LEFT;
Tony Wickham1eeffbe2018-06-12 15:01:15 -0700253 lp.width = grid.hotseatBarSizePx + insets.left;
Sunny Goyal07b69292018-01-08 14:19:34 -0800254 } else {
255 lp.gravity = Gravity.RIGHT;
Tony Wickham1eeffbe2018-06-12 15:01:15 -0700256 lp.width = grid.hotseatBarSizePx + insets.right;
Sunny Goyal07b69292018-01-08 14:19:34 -0800257 }
258 } else {
Sunny Goyalc373e1c2021-03-09 17:27:53 -0800259 mQsb.setVisibility(View.VISIBLE);
Sunny Goyal07b69292018-01-08 14:19:34 -0800260 lp.gravity = Gravity.BOTTOM;
261 lp.width = ViewGroup.LayoutParams.MATCH_PARENT;
Thales Limab8c05952022-05-23 16:58:38 +0100262 lp.height = grid.hotseatBarSizePx;
Sunny Goyal07b69292018-01-08 14:19:34 -0800263 }
Sunny Goyalc373e1c2021-03-09 17:27:53 -0800264
Sunny Goyal57b22792021-05-25 14:35:01 -0700265 Rect padding = grid.getHotseatLayoutPadding(getContext());
266 setPadding(padding.left, padding.top, padding.right, padding.bottom);
Sunny Goyal07b69292018-01-08 14:19:34 -0800267 setLayoutParams(lp);
268 InsettableFrameLayout.dispatchInsets(this, insets);
269 }
Sunny Goyald1580972019-04-09 11:52:49 -0700270
Shikha Malhotraf78da1b2022-04-11 10:23:18 +0000271 public void setWorkspace(Workspace<?> w) {
Adam Cohenb66675a2020-05-15 16:16:17 -0700272 mWorkspace = w;
Sebastian Franco2986e0b2024-01-25 10:23:39 -0800273 setCellLayoutContainer(w);
Adam Cohenb66675a2020-05-15 16:16:17 -0700274 }
275
276 @Override
277 public boolean onInterceptTouchEvent(MotionEvent ev) {
278 // We allow horizontal workspace scrolling from within the Hotseat. We do this by delegating
279 // touch intercept the Workspace, and if it intercepts, delegating touch to the Workspace
280 // for the remainder of the this input stream.
281 int yThreshold = getMeasuredHeight() - getPaddingBottom();
282 if (mWorkspace != null && ev.getY() <= yThreshold) {
283 mSendTouchToWorkspace = mWorkspace.onInterceptTouchEvent(ev);
284 return mSendTouchToWorkspace;
285 }
286 return false;
287 }
288
Sunny Goyald1580972019-04-09 11:52:49 -0700289 @Override
290 public boolean onTouchEvent(MotionEvent event) {
Adam Cohenb66675a2020-05-15 16:16:17 -0700291 // See comment in #onInterceptTouchEvent
292 if (mSendTouchToWorkspace) {
293 final int action = event.getAction();
294 switch (action & MotionEvent.ACTION_MASK) {
295 case MotionEvent.ACTION_UP:
296 case MotionEvent.ACTION_CANCEL:
297 mSendTouchToWorkspace = false;
298 }
299 return mWorkspace.onTouchEvent(event);
300 }
Alex Chau21698c52021-09-24 14:36:15 +0100301 // Always let touch follow through to Workspace.
302 return false;
Sunny Goyald1580972019-04-09 11:52:49 -0700303 }
Schneider Victor-tulias3cf264f2020-09-22 12:58:38 -0700304
305 @Override
Sunny Goyalc373e1c2021-03-09 17:27:53 -0800306 protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
307 super.onMeasure(widthMeasureSpec, heightMeasureSpec);
308
Alex Chau206ede92022-08-01 17:46:12 +0100309 DeviceProfile dp = mActivity.getDeviceProfile();
310 mQsb.measure(MeasureSpec.makeMeasureSpec(dp.hotseatQsbWidth, MeasureSpec.EXACTLY),
311 MeasureSpec.makeMeasureSpec(dp.hotseatQsbHeight, MeasureSpec.EXACTLY));
Sunny Goyalc373e1c2021-03-09 17:27:53 -0800312 }
313
314 @Override
315 protected void onLayout(boolean changed, int l, int t, int r, int b) {
316 super.onLayout(changed, l, t, r, b);
317
Alex Chau206ede92022-08-01 17:46:12 +0100318 int qsbMeasuredWidth = mQsb.getMeasuredWidth();
Thales Limaa1012902022-01-13 17:58:42 +0000319 int left;
Alex Chau206ede92022-08-01 17:46:12 +0100320 DeviceProfile dp = mActivity.getDeviceProfile();
321 if (dp.isQsbInline) {
322 int qsbSpace = dp.hotseatBorderSpace;
Thales Lima612230d2022-03-31 18:04:37 +0100323 left = Utilities.isRtl(getResources()) ? r - getPaddingRight() + qsbSpace
Alex Chau206ede92022-08-01 17:46:12 +0100324 : l + getPaddingLeft() - qsbMeasuredWidth - qsbSpace;
Thales Limaa1012902022-01-13 17:58:42 +0000325 } else {
Alex Chau206ede92022-08-01 17:46:12 +0100326 left = (r - l - qsbMeasuredWidth) / 2;
Thales Limaa1012902022-01-13 17:58:42 +0000327 }
Alex Chau206ede92022-08-01 17:46:12 +0100328 int right = left + qsbMeasuredWidth;
Sunny Goyalc373e1c2021-03-09 17:27:53 -0800329
Alex Chau206ede92022-08-01 17:46:12 +0100330 int bottom = b - t - dp.getQsbOffsetY();
331 int top = bottom - dp.hotseatQsbHeight;
Sunny Goyalc373e1c2021-03-09 17:27:53 -0800332 mQsb.layout(left, top, right, bottom);
333 }
334
Tony Wickham39938cb2021-02-26 09:15:31 -0800335 /**
Liran Binyamin69f49742024-03-04 09:39:53 -0500336 * Sets the alpha value of the specified alpha channel of just our ShortcutAndWidgetContainer.
Tony Wickham9ce3b252021-03-22 14:43:58 -0700337 */
Liran Binyamin69f49742024-03-04 09:39:53 -0500338 public void setIconsAlpha(float alpha, @HotseatQsbAlphaId int channelId) {
339 getIconsAlpha(channelId).setValue(alpha);
Tony Wickhamae72b462021-03-10 16:18:40 -0800340 }
Sunny Goyalc373e1c2021-03-09 17:27:53 -0800341
Alex Chauc1d26442022-06-09 15:09:26 +0100342 /**
343 * Sets the alpha value of just our QSB.
344 */
Liran Binyamin69f49742024-03-04 09:39:53 -0500345 public void setQsbAlpha(float alpha, @HotseatQsbAlphaId int channelId) {
346 getQsbAlpha(channelId).setValue(alpha);
Alex Chauc1d26442022-06-09 15:09:26 +0100347 }
348
Liran Binyamin69f49742024-03-04 09:39:53 -0500349 /** Returns the alpha channel for ShortcutAndWidgetContainer */
350 public MultiProperty getIconsAlpha(@HotseatQsbAlphaId int channelId) {
351 return mIconsAlphaChannels.get(channelId);
352 }
353
354 /** Returns the alpha channel for Qsb */
355 public MultiProperty getQsbAlpha(@HotseatQsbAlphaId int channelId) {
356 return mQsbAlphaChannels.get(channelId);
Tracy Zhouae881972021-09-30 10:14:34 -0700357 }
358
Sunny Goyalc373e1c2021-03-09 17:27:53 -0800359 /**
360 * Returns the QSB inside hotseat
361 */
362 public View getQsb() {
363 return mQsb;
364 }
Tony Wickham9ce3b252021-03-22 14:43:58 -0700365
Liran Binyamin69f49742024-03-04 09:39:53 -0500366 /** Dumps the Hotseat internal state */
367 public void dump(String prefix, PrintWriter writer) {
368 writer.println(prefix + "Hotseat:");
369 mIconsAlphaChannels.dump(
370 prefix + "\t",
371 writer,
372 "mIconsAlphaChannels",
373 "ALPHA_CHANNEL_TASKBAR_ALIGNMENT",
374 "ALPHA_CHANNEL_PREVIEW_RENDERER",
375 "ALPHA_CHANNEL_TASKBAR_STASH");
376 mQsbAlphaChannels.dump(
377 prefix + "\t",
378 writer,
379 "mQsbAlphaChannels",
380 "ALPHA_CHANNEL_TASKBAR_ALIGNMENT",
381 "ALPHA_CHANNEL_PREVIEW_RENDERER",
382 "ALPHA_CHANNEL_TASKBAR_STASH"
383 );
384 }
385
Winson Chung3d503fb2011-07-13 17:25:49 -0700386}