blob: e6f8a85e523e833bb12d5ad82c3e79da24625e12 [file] [log] [blame]
The Android Open Source Project31dd5032009-03-03 19:32:27 -08001/*
2 * Copyright (C) 2008 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;
The Android Open Source Project31dd5032009-03-03 19:32:27 -080018
Sunny Goyal14168432019-10-24 15:59:49 -070019import static com.android.launcher3.FastBitmapDrawable.newIcon;
20import static com.android.launcher3.graphics.PreloadIconDrawable.newPendingIcon;
Sunny Goyal066ace12018-11-05 11:08:31 -080021import static com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound;
22
Tony4043b052018-08-17 13:47:39 -070023import android.animation.Animator;
24import android.animation.AnimatorListenerAdapter;
Tony Wickham1237df02017-02-24 08:59:36 -080025import android.animation.ObjectAnimator;
The Android Open Source Project31dd5032009-03-03 19:32:27 -080026import android.content.Context;
Adam Cohen96bb7982014-07-07 11:58:56 -070027import android.content.res.ColorStateList;
Adam Cohen96bb7982014-07-07 11:58:56 -070028import android.content.res.TypedArray;
The Android Open Source Project31dd5032009-03-03 19:32:27 -080029import android.graphics.Canvas;
Tony17b7f9b2017-05-23 12:19:09 -070030import android.graphics.Color;
Winson1f064272016-07-18 17:18:02 -070031import android.graphics.Paint;
Tony Wickham1237df02017-02-24 08:59:36 -080032import android.graphics.Rect;
Tony17b7f9b2017-05-23 12:19:09 -070033import android.graphics.drawable.ColorDrawable;
The Android Open Source Project31dd5032009-03-03 19:32:27 -080034import android.graphics.drawable.Drawable;
Sunny Goyal66dccad2018-03-19 12:00:51 -070035import android.text.TextUtils.TruncateAt;
Winson Chung656d11c2010-11-29 17:15:47 -080036import android.util.AttributeSet;
Tony Wickham1237df02017-02-24 08:59:36 -080037import android.util.Property;
Winson Chung5f8afe62013-08-12 16:19:28 -070038import android.util.TypedValue;
Sunny Goyal508da152014-08-14 10:53:27 -070039import android.view.KeyEvent;
Michael Jurka38b4f7c2010-12-14 16:46:39 -080040import android.view.MotionEvent;
Sunny Goyal317698b2015-07-29 11:45:41 -070041import android.view.View;
Jason Monk02dd7ae2014-04-15 15:23:31 -040042import android.view.ViewConfiguration;
Sunny Goyal4ffec482016-02-09 11:28:52 -080043import android.view.ViewDebug;
Michael Jurkabdb5c532011-02-01 15:05:06 -080044import android.widget.TextView;
Sunny Goyal317698b2015-07-29 11:45:41 -070045
Sunny Goyal3dce5f32017-10-05 11:40:05 -070046import com.android.launcher3.Launcher.OnResumeCallback;
Adam Cohen29794c52019-06-21 12:50:30 -070047import com.android.launcher3.accessibility.LauncherAccessibilityDelegate;
Tony Wickhamf34bee82018-12-03 18:11:39 -080048import com.android.launcher3.dot.DotInfo;
Tony7308cde2017-06-27 22:38:33 -070049import com.android.launcher3.folder.FolderIcon;
Tony Wickham1237df02017-02-24 08:59:36 -080050import com.android.launcher3.graphics.IconPalette;
Tony Wickhame1cb93f2019-05-03 11:27:32 -070051import com.android.launcher3.graphics.IconShape;
Sunny Goyal96ac68a2017-02-02 16:37:21 -080052import com.android.launcher3.graphics.PreloadIconDrawable;
Tony Wickham8912b042018-11-29 15:28:53 -080053import com.android.launcher3.icons.DotRenderer;
Sunny Goyalfe8e4a92018-11-13 19:43:57 -080054import com.android.launcher3.icons.IconCache.IconLoadRequest;
55import com.android.launcher3.icons.IconCache.ItemInfoUpdateReceiver;
Hyunyoung Song2bd3d7d2015-05-21 13:04:53 -070056import com.android.launcher3.model.PackageItemInfo;
Sunny Goyalfe8e4a92018-11-13 19:43:57 -080057import com.android.launcher3.views.ActivityContext;
Jon Miranda9b78e192019-08-30 18:42:01 -070058import com.android.launcher3.views.IconLabelDotView;
Sunny Goyal34b65272015-03-11 16:56:52 -070059
Sunny Goyalc469aad2015-10-01 11:24:23 -070060import java.text.NumberFormat;
61
The Android Open Source Project31dd5032009-03-03 19:32:27 -080062/**
63 * TextView that draws a bubble behind the text. We cannot use a LineBackgroundSpan
64 * because we want to make the bubble taller than the text and TextView's clip is
65 * too aggressive.
66 */
Jon Miranda9b78e192019-08-30 18:42:01 -070067public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, OnResumeCallback,
68 IconLabelDotView {
Sunny Goyal95abbb32014-08-04 10:53:22 -070069
Sunny Goyaldfaccf62015-05-11 16:30:44 -070070 private static final int DISPLAY_WORKSPACE = 0;
71 private static final int DISPLAY_ALL_APPS = 1;
Sunny Goyalbaec6ff2016-09-14 11:26:21 -070072 private static final int DISPLAY_FOLDER = 2;
Sunny Goyaldfaccf62015-05-11 16:30:44 -070073
Sunny Goyal2a76e3f2017-02-16 13:33:15 -080074 private static final int[] STATE_PRESSED = new int[] {android.R.attr.state_pressed};
75
Tony Wickham1237df02017-02-24 08:59:36 -080076
Tony Wickhamf34bee82018-12-03 18:11:39 -080077 private static final Property<BubbleTextView, Float> DOT_SCALE_PROPERTY
78 = new Property<BubbleTextView, Float>(Float.TYPE, "dotScale") {
Tony Wickham1237df02017-02-24 08:59:36 -080079 @Override
80 public Float get(BubbleTextView bubbleTextView) {
Tony Wickham8912b042018-11-29 15:28:53 -080081 return bubbleTextView.mDotParams.scale;
Tony Wickham1237df02017-02-24 08:59:36 -080082 }
83
84 @Override
85 public void set(BubbleTextView bubbleTextView, Float value) {
Tony Wickham8912b042018-11-29 15:28:53 -080086 bubbleTextView.mDotParams.scale = value;
Tony Wickham1237df02017-02-24 08:59:36 -080087 bubbleTextView.invalidate();
88 }
89 };
90
Sunny Goyaled7a6932018-04-13 11:41:50 -070091 public static final Property<BubbleTextView, Float> TEXT_ALPHA_PROPERTY
92 = new Property<BubbleTextView, Float>(Float.class, "textAlpha") {
Tony8f402802017-06-16 17:24:54 -070093 @Override
Sunny Goyaled7a6932018-04-13 11:41:50 -070094 public Float get(BubbleTextView bubbleTextView) {
95 return bubbleTextView.mTextAlpha;
Tony8f402802017-06-16 17:24:54 -070096 }
97
98 @Override
Sunny Goyaled7a6932018-04-13 11:41:50 -070099 public void set(BubbleTextView bubbleTextView, Float alpha) {
Tony8f402802017-06-16 17:24:54 -0700100 bubbleTextView.setTextAlpha(alpha);
101 }
102 };
103
Sunny Goyalfe8e4a92018-11-13 19:43:57 -0800104 private final ActivityContext mActivity;
Sunny Goyaled7a6932018-04-13 11:41:50 -0700105 private Drawable mIcon;
106 private final boolean mCenterVertically;
107
Samuel Fufac96fa242019-09-26 23:06:32 -0700108 private final int mDisplay;
109
Sunny Goyaled7a6932018-04-13 11:41:50 -0700110 private final CheckLongPressHelper mLongPressHelper;
111 private final StylusEventHelper mStylusEventHelper;
112 private final float mSlop;
113
114 private final boolean mLayoutHorizontal;
115 private final int mIconSize;
116
117 @ViewDebug.ExportedProperty(category = "launcher")
118 private boolean mIsIconVisible = true;
119 @ViewDebug.ExportedProperty(category = "launcher")
120 private int mTextColor;
121 @ViewDebug.ExportedProperty(category = "launcher")
122 private float mTextAlpha = 1;
123
Tony4043b052018-08-17 13:47:39 -0700124 @ViewDebug.ExportedProperty(category = "launcher")
Tony Wickhamf34bee82018-12-03 18:11:39 -0800125 private DotInfo mDotInfo;
Tony Wickham8912b042018-11-29 15:28:53 -0800126 private DotRenderer mDotRenderer;
127 @ViewDebug.ExportedProperty(category = "launcher", deepExport = true)
128 private DotRenderer.DrawParams mDotParams;
Tony Wickhamf34bee82018-12-03 18:11:39 -0800129 private Animator mDotScaleAnim;
130 private boolean mForceHideDot;
Sunny Goyaled7a6932018-04-13 11:41:50 -0700131
Sunny Goyal4ffec482016-02-09 11:28:52 -0800132 @ViewDebug.ExportedProperty(category = "launcher")
Michael Jurkaddd62e92011-02-16 17:49:14 -0800133 private boolean mStayPressed;
Sunny Goyal4ffec482016-02-09 11:28:52 -0800134 @ViewDebug.ExportedProperty(category = "launcher")
Sunny Goyal508da152014-08-14 10:53:27 -0700135 private boolean mIgnorePressedStateChange;
Sunny Goyal4ffec482016-02-09 11:28:52 -0800136 @ViewDebug.ExportedProperty(category = "launcher")
Sunny Goyal69b75642015-05-15 17:00:24 -0700137 private boolean mDisableRelayout = false;
Chris Wrenaeff7ea2014-02-14 16:59:24 -0500138
Samuel Fufa4a1d9b12019-09-19 17:28:00 -0700139 @ViewDebug.ExportedProperty(category = "launcher")
140 private final boolean mIgnorePaddingTouch;
141
Sunny Goyal34b65272015-03-11 16:56:52 -0700142 private IconLoadRequest mIconLoadRequest;
143
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800144 public BubbleTextView(Context context) {
Adam Cohen96bb7982014-07-07 11:58:56 -0700145 this(context, null, 0);
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800146 }
147
148 public BubbleTextView(Context context, AttributeSet attrs) {
Adam Cohen96bb7982014-07-07 11:58:56 -0700149 this(context, attrs, 0);
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800150 }
151
152 public BubbleTextView(Context context, AttributeSet attrs, int defStyle) {
153 super(context, attrs, defStyle);
Sunny Goyalfe8e4a92018-11-13 19:43:57 -0800154 mActivity = ActivityContext.lookupContext(context);
Sunny Goyal9314b7c2017-06-23 10:36:27 -0700155 mSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
Adam Cohen96bb7982014-07-07 11:58:56 -0700156
Adam Cohen96bb7982014-07-07 11:58:56 -0700157 TypedArray a = context.obtainStyledAttributes(attrs,
158 R.styleable.BubbleTextView, defStyle, 0);
Winson Chungb745afb2015-03-02 11:51:23 -0800159 mLayoutHorizontal = a.getBoolean(R.styleable.BubbleTextView_layoutHorizontal, false);
Sunny Goyaldfaccf62015-05-11 16:30:44 -0700160
Samuel Fufac96fa242019-09-26 23:06:32 -0700161 mDisplay = a.getInteger(R.styleable.BubbleTextView_iconDisplay, DISPLAY_WORKSPACE);
Sunny Goyalae6e3182019-04-30 12:04:37 -0700162 final int defaultIconSize;
Samuel Fufac96fa242019-09-26 23:06:32 -0700163 if (mDisplay == DISPLAY_WORKSPACE) {
Sunny Goyalae6e3182019-04-30 12:04:37 -0700164 DeviceProfile grid = mActivity.getWallpaperDeviceProfile();
Winson Chung44d0aac2015-05-11 18:02:55 -0700165 setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.iconTextSizePx);
Jon Miranda09660722017-06-14 14:20:14 -0700166 setCompoundDrawablePadding(grid.iconDrawablePaddingPx);
Sunny Goyalae6e3182019-04-30 12:04:37 -0700167 defaultIconSize = grid.iconSizePx;
Samuel Fufa4a1d9b12019-09-19 17:28:00 -0700168 mIgnorePaddingTouch = true;
Samuel Fufac96fa242019-09-26 23:06:32 -0700169 } else if (mDisplay == DISPLAY_ALL_APPS) {
Sunny Goyalae6e3182019-04-30 12:04:37 -0700170 DeviceProfile grid = mActivity.getDeviceProfile();
Winson1f064272016-07-18 17:18:02 -0700171 setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.allAppsIconTextSizePx);
172 setCompoundDrawablePadding(grid.allAppsIconDrawablePaddingPx);
Sunny Goyaldfaccf62015-05-11 16:30:44 -0700173 defaultIconSize = grid.allAppsIconSizePx;
Samuel Fufa4a1d9b12019-09-19 17:28:00 -0700174 mIgnorePaddingTouch = true;
Samuel Fufac96fa242019-09-26 23:06:32 -0700175 } else if (mDisplay == DISPLAY_FOLDER) {
Sunny Goyalae6e3182019-04-30 12:04:37 -0700176 DeviceProfile grid = mActivity.getDeviceProfile();
Jon Mirandabf7d8122016-11-03 15:29:29 -0700177 setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.folderChildTextSizePx);
Sunny Goyalbaec6ff2016-09-14 11:26:21 -0700178 setCompoundDrawablePadding(grid.folderChildDrawablePaddingPx);
Jon Mirandabf7d8122016-11-03 15:29:29 -0700179 defaultIconSize = grid.folderChildIconSizePx;
Samuel Fufa4a1d9b12019-09-19 17:28:00 -0700180 mIgnorePaddingTouch = true;
Sunny Goyalae6e3182019-04-30 12:04:37 -0700181 } else {
Samuel Fufa4a1d9b12019-09-19 17:28:00 -0700182 // widget_selection or shortcut_popup
Sunny Goyalae6e3182019-04-30 12:04:37 -0700183 defaultIconSize = mActivity.getDeviceProfile().iconSizePx;
Samuel Fufa4a1d9b12019-09-19 17:28:00 -0700184 mIgnorePaddingTouch = false;
Sunny Goyaldfaccf62015-05-11 16:30:44 -0700185 }
Samuel Fufa4a1d9b12019-09-19 17:28:00 -0700186
Winson1f064272016-07-18 17:18:02 -0700187 mCenterVertically = a.getBoolean(R.styleable.BubbleTextView_centerVertically, false);
Sunny Goyaldfaccf62015-05-11 16:30:44 -0700188
189 mIconSize = a.getDimensionPixelSize(R.styleable.BubbleTextView_iconSizeOverride,
190 defaultIconSize);
Adam Cohen96bb7982014-07-07 11:58:56 -0700191 a.recycle();
192
Sunny Goyal71b5c0b2015-01-08 16:59:04 -0800193 mLongPressHelper = new CheckLongPressHelper(this);
Mady Mellorbb835202015-07-15 16:34:34 -0700194 mStylusEventHelper = new StylusEventHelper(new SimpleOnStylusPressListener(this), this);
Sunny Goyal71b5c0b2015-01-08 16:59:04 -0800195
Tony Wickham8912b042018-11-29 15:28:53 -0800196 mDotParams = new DotRenderer.DrawParams();
197
Sunny Goyal66dccad2018-03-19 12:00:51 -0700198 setEllipsize(TruncateAt.END);
Sunny Goyal0b0847b2018-03-14 12:30:11 -0700199 setAccessibilityDelegate(mActivity.getAccessibilityDelegate());
Sunny Goyaled7a6932018-04-13 11:41:50 -0700200 setTextAlpha(1f);
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800201 }
202
Sunny Goyal66dccad2018-03-19 12:00:51 -0700203 @Override
204 protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
205 // Disable marques when not focused to that, so that updating text does not cause relayout.
206 setEllipsize(focused ? TruncateAt.MARQUEE : TruncateAt.END);
207 super.onFocusChanged(focused, direction, previouslyFocusedRect);
208 }
209
Jon Miranda52549442017-10-26 11:28:06 -0700210 /**
211 * Resets the view so it can be recycled.
212 */
213 public void reset() {
Tony Wickhamf34bee82018-12-03 18:11:39 -0800214 mDotInfo = null;
Tony Wickham8912b042018-11-29 15:28:53 -0800215 mDotParams.color = Color.TRANSPARENT;
Tony Wickhamf34bee82018-12-03 18:11:39 -0800216 cancelDotScaleAnim();
Tony Wickham8912b042018-11-29 15:28:53 -0800217 mDotParams.scale = 0f;
Tony Wickhamf34bee82018-12-03 18:11:39 -0800218 mForceHideDot = false;
Samuel Fufaba6b47f2019-11-07 10:27:41 -0800219 setBackground(null);
Jon Miranda52549442017-10-26 11:28:06 -0700220 }
221
Tony Wickhamf34bee82018-12-03 18:11:39 -0800222 private void cancelDotScaleAnim() {
223 if (mDotScaleAnim != null) {
224 mDotScaleAnim.cancel();
Tony4043b052018-08-17 13:47:39 -0700225 }
226 }
227
Tony Wickhamf34bee82018-12-03 18:11:39 -0800228 private void animateDotScale(float... dotScales) {
229 cancelDotScaleAnim();
230 mDotScaleAnim = ObjectAnimator.ofFloat(this, DOT_SCALE_PROPERTY, dotScales);
231 mDotScaleAnim.addListener(new AnimatorListenerAdapter() {
Tony4043b052018-08-17 13:47:39 -0700232 @Override
233 public void onAnimationEnd(Animator animation) {
Tony Wickhamf34bee82018-12-03 18:11:39 -0800234 mDotScaleAnim = null;
Tony4043b052018-08-17 13:47:39 -0700235 }
236 });
Tony Wickhamf34bee82018-12-03 18:11:39 -0800237 mDotScaleAnim.start();
Tony4043b052018-08-17 13:47:39 -0700238 }
239
Sunny Goyal95899162019-03-27 16:03:06 -0700240 public void applyFromWorkspaceItem(WorkspaceItemInfo info) {
241 applyFromWorkspaceItem(info, false);
Winson Chung5f8afe62013-08-12 16:19:28 -0700242 }
243
Adam Cohen29794c52019-06-21 12:50:30 -0700244 @Override
245 public void setAccessibilityDelegate(AccessibilityDelegate delegate) {
246 if (delegate instanceof LauncherAccessibilityDelegate) {
247 super.setAccessibilityDelegate(delegate);
248 } else {
249 // NO-OP
250 // Workaround for b/129745295 where RecyclerView is setting our Accessibility
251 // delegate incorrectly. There are no cases when we shouldn't be using the
252 // LauncherAccessibilityDelegate for BubbleTextView.
253 }
254 }
255
Sunny Goyal95899162019-03-27 16:03:06 -0700256 public void applyFromWorkspaceItem(WorkspaceItemInfo info, boolean promiseStateChanged) {
Sunny Goyal179249d2017-12-19 16:49:24 -0800257 applyIconAndLabel(info);
Michael Jurka67b2f6c2010-11-17 12:33:46 -0800258 setTag(info);
Mario Bertschler8ff9e1d2017-08-08 16:26:18 -0700259 if (promiseStateChanged || (info.hasPromiseIconUi())) {
Tony Wickham9a8d11f2017-01-11 09:53:12 -0800260 applyPromiseState(promiseStateChanged);
Chris Wrenaeff7ea2014-02-14 16:59:24 -0500261 }
Tony Wickham010d2552017-01-20 08:15:28 -0800262
Tony Wickhamf34bee82018-12-03 18:11:39 -0800263 applyDotState(info, false /* animate */);
Michael Jurka67b2f6c2010-11-17 12:33:46 -0800264 }
265
Sunny Goyal508da152014-08-14 10:53:27 -0700266 public void applyFromApplicationInfo(AppInfo info) {
Sunny Goyal179249d2017-12-19 16:49:24 -0800267 applyIconAndLabel(info);
Sunny Goyalf4204382016-07-13 10:46:07 -0700268
Sunny Goyal95899162019-03-27 16:03:06 -0700269 // We don't need to check the info since it's not a WorkspaceItemInfo
Winson Chung888b3a12015-03-13 11:14:16 -0700270 super.setTag(info);
Sunny Goyal34b65272015-03-11 16:56:52 -0700271
272 // Verify high res immediately
273 verifyHighRes();
Tony Wickham010d2552017-01-20 08:15:28 -0800274
Mario Bertschler08ffaae2017-03-20 11:30:27 -0700275 if (info instanceof PromiseAppInfo) {
276 PromiseAppInfo promiseAppInfo = (PromiseAppInfo) info;
277 applyProgressLevel(promiseAppInfo.level);
278 }
Tony Wickhamf34bee82018-12-03 18:11:39 -0800279 applyDotState(info, false /* animate */);
Sunny Goyal508da152014-08-14 10:53:27 -0700280 }
281
Sunny Goyal0e08f162015-05-12 11:32:39 -0700282 public void applyFromPackageItemInfo(PackageItemInfo info) {
Sunny Goyal179249d2017-12-19 16:49:24 -0800283 applyIconAndLabel(info);
Sunny Goyal95899162019-03-27 16:03:06 -0700284 // We don't need to check the info since it's not a WorkspaceItemInfo
Sunny Goyal0e08f162015-05-12 11:32:39 -0700285 super.setTag(info);
286
287 // Verify high res immediately
288 verifyHighRes();
289 }
290
Sunny Goyal179249d2017-12-19 16:49:24 -0800291 private void applyIconAndLabel(ItemInfoWithIcon info) {
Sunny Goyal14168432019-10-24 15:59:49 -0700292 FastBitmapDrawable iconDrawable = newIcon(getContext(), info);
Sunny Goyal3808a692019-10-25 13:41:28 -0700293 mDotParams.color = IconPalette.getMutedColor(info.bitmap.color, 0.54f);
Sunny Goyal179249d2017-12-19 16:49:24 -0800294
Sunny Goyalf4204382016-07-13 10:46:07 -0700295 setIcon(iconDrawable);
296 setText(info.title);
297 if (info.contentDescription != null) {
298 setContentDescription(info.isDisabled()
299 ? getContext().getString(R.string.disabled_app_label, info.contentDescription)
300 : info.contentDescription);
301 }
302 }
303
Winson Chung7501adf2015-06-02 11:24:28 -0700304 /**
305 * Overrides the default long press timeout.
306 */
Tony2ca999c2018-09-24 17:24:51 -0400307 public void setLongPressTimeoutFactor(float longPressTimeoutFactor) {
308 mLongPressHelper.setLongPressTimeoutFactor(longPressTimeoutFactor);
Winson Chung7501adf2015-06-02 11:24:28 -0700309 }
Sunny Goyal0e08f162015-05-12 11:32:39 -0700310
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800311 @Override
Sunny Goyal2a76e3f2017-02-16 13:33:15 -0800312 public void refreshDrawableState() {
Sunny Goyal508da152014-08-14 10:53:27 -0700313 if (!mIgnorePressedStateChange) {
Sunny Goyal2a76e3f2017-02-16 13:33:15 -0800314 super.refreshDrawableState();
Michael Jurka38b4f7c2010-12-14 16:46:39 -0800315 }
Sunny Goyal508da152014-08-14 10:53:27 -0700316 }
Michael Jurka38b4f7c2010-12-14 16:46:39 -0800317
Sunny Goyal2a76e3f2017-02-16 13:33:15 -0800318 @Override
319 protected int[] onCreateDrawableState(int extraSpace) {
320 final int[] drawableState = super.onCreateDrawableState(extraSpace + 1);
321 if (mStayPressed) {
322 mergeDrawableStates(drawableState, STATE_PRESSED);
323 }
324 return drawableState;
325 }
326
Winson Chungb745afb2015-03-02 11:51:23 -0800327 /** Returns the icon for this view. */
328 public Drawable getIcon() {
329 return mIcon;
330 }
331
Tony Wickham1bce7fd2016-04-28 17:39:03 -0700332 @Override
Michael Jurka38b4f7c2010-12-14 16:46:39 -0800333 public boolean onTouchEvent(MotionEvent event) {
Samuel Fufa4a1d9b12019-09-19 17:28:00 -0700334 // ignore events if they happen in padding area
335 if (event.getAction() == MotionEvent.ACTION_DOWN && mIgnorePaddingTouch
336 && (event.getY() < getPaddingTop()
337 || event.getX() < getPaddingLeft()
338 || event.getY() > getHeight() - getPaddingBottom()
339 || event.getX() > getWidth() - getPaddingRight())) {
340 return false;
341 }
342
Michael Jurka38b4f7c2010-12-14 16:46:39 -0800343 // Call the superclass onTouchEvent first, because sometimes it changes the state to
344 // isPressed() on an ACTION_UP
345 boolean result = super.onTouchEvent(event);
346
Mady Melloref044dd2015-06-02 15:35:07 -0700347 // Check for a stylus button press, if it occurs cancel any long press checks.
Mady Mellorbb835202015-07-15 16:34:34 -0700348 if (mStylusEventHelper.onMotionEvent(event)) {
Mady Melloref044dd2015-06-02 15:35:07 -0700349 mLongPressHelper.cancelLongPress();
350 result = true;
351 }
352
Michael Jurka38b4f7c2010-12-14 16:46:39 -0800353 switch (event.getAction()) {
354 case MotionEvent.ACTION_DOWN:
Mady Melloref044dd2015-06-02 15:35:07 -0700355 // If we're in a stylus button press, don't check for long press.
356 if (!mStylusEventHelper.inStylusButtonPressed()) {
357 mLongPressHelper.postCheckForLongPress();
358 }
Michael Jurka38b4f7c2010-12-14 16:46:39 -0800359 break;
360 case MotionEvent.ACTION_CANCEL:
361 case MotionEvent.ACTION_UP:
Winson Chung88f33452012-02-23 15:23:44 -0800362 mLongPressHelper.cancelLongPress();
Michael Jurka38b4f7c2010-12-14 16:46:39 -0800363 break;
Jason Monk02dd7ae2014-04-15 15:23:31 -0400364 case MotionEvent.ACTION_MOVE:
365 if (!Utilities.pointInView(this, event.getX(), event.getY(), mSlop)) {
366 mLongPressHelper.cancelLongPress();
367 }
368 break;
Michael Jurka38b4f7c2010-12-14 16:46:39 -0800369 }
370 return result;
371 }
372
Michael Jurkaddd62e92011-02-16 17:49:14 -0800373 void setStayPressed(boolean stayPressed) {
374 mStayPressed = stayPressed;
Sunny Goyal2a76e3f2017-02-16 13:33:15 -0800375 refreshDrawableState();
Patrick Dubroy3499d8c2011-03-10 17:17:23 -0800376 }
377
Sunny Goyal3dce5f32017-10-05 11:40:05 -0700378 @Override
Hyunyoung Songef468d82019-01-03 01:02:43 -0800379 public void onVisibilityAggregated(boolean isVisible) {
380 super.onVisibilityAggregated(isVisible);
381 if (mIcon != null) {
Hyunyoung Songa2373852019-01-04 12:01:32 -0800382 mIcon.setVisible(isVisible, false);
Hyunyoung Songef468d82019-01-03 01:02:43 -0800383 }
384 }
385
386 @Override
Sunny Goyal3dce5f32017-10-05 11:40:05 -0700387 public void onLauncherResume() {
388 // Reset the pressed state of icon that was locked in the press state while activity
389 // was launching
390 setStayPressed(false);
391 }
392
Sunny Goyal508da152014-08-14 10:53:27 -0700393 void clearPressedBackground() {
394 setPressed(false);
395 setStayPressed(false);
396 }
397
398 @Override
Sunny Goyal508da152014-08-14 10:53:27 -0700399 public boolean onKeyUp(int keyCode, KeyEvent event) {
400 // Unlike touch events, keypress event propagate pressed state change immediately,
401 // without waiting for onClickHandler to execute. Disable pressed state changes here
402 // to avoid flickering.
403 mIgnorePressedStateChange = true;
404 boolean result = super.onKeyUp(keyCode, event);
Sunny Goyal508da152014-08-14 10:53:27 -0700405 mIgnorePressedStateChange = false;
Sunny Goyal2a76e3f2017-02-16 13:33:15 -0800406 refreshDrawableState();
Sunny Goyal508da152014-08-14 10:53:27 -0700407 return result;
Michael Jurkaddd62e92011-02-16 17:49:14 -0800408 }
Patrick Dubroya017c032011-03-09 15:58:32 -0800409
Sunny Goyal9314b7c2017-06-23 10:36:27 -0700410 @SuppressWarnings("wrongcall")
Tony Wickhamf34bee82018-12-03 18:11:39 -0800411 protected void drawWithoutDot(Canvas canvas) {
Sunny Goyal9314b7c2017-06-23 10:36:27 -0700412 super.onDraw(canvas);
413 }
414
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800415 @Override
Sunny Goyal9314b7c2017-06-23 10:36:27 -0700416 public void onDraw(Canvas canvas) {
417 super.onDraw(canvas);
Tony Wickhamf34bee82018-12-03 18:11:39 -0800418 drawDotIfNecessary(canvas);
Tony Wickham1237df02017-02-24 08:59:36 -0800419 }
420
421 /**
Tony Wickhamf34bee82018-12-03 18:11:39 -0800422 * Draws the notification dot in the top right corner of the icon bounds.
Tony Wickham1237df02017-02-24 08:59:36 -0800423 * @param canvas The canvas to draw to.
424 */
Tony Wickhamf34bee82018-12-03 18:11:39 -0800425 protected void drawDotIfNecessary(Canvas canvas) {
426 if (!mForceHideDot && (hasDot() || mDotParams.scale > 0)) {
Tony Wickham8912b042018-11-29 15:28:53 -0800427 getIconBounds(mDotParams.iconBounds);
Tony Wickhame1cb93f2019-05-03 11:27:32 -0700428 Utilities.scaleRectAboutCenter(mDotParams.iconBounds, IconShape.getNormalizationScale());
Tony Wickham1237df02017-02-24 08:59:36 -0800429 final int scrollX = getScrollX();
430 final int scrollY = getScrollY();
431 canvas.translate(scrollX, scrollY);
Tony Wickham8912b042018-11-29 15:28:53 -0800432 mDotRenderer.draw(canvas, mDotParams);
Tony Wickham1237df02017-02-24 08:59:36 -0800433 canvas.translate(-scrollX, -scrollY);
434 }
435 }
436
Jon Miranda9b78e192019-08-30 18:42:01 -0700437 @Override
438 public void setForceHideDot(boolean forceHideDot) {
Tony Wickhamf34bee82018-12-03 18:11:39 -0800439 if (mForceHideDot == forceHideDot) {
Tony Wickham1237df02017-02-24 08:59:36 -0800440 return;
441 }
Tony Wickhamf34bee82018-12-03 18:11:39 -0800442 mForceHideDot = forceHideDot;
Tony Wickham1237df02017-02-24 08:59:36 -0800443
Tony Wickhamf34bee82018-12-03 18:11:39 -0800444 if (forceHideDot) {
Tony Wickham1237df02017-02-24 08:59:36 -0800445 invalidate();
Tony Wickhamf34bee82018-12-03 18:11:39 -0800446 } else if (hasDot()) {
447 animateDotScale(0, 1);
Tony Wickham1237df02017-02-24 08:59:36 -0800448 }
449 }
450
Tony Wickhamf34bee82018-12-03 18:11:39 -0800451 private boolean hasDot() {
452 return mDotInfo != null;
Tony Wickham1237df02017-02-24 08:59:36 -0800453 }
454
455 public void getIconBounds(Rect outBounds) {
Tony05d98c22018-07-23 08:01:15 -0700456 getIconBounds(this, outBounds, mIconSize);
457 }
458
459 public static void getIconBounds(View iconView, Rect outBounds, int iconSize) {
460 int top = iconView.getPaddingTop();
461 int left = (iconView.getWidth() - iconSize) / 2;
462 int right = left + iconSize;
463 int bottom = top + iconSize;
Tony Wickham1237df02017-02-24 08:59:36 -0800464 outBounds.set(left, top, right, bottom);
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800465 }
Joe Onorato9c1289c2009-08-17 11:03:03 -0400466
467 @Override
Winson1f064272016-07-18 17:18:02 -0700468 protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
469 if (mCenterVertically) {
470 Paint.FontMetrics fm = getPaint().getFontMetrics();
471 int cellHeightPx = mIconSize + getCompoundDrawablePadding() +
472 (int) Math.ceil(fm.bottom - fm.top);
473 int height = MeasureSpec.getSize(heightMeasureSpec);
474 setPadding(getPaddingLeft(), (height - cellHeightPx) / 2, getPaddingRight(),
475 getPaddingBottom());
476 }
477 super.onMeasure(widthMeasureSpec, heightMeasureSpec);
478 }
479
480 @Override
Adam Cohen477828c2013-09-20 12:05:49 -0700481 public void setTextColor(int color) {
482 mTextColor = color;
Sunny Goyaled7a6932018-04-13 11:41:50 -0700483 super.setTextColor(getModifiedColor());
Adam Cohen477828c2013-09-20 12:05:49 -0700484 }
485
Adam Cohen96bb7982014-07-07 11:58:56 -0700486 @Override
487 public void setTextColor(ColorStateList colors) {
488 mTextColor = colors.getDefaultColor();
Sunny Goyaled7a6932018-04-13 11:41:50 -0700489 if (Float.compare(mTextAlpha, 1) == 0) {
490 super.setTextColor(colors);
491 } else {
492 super.setTextColor(getModifiedColor());
493 }
Adam Cohen477828c2013-09-20 12:05:49 -0700494 }
495
Tony7308cde2017-06-27 22:38:33 -0700496 public boolean shouldTextBeVisible() {
497 // Text should be visible everywhere but the hotseat.
498 Object tag = getParent() instanceof FolderIcon ? ((View) getParent()).getTag() : getTag();
499 ItemInfo info = tag instanceof ItemInfo ? (ItemInfo) tag : null;
Samuel Fufaefb665d2019-10-30 13:24:14 -0700500 return info == null || (info.container != LauncherSettings.Favorites.CONTAINER_HOTSEAT
501 && info.container != LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION);
Tony7308cde2017-06-27 22:38:33 -0700502 }
503
Winson Chung5f8afe62013-08-12 16:19:28 -0700504 public void setTextVisibility(boolean visible) {
Sunny Goyaled7a6932018-04-13 11:41:50 -0700505 setTextAlpha(visible ? 1 : 0);
506 }
507
508 private void setTextAlpha(float alpha) {
509 mTextAlpha = alpha;
510 super.setTextColor(getModifiedColor());
511 }
512
513 private int getModifiedColor() {
514 if (mTextAlpha == 0) {
515 // Special case to prevent text shadows in high contrast mode
516 return Color.TRANSPARENT;
Winson Chung5f8afe62013-08-12 16:19:28 -0700517 }
Sunny Goyal066ace12018-11-05 11:08:31 -0800518 return setColorAlphaBound(mTextColor, Math.round(Color.alpha(mTextColor) * mTextAlpha));
Tony8f402802017-06-16 17:24:54 -0700519 }
520
521 /**
522 * Creates an animator to fade the text in or out.
523 * @param fadeIn Whether the text should fade in or fade out.
524 */
Sunny Goyal4e5a8782017-06-23 09:34:06 -0700525 public ObjectAnimator createTextAlphaAnimator(boolean fadeIn) {
Sunny Goyaled7a6932018-04-13 11:41:50 -0700526 float toAlpha = shouldTextBeVisible() && fadeIn ? 1 : 0;
Jon Miranda83cdca62019-04-15 13:01:05 -0700527 return ObjectAnimator.ofFloat(this, TEXT_ALPHA_PROPERTY, toAlpha);
Tony8f402802017-06-16 17:24:54 -0700528 }
529
Winson Chungaffd7b42010-08-20 15:11:56 -0700530 @Override
Winson Chung88f33452012-02-23 15:23:44 -0800531 public void cancelLongPress() {
532 super.cancelLongPress();
533
534 mLongPressHelper.cancelLongPress();
535 }
Chris Wrenaeff7ea2014-02-14 16:59:24 -0500536
Tony Wickham9a8d11f2017-01-11 09:53:12 -0800537 public void applyPromiseState(boolean promiseStateChanged) {
Sunny Goyal95899162019-03-27 16:03:06 -0700538 if (getTag() instanceof WorkspaceItemInfo) {
539 WorkspaceItemInfo info = (WorkspaceItemInfo) getTag();
Mario Bertschler8ff9e1d2017-08-08 16:26:18 -0700540 final boolean isPromise = info.hasPromiseIconUi();
Sunny Goyal34942622014-08-29 17:20:55 -0700541 final int progressLevel = isPromise ?
Sunny Goyal95899162019-03-27 16:03:06 -0700542 ((info.hasStatusFlag(WorkspaceItemInfo.FLAG_INSTALL_SESSION_ACTIVE) ?
Sunny Goyal34942622014-08-29 17:20:55 -0700543 info.getInstallProgress() : 0)) : 100;
Sunny Goyale755d462014-07-22 13:48:29 -0700544
Mario Bertschler08ffaae2017-03-20 11:30:27 -0700545 PreloadIconDrawable preloadDrawable = applyProgressLevel(progressLevel);
546 if (preloadDrawable != null && promiseStateChanged) {
547 preloadDrawable.maybePerformFinishedAnimation();
548 }
549 }
550 }
551
552 public PreloadIconDrawable applyProgressLevel(int progressLevel) {
553 if (getTag() instanceof ItemInfoWithIcon) {
554 ItemInfoWithIcon info = (ItemInfoWithIcon) getTag();
Mario Bertschler230612f2017-09-27 17:05:21 -0700555 if (progressLevel >= 100) {
556 setContentDescription(info.contentDescription != null
557 ? info.contentDescription : "");
558 } else if (progressLevel > 0) {
559 setContentDescription(getContext()
560 .getString(R.string.app_downloading_title, info.title,
561 NumberFormat.getPercentInstance().format(progressLevel * 0.01)));
562 } else {
563 setContentDescription(getContext()
564 .getString(R.string.app_waiting_download_title, info.title));
565 }
Winson Chungb745afb2015-03-02 11:51:23 -0800566 if (mIcon != null) {
Sunny Goyale755d462014-07-22 13:48:29 -0700567 final PreloadIconDrawable preloadDrawable;
Winson Chungb745afb2015-03-02 11:51:23 -0800568 if (mIcon instanceof PreloadIconDrawable) {
569 preloadDrawable = (PreloadIconDrawable) mIcon;
Mario Bertschler08ffaae2017-03-20 11:30:27 -0700570 preloadDrawable.setLevel(progressLevel);
Sunny Goyale755d462014-07-22 13:48:29 -0700571 } else {
Sunny Goyal14168432019-10-24 15:59:49 -0700572 preloadDrawable = newPendingIcon(getContext(), info);
Mario Bertschler08ffaae2017-03-20 11:30:27 -0700573 preloadDrawable.setLevel(progressLevel);
Tony Wickhambfbf7f92016-05-19 11:19:39 -0700574 setIcon(preloadDrawable);
Sunny Goyale755d462014-07-22 13:48:29 -0700575 }
Mario Bertschler08ffaae2017-03-20 11:30:27 -0700576 return preloadDrawable;
Sunny Goyale755d462014-07-22 13:48:29 -0700577 }
Chris Wren40c5ed32014-06-24 18:24:23 -0400578 }
Mario Bertschler08ffaae2017-03-20 11:30:27 -0700579 return null;
Chris Wren40c5ed32014-06-24 18:24:23 -0400580 }
Sunny Goyal95abbb32014-08-04 10:53:22 -0700581
Tony Wickhamf34bee82018-12-03 18:11:39 -0800582 public void applyDotState(ItemInfo itemInfo, boolean animate) {
Tony Wickham9a8d11f2017-01-11 09:53:12 -0800583 if (mIcon instanceof FastBitmapDrawable) {
Tony Wickhamf34bee82018-12-03 18:11:39 -0800584 boolean wasDotted = mDotInfo != null;
585 mDotInfo = mActivity.getDotInfoForItem(itemInfo);
586 boolean isDotted = mDotInfo != null;
587 float newDotScale = isDotted ? 1f : 0;
Samuel Fufac96fa242019-09-26 23:06:32 -0700588 if (mDisplay == DISPLAY_ALL_APPS) {
589 mDotRenderer = mActivity.getDeviceProfile().mDotRendererAllApps;
590 } else {
591 mDotRenderer = mActivity.getDeviceProfile().mDotRendererWorkSpace;
592 }
Tony Wickhamf34bee82018-12-03 18:11:39 -0800593 if (wasDotted || isDotted) {
594 // Animate when a dot is first added or when it is removed.
595 if (animate && (wasDotted ^ isDotted) && isShown()) {
596 animateDotScale(newDotScale);
Tony Wickham1237df02017-02-24 08:59:36 -0800597 } else {
Tony Wickhamf34bee82018-12-03 18:11:39 -0800598 cancelDotScaleAnim();
599 mDotParams.scale = newDotScale;
Tony Wickham1237df02017-02-24 08:59:36 -0800600 invalidate();
601 }
602 }
Tony Wickham305e9202018-01-23 17:46:47 -0800603 if (itemInfo.contentDescription != null) {
vadimtda6dad52019-05-21 13:24:23 -0700604 if (itemInfo.isDisabled()) {
605 setContentDescription(getContext().getString(R.string.disabled_app_label,
606 itemInfo.contentDescription));
607 } else if (hasDot()) {
Tony Wickhamf34bee82018-12-03 18:11:39 -0800608 int count = mDotInfo.getNotificationCount();
Tony Wickham305e9202018-01-23 17:46:47 -0800609 setContentDescription(getContext().getResources().getQuantityString(
Tony Wickhamf34bee82018-12-03 18:11:39 -0800610 R.plurals.dotted_app_label, count, itemInfo.contentDescription, count));
Tony Wickham305e9202018-01-23 17:46:47 -0800611 } else {
612 setContentDescription(itemInfo.contentDescription);
613 }
614 }
Tony Wickham9a8d11f2017-01-11 09:53:12 -0800615 }
616 }
617
Winson Chungb745afb2015-03-02 11:51:23 -0800618 /**
619 * Sets the icon for this view based on the layout direction.
620 */
Tony Wickham377ed3f2016-07-20 15:21:04 -0700621 private void setIcon(Drawable icon) {
Tony17b7f9b2017-05-23 12:19:09 -0700622 if (mIsIconVisible) {
Sunny Goyal66dccad2018-03-19 12:00:51 -0700623 applyCompoundDrawables(icon);
Tony17b7f9b2017-05-23 12:19:09 -0700624 }
Sunny Goyal66dccad2018-03-19 12:00:51 -0700625 mIcon = icon;
Hyunyoung Songa2373852019-01-04 12:01:32 -0800626 if (mIcon != null) {
627 mIcon.setVisible(getWindowVisibility() == VISIBLE && isShown(), false);
628 }
Tony17b7f9b2017-05-23 12:19:09 -0700629 }
630
Jon Miranda9b78e192019-08-30 18:42:01 -0700631 @Override
Tony17b7f9b2017-05-23 12:19:09 -0700632 public void setIconVisible(boolean visible) {
633 mIsIconVisible = visible;
Sunny Goyal66dccad2018-03-19 12:00:51 -0700634 Drawable icon = visible ? mIcon : new ColorDrawable(Color.TRANSPARENT);
Tony17b7f9b2017-05-23 12:19:09 -0700635 applyCompoundDrawables(icon);
Tony Wickham377ed3f2016-07-20 15:21:04 -0700636 }
637
638 protected void applyCompoundDrawables(Drawable icon) {
Sunny Goyal66dccad2018-03-19 12:00:51 -0700639 // If we had already set an icon before, disable relayout as the icon size is the
640 // same as before.
641 mDisableRelayout = mIcon != null;
642
643 icon.setBounds(0, 0, mIconSize, mIconSize);
Winson Chungb745afb2015-03-02 11:51:23 -0800644 if (mLayoutHorizontal) {
Sunny Goyala52ecb02016-12-16 15:04:51 -0800645 setCompoundDrawablesRelative(icon, null, null, null);
Winson Chungb745afb2015-03-02 11:51:23 -0800646 } else {
Tony Wickham377ed3f2016-07-20 15:21:04 -0700647 setCompoundDrawables(null, icon, null, null);
Winson Chungb745afb2015-03-02 11:51:23 -0800648 }
Sunny Goyal66dccad2018-03-19 12:00:51 -0700649 mDisableRelayout = false;
Winson Chungb745afb2015-03-02 11:51:23 -0800650 }
Sunny Goyal34b65272015-03-11 16:56:52 -0700651
Sunny Goyal69b75642015-05-15 17:00:24 -0700652 @Override
653 public void requestLayout() {
654 if (!mDisableRelayout) {
655 super.requestLayout();
656 }
657 }
658
Sunny Goyal34b65272015-03-11 16:56:52 -0700659 /**
660 * Applies the item info if it is same as what the view is pointing to currently.
661 */
Sunny Goyal2d7cca12017-01-03 16:52:43 -0800662 @Override
663 public void reapplyItemInfo(ItemInfoWithIcon info) {
Sunny Goyal34b65272015-03-11 16:56:52 -0700664 if (getTag() == info) {
665 mIconLoadRequest = null;
Sunny Goyal69b75642015-05-15 17:00:24 -0700666 mDisableRelayout = true;
Winsonc0880492015-08-21 11:16:27 -0700667
Jon Miranda7f522a22017-07-28 11:56:47 -0700668 // Optimization: Starting in N, pre-uploads the bitmap to RenderThread.
Sunny Goyal3808a692019-10-25 13:41:28 -0700669 info.bitmap.icon.prepareToDraw();
Jon Miranda7f522a22017-07-28 11:56:47 -0700670
Sunny Goyal34b65272015-03-11 16:56:52 -0700671 if (info instanceof AppInfo) {
672 applyFromApplicationInfo((AppInfo) info);
Sunny Goyal95899162019-03-27 16:03:06 -0700673 } else if (info instanceof WorkspaceItemInfo) {
674 applyFromWorkspaceItem((WorkspaceItemInfo) info);
Sunny Goyal0b0847b2018-03-14 12:30:11 -0700675 mActivity.invalidateParent(info);
Sunny Goyal0e08f162015-05-12 11:32:39 -0700676 } else if (info instanceof PackageItemInfo) {
677 applyFromPackageItemInfo((PackageItemInfo) info);
Sunny Goyal34b65272015-03-11 16:56:52 -0700678 }
Winsonc0880492015-08-21 11:16:27 -0700679
Sunny Goyal69b75642015-05-15 17:00:24 -0700680 mDisableRelayout = false;
Sunny Goyal34b65272015-03-11 16:56:52 -0700681 }
682 }
683
684 /**
685 * Verifies that the current icon is high-res otherwise posts a request to load the icon.
686 */
687 public void verifyHighRes() {
688 if (mIconLoadRequest != null) {
689 mIconLoadRequest.cancel();
690 mIconLoadRequest = null;
691 }
Sunny Goyal2d7cca12017-01-03 16:52:43 -0800692 if (getTag() instanceof ItemInfoWithIcon) {
693 ItemInfoWithIcon info = (ItemInfoWithIcon) getTag();
Sunny Goyal2b787e52018-08-20 15:01:03 -0700694 if (info.usingLowResIcon()) {
Sunny Goyal87f784c2017-01-11 10:48:34 -0800695 mIconLoadRequest = LauncherAppState.getInstance(getContext()).getIconCache()
Sunny Goyal0e08f162015-05-12 11:32:39 -0700696 .updateIconInBackground(BubbleTextView.this, info);
697 }
Sunny Goyal34b65272015-03-11 16:56:52 -0700698 }
699 }
Sunny Goyal4b6eb262015-05-14 19:24:40 -0700700
Jon Miranda47170112017-03-03 14:57:14 -0800701 public int getIconSize() {
702 return mIconSize;
703 }
The Android Open Source Project31dd5032009-03-03 19:32:27 -0800704}