Rename notification settings icon row / gear to notification menu row
Test: manual Change-Id: I3a84c5ea180bd1e53495c5a44a93fa1982056174
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<com.android.systemui.statusbar.NotificationSettingsIconRow
|
||||
<com.android.systemui.statusbar.NotificationMenuRow
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:systemui="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
@@ -24,9 +24,9 @@
|
||||
>
|
||||
|
||||
<ViewStub
|
||||
android:layout="@layout/notification_settings_icon_row"
|
||||
android:id="@+id/settings_icon_row_stub"
|
||||
android:inflatedId="@+id/notification_settings_icon_row"
|
||||
android:layout="@layout/notification_menu_row"
|
||||
android:id="@+id/menu_row_stub"
|
||||
android:inflatedId="@+id/notification_menu_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
/>
|
||||
|
||||
@@ -106,11 +106,11 @@
|
||||
<!-- Minimum layouted height of a notification in the statusbar-->
|
||||
<dimen name="min_notification_layout_height">48dp</dimen>
|
||||
|
||||
<!-- Width of the space containing the gear icon behind a notification -->
|
||||
<dimen name="notification_gear_width">64dp</dimen>
|
||||
<!-- Size of the space to place a notification menu item -->
|
||||
<dimen name="notification_menu_icon_size">64dp</dimen>
|
||||
|
||||
<!-- The space around the gear icon displayed behind a notification -->
|
||||
<dimen name="notification_gear_padding">20dp</dimen>
|
||||
<!-- The space around a notification menu item -->
|
||||
<dimen name="notification_menu_icon_padding">20dp</dimen>
|
||||
|
||||
<!-- size at which Notification icons will be drawn in the status bar -->
|
||||
<dimen name="status_bar_icon_drawing_size">17dp</dimen>
|
||||
|
||||
@@ -34,7 +34,7 @@ import android.view.accessibility.AccessibilityEvent;
|
||||
import com.android.systemui.classifier.FalsingManager;
|
||||
import com.android.systemui.plugins.statusbar.NotificationMenuRowProvider.MenuItem;
|
||||
import com.android.systemui.statusbar.FlingAnimationUtils;
|
||||
import com.android.systemui.statusbar.NotificationSettingsIconRow;
|
||||
import com.android.systemui.statusbar.NotificationMenuRow;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -286,8 +286,7 @@ public class SwipeHelper implements Gefingerpoken {
|
||||
final int x = (int) ev.getRawX() - mTmpPos[0];
|
||||
final int y = (int) ev.getRawY() - mTmpPos[1];
|
||||
mLongPressListener.onLongPress(mCurrView, x, y,
|
||||
NotificationSettingsIconRow
|
||||
.getSettingsMenuItem(mContext));
|
||||
NotificationMenuRow.getSettingsMenuItem(mContext));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -118,7 +118,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
|
||||
private int mNotificationColor;
|
||||
private ExpansionLogger mLogger;
|
||||
private String mLoggingKey;
|
||||
private NotificationSettingsIconRow mSettingsIconRow;
|
||||
private NotificationMenuRow mMenuRow;
|
||||
private NotificationGuts mGuts;
|
||||
private NotificationData.Entry mEntry;
|
||||
private StatusBarNotification mStatusBarNotification;
|
||||
@@ -130,7 +130,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
|
||||
private boolean mChildrenExpanded;
|
||||
private boolean mIsSummaryWithChildren;
|
||||
private NotificationChildrenContainer mChildrenContainer;
|
||||
private ViewStub mSettingsIconRowStub;
|
||||
private ViewStub mMenuRowStub;
|
||||
private ViewStub mGutsStub;
|
||||
private boolean mIsSystemChildExpanded;
|
||||
private boolean mIsPinned;
|
||||
@@ -372,8 +372,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
|
||||
|
||||
public void setAppName(String appName) {
|
||||
mAppName = appName;
|
||||
if (mSettingsIconRow != null) {
|
||||
mSettingsIconRow.setAppName(mAppName);
|
||||
if (mMenuRow != null) {
|
||||
mMenuRow.setAppName(mAppName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -442,7 +442,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
|
||||
|
||||
@Override
|
||||
protected boolean handleSlideBack() {
|
||||
if (mSettingsIconRow != null && mSettingsIconRow.isVisible()) {
|
||||
if (mMenuRow != null && mMenuRow.isVisible()) {
|
||||
animateTranslateNotification(0 /* targetLeft */);
|
||||
return true;
|
||||
}
|
||||
@@ -682,16 +682,16 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
|
||||
mGuts.setVisibility(oldGuts.getVisibility());
|
||||
addView(mGuts, index);
|
||||
}
|
||||
if (mSettingsIconRow != null) {
|
||||
View oldSettings = mSettingsIconRow;
|
||||
int settingsIndex = indexOfChild(oldSettings);
|
||||
removeView(oldSettings);
|
||||
mSettingsIconRow = (NotificationSettingsIconRow) LayoutInflater.from(mContext).inflate(
|
||||
R.layout.notification_settings_icon_row, this, false);
|
||||
mSettingsIconRow.setNotificationRowParent(ExpandableNotificationRow.this);
|
||||
mSettingsIconRow.setAppName(mAppName);
|
||||
mSettingsIconRow.setVisibility(oldSettings.getVisibility());
|
||||
addView(mSettingsIconRow, settingsIndex);
|
||||
if (mMenuRow != null) {
|
||||
View oldMenu = mMenuRow;
|
||||
int menuIndex = indexOfChild(oldMenu);
|
||||
removeView(oldMenu);
|
||||
mMenuRow = (NotificationMenuRow) LayoutInflater.from(mContext).inflate(
|
||||
R.layout.notification_menu_row, this, false);
|
||||
mMenuRow.setNotificationRowParent(ExpandableNotificationRow.this);
|
||||
mMenuRow.setAppName(mAppName);
|
||||
mMenuRow.setVisibility(oldMenu.getVisibility());
|
||||
addView(mMenuRow, menuIndex);
|
||||
|
||||
}
|
||||
for (NotificationContentView l : mLayouts) {
|
||||
@@ -1012,21 +1012,19 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
|
||||
super.onFinishInflate();
|
||||
mPublicLayout = (NotificationContentView) findViewById(R.id.expandedPublic);
|
||||
mPrivateLayout = (NotificationContentView) findViewById(R.id.expanded);
|
||||
|
||||
mLayouts = new NotificationContentView[] {mPrivateLayout, mPublicLayout};
|
||||
|
||||
for (NotificationContentView l : mLayouts) {
|
||||
l.setExpandClickListener(mExpandClickListener);
|
||||
l.setContainingNotification(this);
|
||||
}
|
||||
|
||||
mSettingsIconRowStub = (ViewStub) findViewById(R.id.settings_icon_row_stub);
|
||||
mSettingsIconRowStub.setOnInflateListener(new ViewStub.OnInflateListener() {
|
||||
mMenuRowStub = (ViewStub) findViewById(R.id.menu_row_stub);
|
||||
mMenuRowStub.setOnInflateListener(new ViewStub.OnInflateListener() {
|
||||
@Override
|
||||
public void onInflate(ViewStub stub, View inflated) {
|
||||
mSettingsIconRow = (NotificationSettingsIconRow) inflated;
|
||||
mSettingsIconRow.setNotificationRowParent(ExpandableNotificationRow.this);
|
||||
mSettingsIconRow.setAppName(mAppName);
|
||||
mMenuRow = (NotificationMenuRow) inflated;
|
||||
mMenuRow.setNotificationRowParent(ExpandableNotificationRow.this);
|
||||
mMenuRow.setAppName(mAppName);
|
||||
}
|
||||
});
|
||||
mGutsStub = (ViewStub) findViewById(R.id.notification_guts_stub);
|
||||
@@ -1057,7 +1055,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
|
||||
mTranslateableViews.add(getChildAt(i));
|
||||
}
|
||||
// Remove views that don't translate
|
||||
mTranslateableViews.remove(mSettingsIconRowStub);
|
||||
mTranslateableViews.remove(mMenuRowStub);
|
||||
mTranslateableViews.remove(mChildrenContainerStub);
|
||||
mTranslateableViews.remove(mGutsStub);
|
||||
}
|
||||
@@ -1072,8 +1070,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
|
||||
}
|
||||
}
|
||||
invalidateOutline();
|
||||
if (mSettingsIconRow != null) {
|
||||
mSettingsIconRow.resetState(true /* notify */);
|
||||
if (mMenuRow != null) {
|
||||
mMenuRow.resetState(true /* notify */);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1100,8 +1098,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
|
||||
}
|
||||
}
|
||||
invalidateOutline();
|
||||
if (mSettingsIconRow != null) {
|
||||
mSettingsIconRow.updateSettingsIcons(translationX, getMeasuredWidth());
|
||||
if (mMenuRow != null) {
|
||||
mMenuRow.updateMenuAlpha(translationX, getMeasuredWidth());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1138,8 +1136,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator anim) {
|
||||
if (!cancelled && mSettingsIconRow != null && leftTarget == 0) {
|
||||
mSettingsIconRow.resetState(true /* notify */);
|
||||
if (!cancelled && mMenuRow != null && leftTarget == 0) {
|
||||
mMenuRow.resetState(true /* notify */);
|
||||
mTranslateAnim = null;
|
||||
}
|
||||
}
|
||||
@@ -1149,17 +1147,17 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
|
||||
}
|
||||
|
||||
public float getSpaceForGear() {
|
||||
if (mSettingsIconRow != null) {
|
||||
return mSettingsIconRow.getSpaceForGear();
|
||||
if (mMenuRow != null) {
|
||||
return mMenuRow.getSpaceForMenu();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public NotificationSettingsIconRow getSettingsRow() {
|
||||
if (mSettingsIconRow == null) {
|
||||
mSettingsIconRowStub.inflate();
|
||||
public NotificationMenuRow getSettingsRow() {
|
||||
if (mMenuRow == null) {
|
||||
mMenuRowStub.inflate();
|
||||
}
|
||||
return mSettingsIconRow;
|
||||
return mMenuRow;
|
||||
}
|
||||
|
||||
public void inflateGuts() {
|
||||
@@ -1434,8 +1432,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
|
||||
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||
super.onLayout(changed, left, top, right, bottom);
|
||||
updateMaxHeights();
|
||||
if (mSettingsIconRow != null) {
|
||||
mSettingsIconRow.updateVerticalLocation();
|
||||
if (mMenuRow != null) {
|
||||
mMenuRow.updateVerticalLocation();
|
||||
}
|
||||
updateContentShiftHeight();
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ import com.android.systemui.plugins.statusbar.NotificationMenuRowProvider;
|
||||
import com.android.systemui.plugins.statusbar.NotificationMenuRowProvider.MenuItem;
|
||||
import com.android.systemui.plugins.statusbar.NotificationMenuRowProvider.OnMenuClickListener;
|
||||
|
||||
public class NotificationSettingsIconRow extends FrameLayout
|
||||
public class NotificationMenuRow extends FrameLayout
|
||||
implements PluginListener<NotificationMenuRowProvider>, View.OnClickListener {
|
||||
|
||||
private static final int ICON_ALPHA_ANIM_DURATION = 200;
|
||||
@@ -49,14 +49,14 @@ public class NotificationSettingsIconRow extends FrameLayout
|
||||
private ArrayList<MenuItem> mMenuItems = new ArrayList<>();
|
||||
|
||||
private ValueAnimator mFadeAnimator;
|
||||
private boolean mSettingsFadedIn = false;
|
||||
private boolean mMenuFadedIn = false;
|
||||
private boolean mAnimating = false;
|
||||
private boolean mOnLeft = true;
|
||||
private boolean mDismissing = false;
|
||||
private boolean mSnapping = false;
|
||||
private boolean mIconPlaced = false;
|
||||
private boolean mIconsPlaced = false;
|
||||
|
||||
private int[] mGearLocation = new int[2];
|
||||
private int[] mIconLocation = new int[2];
|
||||
private int[] mParentLocation = new int[2];
|
||||
|
||||
private float mHorizSpaceForIcon;
|
||||
@@ -67,19 +67,19 @@ public class NotificationSettingsIconRow extends FrameLayout
|
||||
|
||||
private float mAlpha = 0f;
|
||||
|
||||
public NotificationSettingsIconRow(Context context) {
|
||||
public NotificationMenuRow(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public NotificationSettingsIconRow(Context context, AttributeSet attrs) {
|
||||
public NotificationMenuRow(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public NotificationSettingsIconRow(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
public NotificationMenuRow(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
this(context, attrs, defStyleAttr, 0);
|
||||
}
|
||||
|
||||
public NotificationSettingsIconRow(Context context, AttributeSet attrs, int defStyleAttr,
|
||||
public NotificationMenuRow(Context context, AttributeSet attrs, int defStyleAttr,
|
||||
int defStyleRes) {
|
||||
super(context, attrs);
|
||||
PluginManager.getInstance(getContext()).addPluginListener(
|
||||
@@ -91,11 +91,11 @@ public class NotificationSettingsIconRow extends FrameLayout
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
mHorizSpaceForIcon =
|
||||
getResources().getDimensionPixelSize(R.dimen.notification_gear_width);
|
||||
mVertSpaceForIcons = getResources().getDimensionPixelSize(R.dimen.notification_min_height);
|
||||
mIconPadding = getResources().getDimensionPixelSize(R.dimen.notification_gear_padding);
|
||||
mIconTint = getResources().getColor(R.color.notification_gear_color);
|
||||
final Resources res = getResources();
|
||||
mHorizSpaceForIcon = res.getDimensionPixelSize(R.dimen.notification_menu_icon_size);
|
||||
mVertSpaceForIcons = res.getDimensionPixelSize(R.dimen.notification_min_height);
|
||||
mIconPadding = res.getDimensionPixelSize(R.dimen.notification_menu_icon_padding);
|
||||
mIconTint = res.getColor(R.color.notification_gear_color);
|
||||
updateMenu(false /* notify */);
|
||||
}
|
||||
|
||||
@@ -135,25 +135,25 @@ public class NotificationSettingsIconRow extends FrameLayout
|
||||
}
|
||||
|
||||
public void resetState(boolean notify) {
|
||||
setGearAlpha(0f);
|
||||
mIconPlaced = false;
|
||||
mSettingsFadedIn = false;
|
||||
setMenuAlpha(0f);
|
||||
mIconsPlaced = false;
|
||||
mMenuFadedIn = false;
|
||||
mAnimating = false;
|
||||
mSnapping = false;
|
||||
mDismissing = false;
|
||||
setIconLocation(mOnLeft ? 1 : -1 /* on left */);
|
||||
setMenuLocation(mOnLeft ? 1 : -1 /* on left */);
|
||||
if (mListener != null && notify) {
|
||||
mListener.onMenuReset(mParent);
|
||||
}
|
||||
}
|
||||
|
||||
public void setGearListener(OnMenuClickListener listener) {
|
||||
public void setMenuClickListener(OnMenuClickListener listener) {
|
||||
mListener = listener;
|
||||
}
|
||||
|
||||
public void setNotificationRowParent(ExpandableNotificationRow parent) {
|
||||
mParent = parent;
|
||||
setIconLocation(mOnLeft ? 1 : -1);
|
||||
setMenuLocation(mOnLeft ? 1 : -1);
|
||||
}
|
||||
|
||||
public void setAppName(String appName) {
|
||||
@@ -172,10 +172,10 @@ public class NotificationSettingsIconRow extends FrameLayout
|
||||
return mParent;
|
||||
}
|
||||
|
||||
public void setGearAlpha(float alpha) {
|
||||
public void setMenuAlpha(float alpha) {
|
||||
mAlpha = alpha;
|
||||
if (alpha == 0) {
|
||||
mSettingsFadedIn = false; // Can fade in again once it's gone.
|
||||
mMenuFadedIn = false; // Can fade in again once it's gone.
|
||||
setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
setVisibility(View.VISIBLE);
|
||||
@@ -187,22 +187,22 @@ public class NotificationSettingsIconRow extends FrameLayout
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the icons are on the left side of the view or not.
|
||||
* Returns whether the menu is displayed on the left side of the view or not.
|
||||
*/
|
||||
public boolean isIconOnLeft() {
|
||||
public boolean isMenuOnLeft() {
|
||||
return mOnLeft;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the horizontal space in pixels required to display the icons behind a notification.
|
||||
* Returns the horizontal space in pixels required to display the menu.
|
||||
*/
|
||||
public float getSpaceForGear() {
|
||||
public float getSpaceForMenu() {
|
||||
return mHorizSpaceForIcon * getChildCount();
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the gear is visible at 1 alpha. Does not indicate
|
||||
* if entire view is visible.
|
||||
* Indicates whether the menu is visible at 1 alpha. Does not indicate if entire view is
|
||||
* visible.
|
||||
*/
|
||||
public boolean isVisible() {
|
||||
return mAlpha > 0;
|
||||
@@ -214,9 +214,9 @@ public class NotificationSettingsIconRow extends FrameLayout
|
||||
}
|
||||
}
|
||||
|
||||
public void updateSettingsIcons(final float transX, final float size) {
|
||||
if (mAnimating || !mSettingsFadedIn) {
|
||||
// Don't adjust when animating, or if the gear hasn't been shown yet.
|
||||
public void updateMenuAlpha(final float transX, final float size) {
|
||||
if (mAnimating || !mMenuFadedIn) {
|
||||
// Don't adjust when animating, or if the menu hasn't been shown yet.
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -231,18 +231,18 @@ public class NotificationSettingsIconRow extends FrameLayout
|
||||
} else {
|
||||
desiredAlpha = 1 - ((absTrans - fadeThreshold) / (size - fadeThreshold));
|
||||
}
|
||||
setGearAlpha(desiredAlpha);
|
||||
setMenuAlpha(desiredAlpha);
|
||||
}
|
||||
|
||||
public void fadeInSettings(final boolean fromLeft, final float transX,
|
||||
public void fadeInMenu(final boolean fromLeft, final float transX,
|
||||
final float notiThreshold) {
|
||||
if (mDismissing || mAnimating) {
|
||||
return;
|
||||
}
|
||||
if (isIconLocationChange(transX)) {
|
||||
setGearAlpha(0f);
|
||||
if (isMenuLocationChange(transX)) {
|
||||
setMenuAlpha(0f);
|
||||
}
|
||||
setIconLocation((int) transX);
|
||||
setMenuLocation((int) transX);
|
||||
mFadeAnimator = ValueAnimator.ofFloat(mAlpha, 1);
|
||||
mFadeAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||
@Override
|
||||
@@ -251,8 +251,8 @@ public class NotificationSettingsIconRow extends FrameLayout
|
||||
|
||||
boolean pastGear = (fromLeft && transX <= notiThreshold)
|
||||
|| (!fromLeft && absTrans <= notiThreshold);
|
||||
if (pastGear && !mSettingsFadedIn) {
|
||||
setGearAlpha((float) animation.getAnimatedValue());
|
||||
if (pastGear && !mMenuFadedIn) {
|
||||
setMenuAlpha((float) animation.getAnimatedValue());
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -265,13 +265,13 @@ public class NotificationSettingsIconRow extends FrameLayout
|
||||
@Override
|
||||
public void onAnimationCancel(Animator animation) {
|
||||
// TODO should animate back to 0f from current alpha
|
||||
setGearAlpha(0f);
|
||||
setMenuAlpha(0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
mAnimating = false;
|
||||
mSettingsFadedIn = mAlpha == 1;
|
||||
mMenuFadedIn = mAlpha == 1;
|
||||
}
|
||||
});
|
||||
mFadeAnimator.setInterpolator(Interpolators.ALPHA_IN);
|
||||
@@ -283,28 +283,28 @@ public class NotificationSettingsIconRow extends FrameLayout
|
||||
if (mParent == null || mMenuItems.size() == 0) {
|
||||
return;
|
||||
}
|
||||
final int iconHeight = getChildAt(0).getHeight();
|
||||
int parentHeight = mParent.getCollapsedHeight();
|
||||
int translationY;
|
||||
float translationY;
|
||||
if (parentHeight < mVertSpaceForIcons) {
|
||||
translationY = (parentHeight / 2) - (iconHeight / 2);
|
||||
translationY = (parentHeight / 2) - (mHorizSpaceForIcon / 2);
|
||||
} else {
|
||||
translationY = (mVertSpaceForIcons - iconHeight) / 2;
|
||||
translationY = (mVertSpaceForIcons - mHorizSpaceForIcon) / 2;
|
||||
}
|
||||
setTranslationY(translationY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRtlPropertiesChanged(int layoutDirection) {
|
||||
setIconLocation(mOnLeft ? 1 : -1);
|
||||
mIconsPlaced = false;
|
||||
setMenuLocation(mOnLeft ? 1 : -1);
|
||||
}
|
||||
|
||||
public void setIconLocation(int translation) {
|
||||
public void setMenuLocation(int translation) {
|
||||
boolean onLeft = translation > 0;
|
||||
if ((mIconPlaced && onLeft == mOnLeft) || mSnapping || mParent == null) {
|
||||
if ((mIconsPlaced && onLeft == mOnLeft) || mSnapping || mParent == null) {
|
||||
// Do nothing
|
||||
return;
|
||||
}
|
||||
|
||||
final boolean isRtl = mParent.isLayoutRtl();
|
||||
final int count = getChildCount();
|
||||
final int width = getWidth();
|
||||
@@ -319,10 +319,10 @@ public class NotificationSettingsIconRow extends FrameLayout
|
||||
v.setTranslationX(onLeft ? left : right);
|
||||
}
|
||||
mOnLeft = onLeft;
|
||||
mIconPlaced = true;
|
||||
mIconsPlaced = true;
|
||||
}
|
||||
|
||||
public boolean isIconLocationChange(float translation) {
|
||||
public boolean isMenuLocationChange(float translation) {
|
||||
boolean onLeft = translation > mIconPadding;
|
||||
boolean onRight = translation < -mIconPadding;
|
||||
if ((mOnLeft && onRight) || (!mOnLeft && onLeft)) {
|
||||
@@ -345,12 +345,12 @@ public class NotificationSettingsIconRow extends FrameLayout
|
||||
// Nothing to do
|
||||
return;
|
||||
}
|
||||
v.getLocationOnScreen(mGearLocation);
|
||||
v.getLocationOnScreen(mIconLocation);
|
||||
mParent.getLocationOnScreen(mParentLocation);
|
||||
final int centerX = (int) (mHorizSpaceForIcon / 2);
|
||||
final int centerY = (int) (v.getTranslationY() * 2 + v.getHeight()) / 2;
|
||||
final int x = mGearLocation[0] - mParentLocation[0] + centerX;
|
||||
final int y = mGearLocation[1] - mParentLocation[1] + centerY;
|
||||
final int x = mIconLocation[0] - mParentLocation[0] + centerX;
|
||||
final int y = mIconLocation[1] - mParentLocation[1] + centerY;
|
||||
final int index = indexOfChild(v);
|
||||
mListener.onMenuClicked(mParent, x, y, mMenuItems.get(index));
|
||||
}
|
||||
@@ -71,7 +71,7 @@ import com.android.systemui.statusbar.EmptyShadeView;
|
||||
import com.android.systemui.statusbar.ExpandableNotificationRow;
|
||||
import com.android.systemui.statusbar.ExpandableView;
|
||||
import com.android.systemui.statusbar.NotificationGuts;
|
||||
import com.android.systemui.statusbar.NotificationSettingsIconRow;
|
||||
import com.android.systemui.statusbar.NotificationMenuRow;
|
||||
import com.android.systemui.statusbar.NotificationShelf;
|
||||
import com.android.systemui.statusbar.StackScrollerDecorView;
|
||||
import com.android.systemui.statusbar.StatusBarState;
|
||||
@@ -226,7 +226,7 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
private int mMaxScrollAfterExpand;
|
||||
private SwipeHelper.LongPressListener mLongPressListener;
|
||||
|
||||
private NotificationSettingsIconRow mCurrIconRow;
|
||||
private NotificationMenuRow mCurrIconRow;
|
||||
private View mTranslatingParentView;
|
||||
private View mGearExposedView;
|
||||
|
||||
@@ -4127,7 +4127,7 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
if (currView instanceof ExpandableNotificationRow) {
|
||||
// Set the listener for the current row's gear
|
||||
mCurrIconRow = ((ExpandableNotificationRow) currView).getSettingsRow();
|
||||
mCurrIconRow.setGearListener(NotificationStackScrollLayout.this);
|
||||
mCurrIconRow.setMenuClickListener(NotificationStackScrollLayout.this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4139,9 +4139,9 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
mCurrIconRow.setSnapping(false); // If we're moving, we're not snapping.
|
||||
|
||||
// If the gear is visible and the movement is towards it it's not a location change.
|
||||
boolean onLeft = mGearSnappedTo ? mGearSnappedOnLeft : mCurrIconRow.isIconOnLeft();
|
||||
boolean onLeft = mGearSnappedTo ? mGearSnappedOnLeft : mCurrIconRow.isMenuOnLeft();
|
||||
boolean locationChange = isTowardsGear(translation, onLeft)
|
||||
? false : mCurrIconRow.isIconLocationChange(translation);
|
||||
? false : mCurrIconRow.isMenuLocationChange(translation);
|
||||
if (locationChange) {
|
||||
// Don't consider it "snapped" if location has changed.
|
||||
setSnappedToGear(false);
|
||||
@@ -4152,8 +4152,8 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
mCheckForDrag = null;
|
||||
} else {
|
||||
// Check scheduled, reset alpha and update location; check will fade it in
|
||||
mCurrIconRow.setGearAlpha(0f);
|
||||
mCurrIconRow.setIconLocation((int) translation);
|
||||
mCurrIconRow.setMenuAlpha(0f);
|
||||
mCurrIconRow.setMenuLocation((int) translation);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4204,14 +4204,14 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
return false; // Let SwipeHelper handle it.
|
||||
}
|
||||
|
||||
boolean gestureTowardsGear = isTowardsGear(velocity, mCurrIconRow.isIconOnLeft());
|
||||
boolean gestureTowardsGear = isTowardsGear(velocity, mCurrIconRow.isMenuOnLeft());
|
||||
boolean gestureFastEnough = Math.abs(velocity) > getEscapeVelocity();
|
||||
final double timeForGesture = ev.getEventTime() - ev.getDownTime();
|
||||
final boolean showGearForSlowOnGoing = !canChildBeDismissed(animView)
|
||||
&& timeForGesture >= SWIPE_GEAR_TIMING;
|
||||
|
||||
if (mGearSnappedTo && mCurrIconRow.isVisible()) {
|
||||
if (mGearSnappedOnLeft == mCurrIconRow.isIconOnLeft()) {
|
||||
if (mGearSnappedOnLeft == mCurrIconRow.isMenuOnLeft()) {
|
||||
boolean coveringGear =
|
||||
Math.abs(getTranslation(animView)) <= getSpaceForGear(animView) * 0.6f;
|
||||
if (gestureTowardsGear || coveringGear) {
|
||||
@@ -4255,7 +4255,7 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
|
||||
private void snapToGear(View animView, float velocity) {
|
||||
final float snapBackThreshold = getSpaceForGear(animView);
|
||||
final float target = mCurrIconRow.isIconOnLeft() ? snapBackThreshold
|
||||
final float target = mCurrIconRow.isMenuOnLeft() ? snapBackThreshold
|
||||
: -snapBackThreshold;
|
||||
mGearExposedView = mTranslatingParentView;
|
||||
if (animView instanceof ExpandableNotificationRow) {
|
||||
@@ -4286,7 +4286,7 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
final float multiplier = canChildBeDismissed(animView) ? 0.4f : 0.2f;
|
||||
final float snapBackThreshold = getSpaceForGear(animView) * multiplier;
|
||||
final float translation = getTranslation(animView);
|
||||
return !swipedFarEnough() && mCurrIconRow.isVisible() && (mCurrIconRow.isIconOnLeft()
|
||||
return !swipedFarEnough() && mCurrIconRow.isVisible() && (mCurrIconRow.isMenuOnLeft()
|
||||
? translation > snapBackThreshold
|
||||
: translation < -snapBackThreshold);
|
||||
}
|
||||
@@ -4355,7 +4355,7 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
* Indicates the the gear has been snapped to.
|
||||
*/
|
||||
private void setSnappedToGear(boolean snapped) {
|
||||
mGearSnappedOnLeft = (mCurrIconRow != null) ? mCurrIconRow.isIconOnLeft() : false;
|
||||
mGearSnappedOnLeft = (mCurrIconRow != null) ? mCurrIconRow.isMenuOnLeft() : false;
|
||||
mGearSnappedTo = snapped && mCurrIconRow != null;
|
||||
}
|
||||
|
||||
@@ -4395,11 +4395,11 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
final float bounceBackToGearWidth = getSpaceForGear(mTranslatingParentView);
|
||||
final float notiThreshold = getSize(mTranslatingParentView) * 0.4f;
|
||||
if ((mCurrIconRow != null && (!mCurrIconRow.isVisible()
|
||||
|| mCurrIconRow.isIconLocationChange(translation)))
|
||||
|| mCurrIconRow.isMenuLocationChange(translation)))
|
||||
&& absTransX >= bounceBackToGearWidth * 0.4
|
||||
&& absTransX < notiThreshold) {
|
||||
// Fade in the gear
|
||||
mCurrIconRow.fadeInSettings(translation > 0 /* fromLeft */, translation,
|
||||
mCurrIconRow.fadeInMenu(translation > 0 /* fromLeft */, translation,
|
||||
notiThreshold);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user