summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/SwipeHelper.java7
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java19
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java9
4 files changed, 33 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
index 414af89..6584c7d 100644
--- a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
@@ -74,6 +74,7 @@ public class SwipeHelper implements Gefingerpoken {
private boolean mLongPressSent;
private View.OnLongClickListener mLongPressListener;
private Runnable mWatchLongPress;
+ private long mLongPressTimeout;
public SwipeHelper(int swipeDirection, Callback callback, float densityScale,
float pagingTouchSlop) {
@@ -83,6 +84,8 @@ public class SwipeHelper implements Gefingerpoken {
mVelocityTracker = VelocityTracker.obtain();
mDensityScale = densityScale;
mPagingTouchSlop = pagingTouchSlop;
+
+ mLongPressTimeout = (long) (ViewConfiguration.getLongPressTimeout() * 1.5f); // extra long-press!
}
public void setLongPressListener(View.OnLongClickListener listener) {
@@ -180,7 +183,7 @@ public class SwipeHelper implements Gefingerpoken {
}
}
- private void removeLongPressCallback() {
+ public void removeLongPressCallback() {
if (mWatchLongPress != null) {
mHandler.removeCallbacks(mWatchLongPress);
}
@@ -214,7 +217,7 @@ public class SwipeHelper implements Gefingerpoken {
}
};
}
- mHandler.postDelayed(mWatchLongPress, ViewConfiguration.getLongPressTimeout());
+ mHandler.postDelayed(mWatchLongPress, mLongPressTimeout);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 7317c5c..f0db2bc 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -91,6 +91,8 @@ public abstract class BaseStatusBar extends SystemUI implements
protected RecentsPanelView mRecentsPanel;
protected RecentTasksLoader mRecentTasksLoader;
+ protected PopupMenu mNotificationBlamePopup;
+
// UI-specific methods
/**
@@ -238,9 +240,11 @@ public abstract class BaseStatusBar extends SystemUI implements
final String packageNameF = (String) v.getTag();
if (packageNameF == null) return false;
if (v.getWindowToken() == null) return false;
- PopupMenu popup = new PopupMenu(mContext, v);
- popup.getMenuInflater().inflate(R.menu.notification_popup_menu, popup.getMenu());
- popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
+ mNotificationBlamePopup = new PopupMenu(mContext, v);
+ mNotificationBlamePopup.getMenuInflater().inflate(
+ R.menu.notification_popup_menu,
+ mNotificationBlamePopup.getMenu());
+ mNotificationBlamePopup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
if (item.getItemId() == R.id.notification_inspect_item) {
startApplicationDetailsActivity(packageNameF);
@@ -251,13 +255,20 @@ public abstract class BaseStatusBar extends SystemUI implements
return true;
}
});
- popup.show();
+ mNotificationBlamePopup.show();
return true;
}
};
}
+ public void dismissPopups() {
+ if (mNotificationBlamePopup != null) {
+ mNotificationBlamePopup.dismiss();
+ mNotificationBlamePopup = null;
+ }
+ }
+
public void dismissIntruder() {
// pass
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index 3b00300..c1d3c57 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -1247,6 +1247,10 @@ public class PhoneStatusBar extends BaseStatusBar {
return;
}
mExpanded = false;
+
+ // Close any "App info" popups that might have snuck on-screen
+ dismissPopups();
+
if (mPostCollapseCleanup != null) {
mPostCollapseCleanup.run();
mPostCollapseCleanup = null;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java
index 93803d9..03dfd1c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java
@@ -32,6 +32,7 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
+import android.view.inputmethod.InputMethodManager;
import android.widget.LinearLayout;
import com.android.systemui.ExpandHelper;
@@ -108,6 +109,14 @@ public class NotificationRowLayout
mSwipeHelper.setLongPressListener(listener);
}
+ @Override
+ public void onWindowFocusChanged(boolean hasWindowFocus) {
+ super.onWindowFocusChanged(hasWindowFocus);
+ if (!hasWindowFocus) {
+ mSwipeHelper.removeLongPressCallback();
+ }
+ }
+
public void setAnimateBounds(boolean anim) {
mAnimateBounds = anim;
}