From bf15cb44cc8e5ea9a19ab8aaee8e02c96bd6130c Mon Sep 17 00:00:00 2001 From: Joe Onorato Date: Fri, 7 Aug 2009 14:33:40 -0700 Subject: clean up rollo / launcher2 --- res/layout-land/workspace_screen.xml | 4 +- res/layout-port/workspace_screen.xml | 4 +- res/raw/rollo.c | 4 +- res/values-land/dimens.xml | 20 +++++ res/values-port/dimens.xml | 20 +++++ src/com/android/launcher2/AllAppsView.java | 82 +++++++++--------- src/com/android/launcher2/BubbleTextView.java | 6 +- src/com/android/launcher2/Utilities.java | 117 +++++++++++++++++++++++++- 8 files changed, 203 insertions(+), 54 deletions(-) create mode 100644 res/values-land/dimens.xml create mode 100644 res/values-port/dimens.xml diff --git a/res/layout-land/workspace_screen.xml b/res/layout-land/workspace_screen.xml index 5207d7b9c..531bac242 100644 --- a/res/layout-land/workspace_screen.xml +++ b/res/layout-land/workspace_screen.xml @@ -21,8 +21,8 @@ android:layout_width="fill_parent" android:layout_height="fill_parent" - launcher:cellWidth="106dip" - launcher:cellHeight="73dip" + launcher:cellWidth="@dimen/workspace_cell_width" + launcher:cellHeight="@dimen/workspace_cell_height" launcher:longAxisStartPadding="0dip" launcher:longAxisEndPadding="55dip" launcher:shortAxisStartPadding="0dip" diff --git a/res/layout-port/workspace_screen.xml b/res/layout-port/workspace_screen.xml index 6bbf6e951..531bac242 100644 --- a/res/layout-port/workspace_screen.xml +++ b/res/layout-port/workspace_screen.xml @@ -21,8 +21,8 @@ android:layout_width="fill_parent" android:layout_height="fill_parent" - launcher:cellWidth="80dip" - launcher:cellHeight="100dip" + launcher:cellWidth="@dimen/workspace_cell_width" + launcher:cellHeight="@dimen/workspace_cell_height" launcher:longAxisStartPadding="0dip" launcher:longAxisEndPadding="55dip" launcher:shortAxisStartPadding="0dip" diff --git a/res/raw/rollo.c b/res/raw/rollo.c index 70d39545e..5ed562a48 100644 --- a/res/raw/rollo.c +++ b/res/raw/rollo.c @@ -128,12 +128,12 @@ int main(void* con, int ft, int launchID) if (alpha > 0) { color(1.0f, 1.0f, 1.0f, alpha); - float ty = 605.f - y * 150.f; + 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 + 32.f, 0.5f); + drawRect(tx, ty, tx + 128.f, ty + 64.f, 0.5f); } iconCount--; index++; diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml new file mode 100644 index 000000000..a9d5082f7 --- /dev/null +++ b/res/values-land/dimens.xml @@ -0,0 +1,20 @@ + + + + + 106dip + 73dip + diff --git a/res/values-port/dimens.xml b/res/values-port/dimens.xml new file mode 100644 index 000000000..65a3fd3e4 --- /dev/null +++ b/res/values-port/dimens.xml @@ -0,0 +1,20 @@ + + + + + 80dip + 100dip + diff --git a/src/com/android/launcher2/AllAppsView.java b/src/com/android/launcher2/AllAppsView.java index dc242203f..7bf0c7c6b 100644 --- a/src/com/android/launcher2/AllAppsView.java +++ b/src/com/android/launcher2/AllAppsView.java @@ -40,7 +40,6 @@ 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; @@ -232,6 +231,7 @@ public class AllAppsView extends RSSurfaceView { } 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; @@ -243,7 +243,6 @@ public class AllAppsView extends RSSurfaceView { public static final int STATE_COUNT = 8; public static final int STATE_TOUCH = 9; - public RolloRS() { } @@ -253,6 +252,7 @@ public class AllAppsView extends RSSurfaceView { mWidth = width; mHeight = height; initNamed(); + initIcons(29); initRS(); } @@ -297,15 +297,15 @@ public class AllAppsView extends RSSurfaceView { private ProgramVertex.MatrixAllocation mPVAlloc; private ProgramVertex mPVOrtho; private ProgramVertex.MatrixAllocation mPVOrthoAlloc; - private Allocation[] mIcons; - private Allocation[] mLabels; private int[] mAllocStateBuf; private Allocation mAllocState; + private Allocation[] mIcons; private int[] mAllocIconIDBuf; private Allocation mAllocIconID; + private Allocation[] mLabels; private int[] mAllocLabelIDBuf; private Allocation mAllocLabelID; @@ -377,52 +377,48 @@ public class AllAppsView extends RSSurfaceView { mAllocScratch.data(mAllocScratchBuf); Log.e("rs", "Done loading named"); + } + + private void initIcons(int count) { + mIcons = new Allocation[count]; + mAllocIconIDBuf = new int[count]; + mAllocIconID = Allocation.createSized(mRS, + Element.USER_I32, mAllocIconIDBuf.length); + + mLabels = new Allocation[count]; + mAllocLabelIDBuf = new int[mLabels.length]; + mAllocLabelID = Allocation.createSized(mRS, + Element.USER_I32, mLabels.length); + + Element ie8888 = Element.RGBA_8888; + + final Utilities.BubbleText bubble = new Utilities.BubbleText(getContext()); + + for (int i=0; i