blob: 3f64bd03d961da4cad1e7f1de20cecab59c25fd9 [file] [log] [blame]
Joe Onorato93839052009-08-06 20:34:32 -07001/*
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
17package com.android.launcher2;
18
19import java.io.Writer;
20import java.util.ArrayList;
21import java.util.concurrent.Semaphore;
22import java.lang.Float;
23
24import android.renderscript.RSSurfaceView;
25import android.renderscript.RenderScript;
26
27import android.renderscript.RenderScript;
28import android.renderscript.ProgramVertex;
29import android.renderscript.Element;
30import android.renderscript.Allocation;
Jason Sams78aebd82009-09-15 13:06:59 -070031import android.renderscript.Type;
Joe Onorato93839052009-08-06 20:34:32 -070032import android.renderscript.Script;
33import android.renderscript.ScriptC;
34import android.renderscript.ProgramFragment;
35import android.renderscript.ProgramStore;
36import android.renderscript.Sampler;
37
38import android.content.Context;
39import android.content.res.Resources;
Joe Onorato7c312c12009-08-13 21:36:53 -070040import android.database.DataSetObserver;
Joe Onorato93839052009-08-06 20:34:32 -070041import android.graphics.Bitmap;
42import android.graphics.BitmapFactory;
43import android.graphics.Canvas;
44import android.graphics.Paint;
Joe Onorato93839052009-08-06 20:34:32 -070045import android.graphics.drawable.BitmapDrawable;
46import android.graphics.drawable.Drawable;
47import android.os.Handler;
48import android.os.Message;
Joe Onoratod769a632009-08-11 17:09:02 -070049import android.os.SystemClock;
Joe Onorato93839052009-08-06 20:34:32 -070050import android.util.AttributeSet;
51import android.util.Log;
Joe Onoratod769a632009-08-11 17:09:02 -070052import android.view.KeyEvent;
53import android.view.MotionEvent;
Joe Onorato93839052009-08-06 20:34:32 -070054import android.view.Surface;
55import android.view.SurfaceHolder;
56import android.view.SurfaceView;
Joe Onorato6665c0f2009-09-02 15:27:24 -070057import android.view.View;
Joe Onoratod769a632009-08-11 17:09:02 -070058import android.view.VelocityTracker;
59import android.view.ViewConfiguration;
Joe Onorato93839052009-08-06 20:34:32 -070060import android.graphics.PixelFormat;
61
62
Joe Onorato6665c0f2009-09-02 15:27:24 -070063public class AllAppsView extends RSSurfaceView
Joe Onorato5162ea92009-09-03 09:39:42 -070064 implements View.OnClickListener, View.OnLongClickListener, DragSource {
Joe Onorato9c1289c2009-08-17 11:03:03 -040065 private static final String TAG = "Launcher.AllAppsView";
66
Joe Onoratofb0ca672009-09-14 17:55:46 -040067 /** Bit for mLocks for when there are icons being loaded. */
68 private static final int LOCK_ICONS_PENDING = 1;
69
Joe Onorato6665c0f2009-09-02 15:27:24 -070070 private Launcher mLauncher;
Joe Onorato5162ea92009-09-03 09:39:42 -070071 private DragController mDragController;
Joe Onoratofb0ca672009-09-14 17:55:46 -040072
73 /** When this is 0, modifications are allowed, when it's not, they're not.
74 * TODO: What about scrolling? */
75 private int mLocks = LOCK_ICONS_PENDING;
Joe Onorato6665c0f2009-09-02 15:27:24 -070076
Joe Onoratof7b0e012009-10-01 14:09:15 -070077 private int mSlopX;
78 private int mMaxFlingVelocity;
79
Joe Onorato1feb3a82009-08-08 22:32:00 -070080 private RenderScript mRS;
81 private RolloRS mRollo;
Joe Onorato9c1289c2009-08-17 11:03:03 -040082 private ArrayList<ApplicationInfo> mAllAppsList;
Joe Onorato1feb3a82009-08-08 22:32:00 -070083
Joe Onoratoc567acb2009-08-31 14:34:43 -070084 private int mPageCount;
Joe Onorato6665c0f2009-09-02 15:27:24 -070085 private boolean mStartedScrolling;
Joe Onoratod769a632009-08-11 17:09:02 -070086 private VelocityTracker mVelocity;
Joe Onorato1feb3a82009-08-08 22:32:00 -070087 private int mLastMotionX;
Joe Onorato5162ea92009-09-03 09:39:42 -070088 private int mMotionDownRawX;
89 private int mMotionDownRawY;
Joe Onoratoc567acb2009-08-31 14:34:43 -070090 private int mScrollHandleTop;
Jason Sams86c87ed2009-09-18 13:55:55 -070091 private long mTouchTime;
Joe Onorato360d0352009-09-28 14:37:53 -040092 private boolean mZoomSwipeInProgress;
Joe Onorato1feb3a82009-08-08 22:32:00 -070093
Joe Onorato6665c0f2009-09-02 15:27:24 -070094 static class Defines {
95 private static float farSize(float sizeAt0) {
96 return sizeAt0 * (Defines.RADIUS - Defines.CAMERA_Z) / -Defines.CAMERA_Z;
97 }
98
Joe Onoratoc567acb2009-08-31 14:34:43 -070099 public static final int ALLOC_PARAMS = 0;
100 public static final int ALLOC_STATE = 1;
Joe Onorato7bb17492009-09-24 17:51:01 -0700101 public static final int ALLOC_READBACK = 2;
102 public static final int ALLOC_ICON_IDS = 3;
103 public static final int ALLOC_LABEL_IDS = 4;
104 public static final int ALLOC_X_BORDERS = 5;
105 public static final int ALLOC_Y_BORDERS = 6;
Joe Onoratoc567acb2009-08-31 14:34:43 -0700106
107 public static final int COLUMNS_PER_PAGE = 4;
108 public static final int ROWS_PER_PAGE = 4;
Jason Sams78aebd82009-09-15 13:06:59 -0700109
Joe Onorato6665c0f2009-09-02 15:27:24 -0700110 public static final float RADIUS = 4.0f;
111
112 public static final int SCREEN_WIDTH_PX = 480;
113 public static final int SCREEN_HEIGHT_PX = 854;
114
115 public static final int ICON_WIDTH_PX = 64;
116 public static final int ICON_TEXTURE_WIDTH_PX = 128;
117
118 public static final int ICON_HEIGHT_PX = 64;
119 public static final int ICON_TEXTURE_HEIGHT_PX = 128;
120 public static final float ICON_TOP_OFFSET = 0.2f;
121
122 public static final float CAMERA_Z = -2;
123 public static final float FAR_ICON_SIZE
124 = farSize(2 * ICON_WIDTH_PX / (float)SCREEN_WIDTH_PX);
Joe Onoratoc567acb2009-08-31 14:34:43 -0700125 }
Joe Onorato7c312c12009-08-13 21:36:53 -0700126
127 public AllAppsView(Context context, AttributeSet attrs) {
128 super(context, attrs);
Joe Onorato93839052009-08-06 20:34:32 -0700129 setFocusable(true);
130 getHolder().setFormat(PixelFormat.TRANSLUCENT);
Joe Onoratof7b0e012009-10-01 14:09:15 -0700131 final ViewConfiguration config = ViewConfiguration.get(context);
132 mSlopX = config.getScaledTouchSlop();
133 mMaxFlingVelocity = config.getScaledMaximumFlingVelocity();
134
Joe Onorato6665c0f2009-09-02 15:27:24 -0700135 setOnClickListener(this);
136 setOnLongClickListener(this);
Dianne Hackborne52a1b52009-09-30 22:36:20 -0700137 setZOrderOnTop(true);
Jason Samsfd22dac2009-09-20 17:24:16 -0700138 getHolder().setFormat(PixelFormat.TRANSLUCENT);
Joe Onorato93839052009-08-06 20:34:32 -0700139 }
140
Joe Onorato7c312c12009-08-13 21:36:53 -0700141 public AllAppsView(Context context, AttributeSet attrs, int defStyle) {
142 this(context, attrs);
Joe Onorato93839052009-08-06 20:34:32 -0700143 }
144
Joe Onorato6665c0f2009-09-02 15:27:24 -0700145 public void setLauncher(Launcher launcher) {
146 mLauncher = launcher;
Joe Onorato93839052009-08-06 20:34:32 -0700147 }
148
Joe Onorato1feb3a82009-08-08 22:32:00 -0700149 @Override
Joe Onorato7bb17492009-09-24 17:51:01 -0700150 public void surfaceDestroyed(SurfaceHolder holder) {
151 super.surfaceDestroyed(holder);
152
153 destroyRenderScript();
154 mRS = null;
155 mRollo = null;
156 }
157
158 @Override
Joe Onorato93839052009-08-06 20:34:32 -0700159 public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
160 super.surfaceChanged(holder, format, w, h);
161
Joe Onorato6665c0f2009-09-02 15:27:24 -0700162 long startTime = SystemClock.uptimeMillis();
163
Jason Sams05de32a2009-09-27 14:01:40 -0700164 mRS = createRenderScript(true);
Joe Onorato1feb3a82009-08-08 22:32:00 -0700165 mRollo = new RolloRS();
166 mRollo.init(getResources(), w, h);
Joe Onorato9c1289c2009-08-17 11:03:03 -0400167 if (mAllAppsList != null) {
168 mRollo.setApps(mAllAppsList);
Joe Onorato6665c0f2009-09-02 15:27:24 -0700169 Log.d(TAG, "surfaceChanged... calling mRollo.setApps");
Joe Onorato9c1289c2009-08-17 11:03:03 -0400170 }
Joe Onoratoc567acb2009-08-31 14:34:43 -0700171
172 Resources res = getContext().getResources();
173 int barHeight = (int)res.getDimension(R.dimen.button_bar_height);
174 mScrollHandleTop = h - barHeight;
Joe Onorato6665c0f2009-09-02 15:27:24 -0700175
176 long endTime = SystemClock.uptimeMillis();
177 Log.d(TAG, "surfaceChanged took " + (endTime-startTime) + "ms");
Joe Onorato93839052009-08-06 20:34:32 -0700178 }
179
180 @Override
181 public boolean onKeyDown(int keyCode, KeyEvent event)
182 {
Joe Onorato93839052009-08-06 20:34:32 -0700183 // this method doesn't work when 'extends View' include 'extends ScrollView'.
184 return super.onKeyDown(keyCode, event);
185 }
186
Joe Onorato93839052009-08-06 20:34:32 -0700187 @Override
188 public boolean onTouchEvent(MotionEvent ev)
189 {
Joe Onorato7bb17492009-09-24 17:51:01 -0700190 if (!isVisible()) {
Joe Onorato85a02a82009-09-08 12:34:22 -0700191 return true;
Joe Onoratoe3406a22009-09-03 14:36:25 -0700192 }
193
Joe Onoratofb0ca672009-09-14 17:55:46 -0400194 if (mLocks != 0) {
Joe Onorato85a02a82009-09-08 12:34:22 -0700195 return true;
196 }
197
198 super.onTouchEvent(ev);
199
Joe Onoratofb0ca672009-09-14 17:55:46 -0400200 int x = (int)ev.getX();
201 int deltaX;
202 switch (ev.getAction()) {
203 case MotionEvent.ACTION_DOWN:
204 mMotionDownRawX = (int)ev.getRawX();
205 mMotionDownRawY = (int)ev.getRawY();
206 mLastMotionX = x;
Joe Onorato7bb17492009-09-24 17:51:01 -0700207 mRollo.mReadback.read();
Jason Sams86c87ed2009-09-18 13:55:55 -0700208
209 mRollo.mState.newPositionX = ev.getRawX() / Defines.SCREEN_WIDTH_PX;
210 mRollo.mState.newTouchDown = 1;
211
Jason Sams476339d2009-09-29 18:14:38 -0700212 if (!mRollo.checkClickOK()) {
Joe Onoratofb0ca672009-09-14 17:55:46 -0400213 mRollo.clearSelectedIcon();
Joe Onoratoc567acb2009-08-31 14:34:43 -0700214 } else {
Joe Onorato7bb17492009-09-24 17:51:01 -0700215 mRollo.selectIcon(x, (int)ev.getY(), mRollo.mReadback.posX);
Joe Onoratoc567acb2009-08-31 14:34:43 -0700216 }
Joe Onoratofb0ca672009-09-14 17:55:46 -0400217 mRollo.mState.save();
Jason Sams86c87ed2009-09-18 13:55:55 -0700218 mRollo.mInvokeMove.execute();
Joe Onoratofb0ca672009-09-14 17:55:46 -0400219 mVelocity = VelocityTracker.obtain();
220 mVelocity.addMovement(ev);
221 mStartedScrolling = false;
222 break;
223 case MotionEvent.ACTION_MOVE:
224 case MotionEvent.ACTION_OUTSIDE:
Joe Onoratof7b0e012009-10-01 14:09:15 -0700225 int slopX = Math.abs(x - mLastMotionX);
226 if (!mStartedScrolling && slopX < mSlopX) {
227 // don't update mLastMotionX so slopX is right and when we do start scrolling
Joe Onoratofb0ca672009-09-14 17:55:46 -0400228 // below, we get the right delta.
229 } else {
Jason Sams86c87ed2009-09-18 13:55:55 -0700230 mRollo.mState.newPositionX = ev.getRawX() / Defines.SCREEN_WIDTH_PX;
231 mRollo.mState.newTouchDown = 1;
232 mRollo.mInvokeMove.execute();
233
Joe Onoratofb0ca672009-09-14 17:55:46 -0400234 mStartedScrolling = true;
235 mRollo.clearSelectedIcon();
236 deltaX = x - mLastMotionX;
237 mVelocity.addMovement(ev);
Joe Onoratofb0ca672009-09-14 17:55:46 -0400238 mRollo.mState.save();
239 mLastMotionX = x;
240 }
241 break;
242 case MotionEvent.ACTION_UP:
243 case MotionEvent.ACTION_CANCEL:
Jason Sams476339d2009-09-29 18:14:38 -0700244 mRollo.mState.newTouchDown = 0;
245 mRollo.mState.newPositionX = ev.getRawX() / Defines.SCREEN_WIDTH_PX;
Jason Sams86c87ed2009-09-18 13:55:55 -0700246
Jason Sams476339d2009-09-29 18:14:38 -0700247 if (!mZoomSwipeInProgress) {
Joe Onoratof7b0e012009-10-01 14:09:15 -0700248 mVelocity.computeCurrentVelocity(1000 /* px/sec */, mMaxFlingVelocity);
Joe Onorato360d0352009-09-28 14:37:53 -0400249 mRollo.mState.flingVelocityX = mVelocity.getXVelocity() / Defines.SCREEN_WIDTH_PX;
250 mRollo.clearSelectedIcon();
251 mRollo.mState.save();
252 mRollo.mInvokeFling.execute();
Jason Sams476339d2009-09-29 18:14:38 -0700253 } else {
254 mRollo.mState.save();
255 mRollo.mInvokeMove.execute();
Joe Onorato360d0352009-09-28 14:37:53 -0400256 }
Jason Sams476339d2009-09-29 18:14:38 -0700257
Joe Onoratofb0ca672009-09-14 17:55:46 -0400258 mLastMotionX = -10000;
259 mVelocity.recycle();
260 mVelocity = null;
261 break;
Joe Onorato93839052009-08-06 20:34:32 -0700262 }
Joe Onorato6665c0f2009-09-02 15:27:24 -0700263
264 return true;
Joe Onorato93839052009-08-06 20:34:32 -0700265 }
266
Joe Onorato6665c0f2009-09-02 15:27:24 -0700267 public void onClick(View v) {
Joe Onorato7bb17492009-09-24 17:51:01 -0700268 if (mLocks != 0 || !isVisible()) {
Joe Onoratofb0ca672009-09-14 17:55:46 -0400269 return;
270 }
Joe Onorato6665c0f2009-09-02 15:27:24 -0700271 int index = mRollo.mState.selectedIconIndex;
Jason Sams476339d2009-09-29 18:14:38 -0700272 if (mRollo.checkClickOK() && index >= 0 && index < mAllAppsList.size()) {
Joe Onorato6665c0f2009-09-02 15:27:24 -0700273 ApplicationInfo app = mAllAppsList.get(index);
274 mLauncher.startActivitySafely(app.intent);
275 }
276 }
277
278 public boolean onLongClick(View v) {
Joe Onorato7bb17492009-09-24 17:51:01 -0700279 if (mLocks != 0 || !isVisible()) {
Joe Onoratofb0ca672009-09-14 17:55:46 -0400280 return true;
281 }
Joe Onorato5162ea92009-09-03 09:39:42 -0700282 int index = mRollo.mState.selectedIconIndex;
Jason Sams476339d2009-09-29 18:14:38 -0700283 Log.d(TAG, "long click! velocity=" + mRollo.mReadback.velocity + " index=" + index);
284 if (mRollo.checkClickOK() && index >= 0 && index < mAllAppsList.size()) {
Joe Onorato5162ea92009-09-03 09:39:42 -0700285 ApplicationInfo app = mAllAppsList.get(index);
286
287 // We don't really have an accurate location to use. This will do.
288 int screenX = mMotionDownRawX - (Defines.ICON_WIDTH_PX / 2);
289 int screenY = mMotionDownRawY - Defines.ICON_HEIGHT_PX;
290
291 int left = (Defines.ICON_TEXTURE_WIDTH_PX - Defines.ICON_WIDTH_PX) / 2;
292 int top = (Defines.ICON_TEXTURE_HEIGHT_PX - Defines.ICON_HEIGHT_PX) / 2;
293 mDragController.startDrag(app.iconBitmap, screenX, screenY,
294 left, top, Defines.ICON_WIDTH_PX, Defines.ICON_HEIGHT_PX,
295 this, app, DragController.DRAG_ACTION_COPY);
Joe Onoratoe3406a22009-09-03 14:36:25 -0700296
Joe Onorato7bb17492009-09-24 17:51:01 -0700297 mLauncher.closeAllApps(true);
Joe Onorato5162ea92009-09-03 09:39:42 -0700298 }
Joe Onorato6665c0f2009-09-02 15:27:24 -0700299 return true;
300 }
301
Joe Onorato5162ea92009-09-03 09:39:42 -0700302 public void setDragController(DragController dragger) {
303 mDragController = dragger;
304 }
305
306 public void onDropCompleted(View target, boolean success) {
307 }
308
Joe Onorato360d0352009-09-28 14:37:53 -0400309 public void setZoomSwipeInProgress(boolean swiping, boolean touchStillDown) {
310 mZoomSwipeInProgress = swiping;
311 if (!touchStillDown) {
312 mRollo.mState.newTouchDown = 0;
313 mRollo.mState.save();
314 mRollo.mInvokeTouchUp.execute();
315 }
316 }
317
Joe Onorato7bb17492009-09-24 17:51:01 -0700318 public void setZoomTarget(float amount) {
319 zoom(amount, true);
Jason Samsfd22dac2009-09-20 17:24:16 -0700320 }
321
Joe Onorato7bb17492009-09-24 17:51:01 -0700322 public void setZoom(float amount) {
323 zoom(amount, false);
324 }
325
326 private void zoom(float amount, boolean animate) {
327 if (mRollo == null) {
328 return;
329 }
330
Joe Onoratofb0ca672009-09-14 17:55:46 -0400331 cancelLongPress();
Joe Onoratofb0ca672009-09-14 17:55:46 -0400332 mRollo.clearSelectedIcon();
Joe Onorato85a02a82009-09-08 12:34:22 -0700333 if (amount > 0.001f) {
Joe Onoratoc5acd422009-10-01 14:21:24 -0700334 // set in readback, so we're correct even before the next frame
335 mRollo.mReadback.zoom = mRollo.mState.zoomTarget = amount;
Joe Onorato7bb17492009-09-24 17:51:01 -0700336 if (!animate) {
Joe Onoratoc5acd422009-10-01 14:21:24 -0700337 mRollo.mState.zoom = amount;
Joe Onorato7bb17492009-09-24 17:51:01 -0700338 mRollo.mReadback.save();
339 }
Joe Onorato85a02a82009-09-08 12:34:22 -0700340 } else {
Joe Onorato7bb17492009-09-24 17:51:01 -0700341 mRollo.mState.zoomTarget = 0;
342 if (!animate) {
343 mRollo.mReadback.zoom = mRollo.mState.zoom = 0;
344 mRollo.mReadback.save();
345 }
Joe Onoratoc567acb2009-08-31 14:34:43 -0700346 }
Joe Onoratofb0ca672009-09-14 17:55:46 -0400347 mRollo.mState.save();
Joe Onorato7bb17492009-09-24 17:51:01 -0700348 if (!animate) {
349 mRollo.mInvokeSetZoom.execute();
350 } else {
351 mRollo.mInvokeSetZoomTarget.execute();
352 }
Joe Onorato8e099e22009-09-25 17:30:47 -0700353 mReadZoom.removeMessages(1);
354 mReadZoom.sendEmptyMessageDelayed(1, 1000);
Joe Onoratofb0ca672009-09-14 17:55:46 -0400355 }
356
Joe Onorato8e099e22009-09-25 17:30:47 -0700357 Handler mReadZoom = new Handler() {
358 public void handleMessage(Message msg) {
Jason Sams0a8dc2c2009-09-27 17:51:44 -0700359 if(mRollo != null && mRollo.mReadback != null) {
360 // FIXME: These checks may indicate other problems.
361 mRollo.mReadback.read();
362 }
Joe Onorato8e099e22009-09-25 17:30:47 -0700363 }
364 };
365
Joe Onoratofb0ca672009-09-14 17:55:46 -0400366 public boolean isVisible() {
Joe Onorato7bb17492009-09-24 17:51:01 -0700367 if (mRollo == null) {
368 return false;
369 }
Joe Onorato8e099e22009-09-25 17:30:47 -0700370 //mRollo.mReadback.read();
Joe Onorato7bb17492009-09-24 17:51:01 -0700371 return mRollo.mReadback.zoom > 0.001f;
Joe Onoratofb0ca672009-09-14 17:55:46 -0400372 }
Joe Onoratoc567acb2009-08-31 14:34:43 -0700373
Joe Onorato93839052009-08-06 20:34:32 -0700374 @Override
375 public boolean onTrackballEvent(MotionEvent ev)
376 {
377 float x = ev.getX();
378 float y = ev.getY();
379 //Float tx = new Float(x);
380 //Float ty = new Float(y);
381 //Log.e("rs", "tbe " + tx.toString() + ", " + ty.toString());
382
383
384 return true;
385 }
386
Joe Onorato9c1289c2009-08-17 11:03:03 -0400387 public void setApps(ArrayList<ApplicationInfo> list) {
388 mAllAppsList = list;
389 if (mRollo != null) {
390 mRollo.setApps(list);
391 }
Joe Onoratoc567acb2009-08-31 14:34:43 -0700392 mPageCount = countPages(list.size());
Joe Onorato6665c0f2009-09-02 15:27:24 -0700393 Log.d(TAG, "setApps mRollo=" + mRollo + " list=" + list);
Joe Onoratofb0ca672009-09-14 17:55:46 -0400394 mLocks &= ~LOCK_ICONS_PENDING;
Joe Onorato6665c0f2009-09-02 15:27:24 -0700395 }
396
397 private void invokeIcon(int index) {
398 Log.d(TAG, "launch it!!!! index=" + index);
Joe Onoratoc567acb2009-08-31 14:34:43 -0700399 }
400
401 private static int countPages(int iconCount) {
402 int iconsPerPage = Defines.COLUMNS_PER_PAGE * Defines.ROWS_PER_PAGE;
403 int pages = iconCount / iconsPerPage;
404 if (pages*iconsPerPage != iconCount) {
405 pages++;
406 }
407 return pages;
Joe Onorato9c1289c2009-08-17 11:03:03 -0400408 }
409
Joe Onorato93839052009-08-06 20:34:32 -0700410 public class RolloRS {
Joe Onoratobf15cb42009-08-07 14:33:40 -0700411
Joe Onorato1feb3a82009-08-08 22:32:00 -0700412 // Allocations ======
Joe Onorato43e7bcf2009-08-08 18:53:53 -0700413
Joe Onorato93839052009-08-06 20:34:32 -0700414 private int mWidth;
415 private int mHeight;
416
417 private Resources mRes;
Joe Onorato93839052009-08-06 20:34:32 -0700418 private Script mScript;
Jason Sams86c87ed2009-09-18 13:55:55 -0700419
420 private Script.Invokable mInvokeMove;
421 private Script.Invokable mInvokeFling;
Joe Onorato7bb17492009-09-24 17:51:01 -0700422 private Script.Invokable mInvokeSetZoomTarget;
423 private Script.Invokable mInvokeSetZoom;
Joe Onorato360d0352009-09-28 14:37:53 -0400424 private Script.Invokable mInvokeTouchUp;
Jason Sams86c87ed2009-09-18 13:55:55 -0700425
Jason Samscd689e12009-09-29 15:28:22 -0700426 private ProgramStore mPSIcons;
Joe Onorato93839052009-08-06 20:34:32 -0700427 private ProgramStore mPSText;
Jason Samscd689e12009-09-29 15:28:22 -0700428 private ProgramFragment mPFColor;
429 private ProgramFragment mPFTexLinear;
430 private ProgramFragment mPFTexNearest;
Joe Onorato93839052009-08-06 20:34:32 -0700431 private ProgramVertex mPV;
Joe Onorato93839052009-08-06 20:34:32 -0700432 private ProgramVertex mPVOrtho;
Joe Onorato93839052009-08-06 20:34:32 -0700433
Joe Onoratoc567acb2009-08-31 14:34:43 -0700434 private Allocation mScrollHandle;
435
Joe Onoratobf15cb42009-08-07 14:33:40 -0700436 private Allocation[] mIcons;
Joe Onorato6665c0f2009-09-02 15:27:24 -0700437 private int[] mIconIds;
Joe Onorato93839052009-08-06 20:34:32 -0700438 private Allocation mAllocIconID;
439
Joe Onoratobf15cb42009-08-07 14:33:40 -0700440 private Allocation[] mLabels;
Joe Onorato6665c0f2009-09-02 15:27:24 -0700441 private int[] mLabelIds;
Joe Onorato93839052009-08-06 20:34:32 -0700442 private Allocation mAllocLabelID;
Joe Onorato6665c0f2009-09-02 15:27:24 -0700443 private Allocation mSelectedIcon;
Joe Onorato93839052009-08-06 20:34:32 -0700444
Joe Onorato6665c0f2009-09-02 15:27:24 -0700445 private int[] mTouchYBorders;
446 private Allocation mAllocTouchYBorders;
447 private int[] mTouchXBorders;
448 private Allocation mAllocTouchXBorders;
449
450 private Bitmap mSelectionBitmap;
Joe Onorato1291a8c2009-09-15 15:07:25 -0400451 private Canvas mSelectionCanvas;
Joe Onorato93839052009-08-06 20:34:32 -0700452
Joe Onorato43e7bcf2009-08-08 18:53:53 -0700453 Params mParams;
Joe Onorato1feb3a82009-08-08 22:32:00 -0700454 State mState;
Joe Onorato7bb17492009-09-24 17:51:01 -0700455 Readback mReadback;
Joe Onorato43e7bcf2009-08-08 18:53:53 -0700456
Jason Sams78aebd82009-09-15 13:06:59 -0700457 class BaseAlloc {
458 Allocation mAlloc;
459 Type mType;
460
461 void save() {
462 mAlloc.data(this);
Joe Onorato43e7bcf2009-08-08 18:53:53 -0700463 }
Joe Onorato43e7bcf2009-08-08 18:53:53 -0700464 }
465
Jason Sams476339d2009-09-29 18:14:38 -0700466 private boolean checkClickOK() {
467 //android.util.Log.e("rs", "check click " + Float.toString(mReadback.velocity) + ", " + Float.toString(mReadback.posX));
468 return (Math.abs(mReadback.velocity) < 0.1f) &&
469 (Math.abs(mReadback.posX - Math.round(mReadback.posX)) < 0.1f);
470 }
471
Jason Sams78aebd82009-09-15 13:06:59 -0700472 class Params extends BaseAlloc {
473 Params() {
474 mType = Type.createFromClass(mRS, Params.class, 1, "ParamsClass");
475 mAlloc = Allocation.createTyped(mRS, mType);
476 save();
Joe Onorato1feb3a82009-08-08 22:32:00 -0700477 }
Jason Sams78aebd82009-09-15 13:06:59 -0700478 public int bubbleWidth;
479 public int bubbleHeight;
480 public int bubbleBitmapWidth;
481 public int bubbleBitmapHeight;
482 public int scrollHandleId;
483 public int scrollHandleTextureWidth;
484 public int scrollHandleTextureHeight;
485 }
486
487 class State extends BaseAlloc {
Jason Sams86c87ed2009-09-18 13:55:55 -0700488 public float newPositionX;
489 public int newTouchDown;
Jason Sams86c87ed2009-09-18 13:55:55 -0700490 public float flingVelocityX;
Jason Sams78aebd82009-09-15 13:06:59 -0700491 public int iconCount;
Jason Sams78aebd82009-09-15 13:06:59 -0700492 public int selectedIconIndex = -1;
493 public int selectedIconTexture;
Joe Onorato7bb17492009-09-24 17:51:01 -0700494 public float zoomTarget;
Jason Sams78aebd82009-09-15 13:06:59 -0700495 public float zoom;
496
497 State() {
498 mType = Type.createFromClass(mRS, State.class, 1, "StateClass");
499 mAlloc = Allocation.createTyped(mRS, mType);
500 save();
501 }
Joe Onorato1feb3a82009-08-08 22:32:00 -0700502 }
503
Joe Onorato7bb17492009-09-24 17:51:01 -0700504 class Readback extends BaseAlloc {
505 public float posX;
506 public float velocity;
507 public float zoom;
508
509 Readback() {
510 mType = Type.createFromClass(mRS, Readback.class, 1, "ReadbackClass");
511 mAlloc = Allocation.createTyped(mRS, mType);
512 save();
513 }
514
515 void read() {
Jason Sams0a8dc2c2009-09-27 17:51:44 -0700516 if(mAlloc != null) {
517 mAlloc.read(this);
518 }
Joe Onorato7bb17492009-09-24 17:51:01 -0700519 }
520 }
521
Joe Onorato1feb3a82009-08-08 22:32:00 -0700522 public RolloRS() {
523 }
524
525 public void init(Resources res, int width, int height) {
526 mRes = res;
527 mWidth = width;
528 mHeight = height;
Jason Samscd689e12009-09-29 15:28:22 -0700529 initProgramVertex();
530 initProgramFragment();
531 initProgramStore();
Joe Onorato1feb3a82009-08-08 22:32:00 -0700532 initGl();
533 initData();
Joe Onorato6665c0f2009-09-02 15:27:24 -0700534 initTouchState();
Joe Onorato1feb3a82009-08-08 22:32:00 -0700535 initRs();
536 }
537
Jason Samscd689e12009-09-29 15:28:22 -0700538 private void initProgramVertex() {
539 ProgramVertex.MatrixAllocation pva = new ProgramVertex.MatrixAllocation(mRS);
540 pva.setupProjectionNormalized(mWidth, mHeight);
Joe Onorato93839052009-08-06 20:34:32 -0700541
542 ProgramVertex.Builder pvb = new ProgramVertex.Builder(mRS, null, null);
543 mPV = pvb.create();
544 mPV.setName("PV");
Jason Samscd689e12009-09-29 15:28:22 -0700545 mPV.bindAllocation(pva);
Joe Onorato93839052009-08-06 20:34:32 -0700546
Jason Samscd689e12009-09-29 15:28:22 -0700547 pva = new ProgramVertex.MatrixAllocation(mRS);
548 pva.setupOrthoWindow(mWidth, mHeight);
Joe Onorato93839052009-08-06 20:34:32 -0700549 pvb.setTextureMatrixEnable(true);
550 mPVOrtho = pvb.create();
551 mPVOrtho.setName("PVOrtho");
Jason Samscd689e12009-09-29 15:28:22 -0700552 mPVOrtho.bindAllocation(pva);
Joe Onorato93839052009-08-06 20:34:32 -0700553
554 mRS.contextBindProgramVertex(mPV);
Jason Samscd689e12009-09-29 15:28:22 -0700555 }
Joe Onorato93839052009-08-06 20:34:32 -0700556
Jason Samscd689e12009-09-29 15:28:22 -0700557 private void initProgramFragment() {
558 Sampler.Builder sb = new Sampler.Builder(mRS);
559 sb.setMin(Sampler.Value.LINEAR);
560 sb.setMag(Sampler.Value.LINEAR);
561 sb.setWrapS(Sampler.Value.CLAMP);
562 sb.setWrapT(Sampler.Value.CLAMP);
563 Sampler linear = sb.create();
564
565 sb.setMin(Sampler.Value.NEAREST);
566 sb.setMag(Sampler.Value.NEAREST);
567 Sampler nearest = sb.create();
568
569 ProgramFragment.Builder bf = new ProgramFragment.Builder(mRS, null, null);
570 mPFColor = bf.create();
571 mPFColor.setName("PFColor");
572
573 bf.setTexEnable(true, 0);
574 bf.setTexEnvMode(ProgramFragment.EnvMode.MODULATE, 0);
575 mPFTexLinear = bf.create();
576 mPFTexLinear.setName("PFTexLinear");
577 mPFTexLinear.bindSampler(linear, 0);
578
579 mPFTexNearest = bf.create();
580 mPFTexNearest.setName("PFTexNearest");
581 mPFTexNearest.bindSampler(nearest, 0);
582 }
583
584 private void initProgramStore() {
585 ProgramStore.Builder bs = new ProgramStore.Builder(mRS, null, null);
586 bs.setDepthFunc(ProgramStore.DepthFunc.ALWAYS);
587 bs.setDitherEnable(true);
588 bs.setBlendFunc(ProgramStore.BlendSrcFunc.SRC_ALPHA,
589 ProgramStore.BlendDstFunc.ONE_MINUS_SRC_ALPHA);
590 mPSIcons = bs.create();
591 mPSIcons.setName("PSIcons");
592
593 //bs.setDitherEnable(false);
594 //mPSText = bs.create();
595 //mPSText.setName("PSText");
596 }
597
598 private void initGl() {
Joe Onorato6665c0f2009-09-02 15:27:24 -0700599 mTouchXBorders = new int[Defines.COLUMNS_PER_PAGE+1];
Jason Sams0a8dc2c2009-09-27 17:51:44 -0700600 mAllocTouchXBorders = Allocation.createSized(mRS, Element.USER_I32(mRS),
Joe Onorato6665c0f2009-09-02 15:27:24 -0700601 mTouchXBorders.length);
602 mAllocTouchXBorders.data(mTouchXBorders);
603
604 mTouchYBorders = new int[Defines.ROWS_PER_PAGE+1];
Jason Sams0a8dc2c2009-09-27 17:51:44 -0700605 mAllocTouchYBorders = Allocation.createSized(mRS, Element.USER_I32(mRS),
Joe Onorato6665c0f2009-09-02 15:27:24 -0700606 mTouchYBorders.length);
607 mAllocTouchYBorders.data(mTouchYBorders);
Joe Onoratobf15cb42009-08-07 14:33:40 -0700608 }
Jason Sams78aebd82009-09-15 13:06:59 -0700609
Joe Onorato1feb3a82009-08-08 22:32:00 -0700610 private void initData() {
Jason Sams78aebd82009-09-15 13:06:59 -0700611 mParams = new Params();
612 mState = new State();
Joe Onorato7bb17492009-09-24 17:51:01 -0700613 mReadback = new Readback();
Joe Onorato43e7bcf2009-08-08 18:53:53 -0700614
Joe Onoratobf15cb42009-08-07 14:33:40 -0700615 final Utilities.BubbleText bubble = new Utilities.BubbleText(getContext());
Joe Onorato93839052009-08-06 20:34:32 -0700616
Joe Onorato43e7bcf2009-08-08 18:53:53 -0700617 mParams.bubbleWidth = bubble.getBubbleWidth();
618 mParams.bubbleHeight = bubble.getMaxBubbleHeight();
619 mParams.bubbleBitmapWidth = bubble.getBitmapWidth();
620 mParams.bubbleBitmapHeight = bubble.getBitmapHeight();
Joe Onorato43e7bcf2009-08-08 18:53:53 -0700621
Joe Onoratoc567acb2009-08-31 14:34:43 -0700622 mScrollHandle = Allocation.createFromBitmapResource(mRS, mRes,
Jason Sams0a8dc2c2009-09-27 17:51:44 -0700623 R.drawable.all_apps_button_pow2, Element.RGBA_8888(mRS), false);
Joe Onoratoc567acb2009-08-31 14:34:43 -0700624 mScrollHandle.uploadToTexture(0);
625 mParams.scrollHandleId = mScrollHandle.getID();
626 Log.d(TAG, "mParams.scrollHandleId=" + mParams.scrollHandleId);
627 mParams.scrollHandleTextureWidth = 128;
628 mParams.scrollHandleTextureHeight = 128;
Joe Onorato6665c0f2009-09-02 15:27:24 -0700629
Joe Onoratoc567acb2009-08-31 14:34:43 -0700630
Joe Onorato1feb3a82009-08-08 22:32:00 -0700631 mParams.save();
632 mState.save();
Joe Onorato7bb17492009-09-24 17:51:01 -0700633 mReadback.save();
Joe Onorato9c1289c2009-08-17 11:03:03 -0400634
Joe Onorato1291a8c2009-09-15 15:07:25 -0400635 mSelectionBitmap = Bitmap.createBitmap(Defines.ICON_TEXTURE_WIDTH_PX,
636 Defines.ICON_TEXTURE_HEIGHT_PX, Bitmap.Config.ARGB_8888);
637 mSelectionCanvas = new Canvas(mSelectionBitmap);
Joe Onorato6665c0f2009-09-02 15:27:24 -0700638
639 Log.d(TAG, "initData calling mRollo.setApps");
Joe Onorato9c1289c2009-08-17 11:03:03 -0400640 setApps(null);
Joe Onorato93839052009-08-06 20:34:32 -0700641 }
642
Joe Onorato1feb3a82009-08-08 22:32:00 -0700643 private void initRs() {
Joe Onorato93839052009-08-06 20:34:32 -0700644 ScriptC.Builder sb = new ScriptC.Builder(mRS);
645 sb.setScript(mRes, R.raw.rollo);
Joe Onorato93839052009-08-06 20:34:32 -0700646 sb.setRoot(true);
Joe Onoratod769a632009-08-11 17:09:02 -0700647 sb.addDefines(Defines.class);
Jason Sams78aebd82009-09-15 13:06:59 -0700648 sb.setType(mParams.mType, "params", Defines.ALLOC_PARAMS);
649 sb.setType(mState.mType, "state", Defines.ALLOC_STATE);
Joe Onorato7bb17492009-09-24 17:51:01 -0700650 sb.setType(mReadback.mType, "readback", Defines.ALLOC_READBACK);
Jason Sams86c87ed2009-09-18 13:55:55 -0700651 mInvokeMove = sb.addInvokable("move");
652 mInvokeFling = sb.addInvokable("fling");
Joe Onorato7bb17492009-09-24 17:51:01 -0700653 mInvokeSetZoomTarget = sb.addInvokable("setZoomTarget");
654 mInvokeSetZoom = sb.addInvokable("setZoom");
Joe Onorato360d0352009-09-28 14:37:53 -0400655 mInvokeTouchUp = sb.addInvokable("touchUp");
Joe Onorato93839052009-08-06 20:34:32 -0700656 mScript = sb.create();
657 mScript.setClearColor(0.0f, 0.0f, 0.0f, 0.0f);
658
Jason Sams78aebd82009-09-15 13:06:59 -0700659 mScript.bindAllocation(mParams.mAlloc, Defines.ALLOC_PARAMS);
660 mScript.bindAllocation(mState.mAlloc, Defines.ALLOC_STATE);
Joe Onorato7bb17492009-09-24 17:51:01 -0700661 mScript.bindAllocation(mReadback.mAlloc, Defines.ALLOC_READBACK);
Joe Onoratod769a632009-08-11 17:09:02 -0700662 mScript.bindAllocation(mAllocIconID, Defines.ALLOC_ICON_IDS);
Joe Onoratod769a632009-08-11 17:09:02 -0700663 mScript.bindAllocation(mAllocLabelID, Defines.ALLOC_LABEL_IDS);
Joe Onorato6665c0f2009-09-02 15:27:24 -0700664 mScript.bindAllocation(mAllocTouchXBorders, Defines.ALLOC_X_BORDERS);
665 mScript.bindAllocation(mAllocTouchYBorders, Defines.ALLOC_Y_BORDERS);
Joe Onorato93839052009-08-06 20:34:32 -0700666
667 mRS.contextBindRootScript(mScript);
668 }
Joe Onorato93839052009-08-06 20:34:32 -0700669
Joe Onorato9c1289c2009-08-17 11:03:03 -0400670 private void setApps(ArrayList<ApplicationInfo> list) {
671 final int count = list != null ? list.size() : 0;
Jason Sams0a8dc2c2009-09-27 17:51:44 -0700672 int allocCount = count;
673 if(allocCount < 1) {
674 allocCount = 1;
675 }
676
Joe Onorato9c1289c2009-08-17 11:03:03 -0400677 mIcons = new Allocation[count];
Jason Sams0a8dc2c2009-09-27 17:51:44 -0700678 mIconIds = new int[allocCount];
679 mAllocIconID = Allocation.createSized(mRS, Element.USER_I32(mRS), allocCount);
Joe Onorato9c1289c2009-08-17 11:03:03 -0400680
681 mLabels = new Allocation[count];
Jason Sams0a8dc2c2009-09-27 17:51:44 -0700682 mLabelIds = new int[allocCount];
683 mAllocLabelID = Allocation.createSized(mRS, Element.USER_I32(mRS), allocCount);
Joe Onorato9c1289c2009-08-17 11:03:03 -0400684
Jason Sams0a8dc2c2009-09-27 17:51:44 -0700685 Element ie8888 = Element.RGBA_8888(mRS);
Joe Onorato9c1289c2009-08-17 11:03:03 -0400686
687 Utilities.BubbleText bubble = new Utilities.BubbleText(getContext());
688
689 for (int i=0; i<count; i++) {
690 final ApplicationInfo item = list.get(i);
691
692 mIcons[i] = Allocation.createFromBitmap(mRS, item.iconBitmap,
Jason Sams0a8dc2c2009-09-27 17:51:44 -0700693 Element.RGBA_8888(mRS), false);
Joe Onorato9c1289c2009-08-17 11:03:03 -0400694 mLabels[i] = Allocation.createFromBitmap(mRS, item.titleBitmap,
Jason Sams0a8dc2c2009-09-27 17:51:44 -0700695 Element.RGBA_8888(mRS), false);
Joe Onorato9c1289c2009-08-17 11:03:03 -0400696
697 mIcons[i].uploadToTexture(0);
698 mLabels[i].uploadToTexture(0);
699
Joe Onorato6665c0f2009-09-02 15:27:24 -0700700 mIconIds[i] = mIcons[i].getID();
701 mLabelIds[i] = mLabels[i].getID();
Joe Onorato9c1289c2009-08-17 11:03:03 -0400702 }
703
Jason Sams0a8dc2c2009-09-27 17:51:44 -0700704 mAllocIconID.data(mIconIds);
705 mAllocLabelID.data(mLabelIds);
Joe Onorato9c1289c2009-08-17 11:03:03 -0400706
707 mState.iconCount = count;
708
Joe Onorato9c1289c2009-08-17 11:03:03 -0400709 if (mScript != null) { // wtf
710 mScript.bindAllocation(mAllocIconID, Defines.ALLOC_ICON_IDS);
711 mScript.bindAllocation(mAllocLabelID, Defines.ALLOC_LABEL_IDS);
712 }
713
714 mState.save();
715 }
Joe Onorato6665c0f2009-09-02 15:27:24 -0700716
717 void initTouchState() {
718 int width = getWidth();
719 int height = getHeight();
720
721 int iconsSize;
722 if (width < height) {
723 iconsSize = width;
724 } else {
725 iconsSize = height;
726 }
727 int cellHeight = iconsSize / Defines.ROWS_PER_PAGE;
728 int cellWidth = iconsSize / Defines.COLUMNS_PER_PAGE;
729
Joe Onorato56848b02009-09-25 13:59:59 -0700730 int centerY = (height / 2) - (int)(cellHeight * 0.2f);
731 mTouchYBorders[0] = centerY - (int)(2.8f * cellHeight);
732 mTouchYBorders[1] = centerY - (int)(1.25f * cellHeight);
Joe Onorato6665c0f2009-09-02 15:27:24 -0700733 mTouchYBorders[2] = centerY;
Joe Onorato56848b02009-09-25 13:59:59 -0700734 mTouchYBorders[3] = centerY + (int)(1.25f * cellHeight);;
735 mTouchYBorders[4] = centerY + (int)(2.6f * cellHeight);
Joe Onorato6665c0f2009-09-02 15:27:24 -0700736
737 mAllocTouchYBorders.data(mTouchYBorders);
Jason Sams78aebd82009-09-15 13:06:59 -0700738
Joe Onorato6665c0f2009-09-02 15:27:24 -0700739 int centerX = (width / 2);
740 mTouchXBorders[0] = centerX - (2 * cellWidth);
Joe Onorato56848b02009-09-25 13:59:59 -0700741 mTouchXBorders[1] = centerX - (int)(0.85f * cellWidth);
Joe Onorato6665c0f2009-09-02 15:27:24 -0700742 mTouchXBorders[2] = centerX;
Joe Onorato56848b02009-09-25 13:59:59 -0700743 mTouchXBorders[3] = centerX + (int)(0.85f * cellWidth);
Joe Onorato6665c0f2009-09-02 15:27:24 -0700744 mTouchXBorders[4] = centerX + (2 * cellWidth);
745
746 mAllocTouchXBorders.data(mTouchXBorders);
747 }
748
Jason Sams86c87ed2009-09-18 13:55:55 -0700749 int chooseTappedIcon(int x, int y, float page) {
750 int currentPage = (int)page;
751
Joe Onorato6665c0f2009-09-02 15:27:24 -0700752 int col = -1;
753 int row = -1;
754
755 for (int i=0; i<Defines.COLUMNS_PER_PAGE; i++) {
756 if (x >= mTouchXBorders[i] && x < mTouchXBorders[i+1]) {
757 col = i;
758 break;
759 }
760 }
761 for (int i=0; i<Defines.ROWS_PER_PAGE; i++) {
762 if (y >= mTouchYBorders[i] && y < mTouchYBorders[i+1]) {
763 row = i;
764 break;
765 }
766 }
767
768 if (row < 0 || col < 0) {
769 return -1;
770 }
771
Jason Sams78aebd82009-09-15 13:06:59 -0700772 return (currentPage * Defines.ROWS_PER_PAGE * Defines.COLUMNS_PER_PAGE)
Joe Onorato6665c0f2009-09-02 15:27:24 -0700773 + (row * Defines.ROWS_PER_PAGE) + col;
774 }
775
776 /**
777 * You need to call save() on mState on your own after calling this.
778 */
Jason Sams86c87ed2009-09-18 13:55:55 -0700779 void selectIcon(int x, int y, float pos) {
780 int index = chooseTappedIcon(x, y, pos);
Joe Onorato1291a8c2009-09-15 15:07:25 -0400781 selectIcon(index);
782 }
783
784 void selectIcon(int index) {
785 Log.d(TAG, "selectIcon index=" + index);
786 int iconCount = mAllAppsList.size();
Joe Onorato6665c0f2009-09-02 15:27:24 -0700787 if (index < 0 || index >= iconCount) {
788 mState.selectedIconIndex = -1;
789 return;
790 } else {
791 mState.selectedIconIndex = index;
Joe Onorato1291a8c2009-09-15 15:07:25 -0400792
793 Bitmap selectionBitmap = mSelectionBitmap;
794
795 Utilities.drawSelectedAllAppsBitmap(mSelectionCanvas,
796 selectionBitmap.getWidth(), selectionBitmap.getHeight(),
797 mAllAppsList.get(index).iconBitmap);
798
799 mSelectedIcon = Allocation.createFromBitmap(mRS, selectionBitmap,
Jason Sams0a8dc2c2009-09-27 17:51:44 -0700800 Element.RGBA_8888(mRS), false);
Joe Onorato1291a8c2009-09-15 15:07:25 -0400801 mSelectedIcon.uploadToTexture(0);
802 mState.selectedIconTexture = mSelectedIcon.getID();
Joe Onorato6665c0f2009-09-02 15:27:24 -0700803 }
804 }
805
806 /**
807 * You need to call save() on mState on your own after calling this.
808 */
809 void clearSelectedIcon() {
Joe Onorato2ca51dc2009-09-16 11:44:14 -0400810 mState.selectedIconIndex = -1;
Joe Onorato6665c0f2009-09-02 15:27:24 -0700811 }
Joe Onorato9c1289c2009-08-17 11:03:03 -0400812 }
Joe Onorato93839052009-08-06 20:34:32 -0700813}
814
815