diff options
author | Joe Onorato <joeo@android.com> | 2009-10-28 15:47:49 -0400 |
---|---|---|
committer | Joe Onorato <joeo@android.com> | 2009-10-28 15:47:49 -0400 |
commit | b39e51aee4c044059dd97c20f0c78f982ed9e388 (patch) | |
tree | c5af2faaeae30cf3f9c240d42a8321652863f252 /src/com/android/launcher2/AllAppsView.java | |
parent | 859b3a7453c7b631a34acde4df9bdca680967520 (diff) | |
download | android_packages_apps_Trebuchet-b39e51aee4c044059dd97c20f0c78f982ed9e388.tar.gz android_packages_apps_Trebuchet-b39e51aee4c044059dd97c20f0c78f982ed9e388.tar.bz2 android_packages_apps_Trebuchet-b39e51aee4c044059dd97c20f0c78f982ed9e388.zip |
Fix 2201778 - Key click on all apps
Do it by hand, because the default on click handling doesn't do what we want.
Diffstat (limited to 'src/com/android/launcher2/AllAppsView.java')
-rw-r--r-- | src/com/android/launcher2/AllAppsView.java | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/com/android/launcher2/AllAppsView.java b/src/com/android/launcher2/AllAppsView.java index f5fdd3619..783be9315 100644 --- a/src/com/android/launcher2/AllAppsView.java +++ b/src/com/android/launcher2/AllAppsView.java @@ -54,6 +54,7 @@ import android.util.AttributeSet; import android.util.Log; import android.view.KeyEvent; import android.view.MotionEvent; +import android.view.SoundEffectConstants; import android.view.Surface; import android.view.SurfaceHolder; import android.view.SurfaceView; @@ -132,6 +133,7 @@ public class AllAppsView extends RSSurfaceView public AllAppsView(Context context, AttributeSet attrs) { super(context, attrs); setFocusable(true); + setSoundEffectsEnabled(false); getHolder().setFormat(PixelFormat.TRANSLUCENT); final ViewConfiguration config = ViewConfiguration.get(context); mSlop = config.getScaledTouchSlop(); @@ -143,6 +145,17 @@ public class AllAppsView extends RSSurfaceView getHolder().setFormat(PixelFormat.TRANSLUCENT); } + /** + * If you have an attached click listener, View always plays the click sound!?!? + * Deal with sound effects by hand. + */ + public void reallyPlaySoundEffect(int sound) { + boolean old = isSoundEffectsEnabled(); + setSoundEffectsEnabled(true); + playSoundEffect(sound); + setSoundEffectsEnabled(old); + } + public AllAppsView(Context context, AttributeSet attrs, int defStyle) { this(context, attrs); } @@ -188,7 +201,6 @@ public class AllAppsView extends RSSurfaceView Log.d(TAG, "surfaceChanged took " + (endTime-startTime) + "ms"); } - @Override protected void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect) { super.onFocusChanged(gainFocus, direction, previouslyFocusedRect); @@ -381,6 +393,7 @@ public class AllAppsView extends RSSurfaceView if (mTouchTracking == TRACKING_HOME) { if (action == MotionEvent.ACTION_UP) { if (y > mRollo.mTouchYBorders[mRollo.mTouchYBorders.length-1]) { + reallyPlaySoundEffect(SoundEffectConstants.CLICK); mLauncher.closeAllApps(true); } mRollo.setHomeSelected(false); @@ -415,6 +428,7 @@ public class AllAppsView extends RSSurfaceView } if (mRollo.checkClickOK() && mCurrentIconIndex == mDownIconIndex && mCurrentIconIndex >= 0 && mCurrentIconIndex < mAllAppsList.size()) { + reallyPlaySoundEffect(SoundEffectConstants.CLICK); ApplicationInfo app = mAllAppsList.get(mCurrentIconIndex); mLauncher.startActivitySafely(app.intent); } |