Methods Summary |
---|
public boolean | canChildBeDismissed(android.view.View v)
return true;
|
public boolean | canChildBeExpanded(android.view.View v)
return mHeadsUp != null && mHeadsUp.row == v && mHeadsUp.row.isExpandable();
|
public void | clear()Discard the Heads Up notification.
mHeadsUp = null;
mBar.scheduleHeadsUpClose();
|
public void | dismiss()Respond to dismissal of the Heads Up window.
if (mHeadsUp == null) return;
if (mHeadsUp.notification.isClearable()) {
mBar.onNotificationClear(mHeadsUp.notification);
} else {
release();
}
mHeadsUp = null;
mBar.scheduleHeadsUpClose();
|
public void | escalate()
mBar.scheduleHeadsUpEscalation();
|
public void | expansionStateChanged(boolean isExpanding)
|
public com.android.systemui.statusbar.ExpandableView | getChildAtPosition(float x, float y)
return mHeadsUp == null ? null : mHeadsUp.row;
|
public android.view.View | getChildAtPosition(android.view.MotionEvent ev)
return mContentHolder;
|
public com.android.systemui.statusbar.ExpandableView | getChildAtRawPosition(float x, float y)
return getChildAtPosition(x, y);
|
public android.view.View | getChildContentView(android.view.View v)
return mContentHolder;
|
public NotificationData.Entry | getEntry()
return mHeadsUp;
|
public float | getFalsingThresholdFactor()
return 1.0f;
|
public android.view.ViewGroup | getHolder()
return mContentHolder;
|
public java.lang.String | getKey()
return mHeadsUp == null ? null : mHeadsUp.notification.getKey();
|
public boolean | isAntiFalsingNeeded()
return false;
|
public boolean | isClearable()
return mHeadsUp == null || mHeadsUp.notification.isClearable();
|
public boolean | isShowing(java.lang.String key)
return mHeadsUp != null && mHeadsUp.key.equals(key);
|
public boolean | isSnoozed(java.lang.String packageName)
final String key = snoozeKey(packageName, mUser);
Long snoozedUntil = mSnoozedPackages.get(key);
if (snoozedUntil != null) {
if (snoozedUntil > SystemClock.elapsedRealtime()) {
if (DEBUG) Log.v(TAG, key + " snoozed");
return true;
}
mSnoozedPackages.remove(packageName);
}
return false;
|
public void | onAttachedToWindow()
final ViewConfiguration viewConfiguration = ViewConfiguration.get(getContext());
float touchSlop = viewConfiguration.getScaledTouchSlop();
mSwipeHelper = new SwipeHelper(SwipeHelper.X, this, getContext());
mSwipeHelper.setMaxSwipeProgress(mMaxAlpha);
mEdgeSwipeHelper = new EdgeSwipeHelper(touchSlop);
int minHeight = getResources().getDimensionPixelSize(R.dimen.notification_min_height);
int maxHeight = getResources().getDimensionPixelSize(R.dimen.notification_max_height);
mContentHolder = (ViewGroup) findViewById(R.id.content_holder);
mContentHolder.setOutlineProvider(CONTENT_HOLDER_OUTLINE_PROVIDER);
mSnoozeLengthMs = Settings.Global.getInt(mContext.getContentResolver(),
SETTING_HEADS_UP_SNOOZE_LENGTH_MS, mDefaultSnoozeLengthMs);
mSettingsObserver = new ContentObserver(getHandler()) {
@Override
public void onChange(boolean selfChange) {
final int packageSnoozeLengthMs = Settings.Global.getInt(
mContext.getContentResolver(), SETTING_HEADS_UP_SNOOZE_LENGTH_MS, -1);
if (packageSnoozeLengthMs > -1 && packageSnoozeLengthMs != mSnoozeLengthMs) {
mSnoozeLengthMs = packageSnoozeLengthMs;
if (DEBUG) Log.v(TAG, "mSnoozeLengthMs = " + mSnoozeLengthMs);
}
}
};
mContext.getContentResolver().registerContentObserver(
Settings.Global.getUriFor(SETTING_HEADS_UP_SNOOZE_LENGTH_MS), false,
mSettingsObserver);
if (DEBUG) Log.v(TAG, "mSnoozeLengthMs = " + mSnoozeLengthMs);
if (mHeadsUp != null) {
// whoops, we're on already!
showNotification(mHeadsUp);
}
getViewTreeObserver().addOnComputeInternalInsetsListener(this);
|
public void | onBeginDrag(android.view.View v)
|
public void | onChildDismissed(android.view.View v)
Log.v(TAG, "User swiped heads up to dismiss");
mBar.onHeadsUpDismissed();
|
public void | onChildSnappedBack(android.view.View animView)
|
public void | onComputeInternalInsets(ViewTreeObserver.InternalInsetsInfo info)
mContentHolder.getLocationOnScreen(mTmpTwoArray);
info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
info.touchableRegion.set(mTmpTwoArray[0], mTmpTwoArray[1],
mTmpTwoArray[0] + mContentHolder.getWidth(),
mTmpTwoArray[1] + mContentHolder.getHeight());
|
protected void | onConfigurationChanged(android.content.res.Configuration newConfig)
super.onConfigurationChanged(newConfig);
float densityScale = getResources().getDisplayMetrics().density;
mSwipeHelper.setDensityScale(densityScale);
float pagingTouchSlop = ViewConfiguration.get(getContext()).getScaledPagingTouchSlop();
mSwipeHelper.setPagingTouchSlop(pagingTouchSlop);
|
protected void | onDetachedFromWindow()
mContext.getContentResolver().unregisterContentObserver(mSettingsObserver);
|
public void | onDragCancelled(android.view.View v)
mContentHolder.setAlpha(mMaxAlpha); // sometimes this isn't quite reset
|
public void | onDraw(android.graphics.Canvas c)
super.onDraw(c);
if (DEBUG) {
//Log.d(TAG, "onDraw: canvas height: " + c.getHeight() + "px; measured height: "
// + getMeasuredHeight() + "px");
c.save();
c.clipRect(6, 6, c.getWidth() - 6, getMeasuredHeight() - 6,
android.graphics.Region.Op.DIFFERENCE);
c.drawColor(0xFFcc00cc);
c.restore();
}
|
public boolean | onInterceptTouchEvent(android.view.MotionEvent ev)
if (DEBUG) Log.v(TAG, "onInterceptTouchEvent()");
if (SystemClock.elapsedRealtime() < mStartTouchTime) {
return true;
}
return mEdgeSwipeHelper.onInterceptTouchEvent(ev)
|| mSwipeHelper.onInterceptTouchEvent(ev)
|| super.onInterceptTouchEvent(ev);
|
public boolean | onTouchEvent(android.view.MotionEvent ev)
if (SystemClock.elapsedRealtime() < mStartTouchTime) {
return false;
}
mBar.resetHeadsUpDecayTimer();
return mEdgeSwipeHelper.onTouchEvent(ev)
|| mSwipeHelper.onTouchEvent(ev)
|| super.onTouchEvent(ev);
|
protected void | onVisibilityChanged(android.view.View changedView, int visibility)
super.onVisibilityChanged(changedView, visibility);
if (changedView.getVisibility() == VISIBLE) {
sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
}
|
public void | release()Push any current Heads Up notification down into the shade.
if (mHeadsUp != null) {
mBar.displayNotificationFromHeadsUp(mHeadsUp.notification);
}
mHeadsUp = null;
|
public void | releaseAndClose()
release();
mBar.scheduleHeadsUpClose();
|
public void | setBar(com.android.systemui.statusbar.phone.PhoneStatusBar bar)
mBar = bar;
|
public void | setUser(int user)
mUser = user;
|
public void | setUserExpandedChild(android.view.View v, boolean userExpanded)
if (mHeadsUp != null && mHeadsUp.row == v) {
mHeadsUp.row.setUserExpanded(userExpanded);
}
|
public void | setUserLockedChild(android.view.View v, boolean userLocked)
if (mHeadsUp != null && mHeadsUp.row == v) {
mHeadsUp.row.setUserLocked(userLocked);
}
|
public boolean | showNotification(NotificationData.Entry headsUp)
if (mHeadsUp != null && headsUp != null && !mHeadsUp.key.equals(headsUp.key)) {
// bump any previous heads up back to the shade
release();
}
mHeadsUp = headsUp;
if (mContentHolder != null) {
mContentHolder.removeAllViews();
}
if (mHeadsUp != null) {
mMostRecentPackageName = mHeadsUp.notification.getPackageName();
mHeadsUp.row.setSystemExpanded(true);
mHeadsUp.row.setSensitive(false);
mHeadsUp.row.setHeadsUp(true);
mHeadsUp.row.setHideSensitive(
false, false /* animated */, 0 /* delay */, 0 /* duration */);
if (mContentHolder == null) {
// too soon!
return false;
}
mContentHolder.setX(0);
mContentHolder.setVisibility(View.VISIBLE);
mContentHolder.setAlpha(mMaxAlpha);
mContentHolder.addView(mHeadsUp.row);
sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
mSwipeHelper.snapChild(mContentHolder, 1f);
mStartTouchTime = SystemClock.elapsedRealtime() + mTouchSensitivityDelay;
mHeadsUp.setInterruption();
// 2. Animate mHeadsUpNotificationView in
mBar.scheduleHeadsUpOpen();
// 3. Set alarm to age the notification off
mBar.resetHeadsUpDecayTimer();
}
return true;
|
private void | snooze()
if (mMostRecentPackageName != null) {
mSnoozedPackages.put(snoozeKey(mMostRecentPackageName, mUser),
SystemClock.elapsedRealtime() + mSnoozeLengthMs);
}
releaseAndClose();
|
private static java.lang.String | snoozeKey(java.lang.String packageName, int user)
return user + "," + packageName;
|
public void | updateResources()
if (mContentHolder != null) {
final LayoutParams lp = (LayoutParams) mContentHolder.getLayoutParams();
lp.width = getResources().getDimensionPixelSize(R.dimen.notification_panel_width);
lp.gravity = getResources().getInteger(R.integer.notification_panel_layout_gravity);
mContentHolder.setLayoutParams(lp);
}
|
public boolean | updateSwipeProgress(android.view.View animView, boolean dismissable, float swipeProgress)
getBackground().setAlpha((int) (255 * swipeProgress));
return false;
|