The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 1 | /* |
| 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 | |
Joe Onorato | a590252 | 2009-07-30 13:37:37 -0700 | [diff] [blame] | 17 | package com.android.launcher2; |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 18 | |
Adam Cohen | 2801caf | 2011-05-13 20:57:39 -0700 | [diff] [blame] | 19 | import android.animation.Animator; |
| 20 | import android.animation.AnimatorListenerAdapter; |
Adam Cohen | 2801caf | 2011-05-13 20:57:39 -0700 | [diff] [blame] | 21 | import android.animation.ValueAnimator; |
| 22 | import android.animation.ValueAnimator.AnimatorUpdateListener; |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 23 | import android.content.Context; |
| 24 | import android.content.res.Resources; |
Adam Cohen | a9cf38f | 2011-05-02 15:36:58 -0700 | [diff] [blame] | 25 | import android.graphics.Canvas; |
Adam Cohen | f4b0891 | 2011-05-17 18:45:47 -0700 | [diff] [blame] | 26 | import android.graphics.Color; |
Adam Cohen | ac8c876 | 2011-07-13 11:15:27 -0700 | [diff] [blame] | 27 | import android.graphics.Paint; |
Adam Cohen | badf71e | 2011-05-26 19:08:29 -0700 | [diff] [blame] | 28 | import android.graphics.PorterDuff; |
Adam Cohen | 3e8f811 | 2011-07-02 18:03:00 -0700 | [diff] [blame] | 29 | import android.graphics.Rect; |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 30 | import android.graphics.drawable.Drawable; |
| 31 | import android.util.AttributeSet; |
| 32 | import android.view.LayoutInflater; |
Adam Cohen | 7c69321 | 2011-05-18 15:26:57 -0700 | [diff] [blame] | 33 | import android.view.View; |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 34 | import android.view.ViewGroup; |
Adam Cohen | 3e8f811 | 2011-07-02 18:03:00 -0700 | [diff] [blame] | 35 | import android.view.animation.AccelerateInterpolator; |
| 36 | import android.view.animation.DecelerateInterpolator; |
Adam Cohen | 76fc085 | 2011-06-17 13:26:23 -0700 | [diff] [blame] | 37 | import android.widget.ImageView; |
| 38 | import android.widget.LinearLayout; |
Adam Cohen | a9cf38f | 2011-05-02 15:36:58 -0700 | [diff] [blame] | 39 | import android.widget.TextView; |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 40 | |
Romain Guy | edcce09 | 2010-03-04 13:03:17 -0800 | [diff] [blame] | 41 | import com.android.launcher.R; |
Adam Cohen | c0dcf59 | 2011-06-01 15:30:43 -0700 | [diff] [blame] | 42 | import com.android.launcher2.DropTarget.DragObject; |
Adam Cohen | a9cf38f | 2011-05-02 15:36:58 -0700 | [diff] [blame] | 43 | import com.android.launcher2.FolderInfo.FolderListener; |
Romain Guy | edcce09 | 2010-03-04 13:03:17 -0800 | [diff] [blame] | 44 | |
Adam Cohen | c0dcf59 | 2011-06-01 15:30:43 -0700 | [diff] [blame] | 45 | import java.util.ArrayList; |
| 46 | |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 47 | /** |
| 48 | * An icon that can appear on in the workspace representing an {@link UserFolder}. |
| 49 | */ |
Adam Cohen | 76fc085 | 2011-06-17 13:26:23 -0700 | [diff] [blame] | 50 | public class FolderIcon extends LinearLayout implements FolderListener { |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 51 | private Launcher mLauncher; |
Adam Cohen | a9cf38f | 2011-05-02 15:36:58 -0700 | [diff] [blame] | 52 | Folder mFolder; |
| 53 | FolderInfo mInfo; |
| 54 | |
Adam Cohen | badf71e | 2011-05-26 19:08:29 -0700 | [diff] [blame] | 55 | // The number of icons to display in the |
Adam Cohen | 76fc085 | 2011-06-17 13:26:23 -0700 | [diff] [blame] | 56 | private static final int NUM_ITEMS_IN_PREVIEW = 3; |
Adam Cohen | f4b0891 | 2011-05-17 18:45:47 -0700 | [diff] [blame] | 57 | private static final int CONSUMPTION_ANIMATION_DURATION = 100; |
Adam Cohen | d044526 | 2011-07-04 23:53:22 -0700 | [diff] [blame] | 58 | private static final int DROP_IN_ANIMATION_DURATION = 400; |
Adam Cohen | 8dfcba4 | 2011-07-07 16:38:18 -0700 | [diff] [blame] | 59 | private static final int INITIAL_ITEM_ANIMATION_DURATION = 350; |
Adam Cohen | badf71e | 2011-05-26 19:08:29 -0700 | [diff] [blame] | 60 | |
| 61 | // The degree to which the inner ring grows when accepting drop |
Adam Cohen | 69ce2e5 | 2011-07-03 19:25:21 -0700 | [diff] [blame] | 62 | private static final float INNER_RING_GROWTH_FACTOR = 0.15f; |
Adam Cohen | badf71e | 2011-05-26 19:08:29 -0700 | [diff] [blame] | 63 | |
Adam Cohen | badf71e | 2011-05-26 19:08:29 -0700 | [diff] [blame] | 64 | // The degree to which the outer ring is scaled in its natural state |
Adam Cohen | 69ce2e5 | 2011-07-03 19:25:21 -0700 | [diff] [blame] | 65 | private static final float OUTER_RING_GROWTH_FACTOR = 0.3f; |
Adam Cohen | badf71e | 2011-05-26 19:08:29 -0700 | [diff] [blame] | 66 | |
| 67 | // The amount of vertical spread between items in the stack [0...1] |
Adam Cohen | 76fc085 | 2011-06-17 13:26:23 -0700 | [diff] [blame] | 68 | private static final float PERSPECTIVE_SHIFT_FACTOR = 0.24f; |
Adam Cohen | badf71e | 2011-05-26 19:08:29 -0700 | [diff] [blame] | 69 | |
| 70 | // The degree to which the item in the back of the stack is scaled [0...1] |
| 71 | // (0 means it's not scaled at all, 1 means it's scaled to nothing) |
Adam Cohen | 76fc085 | 2011-06-17 13:26:23 -0700 | [diff] [blame] | 72 | private static final float PERSPECTIVE_SCALE_FACTOR = 0.35f; |
Adam Cohen | badf71e | 2011-05-26 19:08:29 -0700 | [diff] [blame] | 73 | |
Adam Cohen | c51934b | 2011-07-26 21:07:43 -0700 | [diff] [blame] | 74 | public static Drawable sSharedFolderLeaveBehind = null; |
| 75 | |
Adam Cohen | 76fc085 | 2011-06-17 13:26:23 -0700 | [diff] [blame] | 76 | private ImageView mPreviewBackground; |
| 77 | private BubbleTextView mFolderName; |
Adam Cohen | 073a46f | 2011-05-17 16:28:09 -0700 | [diff] [blame] | 78 | |
Adam Cohen | 19072da | 2011-05-31 14:30:45 -0700 | [diff] [blame] | 79 | FolderRingAnimator mFolderRingAnimator = null; |
Adam Cohen | 2801caf | 2011-05-13 20:57:39 -0700 | [diff] [blame] | 80 | |
Adam Cohen | d044526 | 2011-07-04 23:53:22 -0700 | [diff] [blame] | 81 | // These variables are all associated with the drawing of the preview; they are stored |
| 82 | // as member variables for shared usage and to avoid computation on each frame |
| 83 | private int mIntrinsicIconSize; |
| 84 | private float mBaselineIconScale; |
| 85 | private int mBaselineIconSize; |
| 86 | private int mAvailableSpaceInPreview; |
| 87 | private int mTotalWidth = -1; |
| 88 | private int mPreviewOffsetX; |
| 89 | private int mPreviewOffsetY; |
| 90 | private float mMaxPerspectiveShift; |
| 91 | boolean mAnimating = false; |
| 92 | private PreviewItemDrawingParams mParams = new PreviewItemDrawingParams(0, 0, 0, 0); |
| 93 | private PreviewItemDrawingParams mAnimParams = new PreviewItemDrawingParams(0, 0, 0, 0); |
| 94 | |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 95 | public FolderIcon(Context context, AttributeSet attrs) { |
| 96 | super(context, attrs); |
| 97 | } |
| 98 | |
| 99 | public FolderIcon(Context context) { |
| 100 | super(context); |
| 101 | } |
| 102 | |
Michael Jurka | 0280c3b | 2010-09-17 15:00:07 -0700 | [diff] [blame] | 103 | public boolean isDropEnabled() { |
Winson Chung | 7a1d165 | 2011-03-18 15:56:01 -0700 | [diff] [blame] | 104 | final ViewGroup cellLayoutChildren = (ViewGroup) getParent(); |
| 105 | final ViewGroup cellLayout = (ViewGroup) cellLayoutChildren.getParent(); |
| 106 | final Workspace workspace = (Workspace) cellLayout.getParent(); |
| 107 | return !workspace.isSmall(); |
Michael Jurka | 0280c3b | 2010-09-17 15:00:07 -0700 | [diff] [blame] | 108 | } |
| 109 | |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 110 | static FolderIcon fromXml(int resId, Launcher launcher, ViewGroup group, |
Adam Cohen | df2cc41 | 2011-04-27 16:56:57 -0700 | [diff] [blame] | 111 | FolderInfo folderInfo, IconCache iconCache) { |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 112 | |
Adam Cohen | d044526 | 2011-07-04 23:53:22 -0700 | [diff] [blame] | 113 | if (INITIAL_ITEM_ANIMATION_DURATION >= DROP_IN_ANIMATION_DURATION) { |
| 114 | throw new IllegalStateException("DROP_IN_ANIMATION_DURATION must be greater than " + |
| 115 | "INITIAL_ITEM_ANIMATION_DURATION, as sequencing of adding first two items " + |
| 116 | "is dependent on this"); |
| 117 | } |
| 118 | |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 119 | FolderIcon icon = (FolderIcon) LayoutInflater.from(launcher).inflate(resId, group, false); |
| 120 | |
Adam Cohen | d2eca6b | 2011-07-26 22:49:13 -0700 | [diff] [blame] | 121 | icon.mFolderName = (BubbleTextView) icon.findViewById(R.id.folder_icon_name); |
Adam Cohen | 76fc085 | 2011-06-17 13:26:23 -0700 | [diff] [blame] | 122 | icon.mFolderName.setText(folderInfo.title); |
| 123 | icon.mPreviewBackground = (ImageView) icon.findViewById(R.id.preview_background); |
Winson Chung | 6a0f57d | 2011-06-29 20:10:49 -0700 | [diff] [blame] | 124 | icon.mPreviewBackground.setContentDescription(folderInfo.title); |
Adam Cohen | 76fc085 | 2011-06-17 13:26:23 -0700 | [diff] [blame] | 125 | |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 126 | icon.setTag(folderInfo); |
| 127 | icon.setOnClickListener(launcher); |
| 128 | icon.mInfo = folderInfo; |
| 129 | icon.mLauncher = launcher; |
Adam Cohen | a9cf38f | 2011-05-02 15:36:58 -0700 | [diff] [blame] | 130 | |
| 131 | Folder folder = Folder.fromXml(launcher); |
| 132 | folder.setDragController(launcher.getDragController()); |
Adam Cohen | 2801caf | 2011-05-13 20:57:39 -0700 | [diff] [blame] | 133 | folder.setFolderIcon(icon); |
Adam Cohen | a9cf38f | 2011-05-02 15:36:58 -0700 | [diff] [blame] | 134 | folder.bind(folderInfo); |
| 135 | icon.mFolder = folder; |
Adam Cohen | 19072da | 2011-05-31 14:30:45 -0700 | [diff] [blame] | 136 | icon.mFolderRingAnimator = new FolderRingAnimator(launcher, icon); |
Adam Cohen | 69ce2e5 | 2011-07-03 19:25:21 -0700 | [diff] [blame] | 137 | |
Adam Cohen | a9cf38f | 2011-05-02 15:36:58 -0700 | [diff] [blame] | 138 | folderInfo.addListener(icon); |
Adam Cohen | 19072da | 2011-05-31 14:30:45 -0700 | [diff] [blame] | 139 | |
Adam Cohen | c51934b | 2011-07-26 21:07:43 -0700 | [diff] [blame] | 140 | Resources res = launcher.getResources(); |
| 141 | if (sSharedFolderLeaveBehind == null) { |
| 142 | sSharedFolderLeaveBehind = res.getDrawable(R.drawable.portal_ring_rest); |
| 143 | } |
| 144 | |
Adam Cohen | 19072da | 2011-05-31 14:30:45 -0700 | [diff] [blame] | 145 | return icon; |
| 146 | } |
| 147 | |
| 148 | public static class FolderRingAnimator { |
Adam Cohen | 69ce2e5 | 2011-07-03 19:25:21 -0700 | [diff] [blame] | 149 | public int mCellX; |
| 150 | public int mCellY; |
| 151 | private CellLayout mCellLayout; |
Adam Cohen | 76fc085 | 2011-06-17 13:26:23 -0700 | [diff] [blame] | 152 | public float mOuterRingSize; |
| 153 | public float mInnerRingSize; |
Adam Cohen | 19072da | 2011-05-31 14:30:45 -0700 | [diff] [blame] | 154 | public FolderIcon mFolderIcon = null; |
Adam Cohen | c0dcf59 | 2011-06-01 15:30:43 -0700 | [diff] [blame] | 155 | public Drawable mOuterRingDrawable = null; |
| 156 | public Drawable mInnerRingDrawable = null; |
| 157 | public static Drawable sSharedOuterRingDrawable = null; |
| 158 | public static Drawable sSharedInnerRingDrawable = null; |
Adam Cohen | 76fc085 | 2011-06-17 13:26:23 -0700 | [diff] [blame] | 159 | public static int sPreviewSize = -1; |
| 160 | public static int sPreviewPadding = -1; |
| 161 | |
Adam Cohen | c0dcf59 | 2011-06-01 15:30:43 -0700 | [diff] [blame] | 162 | private ValueAnimator mAcceptAnimator; |
| 163 | private ValueAnimator mNeutralAnimator; |
Adam Cohen | 19072da | 2011-05-31 14:30:45 -0700 | [diff] [blame] | 164 | |
| 165 | public FolderRingAnimator(Launcher launcher, FolderIcon folderIcon) { |
Adam Cohen | 19072da | 2011-05-31 14:30:45 -0700 | [diff] [blame] | 166 | mFolderIcon = folderIcon; |
Adam Cohen | 76fc085 | 2011-06-17 13:26:23 -0700 | [diff] [blame] | 167 | Resources res = launcher.getResources(); |
| 168 | mOuterRingDrawable = res.getDrawable(R.drawable.portal_ring_outer_holo); |
| 169 | mInnerRingDrawable = res.getDrawable(R.drawable.portal_ring_inner_holo); |
| 170 | |
| 171 | if (sPreviewSize < 0 || sPreviewPadding < 0) { |
| 172 | sPreviewSize = res.getDimensionPixelSize(R.dimen.folder_preview_size); |
| 173 | sPreviewPadding = res.getDimensionPixelSize(R.dimen.folder_preview_padding); |
| 174 | } |
Adam Cohen | c0dcf59 | 2011-06-01 15:30:43 -0700 | [diff] [blame] | 175 | if (sSharedOuterRingDrawable == null) { |
Adam Cohen | 76fc085 | 2011-06-17 13:26:23 -0700 | [diff] [blame] | 176 | sSharedOuterRingDrawable = res.getDrawable(R.drawable.portal_ring_outer_holo); |
Adam Cohen | 19072da | 2011-05-31 14:30:45 -0700 | [diff] [blame] | 177 | } |
Adam Cohen | c0dcf59 | 2011-06-01 15:30:43 -0700 | [diff] [blame] | 178 | if (sSharedInnerRingDrawable == null) { |
Adam Cohen | 76fc085 | 2011-06-17 13:26:23 -0700 | [diff] [blame] | 179 | sSharedInnerRingDrawable = res.getDrawable(R.drawable.portal_ring_inner_holo); |
Adam Cohen | 19072da | 2011-05-31 14:30:45 -0700 | [diff] [blame] | 180 | } |
Adam Cohen | 073a46f | 2011-05-17 16:28:09 -0700 | [diff] [blame] | 181 | } |
Adam Cohen | a9cf38f | 2011-05-02 15:36:58 -0700 | [diff] [blame] | 182 | |
Adam Cohen | 19072da | 2011-05-31 14:30:45 -0700 | [diff] [blame] | 183 | public void animateToAcceptState() { |
Adam Cohen | c0dcf59 | 2011-06-01 15:30:43 -0700 | [diff] [blame] | 184 | if (mNeutralAnimator != null) { |
| 185 | mNeutralAnimator.cancel(); |
| 186 | } |
| 187 | mAcceptAnimator = ValueAnimator.ofFloat(0f, 1f); |
| 188 | mAcceptAnimator.setDuration(CONSUMPTION_ANIMATION_DURATION); |
| 189 | mAcceptAnimator.addUpdateListener(new AnimatorUpdateListener() { |
Adam Cohen | 19072da | 2011-05-31 14:30:45 -0700 | [diff] [blame] | 190 | public void onAnimationUpdate(ValueAnimator animation) { |
| 191 | final float percent = (Float) animation.getAnimatedValue(); |
Adam Cohen | 76fc085 | 2011-06-17 13:26:23 -0700 | [diff] [blame] | 192 | mOuterRingSize = (1 + percent * OUTER_RING_GROWTH_FACTOR) * sPreviewSize; |
| 193 | mInnerRingSize = (1 + percent * INNER_RING_GROWTH_FACTOR) * sPreviewSize; |
Adam Cohen | 69ce2e5 | 2011-07-03 19:25:21 -0700 | [diff] [blame] | 194 | if (mCellLayout != null) { |
| 195 | mCellLayout.invalidate(); |
Adam Cohen | 19072da | 2011-05-31 14:30:45 -0700 | [diff] [blame] | 196 | } |
| 197 | } |
| 198 | }); |
Adam Cohen | c0dcf59 | 2011-06-01 15:30:43 -0700 | [diff] [blame] | 199 | mAcceptAnimator.addListener(new AnimatorListenerAdapter() { |
Adam Cohen | 19072da | 2011-05-31 14:30:45 -0700 | [diff] [blame] | 200 | @Override |
Adam Cohen | c0dcf59 | 2011-06-01 15:30:43 -0700 | [diff] [blame] | 201 | public void onAnimationStart(Animator animation) { |
Adam Cohen | 19072da | 2011-05-31 14:30:45 -0700 | [diff] [blame] | 202 | if (mFolderIcon != null) { |
Adam Cohen | 76fc085 | 2011-06-17 13:26:23 -0700 | [diff] [blame] | 203 | mFolderIcon.mPreviewBackground.setVisibility(INVISIBLE); |
Adam Cohen | 19072da | 2011-05-31 14:30:45 -0700 | [diff] [blame] | 204 | } |
| 205 | } |
| 206 | }); |
Adam Cohen | c0dcf59 | 2011-06-01 15:30:43 -0700 | [diff] [blame] | 207 | mAcceptAnimator.start(); |
Adam Cohen | 19072da | 2011-05-31 14:30:45 -0700 | [diff] [blame] | 208 | } |
| 209 | |
| 210 | public void animateToNaturalState() { |
Adam Cohen | c0dcf59 | 2011-06-01 15:30:43 -0700 | [diff] [blame] | 211 | if (mAcceptAnimator != null) { |
| 212 | mAcceptAnimator.cancel(); |
| 213 | } |
| 214 | mNeutralAnimator = ValueAnimator.ofFloat(0f, 1f); |
| 215 | mNeutralAnimator.setDuration(CONSUMPTION_ANIMATION_DURATION); |
| 216 | mNeutralAnimator.addUpdateListener(new AnimatorUpdateListener() { |
Adam Cohen | 19072da | 2011-05-31 14:30:45 -0700 | [diff] [blame] | 217 | public void onAnimationUpdate(ValueAnimator animation) { |
| 218 | final float percent = (Float) animation.getAnimatedValue(); |
Adam Cohen | 76fc085 | 2011-06-17 13:26:23 -0700 | [diff] [blame] | 219 | mOuterRingSize = (1 + (1 - percent) * OUTER_RING_GROWTH_FACTOR) * sPreviewSize; |
| 220 | mInnerRingSize = (1 + (1 - percent) * INNER_RING_GROWTH_FACTOR) * sPreviewSize; |
Adam Cohen | 69ce2e5 | 2011-07-03 19:25:21 -0700 | [diff] [blame] | 221 | if (mCellLayout != null) { |
| 222 | mCellLayout.invalidate(); |
Adam Cohen | 19072da | 2011-05-31 14:30:45 -0700 | [diff] [blame] | 223 | } |
| 224 | } |
| 225 | }); |
Adam Cohen | c0dcf59 | 2011-06-01 15:30:43 -0700 | [diff] [blame] | 226 | mNeutralAnimator.addListener(new AnimatorListenerAdapter() { |
Adam Cohen | 19072da | 2011-05-31 14:30:45 -0700 | [diff] [blame] | 227 | @Override |
| 228 | public void onAnimationEnd(Animator animation) { |
Adam Cohen | 69ce2e5 | 2011-07-03 19:25:21 -0700 | [diff] [blame] | 229 | if (mCellLayout != null) { |
| 230 | mCellLayout.hideFolderAccept(FolderRingAnimator.this); |
| 231 | } |
Adam Cohen | 19072da | 2011-05-31 14:30:45 -0700 | [diff] [blame] | 232 | if (mFolderIcon != null) { |
Adam Cohen | 76fc085 | 2011-06-17 13:26:23 -0700 | [diff] [blame] | 233 | mFolderIcon.mPreviewBackground.setVisibility(VISIBLE); |
Adam Cohen | 19072da | 2011-05-31 14:30:45 -0700 | [diff] [blame] | 234 | } |
Adam Cohen | 19072da | 2011-05-31 14:30:45 -0700 | [diff] [blame] | 235 | } |
| 236 | }); |
Adam Cohen | c0dcf59 | 2011-06-01 15:30:43 -0700 | [diff] [blame] | 237 | mNeutralAnimator.start(); |
Adam Cohen | 19072da | 2011-05-31 14:30:45 -0700 | [diff] [blame] | 238 | } |
| 239 | |
Adam Cohen | c0dcf59 | 2011-06-01 15:30:43 -0700 | [diff] [blame] | 240 | // Location is expressed in window coordinates |
Adam Cohen | 69ce2e5 | 2011-07-03 19:25:21 -0700 | [diff] [blame] | 241 | public void getCell(int[] loc) { |
| 242 | loc[0] = mCellX; |
| 243 | loc[1] = mCellY; |
| 244 | } |
| 245 | |
| 246 | // Location is expressed in window coordinates |
| 247 | public void setCell(int x, int y) { |
| 248 | mCellX = x; |
| 249 | mCellY = y; |
| 250 | } |
| 251 | |
| 252 | public void setCellLayout(CellLayout layout) { |
| 253 | mCellLayout = layout; |
Adam Cohen | 19072da | 2011-05-31 14:30:45 -0700 | [diff] [blame] | 254 | } |
| 255 | |
Adam Cohen | 76fc085 | 2011-06-17 13:26:23 -0700 | [diff] [blame] | 256 | public float getOuterRingSize() { |
| 257 | return mOuterRingSize; |
Adam Cohen | 19072da | 2011-05-31 14:30:45 -0700 | [diff] [blame] | 258 | } |
| 259 | |
Adam Cohen | 76fc085 | 2011-06-17 13:26:23 -0700 | [diff] [blame] | 260 | public float getInnerRingSize() { |
| 261 | return mInnerRingSize; |
Adam Cohen | 19072da | 2011-05-31 14:30:45 -0700 | [diff] [blame] | 262 | } |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 263 | } |
| 264 | |
Adam Cohen | 073a46f | 2011-05-17 16:28:09 -0700 | [diff] [blame] | 265 | private boolean willAcceptItem(ItemInfo item) { |
| 266 | final int itemType = item.itemType; |
| 267 | return ((itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION || |
| 268 | itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT) && |
Adam Cohen | c51934b | 2011-07-26 21:07:43 -0700 | [diff] [blame] | 269 | !mFolder.isFull() && item != mInfo && !mInfo.opened); |
Adam Cohen | 073a46f | 2011-05-17 16:28:09 -0700 | [diff] [blame] | 270 | } |
| 271 | |
Adam Cohen | c0dcf59 | 2011-06-01 15:30:43 -0700 | [diff] [blame] | 272 | public boolean acceptDrop(Object dragInfo) { |
| 273 | final ItemInfo item = (ItemInfo) dragInfo; |
Adam Cohen | 073a46f | 2011-05-17 16:28:09 -0700 | [diff] [blame] | 274 | return willAcceptItem(item); |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 275 | } |
| 276 | |
Adam Cohen | df03538 | 2011-04-11 17:22:04 -0700 | [diff] [blame] | 277 | public void addItem(ShortcutInfo item) { |
| 278 | mInfo.add(item); |
Adam Cohen | a9cf38f | 2011-05-02 15:36:58 -0700 | [diff] [blame] | 279 | LauncherModel.addOrMoveItemInDatabase(mLauncher, item, mInfo.id, 0, item.cellX, item.cellY); |
Adam Cohen | df03538 | 2011-04-11 17:22:04 -0700 | [diff] [blame] | 280 | } |
| 281 | |
Adam Cohen | c0dcf59 | 2011-06-01 15:30:43 -0700 | [diff] [blame] | 282 | public void onDragEnter(Object dragInfo) { |
| 283 | if (!willAcceptItem((ItemInfo) dragInfo)) return; |
Adam Cohen | 69ce2e5 | 2011-07-03 19:25:21 -0700 | [diff] [blame] | 284 | CellLayout.LayoutParams lp = (CellLayout.LayoutParams) getLayoutParams(); |
| 285 | CellLayout layout = (CellLayout) getParent().getParent(); |
| 286 | mFolderRingAnimator.setCell(lp.cellX, lp.cellY); |
| 287 | mFolderRingAnimator.setCellLayout(layout); |
Adam Cohen | 19072da | 2011-05-31 14:30:45 -0700 | [diff] [blame] | 288 | mFolderRingAnimator.animateToAcceptState(); |
Adam Cohen | 69ce2e5 | 2011-07-03 19:25:21 -0700 | [diff] [blame] | 289 | layout.showFolderAccept(mFolderRingAnimator); |
Adam Cohen | 073a46f | 2011-05-17 16:28:09 -0700 | [diff] [blame] | 290 | } |
| 291 | |
Adam Cohen | c0dcf59 | 2011-06-01 15:30:43 -0700 | [diff] [blame] | 292 | public void onDragOver(Object dragInfo) { |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 293 | } |
| 294 | |
Adam Cohen | d044526 | 2011-07-04 23:53:22 -0700 | [diff] [blame] | 295 | public void performCreateAnimation(final ShortcutInfo destInfo, final View destView, |
Winson Chung | 557d6ed | 2011-07-08 15:34:52 -0700 | [diff] [blame] | 296 | final ShortcutInfo srcInfo, final View srcView, Rect dstRect, |
Adam Cohen | ac8c876 | 2011-07-13 11:15:27 -0700 | [diff] [blame] | 297 | float scaleRelativeToDragLayer, Runnable postAnimationRunnable) { |
Adam Cohen | d044526 | 2011-07-04 23:53:22 -0700 | [diff] [blame] | 298 | |
| 299 | Drawable animateDrawable = ((TextView) destView).getCompoundDrawables()[1]; |
| 300 | computePreviewDrawingParams(animateDrawable.getIntrinsicWidth(), destView.getMeasuredWidth()); |
Adam Cohen | ac8c876 | 2011-07-13 11:15:27 -0700 | [diff] [blame] | 301 | |
Adam Cohen | d044526 | 2011-07-04 23:53:22 -0700 | [diff] [blame] | 302 | // This will animate the dragView (srcView) into the new folder |
Adam Cohen | ac8c876 | 2011-07-13 11:15:27 -0700 | [diff] [blame] | 303 | onDrop(srcInfo, srcView, dstRect, scaleRelativeToDragLayer, 1, postAnimationRunnable); |
Adam Cohen | d044526 | 2011-07-04 23:53:22 -0700 | [diff] [blame] | 304 | |
| 305 | // This will animate the first item from it's position as an icon into its |
| 306 | // position as the first item in the preview |
Adam Cohen | 8dfcba4 | 2011-07-07 16:38:18 -0700 | [diff] [blame] | 307 | animateFirstItem(animateDrawable, INITIAL_ITEM_ANIMATION_DURATION); |
Adam Cohen | d044526 | 2011-07-04 23:53:22 -0700 | [diff] [blame] | 308 | |
| 309 | postDelayed(new Runnable() { |
| 310 | public void run() { |
| 311 | addItem(destInfo); |
| 312 | } |
| 313 | }, INITIAL_ITEM_ANIMATION_DURATION); |
| 314 | } |
| 315 | |
Adam Cohen | c0dcf59 | 2011-06-01 15:30:43 -0700 | [diff] [blame] | 316 | public void onDragExit(Object dragInfo) { |
| 317 | if (!willAcceptItem((ItemInfo) dragInfo)) return; |
Adam Cohen | 19072da | 2011-05-31 14:30:45 -0700 | [diff] [blame] | 318 | mFolderRingAnimator.animateToNaturalState(); |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 319 | } |
Patrick Dubroy | 440c360 | 2010-07-13 17:50:32 -0700 | [diff] [blame] | 320 | |
Adam Cohen | ac8c876 | 2011-07-13 11:15:27 -0700 | [diff] [blame] | 321 | private void onDrop(final ShortcutInfo item, View animateView, Rect finalRect, |
| 322 | float scaleRelativeToDragLayer, int index, Runnable postAnimationRunnable) { |
Adam Cohen | d044526 | 2011-07-04 23:53:22 -0700 | [diff] [blame] | 323 | item.cellX = -1; |
| 324 | item.cellY = -1; |
| 325 | DragLayer dragLayer = mLauncher.getDragLayer(); |
| 326 | Rect from = new Rect(); |
| 327 | dragLayer.getViewRectRelativeToSelf(animateView, from); |
| 328 | Rect to = finalRect; |
| 329 | if (to == null) { |
| 330 | to = new Rect(); |
Adam Cohen | 4b285c5 | 2011-07-21 14:24:06 -0700 | [diff] [blame] | 331 | Workspace workspace = mLauncher.getWorkspace(); |
| 332 | workspace.setFinalTransitionTransform((CellLayout) getParent().getParent()); |
Adam Cohen | ac8c876 | 2011-07-13 11:15:27 -0700 | [diff] [blame] | 333 | scaleRelativeToDragLayer = dragLayer.getDescendantRectRelativeToSelf(this, to); |
Adam Cohen | 4b285c5 | 2011-07-21 14:24:06 -0700 | [diff] [blame] | 334 | workspace.resetTransitionTransform((CellLayout) getParent().getParent()); |
Adam Cohen | d044526 | 2011-07-04 23:53:22 -0700 | [diff] [blame] | 335 | } |
| 336 | |
Adam Cohen | ac8c876 | 2011-07-13 11:15:27 -0700 | [diff] [blame] | 337 | int[] center = new int[2]; |
| 338 | float scale = getLocalCenterForIndex(index, center); |
| 339 | center[0] = (int) Math.round(scaleRelativeToDragLayer * center[0]); |
| 340 | center[1] = (int) Math.round(scaleRelativeToDragLayer * center[1]); |
| 341 | |
| 342 | to.offset(center[0] - animateView.getMeasuredWidth() / 2, |
| 343 | center[1] - animateView.getMeasuredHeight() / 2); |
Adam Cohen | d044526 | 2011-07-04 23:53:22 -0700 | [diff] [blame] | 344 | |
| 345 | float finalAlpha = index < NUM_ITEMS_IN_PREVIEW ? 0.5f : 0f; |
| 346 | |
Adam Cohen | ac8c876 | 2011-07-13 11:15:27 -0700 | [diff] [blame] | 347 | dragLayer.animateView(animateView, from, to, finalAlpha, scale * scaleRelativeToDragLayer, |
| 348 | DROP_IN_ANIMATION_DURATION, new DecelerateInterpolator(2), |
| 349 | new AccelerateInterpolator(2), postAnimationRunnable, false); |
Adam Cohen | d044526 | 2011-07-04 23:53:22 -0700 | [diff] [blame] | 350 | postDelayed(new Runnable() { |
| 351 | public void run() { |
| 352 | addItem(item); |
| 353 | } |
| 354 | }, DROP_IN_ANIMATION_DURATION); |
| 355 | } |
| 356 | |
Adam Cohen | 3e8f811 | 2011-07-02 18:03:00 -0700 | [diff] [blame] | 357 | public void onDrop(DragObject d) { |
Adam Cohen | c0dcf59 | 2011-06-01 15:30:43 -0700 | [diff] [blame] | 358 | ShortcutInfo item; |
Adam Cohen | 3e8f811 | 2011-07-02 18:03:00 -0700 | [diff] [blame] | 359 | if (d.dragInfo instanceof ApplicationInfo) { |
Adam Cohen | c0dcf59 | 2011-06-01 15:30:43 -0700 | [diff] [blame] | 360 | // Came from all apps -- make a copy |
Adam Cohen | 3e8f811 | 2011-07-02 18:03:00 -0700 | [diff] [blame] | 361 | item = ((ApplicationInfo) d.dragInfo).makeShortcut(); |
Adam Cohen | c0dcf59 | 2011-06-01 15:30:43 -0700 | [diff] [blame] | 362 | } else { |
Adam Cohen | 3e8f811 | 2011-07-02 18:03:00 -0700 | [diff] [blame] | 363 | item = (ShortcutInfo) d.dragInfo; |
Adam Cohen | c0dcf59 | 2011-06-01 15:30:43 -0700 | [diff] [blame] | 364 | } |
Adam Cohen | ac8c876 | 2011-07-13 11:15:27 -0700 | [diff] [blame] | 365 | onDrop(item, d.dragView, null, 1.0f, mInfo.contents.size(), d.postAnimationRunnable); |
Adam Cohen | c0dcf59 | 2011-06-01 15:30:43 -0700 | [diff] [blame] | 366 | } |
| 367 | |
Adam Cohen | cb3382b | 2011-05-24 14:07:08 -0700 | [diff] [blame] | 368 | public DropTarget getDropTargetDelegate(DragObject d) { |
Patrick Dubroy | 440c360 | 2010-07-13 17:50:32 -0700 | [diff] [blame] | 369 | return null; |
| 370 | } |
Adam Cohen | a9cf38f | 2011-05-02 15:36:58 -0700 | [diff] [blame] | 371 | |
Adam Cohen | d044526 | 2011-07-04 23:53:22 -0700 | [diff] [blame] | 372 | private void computePreviewDrawingParams(int drawableSize, int totalSize) { |
| 373 | if (mIntrinsicIconSize != drawableSize || mTotalWidth != totalSize) { |
| 374 | mIntrinsicIconSize = drawableSize; |
| 375 | mTotalWidth = totalSize; |
| 376 | |
| 377 | final int previewSize = FolderRingAnimator.sPreviewSize; |
| 378 | final int previewPadding = FolderRingAnimator.sPreviewPadding; |
| 379 | |
| 380 | mAvailableSpaceInPreview = (previewSize - 2 * previewPadding); |
| 381 | // cos(45) = 0.707 + ~= 0.1) = 0.8f |
| 382 | int adjustedAvailableSpace = (int) ((mAvailableSpaceInPreview / 2) * (1 + 0.8f)); |
| 383 | |
| 384 | int unscaledHeight = (int) (mIntrinsicIconSize * (1 + PERSPECTIVE_SHIFT_FACTOR)); |
| 385 | mBaselineIconScale = (1.0f * adjustedAvailableSpace / unscaledHeight); |
| 386 | |
| 387 | mBaselineIconSize = (int) (mIntrinsicIconSize * mBaselineIconScale); |
| 388 | mMaxPerspectiveShift = mBaselineIconSize * PERSPECTIVE_SHIFT_FACTOR; |
| 389 | |
| 390 | mPreviewOffsetX = (mTotalWidth - mAvailableSpaceInPreview) / 2; |
| 391 | mPreviewOffsetY = previewPadding; |
| 392 | } |
| 393 | } |
| 394 | |
| 395 | private void computePreviewDrawingParams(Drawable d) { |
| 396 | computePreviewDrawingParams(d.getIntrinsicWidth(), getMeasuredWidth()); |
| 397 | } |
| 398 | |
| 399 | class PreviewItemDrawingParams { |
| 400 | PreviewItemDrawingParams(float transX, float transY, float scale, int overlayAlpha) { |
| 401 | this.transX = transX; |
| 402 | this.transY = transY; |
| 403 | this.scale = scale; |
| 404 | this.overlayAlpha = overlayAlpha; |
| 405 | } |
| 406 | float transX; |
| 407 | float transY; |
| 408 | float scale; |
| 409 | int overlayAlpha; |
| 410 | Drawable drawable; |
| 411 | } |
| 412 | |
Adam Cohen | ac8c876 | 2011-07-13 11:15:27 -0700 | [diff] [blame] | 413 | private float getLocalCenterForIndex(int index, int[] center) { |
Adam Cohen | d044526 | 2011-07-04 23:53:22 -0700 | [diff] [blame] | 414 | mParams = computePreviewItemDrawingParams(Math.min(NUM_ITEMS_IN_PREVIEW, index), mParams); |
| 415 | |
| 416 | mParams.transX += mPreviewOffsetX; |
| 417 | mParams.transY += mPreviewOffsetY; |
Adam Cohen | ac8c876 | 2011-07-13 11:15:27 -0700 | [diff] [blame] | 418 | float offsetX = mParams.transX + (mParams.scale * mIntrinsicIconSize) / 2; |
| 419 | float offsetY = mParams.transY + (mParams.scale * mIntrinsicIconSize) / 2; |
Adam Cohen | d044526 | 2011-07-04 23:53:22 -0700 | [diff] [blame] | 420 | |
Adam Cohen | ac8c876 | 2011-07-13 11:15:27 -0700 | [diff] [blame] | 421 | center[0] = (int) Math.round(offsetX); |
| 422 | center[1] = (int) Math.round(offsetY); |
Adam Cohen | d044526 | 2011-07-04 23:53:22 -0700 | [diff] [blame] | 423 | return mParams.scale; |
| 424 | } |
| 425 | |
| 426 | private PreviewItemDrawingParams computePreviewItemDrawingParams(int index, |
| 427 | PreviewItemDrawingParams params) { |
| 428 | index = NUM_ITEMS_IN_PREVIEW - index - 1; |
| 429 | float r = (index * 1.0f) / (NUM_ITEMS_IN_PREVIEW - 1); |
| 430 | float scale = (1 - PERSPECTIVE_SCALE_FACTOR * (1 - r)); |
| 431 | |
| 432 | float offset = (1 - r) * mMaxPerspectiveShift; |
| 433 | float scaledSize = scale * mBaselineIconSize; |
| 434 | float scaleOffsetCorrection = (1 - scale) * mBaselineIconSize; |
| 435 | |
| 436 | // We want to imagine our coordinates from the bottom left, growing up and to the |
| 437 | // right. This is natural for the x-axis, but for the y-axis, we have to invert things. |
| 438 | float transY = mAvailableSpaceInPreview - (offset + scaledSize + scaleOffsetCorrection); |
| 439 | float transX = offset + scaleOffsetCorrection; |
| 440 | float totalScale = mBaselineIconScale * scale; |
| 441 | final int overlayAlpha = (int) (80 * (1 - r)); |
| 442 | |
| 443 | if (params == null) { |
| 444 | params = new PreviewItemDrawingParams(transX, transY, totalScale, overlayAlpha); |
| 445 | } else { |
| 446 | params.transX = transX; |
| 447 | params.transY = transY; |
| 448 | params.scale = totalScale; |
| 449 | params.overlayAlpha = overlayAlpha; |
| 450 | } |
| 451 | return params; |
| 452 | } |
| 453 | |
| 454 | private void drawPreviewItem(Canvas canvas, PreviewItemDrawingParams params) { |
| 455 | canvas.save(); |
| 456 | canvas.translate(params.transX + mPreviewOffsetX, params.transY + mPreviewOffsetY); |
| 457 | canvas.scale(params.scale, params.scale); |
| 458 | Drawable d = params.drawable; |
| 459 | |
| 460 | if (d != null) { |
| 461 | d.setBounds(0, 0, mIntrinsicIconSize, mIntrinsicIconSize); |
| 462 | d.setFilterBitmap(true); |
| 463 | d.setColorFilter(Color.argb(params.overlayAlpha, 0, 0, 0), PorterDuff.Mode.SRC_ATOP); |
| 464 | d.draw(canvas); |
| 465 | d.clearColorFilter(); |
| 466 | d.setFilterBitmap(false); |
| 467 | } |
| 468 | canvas.restore(); |
| 469 | } |
| 470 | |
Adam Cohen | a9cf38f | 2011-05-02 15:36:58 -0700 | [diff] [blame] | 471 | @Override |
Adam Cohen | c0dcf59 | 2011-06-01 15:30:43 -0700 | [diff] [blame] | 472 | protected void dispatchDraw(Canvas canvas) { |
Adam Cohen | 76fc085 | 2011-06-17 13:26:23 -0700 | [diff] [blame] | 473 | super.dispatchDraw(canvas); |
| 474 | |
Adam Cohen | a9cf38f | 2011-05-02 15:36:58 -0700 | [diff] [blame] | 475 | if (mFolder == null) return; |
Adam Cohen | d044526 | 2011-07-04 23:53:22 -0700 | [diff] [blame] | 476 | if (mFolder.getItemCount() == 0 && !mAnimating) return; |
Adam Cohen | a9cf38f | 2011-05-02 15:36:58 -0700 | [diff] [blame] | 477 | |
Adam Cohen | 76078c4 | 2011-06-09 15:06:52 -0700 | [diff] [blame] | 478 | ArrayList<View> items = mFolder.getItemsInReadingOrder(false); |
Adam Cohen | d044526 | 2011-07-04 23:53:22 -0700 | [diff] [blame] | 479 | Drawable d; |
| 480 | TextView v; |
Adam Cohen | badf71e | 2011-05-26 19:08:29 -0700 | [diff] [blame] | 481 | |
Adam Cohen | d044526 | 2011-07-04 23:53:22 -0700 | [diff] [blame] | 482 | // Update our drawing parameters if necessary |
| 483 | if (mAnimating) { |
| 484 | computePreviewDrawingParams(mAnimParams.drawable); |
| 485 | } else { |
| 486 | v = (TextView) items.get(0); |
Adam Cohen | a9cf38f | 2011-05-02 15:36:58 -0700 | [diff] [blame] | 487 | d = v.getCompoundDrawables()[1]; |
Adam Cohen | d044526 | 2011-07-04 23:53:22 -0700 | [diff] [blame] | 488 | computePreviewDrawingParams(d); |
Adam Cohen | a9cf38f | 2011-05-02 15:36:58 -0700 | [diff] [blame] | 489 | } |
Adam Cohen | d044526 | 2011-07-04 23:53:22 -0700 | [diff] [blame] | 490 | |
| 491 | int nItemsInPreview = Math.min(items.size(), NUM_ITEMS_IN_PREVIEW); |
| 492 | if (!mAnimating) { |
| 493 | for (int i = nItemsInPreview - 1; i >= 0; i--) { |
| 494 | v = (TextView) items.get(i); |
| 495 | d = v.getCompoundDrawables()[1]; |
| 496 | |
| 497 | mParams = computePreviewItemDrawingParams(i, mParams); |
| 498 | mParams.drawable = d; |
| 499 | drawPreviewItem(canvas, mParams); |
| 500 | } |
| 501 | } else { |
| 502 | drawPreviewItem(canvas, mAnimParams); |
| 503 | } |
| 504 | } |
| 505 | |
| 506 | private void animateFirstItem(final Drawable d, int duration) { |
| 507 | computePreviewDrawingParams(d); |
| 508 | final PreviewItemDrawingParams finalParams = computePreviewItemDrawingParams(0, null); |
| 509 | |
| 510 | final float scale0 = 1.0f; |
| 511 | final float transX0 = 0; |
| 512 | final float transY0 = 0; |
| 513 | mAnimParams.drawable = d; |
| 514 | |
| 515 | ValueAnimator va = ValueAnimator.ofFloat(0f, 1.0f); |
| 516 | va.addUpdateListener(new AnimatorUpdateListener(){ |
| 517 | public void onAnimationUpdate(ValueAnimator animation) { |
| 518 | float progress = (Float) animation.getAnimatedValue(); |
| 519 | |
| 520 | mAnimParams.transX = transX0 + progress * (finalParams.transX - transX0); |
| 521 | mAnimParams.transY = transY0 + progress * (finalParams.transY - transY0); |
| 522 | mAnimParams.scale = scale0 + progress * (finalParams.scale - scale0); |
| 523 | invalidate(); |
| 524 | } |
| 525 | }); |
| 526 | va.addListener(new AnimatorListenerAdapter() { |
| 527 | @Override |
| 528 | public void onAnimationStart(Animator animation) { |
| 529 | mAnimating = true; |
| 530 | } |
| 531 | @Override |
| 532 | public void onAnimationEnd(Animator animation) { |
| 533 | mAnimating = false; |
| 534 | } |
| 535 | }); |
| 536 | va.setDuration(duration); |
| 537 | va.start(); |
Adam Cohen | a9cf38f | 2011-05-02 15:36:58 -0700 | [diff] [blame] | 538 | } |
| 539 | |
Adam Cohen | 76078c4 | 2011-06-09 15:06:52 -0700 | [diff] [blame] | 540 | public void onItemsChanged() { |
| 541 | invalidate(); |
| 542 | requestLayout(); |
| 543 | } |
| 544 | |
Adam Cohen | a9cf38f | 2011-05-02 15:36:58 -0700 | [diff] [blame] | 545 | public void onAdd(ShortcutInfo item) { |
| 546 | invalidate(); |
| 547 | requestLayout(); |
| 548 | } |
| 549 | |
| 550 | public void onRemove(ShortcutInfo item) { |
| 551 | invalidate(); |
| 552 | requestLayout(); |
| 553 | } |
Adam Cohen | 76fc085 | 2011-06-17 13:26:23 -0700 | [diff] [blame] | 554 | |
| 555 | public void onTitleChanged(CharSequence title) { |
Adam Cohen | d63cfa9 | 2011-06-24 14:17:17 -0700 | [diff] [blame] | 556 | mFolderName.setText(title.toString()); |
Winson Chung | 6a0f57d | 2011-06-29 20:10:49 -0700 | [diff] [blame] | 557 | mPreviewBackground.setContentDescription(title.toString()); |
Adam Cohen | 76fc085 | 2011-06-17 13:26:23 -0700 | [diff] [blame] | 558 | } |
The Android Open Source Project | 31dd503 | 2009-03-03 19:32:27 -0800 | [diff] [blame] | 559 | } |