delete these unused files
This commit is contained in:
-184
@@ -1,184 +0,0 @@
|
||||
#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 = 654.f - y * 150.f;
|
||||
|
||||
ty = ty + 0.25f;
|
||||
|
||||
bindTexture(NAMED_PFText, 0, loadI32(3, index));
|
||||
drawRect(tx, ty, tx + 128.f, ty + 64.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;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
/*
|
||||
* 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 android.widget.GridView;
|
||||
import android.widget.AdapterView;
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Canvas;
|
||||
|
||||
public class AllAppsGridView extends GridView implements AdapterView.OnItemClickListener,
|
||||
AdapterView.OnItemLongClickListener, DragSource {
|
||||
|
||||
private DragController mDragController;
|
||||
private Launcher mLauncher;
|
||||
private boolean mDraw = true;
|
||||
|
||||
public AllAppsGridView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public AllAppsGridView(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, com.android.internal.R.attr.gridViewStyle);
|
||||
}
|
||||
|
||||
public AllAppsGridView(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
setOnItemClickListener(this);
|
||||
setOnItemLongClickListener(this);
|
||||
}
|
||||
|
||||
public void onItemClick(AdapterView parent, View v, int position, long id) {
|
||||
ApplicationInfo app = (ApplicationInfo) parent.getItemAtPosition(position);
|
||||
mLauncher.startActivitySafely(app.intent);
|
||||
}
|
||||
|
||||
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
if (!view.isInTouchMode()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ApplicationInfo app = (ApplicationInfo) parent.getItemAtPosition(position);
|
||||
app = new ApplicationInfo(app);
|
||||
|
||||
mDragController.startDrag(view, this, app, DragController.DRAG_ACTION_COPY);
|
||||
mLauncher.closeAllApps();
|
||||
mDraw = false;
|
||||
invalidate();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dispatchDraw(Canvas canvas) {
|
||||
if (mDraw) {
|
||||
super.dispatchDraw(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
public void setDragController(DragController dragController) {
|
||||
mDragController = dragController;
|
||||
}
|
||||
|
||||
public void onDropCompleted(View target, boolean success) {
|
||||
mLauncher.closeAllApps();
|
||||
}
|
||||
|
||||
void setLauncher(Launcher launcher) {
|
||||
mLauncher = launcher;
|
||||
}
|
||||
|
||||
void onPrepareDialog() {
|
||||
mDraw = true;
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2009 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.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* Annotate fields of a subclass of {@link IntAllocaiton} or
|
||||
* FloatAllocation with this, and the save() method on those
|
||||
* those classes will find the field an save it.
|
||||
* <p>
|
||||
* TODO: This would be even better if the allocations were
|
||||
* named, and renderscript automatically added them into to
|
||||
* the renderscript namespace.
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface AllocationIndex {
|
||||
/**
|
||||
* The index in the allocation to use inside renderscript.
|
||||
*/
|
||||
int value();
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2009 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 android.renderscript.Allocation;
|
||||
import android.renderscript.Element;
|
||||
import android.renderscript.RenderScript;
|
||||
import android.util.Log;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class IntAllocation {
|
||||
private RenderScript mRS;
|
||||
private int[] mBuffer;
|
||||
private Allocation mAlloc;
|
||||
|
||||
public IntAllocation(RenderScript rs) {
|
||||
mRS = rs;
|
||||
}
|
||||
|
||||
public void save() {
|
||||
Field[] fields = this.getClass().getFields();
|
||||
if (mBuffer == null) {
|
||||
int maxIndex = 0;
|
||||
for (Field f: fields) {
|
||||
AllocationIndex index = f.getAnnotation(AllocationIndex.class);
|
||||
if (index != null) {
|
||||
int value = index.value();
|
||||
if (value > maxIndex) {
|
||||
maxIndex = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
mBuffer = new int[maxIndex+1];
|
||||
if (true) {
|
||||
// helpful debugging check
|
||||
for (Field f: fields) {
|
||||
AllocationIndex index = f.getAnnotation(AllocationIndex.class);
|
||||
if (index != null) {
|
||||
int i = index.value();
|
||||
if (mBuffer[i] != 0) {
|
||||
throw new RuntimeException("@AllocationIndex on field in class "
|
||||
+ this.getClass().getName() + " with duplicate value "
|
||||
+ i + " for field " + f.getName() + ". The other field is "
|
||||
+ fields[mBuffer[i]-1].getName() + '.');
|
||||
}
|
||||
mBuffer[i] = i+1;
|
||||
}
|
||||
}
|
||||
for (int i=0; i<mBuffer.length; i++) {
|
||||
mBuffer[i] = 0;
|
||||
}
|
||||
}
|
||||
mAlloc = Allocation.createSized(mRS, Element.USER_I32, mBuffer.length);
|
||||
}
|
||||
int[] buf = mBuffer;
|
||||
for (Field f: fields) {
|
||||
AllocationIndex index = f.getAnnotation(AllocationIndex.class);
|
||||
if (index != null) {
|
||||
try {
|
||||
buf[index.value()] = f.getInt(this);
|
||||
} catch (IllegalAccessException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
mAlloc.data(buf);
|
||||
}
|
||||
|
||||
public void read() {
|
||||
int[] buf = mBuffer;
|
||||
if (buf != null) {
|
||||
mAlloc.readData(buf);
|
||||
Field[] fields = this.getClass().getFields();
|
||||
for (Field f: fields) {
|
||||
AllocationIndex index = f.getAnnotation(AllocationIndex.class);
|
||||
if (index != null) {
|
||||
try {
|
||||
f.setInt(this, buf[index.value()]);
|
||||
} catch (IllegalAccessException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Allocation getAllocation() {
|
||||
return mAlloc;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user