Merge changes I674abfcc,Ia40f4c53 into honeycomb-mr1
* changes: When the user touches a peeked notification, reset the fadeout timer. Fix touches on glowing region around panel.
This commit is contained in:
committed by
Android (Google) Code Review
commit
ec1f1f4cfc
@@ -22,7 +22,6 @@
|
|||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:background="@drawable/notify_panel_clock_bg"
|
android:background="@drawable/notify_panel_clock_bg"
|
||||||
android:clickable="true"
|
|
||||||
>
|
>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/icons"
|
android:id="@+id/icons"
|
||||||
|
|||||||
@@ -18,11 +18,15 @@ package com.android.systemui.statusbar.tablet;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
import android.util.Slog;
|
||||||
|
import android.view.MotionEvent;
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
|
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
|
|
||||||
public class NotificationPeekPanel extends RelativeLayout implements StatusBarPanel {
|
public class NotificationPeekPanel extends RelativeLayout implements StatusBarPanel {
|
||||||
|
TabletStatusBar mBar;
|
||||||
|
|
||||||
public NotificationPeekPanel(Context context, AttributeSet attrs) {
|
public NotificationPeekPanel(Context context, AttributeSet attrs) {
|
||||||
this(context, attrs, 0);
|
this(context, attrs, 0);
|
||||||
}
|
}
|
||||||
@@ -39,5 +43,16 @@ public class NotificationPeekPanel extends RelativeLayout implements StatusBarPa
|
|||||||
return x >= l && x < r && y >= t && y < b;
|
return x >= l && x < r && y >= t && y < b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setBar(TabletStatusBar bar) {
|
||||||
|
mBar = bar;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We don't really want to intercept the touch event, but we *do* want to reset the fade timer
|
||||||
|
// in case the user is interacting with some custom controls or something.
|
||||||
|
@Override
|
||||||
|
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||||
|
mBar.resetNotificationPeekFadeTimer();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -217,6 +217,8 @@ public class TabletStatusBar extends StatusBar implements
|
|||||||
// Notification preview window
|
// Notification preview window
|
||||||
mNotificationPeekWindow = (NotificationPeekPanel) View.inflate(context,
|
mNotificationPeekWindow = (NotificationPeekPanel) View.inflate(context,
|
||||||
R.layout.status_bar_notification_peek, null);
|
R.layout.status_bar_notification_peek, null);
|
||||||
|
mNotificationPeekWindow.setBar(this);
|
||||||
|
|
||||||
mNotificationPeekRow = (ViewGroup) mNotificationPeekWindow.findViewById(R.id.content);
|
mNotificationPeekRow = (ViewGroup) mNotificationPeekWindow.findViewById(R.id.content);
|
||||||
mNotificationPeekWindow.setVisibility(View.GONE);
|
mNotificationPeekWindow.setVisibility(View.GONE);
|
||||||
mNotificationPeekWindow.setOnTouchListener(
|
mNotificationPeekWindow.setOnTouchListener(
|
||||||
@@ -1211,10 +1213,20 @@ public class TabletStatusBar extends StatusBar implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class NotificationIconTouchListener implements View.OnTouchListener {
|
final static int NOTIFICATION_PEEK_HOLD_THRESH = 200; // ms
|
||||||
final static int NOTIFICATION_PEEK_HOLD_THRESH = 200; // ms
|
final static int NOTIFICATION_PEEK_FADE_DELAY = 3000; // ms
|
||||||
final static int NOTIFICATION_PEEK_FADE_DELAY = 5000; // ms
|
|
||||||
|
|
||||||
|
public void resetNotificationPeekFadeTimer() {
|
||||||
|
if (DEBUG) {
|
||||||
|
Slog.d(TAG, "setting peek fade timer for " + NOTIFICATION_PEEK_FADE_DELAY
|
||||||
|
+ "ms from now");
|
||||||
|
}
|
||||||
|
mHandler.removeMessages(MSG_CLOSE_NOTIFICATION_PEEK);
|
||||||
|
mHandler.sendEmptyMessageDelayed(MSG_CLOSE_NOTIFICATION_PEEK,
|
||||||
|
NOTIFICATION_PEEK_FADE_DELAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class NotificationIconTouchListener implements View.OnTouchListener {
|
||||||
VelocityTracker mVT;
|
VelocityTracker mVT;
|
||||||
int mPeekIndex;
|
int mPeekIndex;
|
||||||
float mInitialTouchX, mInitialTouchY;
|
float mInitialTouchX, mInitialTouchY;
|
||||||
@@ -1303,8 +1315,7 @@ public class TabletStatusBar extends StatusBar implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (peeking) {
|
if (peeking) {
|
||||||
mHandler.sendEmptyMessageDelayed(MSG_CLOSE_NOTIFICATION_PEEK,
|
resetNotificationPeekFadeTimer();
|
||||||
NOTIFICATION_PEEK_FADE_DELAY);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mVT.recycle();
|
mVT.recycle();
|
||||||
|
|||||||
Reference in New Issue
Block a user