summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Jurka <mikejurka@google.com>2011-10-13 04:55:35 -0700
committerMichael Jurka <mikejurka@google.com>2011-10-13 05:05:37 -0700
commit5130e401a005fcf6afba6e8e72a628fc45f9a287 (patch)
tree9159c441d9038a0aa5b29b239f032ad62d513bbe /src
parent3f74f0cbc63a1ee264b49d5ca88954ea294b366b (diff)
downloadandroid_packages_apps_Trebuchet-5130e401a005fcf6afba6e8e72a628fc45f9a287.tar.gz
android_packages_apps_Trebuchet-5130e401a005fcf6afba6e8e72a628fc45f9a287.tar.bz2
android_packages_apps_Trebuchet-5130e401a005fcf6afba6e8e72a628fc45f9a287.zip
Move haptic feedback on All Apps button to touch down
Bug #5453040 - Also fixing one case where db cursor wasn't closed Bug #5453040 Change-Id: Id5e8f3c30690160900a6be2cd60c1062ff48ee54
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher2/Hotseat.java12
-rw-r--r--src/com/android/launcher2/Launcher.java20
-rw-r--r--src/com/android/launcher2/LauncherProvider.java3
3 files changed, 32 insertions, 3 deletions
diff --git a/src/com/android/launcher2/Hotseat.java b/src/com/android/launcher2/Hotseat.java
index f1fb6ab1c..f7fa38007 100644
--- a/src/com/android/launcher2/Hotseat.java
+++ b/src/com/android/launcher2/Hotseat.java
@@ -21,6 +21,7 @@ import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.LayoutInflater;
+import android.view.MotionEvent;
import android.view.View;
import android.widget.FrameLayout;
@@ -103,6 +104,17 @@ public class Hotseat extends FrameLayout {
context.getResources().getDrawable(R.drawable.all_apps_button_icon), null, null);
// allAppsButton.setText(context.getString(R.string.all_apps_button_label));
allAppsButton.setContentDescription(context.getString(R.string.all_apps_button_label));
+ allAppsButton.setOnTouchListener(new View.OnTouchListener() {
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ if (mLauncher != null &&
+ (event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_DOWN) {
+ mLauncher.onTouchDownAllAppsButton(v);
+ }
+ return false;
+ }
+ });
+
allAppsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(android.view.View v) {
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 6d95555a1..72ac39079 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -748,8 +748,19 @@ public final class Launcher extends Activity
mAppsCustomizeTabHost.findViewById(R.id.apps_customize_pane_content);
mAppsCustomizeContent.setup(this, dragController);
-
-
+ // Get the all apps button
+ mAllAppsButton = findViewById(R.id.all_apps_button);
+ if (mAllAppsButton != null) {
+ mAllAppsButton.setOnTouchListener(new View.OnTouchListener() {
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ if ((event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_DOWN) {
+ onTouchDownAllAppsButton(v);
+ }
+ return false;
+ }
+ });
+ }
// Setup the drag controller (drop targets have to be added in reverse order in priority)
dragController.setDragScoller(mWorkspace);
dragController.setScrollView(mDragLayer);
@@ -1731,9 +1742,12 @@ public final class Launcher extends Activity
* @param v The view that was clicked.
*/
public void onClickAllAppsButton(View v) {
+ showAllApps(true);
+ }
+
+ public void onTouchDownAllAppsButton(View v) {
// Provide the same haptic feedback that the system offers for virtual keys.
v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
- showAllApps(true);
}
public void onClickAppMarketButton(View v) {
diff --git a/src/com/android/launcher2/LauncherProvider.java b/src/com/android/launcher2/LauncherProvider.java
index 53f7b428b..6cec101ab 100644
--- a/src/com/android/launcher2/LauncherProvider.java
+++ b/src/com/android/launcher2/LauncherProvider.java
@@ -602,6 +602,9 @@ public class LauncherProvider extends ContentProvider {
if (c != null && c.moveToNext()) {
id = c.getLong(maxIdIndex);
}
+ if (c != null) {
+ c.close();
+ }
if (id == -1) {
throw new RuntimeException("Error: could not query max id");