diff options
author | Joe Onorato <joeo@android.com> | 2009-10-15 21:19:09 -0700 |
---|---|---|
committer | Joe Onorato <joeo@android.com> | 2009-10-15 21:19:09 -0700 |
commit | d63458b34c33c0701d8ce8920b3b77abc6ac0e0f (patch) | |
tree | 1922e3ffa273c535468c2e4a5ede895bb26e9d1b | |
parent | 1d8e7bbe09e130af5e9534cc26a65f623be7a424 (diff) | |
download | packages_apps_trebuchet-d63458b34c33c0701d8ce8920b3b77abc6ac0e0f.zip packages_apps_trebuchet-d63458b34c33c0701d8ce8920b3b77abc6ac0e0f.tar.gz packages_apps_trebuchet-d63458b34c33c0701d8ce8920b3b77abc6ac0e0f.tar.bz2 |
Add pressed states for the all apps button and the home button.
We'll need another asset for the selected state, when we do that.
This also updates the all apps icon to be a grid.
-rw-r--r-- | res/drawable-hdpi/all_apps_button.png | bin | 3200 -> 0 bytes | |||
-rw-r--r-- | res/drawable-hdpi/all_apps_button_normal.png | bin | 0 -> 1536 bytes | |||
-rw-r--r-- | res/drawable-hdpi/all_apps_button_pressed.png | bin | 0 -> 1559 bytes | |||
-rw-r--r-- | res/drawable-hdpi/home_button_normal.png (renamed from res/drawable-hdpi/home_button.png) | bin | 3414 -> 3414 bytes | |||
-rw-r--r-- | res/drawable-hdpi/home_button_pressed.png | bin | 0 -> 3345 bytes | |||
-rw-r--r-- | res/drawable/all_apps_button.xml | 23 | ||||
-rw-r--r-- | res/raw/rollo.c | 2 | ||||
-rw-r--r-- | res/raw/rollo2.c | 2 | ||||
-rw-r--r-- | res/raw/rollo3.c | 2 | ||||
-rw-r--r-- | res/raw/rollo4.c | 2 | ||||
-rw-r--r-- | src/com/android/launcher2/AllAppsView.java | 31 |
11 files changed, 51 insertions, 11 deletions
diff --git a/res/drawable-hdpi/all_apps_button.png b/res/drawable-hdpi/all_apps_button.png Binary files differdeleted file mode 100644 index bb84278..0000000 --- a/res/drawable-hdpi/all_apps_button.png +++ /dev/null diff --git a/res/drawable-hdpi/all_apps_button_normal.png b/res/drawable-hdpi/all_apps_button_normal.png Binary files differnew file mode 100644 index 0000000..c29d3d7 --- /dev/null +++ b/res/drawable-hdpi/all_apps_button_normal.png diff --git a/res/drawable-hdpi/all_apps_button_pressed.png b/res/drawable-hdpi/all_apps_button_pressed.png Binary files differnew file mode 100644 index 0000000..4c64d69 --- /dev/null +++ b/res/drawable-hdpi/all_apps_button_pressed.png diff --git a/res/drawable-hdpi/home_button.png b/res/drawable-hdpi/home_button_normal.png Binary files differindex 40fbbfd..40fbbfd 100644 --- a/res/drawable-hdpi/home_button.png +++ b/res/drawable-hdpi/home_button_normal.png diff --git a/res/drawable-hdpi/home_button_pressed.png b/res/drawable-hdpi/home_button_pressed.png Binary files differnew file mode 100644 index 0000000..392bc66 --- /dev/null +++ b/res/drawable-hdpi/home_button_pressed.png diff --git a/res/drawable/all_apps_button.xml b/res/drawable/all_apps_button.xml new file mode 100644 index 0000000..985bdff --- /dev/null +++ b/res/drawable/all_apps_button.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. +--> + +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_pressed="true" android:drawable="@drawable/all_apps_button_pressed" /> + <item android:state_focused="true" android:state_window_focused="true" android:drawable="@drawable/all_apps_button_pressed" /> + <item android:state_focused="true" android:state_window_focused="false" android:drawable="@drawable/all_apps_button_normal" /> + <item android:drawable="@drawable/all_apps_button_normal" /> +</selector> + diff --git a/res/raw/rollo.c b/res/raw/rollo.c index 2dd17aa..6a41727 100644 --- a/res/raw/rollo.c +++ b/res/raw/rollo.c @@ -301,7 +301,7 @@ void draw_home_button() { color(1.0f, 1.0f, 1.0f, 1.0f); - bindTexture(NAMED_PFTexLinear, 0, params->homeButtonId); + bindTexture(NAMED_PFTexLinear, 0, state->homeButtonId); float scale = 2.0f / SCREEN_WIDTH_PX; diff --git a/res/raw/rollo2.c b/res/raw/rollo2.c index ad7b18f..eb87063 100644 --- a/res/raw/rollo2.c +++ b/res/raw/rollo2.c @@ -246,7 +246,7 @@ void draw_home_button() { color(1.0f, 1.0f, 1.0f, 1.0f); - bindTexture(NAMED_PFTexLinear, 0, params->homeButtonId); + bindTexture(NAMED_PFTexLinear, 0, state->homeButtonId); float scale = 2.0f / SCREEN_WIDTH_PX; diff --git a/res/raw/rollo3.c b/res/raw/rollo3.c index 0fe940e..3c3ebf0 100644 --- a/res/raw/rollo3.c +++ b/res/raw/rollo3.c @@ -233,7 +233,7 @@ void draw_home_button() { setColor(1.0f, 1.0f, 1.0f, 1.0f); - bindTexture(NAMED_PFTexLinear, 0, params->homeButtonId); + bindTexture(NAMED_PFTexLinear, 0, state->homeButtonId); float scale = 2.0f / SCREEN_WIDTH_PX; diff --git a/res/raw/rollo4.c b/res/raw/rollo4.c index b0ea5b0..29b31a3 100644 --- a/res/raw/rollo4.c +++ b/res/raw/rollo4.c @@ -301,7 +301,7 @@ void draw_home_button() { color(1.0f, 1.0f, 1.0f, 1.0f); - bindTexture(NAMED_PFTexLinear, 0, params->homeButtonId); + bindTexture(NAMED_PFTexLinear, 0, state->homeButtonId); float scale = 2.0f / SCREEN_WIDTH_PX; diff --git a/src/com/android/launcher2/AllAppsView.java b/src/com/android/launcher2/AllAppsView.java index b5074b1..6b4eab4 100644 --- a/src/com/android/launcher2/AllAppsView.java +++ b/src/com/android/launcher2/AllAppsView.java @@ -225,6 +225,8 @@ public class AllAppsView extends RSSurfaceView if (y > mRollo.mTouchYBorders[mRollo.mTouchYBorders.length-1]) { mTouchTracking = TRACKING_HOME; + mRollo.setHomeSelected(true); + mRollo.mState.save(); } else { mTouchTracking = TRACKING_FLING; @@ -258,7 +260,8 @@ public class AllAppsView extends RSSurfaceView case MotionEvent.ACTION_MOVE: case MotionEvent.ACTION_OUTSIDE: if (mTouchTracking == TRACKING_HOME) { - // TODO: highlight? + mRollo.setHomeSelected(y > mRollo.mTouchYBorders[mRollo.mTouchYBorders.length-1]); + mRollo.mState.save(); } else if (mTouchTracking == TRACKING_FLING) { int rawX = (int)ev.getRawX(); int rawY = (int)ev.getRawY(); @@ -306,6 +309,8 @@ public class AllAppsView extends RSSurfaceView if (y > mRollo.mTouchYBorders[mRollo.mTouchYBorders.length-1]) { mLauncher.closeAllApps(true); } + mRollo.setHomeSelected(false); + mRollo.mState.save(); } } else if (mTouchTracking == TRACKING_FLING) { mRollo.mState.newTouchDown = 0; @@ -533,7 +538,8 @@ public class AllAppsView extends RSSurfaceView private SimpleMesh mMesh; private SimpleMesh mMesh2; - private Allocation mHomeButton; + private Allocation mHomeButtonNormal; + private Allocation mHomeButtonPressed; private Allocation[] mIcons; private int[] mIconIds; @@ -595,7 +601,6 @@ public class AllAppsView extends RSSurfaceView public int bubbleBitmapWidth; public int bubbleBitmapHeight; - public int homeButtonId; public int homeButtonWidth; public int homeButtonHeight; public int homeButtonTextureWidth; @@ -610,6 +615,7 @@ public class AllAppsView extends RSSurfaceView public int selectedIconIndex = -1; public int selectedIconTexture; public float zoomTarget; + public int homeButtonId; State() { mType = Type.createFromClass(mRS, State.class, 1, "StateClass"); @@ -814,15 +820,19 @@ public class AllAppsView extends RSSurfaceView mParams.bubbleBitmapWidth = bubble.getBitmapWidth(); mParams.bubbleBitmapHeight = bubble.getBitmapHeight(); - mHomeButton = Allocation.createFromBitmapResource(mRS, mRes, - R.drawable.home_button, Element.RGBA_8888(mRS), false); - mHomeButton.uploadToTexture(0); - mParams.homeButtonId = mHomeButton.getID(); + mHomeButtonNormal = Allocation.createFromBitmapResource(mRS, mRes, + R.drawable.home_button_normal, Element.RGBA_8888(mRS), false); + mHomeButtonNormal.uploadToTexture(0); + mHomeButtonPressed = Allocation.createFromBitmapResource(mRS, mRes, + R.drawable.home_button_pressed, Element.RGBA_8888(mRS), false); + mHomeButtonPressed.uploadToTexture(0); mParams.homeButtonWidth = 76; mParams.homeButtonHeight = 68; mParams.homeButtonTextureWidth = 128; mParams.homeButtonTextureHeight = 128; + mState.homeButtonId = mHomeButtonNormal.getID(); + mParams.save(); mState.save(); @@ -1131,6 +1141,13 @@ public class AllAppsView extends RSSurfaceView mState.selectedIconIndex = -1; } + void setHomeSelected(boolean pressed) { + if (pressed) { + mState.homeButtonId = mHomeButtonPressed.getID(); + } else { + mState.homeButtonId = mHomeButtonNormal.getID(); + } + } } } |