diff options
author | Jason Sams <rjsams@android.com> | 2010-02-04 16:31:35 -0800 |
---|---|---|
committer | Jason Sams <rjsams@android.com> | 2010-02-04 16:38:48 -0800 |
commit | 7651248dd16d3a1b8ada032f61f5100694e00609 (patch) | |
tree | b4c9b62fba41852973177d336d13d2ce96eed0b7 | |
parent | 374e42a2f0d9798d73fca3e814d890b4e52131d3 (diff) | |
download | android_packages_apps_Trebuchet-7651248dd16d3a1b8ada032f61f5100694e00609.tar.gz android_packages_apps_Trebuchet-7651248dd16d3a1b8ada032f61f5100694e00609.tar.bz2 android_packages_apps_Trebuchet-7651248dd16d3a1b8ada032f61f5100694e00609.zip |
Support rotation of the all apps screen.
-rw-r--r-- | res/raw/allapps.rs | 53 | ||||
-rw-r--r-- | src/com/android/launcher2/AllAppsView.java | 23 |
2 files changed, 56 insertions, 20 deletions
diff --git a/res/raw/allapps.rs b/res/raw/allapps.rs index ab79768fa..1d4aed3c7 100644 --- a/res/raw/allapps.rs +++ b/res/raw/allapps.rs @@ -257,10 +257,21 @@ draw_home_button() { setColor(1.0f, 1.0f, 1.0f, 1.0f); bindTexture(NAMED_PFTexNearest, 0, state->homeButtonId); - float x = (SCREEN_WIDTH_PX - params->homeButtonTextureWidth) / 2; - float y = -g_Animation * params->homeButtonTextureHeight; - y -= 30; // move the house to the edge of the screen as it doesn't fill the texture. + float w = getWidth(); + float h = getHeight(); + + float x; + float y; + if (getWidth() > getHeight()) { + x = w - (params->homeButtonTextureWidth * (1 - g_Animation)) + 20; + y = (h - params->homeButtonTextureHeight) * 0.5f; + } else { + x = (w - params->homeButtonTextureWidth) / 2; + y = -g_Animation * params->homeButtonTextureHeight; + y -= 30; // move the house to the edge of the screen as it doesn't fill the texture. + } + drawSpriteScreenspace(x, y, 0, params->homeButtonTextureWidth, params->homeButtonTextureHeight); } @@ -271,50 +282,58 @@ void drawFrontGrid(float rowOffset, float p) int intRowOffset = rowOffset; float rowFrac = rowOffset - intRowOffset; - float colWidth = getWidth() / 4; + float colWidth = 120.f;//getWidth() / 4; float rowHeight = colWidth + 25.f; float yoff = 0.5f * h + 1.5f * rowHeight; int row, col; - int iconNum = (intRowOffset - 5) * 4; + int colCount = 4; + if (w > h) { + colCount = 6; + rowHeight -= 12.f; + yoff = 0.47f * h + 1.0f * rowHeight; + } + + int iconNum = (intRowOffset - 5) * colCount; + bindProgramVertex(NAMED_PVCurve); - storeF(ALLOC_VP_CONSTANTS, 4, p); + vpConstants->Position.z = p; setColor(1.0f, 1.0f, 1.0f, 1.0f); for (row = -5; row < 15; row++) { float y = yoff - ((-rowFrac + row) * rowHeight); - for (col=0; col < 4; col++) { + for (col=0; col < colCount; col++) { if (iconNum >= state->iconCount) { return; } if (iconNum >= 0) { float x = colWidth * col + (colWidth / 2); - storeF(ALLOC_VP_CONSTANTS, 2, x); + vpConstants->Position.x = x; if (state->selectedIconIndex == iconNum && !p) { bindProgramFragment(NAMED_PFTexNearest); bindTexture(NAMED_PFTexNearest, 0, state->selectedIconTexture); - storeF(ALLOC_VP_CONSTANTS, 0, SELECTION_TEXTURE_WIDTH_PX); - storeF(ALLOC_VP_CONSTANTS, 1, SELECTION_TEXTURE_HEIGHT_PX); - storeF(ALLOC_VP_CONSTANTS, 3, y - (SELECTION_TEXTURE_HEIGHT_PX - ICON_TEXTURE_HEIGHT_PX) * 0.5f); + vpConstants->ImgSize.x = SELECTION_TEXTURE_WIDTH_PX; + vpConstants->ImgSize.y = SELECTION_TEXTURE_HEIGHT_PX; + vpConstants->Position.y = y - (SELECTION_TEXTURE_HEIGHT_PX - ICON_TEXTURE_HEIGHT_PX) * 0.5f; drawSimpleMesh(NAMED_SMCell); } bindProgramFragment(NAMED_PFTexMip); - storeF(ALLOC_VP_CONSTANTS, 0, ICON_TEXTURE_WIDTH_PX); - storeF(ALLOC_VP_CONSTANTS, 1, ICON_TEXTURE_HEIGHT_PX); - storeF(ALLOC_VP_CONSTANTS, 3, y); + vpConstants->ImgSize.x = ICON_TEXTURE_WIDTH_PX; + vpConstants->ImgSize.y = ICON_TEXTURE_HEIGHT_PX; + vpConstants->Position.y = y; bindTexture(NAMED_PFTexMip, 0, loadI32(ALLOC_ICON_IDS, iconNum)); drawSimpleMesh(NAMED_SMCell); bindProgramFragment(NAMED_PFTexMipAlpha); - storeF(ALLOC_VP_CONSTANTS, 0, 128.f); - storeF(ALLOC_VP_CONSTANTS, 1, 64.f); - storeF(ALLOC_VP_CONSTANTS, 3, y - 64.f); + vpConstants->ImgSize.x = 120.f; + vpConstants->ImgSize.y = 64.f; + vpConstants->Position.y = y - 64.f; bindTexture(NAMED_PFTexMipAlpha, 0, loadI32(ALLOC_LABEL_IDS, iconNum)); drawSimpleMesh(NAMED_SMCell); } diff --git a/src/com/android/launcher2/AllAppsView.java b/src/com/android/launcher2/AllAppsView.java index 9b81042b7..a5ad1835d 100644 --- a/src/com/android/launcher2/AllAppsView.java +++ b/src/com/android/launcher2/AllAppsView.java @@ -229,6 +229,23 @@ public class AllAppsView extends RSSurfaceView Resources res = getContext().getResources(); int barHeight = (int)res.getDimension(R.dimen.button_bar_height); + + if (mRollo.mUniformAlloc != null) { + float tf[] = new float[] {72.f, 72.f, + 120.f, 120.f, 0.f, 0.f, + 120.f, 680.f, + (2.f / 480.f), 0, -((float)w / 2) - 0.25f, -380.25f}; + if (w > h) { + tf[6] = 40.f; + tf[7] = h - 40.f; + tf[9] = 1.f; + tf[10] = -((float)w / 2) - 0.25f; + tf[11] = -((float)h / 2) - 0.25f; + } + + mRollo.mUniformAlloc.data(tf); + } + //long endTime = SystemClock.uptimeMillis(); //Log.d(TAG, "surfaceChanged took " + (endTime-startTime) + "ms"); } @@ -893,7 +910,7 @@ public class AllAppsView extends RSSurfaceView SimpleMesh.TriangleMeshBuilder tm = new SimpleMesh.TriangleMeshBuilder(mRS, 2, 0); for (int ct=0; ct < 16; ct++) { - float pos = (1.f / 16.f) * ct; + float pos = (1.f / (16.f - 1)) * ct; tm.addVertex(0.0f, pos); tm.addVertex(1.0f, pos); } @@ -936,10 +953,10 @@ public class AllAppsView extends RSSurfaceView // Animation " float ani = UNI_Position.z;\n" + - " float bendAngle = 47.0 * (3.14 / 180.0);\n" + - " float bendDistance = 50.0;\n" + " float bendY1 = UNI_BendPos.x;\n" + " float bendY2 = UNI_BendPos.y;\n" + + " float bendAngle = 47.0 * (3.14 / 180.0);\n" + + " float bendDistance = bendY1 * 0.4;\n" + " float distanceDimLevel = 0.6;\n" + " float bendStep = (bendAngle / bendDistance) * (bendAngle * 0.5);\n" + |