From 938390556010da278cb068dd292730d6ae3ab932 Mon Sep 17 00:00:00 2001 From: Joe Onorato Date: Thu, 6 Aug 2009 20:34:32 -0700 Subject: [PATCH] Move rollo into the all apps view. --- res/layout-land/all_apps.xml | 2 +- res/layout-port/all_apps.xml | 2 +- res/raw/maps.png | Bin 0 -> 5374 bytes res/raw/rollo.c | 184 +++++++++ src/com/android/launcher2/AllAppsView.java | 453 +++++++++++++++++++++ src/com/android/launcher2/Launcher.java | 16 +- 6 files changed, 646 insertions(+), 11 deletions(-) create mode 100644 res/raw/maps.png create mode 100644 res/raw/rollo.c create mode 100644 src/com/android/launcher2/AllAppsView.java diff --git a/res/layout-land/all_apps.xml b/res/layout-land/all_apps.xml index 35adb6793b..c53806221a 100644 --- a/res/layout-land/all_apps.xml +++ b/res/layout-land/all_apps.xml @@ -14,7 +14,7 @@ limitations under the License. --> - - t-CIIR$^Yk~9Bu**cljFthns-I zUH%5Z;U?g4m%jmUxCuDiMLXOCl*-nHqFopKohz9u1b!)T600DRb|YQ8&`Gjg2>!FPiMv@Qo%izlhZTUGXNfcYohLmJ zT5x4VpZ76jV+1J#(z0OZPV5bT#$59fi9IWEtQ5dsT$gLQUY6_MD;f?P0KJPEztwok zb+`H!U4fiC8`pJ_QdZnu*G1;@=r8;)$;WOZHL?-Fl5q9(74qTtf{w!iz~HCn9uq#} z+I7aoR|wf0tz@_s2vVZ->_oZ$2gEl066xksio*Pkm*lp0OUq#aAo0&vt*!sY-N(vs zXp~XMA-DQP?0tK1)B91T%s`vJ5Gj;02r`q!^RHiJsONu>l9dk)amKedVgpkCm5hAg z)8L-P9cKg={(S}Wxwlp@eDeipzkZhbw}*)gdZ~Y_2YKhso_MuiW?H@SS<~U0 zx16ACEqAufh*Xrql!kzu#3qfR2$T||lYk&p6_HHg`hCc0?dW+Q8O^dFJC-B`&?#uc z0n57vU`JB?BpFQ(jkpc<0#rpxvyYd0Q z?X#}ll2)dP0^bNxycdB$!p@{<-!!7!W_uaF{J5|E%IfV;N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85Qvd(} literal 0 HcmV?d00001 diff --git a/res/raw/rollo.c b/res/raw/rollo.c new file mode 100644 index 0000000000..70d39545e2 --- /dev/null +++ b/res/raw/rollo.c @@ -0,0 +1,184 @@ +#pragma version(1) +#pragma stateVertex(PV) +#pragma stateFragment(PF) +#pragma stateFragmentStore(PFS) + +// Scratch buffer layout +#define SCRATCH_FADE 0 +#define SCRATCH_ZOOM 1 +#define SCRATCH_ROT 2 + +//#define STATE_POS_X 0 +#define STATE_DONE 1 +//#define STATE_PRESSURE 2 +#define STATE_ZOOM 3 +//#define STATE_WARP 4 +#define STATE_ORIENTATION 5 +#define STATE_SELECTION 6 +#define STATE_FIRST_VISIBLE 7 +#define STATE_COUNT 8 +#define STATE_TOUCH 9 + + +float filter(float val, float target, float str) +{ + float delta = (target - val); + return val + delta * str; +} + +int main(void* con, int ft, int launchID) +{ + int rowCount; + int row; + int col; + int imageID; + int done = loadI32(0, STATE_DONE); + int selectedID = loadI32(0, STATE_SELECTION); + + float f = loadF(2, 0); + + pfClearColor(0.0f, 0.0f, 0.0f, 0.0f); + if (done) { + if (f > 0.02f) { + //f = f - 0.02f; + //storeF(2, 0, f); + } + } else { + if (f < 0.8f) { + f = f + 0.02f; + storeF(2, 0, f); + } + } + + float touchCut = 1.f; + if (loadI32(0, STATE_TOUCH)) { + touchCut = 4.f; + } + + + float targetZoom = ((float)loadI32(0, STATE_ZOOM)) / 1000.f; + float zoom = filter(loadF(2, SCRATCH_ZOOM), targetZoom, 0.15 * touchCut); + storeF(2, SCRATCH_ZOOM, zoom); + + float targetRot = loadI32(0, STATE_FIRST_VISIBLE) / 180.0f * 3.14f; + targetRot = targetRot * 0.80f - .12f; + float drawRot = filter(loadF(2, SCRATCH_ROT), targetRot, 0.1f * touchCut); + storeF(2, SCRATCH_ROT, drawRot); + + float diam = 8.f; + float scale = 1.0f / zoom; + + // Bug makes 1.0f alpha fail. + color(1.0f, 1.0f, 1.0f, 0.99f); + + float rot = drawRot * scale; + float rotStep = 16.0f / 180.0f * 3.14f * scale; + rowCount = 4; + int index = 0; + int iconCount = loadI32(0, STATE_COUNT); + while (iconCount) { + float tmpSin = sinf(rot); + float tmpCos = cosf(rot); + //debugF("rot", rot); + + float tx1 = tmpSin * diam - (tmpCos * scale * 0.9f); + float tx2 = tx1 + (tmpCos * scale * 1.8f); + float tz1 = tmpCos * diam + (tmpSin * scale * 0.9f); + float tz2 = tz1 - (tmpSin * scale * 1.8f); + + int y; + for (y = rowCount -1; (y >= 0) && iconCount; y--) { + float ty1 = ((y * 3.1f) - 5.f) * scale; + float ty2 = ty1 + scale * 1.8f; + bindTexture(NAMED_PF, 0, loadI32(1, index)); + drawQuad(tx1, ty1, tz1, + tx2, ty1, tz2, + tx2, ty2, tz2, + tx1, ty2, tz1); + + iconCount--; + index++; + } + rot = rot + rotStep; + } + + if ((zoom < 1.1f) && (zoom > 0.9f)) { + bindProgramVertex(NAMED_PVOrtho); + bindProgramFragment(NAMED_PFText); + bindProgramFragmentStore(NAMED_PFSText); + + rot = drawRot * scale; + index = 0; + iconCount = loadI32(0, STATE_COUNT); + while (iconCount) { + int y; + + float tx = 240.f + floorf(sinf(rot) * 430.f) - 64.f + 16.f; + + float alpha = 2.4f - (fabsf(tx - 240.f + 48.f) / 76.f); + if (alpha > 0.99f) { + alpha = 0.99f; + } + alpha = alpha * (1.f - (fabsf(zoom - 1.f) * 10.f)); + + tx = tx + 0.25f; + + for (y = rowCount -1; (y >= 0) && iconCount; y--) { + + if (alpha > 0) { + color(1.0f, 1.0f, 1.0f, alpha); + + float ty = 605.f - y * 150.f; + + ty = ty + 0.25f; + + bindTexture(NAMED_PFText, 0, loadI32(3, index)); + drawRect(tx, ty, tx + 128.f, ty + 32.f, 0.5f); + } + iconCount--; + index++; + } + rot = rot + rotStep; + } + + + bindProgramVertex(NAMED_PV); + bindProgramFragment(NAMED_PF); + bindProgramFragmentStore(NAMED_PFS); + } + + // Draw the selected icon + color(1.0f, 1.0f, 1.0f, 0.9f); + rot = drawRot * scale; + index = 0; + iconCount = loadI32(0, STATE_COUNT); + while (iconCount) { + int y; + for (y = rowCount -1; (y >= 0) && iconCount; y--) { + if (index == selectedID) { + + float tmpSin = sinf(rot) * scale; + float tmpCos = cosf(rot) * scale; + float tx1 = tmpSin * diam * 0.9f - tmpCos * 2.f; + float tx2 = tx1 + (tmpCos * 4.f); + float tz1 = tmpCos * diam * 0.9f + tmpSin * 2.f; + float tz2 = tz1 - (tmpSin * 4.f); + + float ty1 = ((y * 3.1f) - 4.5f) * scale; + float ty2 = ty1 + scale * 4.f; + bindTexture(NAMED_PF, 0, loadI32(1, index)); + drawQuad(tx1, ty1, tz1, + tx2, ty1, tz2, + tx2, ty2, tz2, + tx1, ty2, tz1); + } + iconCount--; + index++; + } + rot = rot + rotStep; + } + + return 1; +} + + diff --git a/src/com/android/launcher2/AllAppsView.java b/src/com/android/launcher2/AllAppsView.java new file mode 100644 index 0000000000..dc242203ff --- /dev/null +++ b/src/com/android/launcher2/AllAppsView.java @@ -0,0 +1,453 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.launcher2; + +import java.io.Writer; +import java.util.ArrayList; +import java.util.concurrent.Semaphore; +import java.lang.Float; + +import android.renderscript.RSSurfaceView; +import android.renderscript.RenderScript; + +import android.renderscript.RenderScript; +import android.renderscript.ProgramVertex; +import android.renderscript.Element; +import android.renderscript.Allocation; +import android.renderscript.Script; +import android.renderscript.ScriptC; +import android.renderscript.ProgramFragment; +import android.renderscript.ProgramStore; +import android.renderscript.Sampler; + +import android.content.Context; +import android.content.res.Resources; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.graphics.Typeface; +import android.graphics.drawable.BitmapDrawable; +import android.graphics.drawable.Drawable; +import android.os.Handler; +import android.os.Message; +import android.util.AttributeSet; +import android.util.Log; +import android.view.Surface; +import android.view.SurfaceHolder; +import android.view.SurfaceView; +import android.view.KeyEvent; +import android.view.MotionEvent; +import android.graphics.PixelFormat; + + +public class AllAppsView extends RSSurfaceView { + public AllAppsView(Context context) { + super(context); + setFocusable(true); + getHolder().setFormat(PixelFormat.TRANSLUCENT); + } + + public AllAppsView(Context context, AttributeSet attrs) { + this(context); + } + + public AllAppsView(Context context, AttributeSet attrs, int defStyle) { + this(context); + } + + private RenderScript mRS; + private RolloRS mRender; + + public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) { + super.surfaceChanged(holder, format, w, h); + + mRS = createRenderScript(); + mRender = new RolloRS(); + mRender.init(mRS, getResources(), w, h); + } + + @Override + public boolean onKeyDown(int keyCode, KeyEvent event) + { + // break point at here + // this method doesn't work when 'extends View' include 'extends ScrollView'. + return super.onKeyDown(keyCode, event); + } + + boolean mControlMode = false; + boolean mZoomMode = false; + boolean mFlingMode = false; + float mFlingX = 0; + float mFlingY = 0; + float mColumn = -1; + float mOldColumn; + float mZoom = 1; + + int mIconCount = 29; + int mRows = 4; + int mColumns = (mIconCount + mRows - 1) / mRows; + + float mMaxZoom = ((float)mColumns) / 3.f; + + + void setColumn(boolean clamp) + { + //Log.e("rs", " col = " + Float.toString(mColumn)); + float c = mColumn; + if(c > (mColumns -2)) { + c = (mColumns -2); + } + if(c < 0) { + c = 0; + } + mRender.setPosition(c); + if(clamp) { + mColumn = c; + } + } + + void computeSelection(float x, float y) + { + float col = mColumn + (x - 0.5f) * 4 + 1.25f; + int iCol = (int)(col + 0.25f); + + float row = (y / 0.8f) * mRows; + int iRow = (int)(row - 0.5f); + + mRender.setSelected(iCol * mRows + iRow); + } + + @Override + public boolean onTouchEvent(MotionEvent ev) + { + boolean ret = true; + int act = ev.getAction(); + if (act == ev.ACTION_UP) { + ret = false; + } + + float nx = ev.getX() / getWidth(); + float ny = ev.getY() / getHeight(); + + //Log.e("rs", "width=" + Float.toString(getWidth())); + //Log.e("rs", "height=" + Float.toString(getHeight())); + + mRender.setTouch(ret); + + if((ny > 0.85f) || mControlMode) { + mFlingMode = false; + + // Projector control + if((nx > 0.2f) && (nx < 0.8f) || mControlMode) { + if(act != ev.ACTION_UP) { + float zoom = mMaxZoom; + if(mControlMode) { + if(!mZoomMode) { + zoom = 1.f; + } + float dx = nx - mFlingX; + + if((ny < 0.9) && mZoomMode) { + zoom = mMaxZoom - ((0.9f - ny) * 10.f); + if(zoom < 1) { + zoom = 1; + mZoomMode = false; + } + mOldColumn = mColumn; + } + mColumn += dx * 4;// * zoom; + if(zoom > 1.01f) { + mColumn += (mZoom - zoom) * (nx - 0.5f) * 4 * zoom; + } + } else { + mOldColumn = mColumn; + mColumn = ((float)mColumns) / 2; + mControlMode = true; + mZoomMode = true; + } + mZoom = zoom; + mFlingX = nx; + mRender.setZoom(zoom); + if(mZoom < 1.01f) { + computeSelection(nx, ny); + } + } else { + mControlMode = false; + mColumn = mOldColumn; + mRender.setZoom(1.f); + mRender.setSelected(-1); + } + } else { + // Do something with corners here.... + } + setColumn(true); + + } else { + // icon control + if(act != ev.ACTION_UP) { + if(mFlingMode) { + mColumn += (mFlingX - nx) * 4; + setColumn(true); + } + mFlingMode = true; + mFlingX = nx; + mFlingY = ny; + } else { + mFlingMode = false; + mColumn = (float)(java.lang.Math.floor(mColumn * 0.25f + 0.3f) * 4.f) + 1.f; + setColumn(true); + } + } + + + return ret; + } + + @Override + public boolean onTrackballEvent(MotionEvent ev) + { + float x = ev.getX(); + float y = ev.getY(); + //Float tx = new Float(x); + //Float ty = new Float(y); + //Log.e("rs", "tbe " + tx.toString() + ", " + ty.toString()); + + + return true; + } + + public class RolloRS { + //public static final int STATE_SELECTED_ID = 0; + public static final int STATE_DONE = 1; + //public static final int STATE_PRESSURE = 2; + public static final int STATE_ZOOM = 3; + //public static final int STATE_WARP = 4; + public static final int STATE_ORIENTATION = 5; + public static final int STATE_SELECTION = 6; + public static final int STATE_FIRST_VISIBLE = 7; + public static final int STATE_COUNT = 8; + public static final int STATE_TOUCH = 9; + + + public RolloRS() { + } + + public void init(RenderScript rs, Resources res, int width, int height) { + mRS = rs; + mRes = res; + mWidth = width; + mHeight = height; + initNamed(); + initRS(); + } + + public void setPosition(float column) { + mAllocStateBuf[STATE_FIRST_VISIBLE] = (int)(column * (-20)); + mAllocState.data(mAllocStateBuf); + } + + public void setTouch(boolean touch) { + mAllocStateBuf[STATE_TOUCH] = touch ? 1 : 0; + mAllocState.data(mAllocStateBuf); + } + + public void setZoom(float z) { + //Log.e("rs", "zoom " + Float.toString(z)); + + mAllocStateBuf[STATE_ZOOM] = (int)(z * 1000.f); + mAllocState.data(mAllocStateBuf); + } + + public void setSelected(int index) { + //Log.e("rs", "setSelected " + Integer.toString(index)); + + mAllocStateBuf[STATE_SELECTION] = index; + mAllocStateBuf[STATE_DONE] = 1; + mAllocState.data(mAllocStateBuf); + } + + private int mWidth; + private int mHeight; + + private Resources mRes; + private RenderScript mRS; + private Script mScript; + private Sampler mSampler; + private Sampler mSamplerText; + private ProgramStore mPSBackground; + private ProgramStore mPSText; + private ProgramFragment mPFImages; + private ProgramFragment mPFText; + private ProgramVertex mPV; + private ProgramVertex.MatrixAllocation mPVAlloc; + private ProgramVertex mPVOrtho; + private ProgramVertex.MatrixAllocation mPVOrthoAlloc; + private Allocation[] mIcons; + private Allocation[] mLabels; + + private int[] mAllocStateBuf; + private Allocation mAllocState; + + private int[] mAllocIconIDBuf; + private Allocation mAllocIconID; + + private int[] mAllocLabelIDBuf; + private Allocation mAllocLabelID; + + private int[] mAllocScratchBuf; + private Allocation mAllocScratch; + + private void initNamed() { + Sampler.Builder sb = new Sampler.Builder(mRS); + sb.setMin(Sampler.Value.LINEAR);//_MIP_LINEAR); + sb.setMag(Sampler.Value.LINEAR); + sb.setWrapS(Sampler.Value.CLAMP); + sb.setWrapT(Sampler.Value.CLAMP); + mSampler = sb.create(); + + sb.setMin(Sampler.Value.NEAREST); + sb.setMag(Sampler.Value.NEAREST); + mSamplerText = sb.create(); + + + ProgramFragment.Builder bf = new ProgramFragment.Builder(mRS, null, null); + bf.setTexEnable(true, 0); + bf.setTexEnvMode(ProgramFragment.EnvMode.MODULATE, 0); + mPFImages = bf.create(); + mPFImages.setName("PF"); + mPFImages.bindSampler(mSampler, 0); + + bf.setTexEnvMode(ProgramFragment.EnvMode.MODULATE, 0); + mPFText = bf.create(); + mPFText.setName("PFText"); + mPFText.bindSampler(mSamplerText, 0); + + ProgramStore.Builder bs = new ProgramStore.Builder(mRS, null, null); + bs.setDepthFunc(ProgramStore.DepthFunc.LESS); + bs.setDitherEnable(false); + bs.setDepthMask(true); + bs.setBlendFunc(ProgramStore.BlendSrcFunc.SRC_ALPHA, + ProgramStore.BlendDstFunc.ONE_MINUS_SRC_ALPHA); + mPSBackground = bs.create(); + mPSBackground.setName("PFS"); + + bs.setDepthFunc(ProgramStore.DepthFunc.ALWAYS); + bs.setDepthMask(false); + bs.setBlendFunc(ProgramStore.BlendSrcFunc.SRC_ALPHA, + ProgramStore.BlendDstFunc.ONE_MINUS_SRC_ALPHA); + mPSText = bs.create(); + mPSText.setName("PFSText"); + + mPVAlloc = new ProgramVertex.MatrixAllocation(mRS); + mPVAlloc.setupProjectionNormalized(mWidth, mHeight); + + ProgramVertex.Builder pvb = new ProgramVertex.Builder(mRS, null, null); + mPV = pvb.create(); + mPV.setName("PV"); + mPV.bindAllocation(mPVAlloc); + + mPVOrthoAlloc = new ProgramVertex.MatrixAllocation(mRS); + mPVOrthoAlloc.setupOrthoWindow(mWidth, mHeight); + + pvb.setTextureMatrixEnable(true); + mPVOrtho = pvb.create(); + mPVOrtho.setName("PVOrtho"); + mPVOrtho.bindAllocation(mPVOrthoAlloc); + + mRS.contextBindProgramVertex(mPV); + + mAllocScratchBuf = new int[32]; + mAllocScratch = Allocation.createSized(mRS, + Element.USER_I32, mAllocScratchBuf.length); + mAllocScratch.data(mAllocScratchBuf); + + Log.e("rs", "Done loading named"); + + + + { + mIcons = new Allocation[29]; + mAllocIconIDBuf = new int[mIcons.length]; + mAllocIconID = Allocation.createSized(mRS, + Element.USER_I32, mAllocIconIDBuf.length); + + mLabels = new Allocation[29]; + mAllocLabelIDBuf = new int[mLabels.length]; + mAllocLabelID = Allocation.createSized(mRS, + Element.USER_I32, mLabels.length); + + Element ie8888 = Element.RGBA_8888; + + for (int i=0; i