Improved the dismiss all animation
Added an AVD to the icon and changed the order to be from bottom to the top. Bug: 17903685 Bug: 17007783 Change-Id: Ia1509e2d4e02c87782285e05b7b7fb6a11854f95
This commit is contained in:
22
packages/SystemUI/res/anim/dismiss_all_shape_animation_1.xml
Normal file
22
packages/SystemUI/res/anim/dismiss_all_shape_animation_1.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<!-- Copyright (C) 2014 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<objectAnimator
|
||||
android:duration="500"
|
||||
android:propertyXName="translateX"
|
||||
android:propertyYName="translateY"
|
||||
android:pathData="M 0,0 c 31.33333,0 156.66667,0 188,0 "
|
||||
android:interpolator="@android:interpolator/fast_out_slow_in" />
|
||||
</set>
|
||||
30
packages/SystemUI/res/anim/dismiss_all_shape_animation_2.xml
Normal file
30
packages/SystemUI/res/anim/dismiss_all_shape_animation_2.xml
Normal file
@@ -0,0 +1,30 @@
|
||||
<!-- Copyright (C) 2014 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<set
|
||||
android:ordering="sequentially" >
|
||||
<objectAnimator
|
||||
android:duration="33"
|
||||
android:propertyXName="translateX"
|
||||
android:propertyYName="translateY"
|
||||
android:pathData="M -12,18 L -12,18" />
|
||||
<objectAnimator
|
||||
android:duration="500"
|
||||
android:propertyXName="translateX"
|
||||
android:propertyYName="translateY"
|
||||
android:pathData="M -12,18 c 31.33333,0 156.66667,0 188,0 "
|
||||
android:interpolator="@android:interpolator/fast_out_slow_in" />
|
||||
</set>
|
||||
</set>
|
||||
30
packages/SystemUI/res/anim/dismiss_all_shape_animation_3.xml
Normal file
30
packages/SystemUI/res/anim/dismiss_all_shape_animation_3.xml
Normal file
@@ -0,0 +1,30 @@
|
||||
<!-- Copyright (C) 2014 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<set
|
||||
android:ordering="sequentially" >
|
||||
<objectAnimator
|
||||
android:duration="67"
|
||||
android:propertyXName="translateX"
|
||||
android:propertyYName="translateY"
|
||||
android:pathData="M -24,36 L -24,36" />
|
||||
<objectAnimator
|
||||
android:duration="500"
|
||||
android:propertyXName="translateX"
|
||||
android:propertyYName="translateY"
|
||||
android:pathData="M -24,36 c 31.33333,0 156.66667,0 188,0 "
|
||||
android:interpolator="@android:interpolator/fast_out_slow_in" />
|
||||
</set>
|
||||
</set>
|
||||
@@ -0,0 +1,31 @@
|
||||
<!-- Copyright (C) 2014 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<set
|
||||
android:ordering="sequentially" >
|
||||
<objectAnimator
|
||||
android:duration="150"
|
||||
android:propertyName="fillAlpha"
|
||||
android:valueFrom="1"
|
||||
android:valueTo="1"
|
||||
android:interpolator="@android:interpolator/linear" />
|
||||
<objectAnimator
|
||||
android:duration="100"
|
||||
android:propertyName="fillAlpha"
|
||||
android:valueFrom="1"
|
||||
android:valueTo="0"
|
||||
android:interpolator="@android:interpolator/linear" />
|
||||
</set>
|
||||
</set>
|
||||
@@ -0,0 +1,31 @@
|
||||
<!-- Copyright (C) 2014 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<set
|
||||
android:ordering="sequentially" >
|
||||
<objectAnimator
|
||||
android:duration="183"
|
||||
android:propertyName="fillAlpha"
|
||||
android:valueFrom="1"
|
||||
android:valueTo="1"
|
||||
android:interpolator="@android:interpolator/linear" />
|
||||
<objectAnimator
|
||||
android:duration="100"
|
||||
android:propertyName="fillAlpha"
|
||||
android:valueFrom="1"
|
||||
android:valueTo="0"
|
||||
android:interpolator="@android:interpolator/linear" />
|
||||
</set>
|
||||
</set>
|
||||
@@ -0,0 +1,31 @@
|
||||
<!-- Copyright (C) 2014 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<set
|
||||
android:ordering="sequentially" >
|
||||
<objectAnimator
|
||||
android:duration="217"
|
||||
android:propertyName="fillAlpha"
|
||||
android:valueFrom="1"
|
||||
android:valueTo="1"
|
||||
android:interpolator="@android:interpolator/linear" />
|
||||
<objectAnimator
|
||||
android:duration="100"
|
||||
android:propertyName="fillAlpha"
|
||||
android:valueFrom="1"
|
||||
android:valueTo="0"
|
||||
android:interpolator="@android:interpolator/linear" />
|
||||
</set>
|
||||
</set>
|
||||
39
packages/SystemUI/res/drawable/dismiss_all_shape.xml
Normal file
39
packages/SystemUI/res/drawable/dismiss_all_shape.xml
Normal file
@@ -0,0 +1,39 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="17dp"
|
||||
android:width="85dp"
|
||||
android:viewportHeight="48"
|
||||
android:viewportWidth="260" >
|
||||
<group
|
||||
android:name="dismiss_all"
|
||||
android:translateX="48"
|
||||
android:translateY="6" >
|
||||
<group
|
||||
android:name="3"
|
||||
android:translateX="-24"
|
||||
android:translateY="36" >
|
||||
<path
|
||||
android:name="rectangle_path_1_2"
|
||||
android:pathData="M -24.0,-6.0 l 48.0,0 l 0,12.0 l -48.0,0 Z"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:fillAlpha="1" />
|
||||
</group>
|
||||
<group
|
||||
android:name="2"
|
||||
android:translateX="-12"
|
||||
android:translateY="18" >
|
||||
<path
|
||||
android:name="rectangle_path_1_1"
|
||||
android:pathData="M -24.0,-6.0 l 48.0,0 l 0,12.0 l -48.0,0 Z"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:fillAlpha="1" />
|
||||
</group>
|
||||
<group
|
||||
android:name="1" >
|
||||
<path
|
||||
android:name="rectangle_path_1"
|
||||
android:pathData="M -24.0,-6.0 l 48.0,0 l 0,12.0 l -48.0,0 Z"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:fillAlpha="1" />
|
||||
</group>
|
||||
</group>
|
||||
</vector>
|
||||
@@ -0,0 +1,21 @@
|
||||
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:drawable="@drawable/dismiss_all_shape" >
|
||||
<target
|
||||
android:name="3"
|
||||
android:animation="@anim/dismiss_all_shape_animation_3" />
|
||||
<target
|
||||
android:name="rectangle_path_1_2"
|
||||
android:animation="@anim/dismiss_all_shape_animation_rectangle_path_1_2" />
|
||||
<target
|
||||
android:name="2"
|
||||
android:animation="@anim/dismiss_all_shape_animation_2" />
|
||||
<target
|
||||
android:name="rectangle_path_1_1"
|
||||
android:animation="@anim/dismiss_all_shape_animation_rectangle_path_1_1" />
|
||||
<target
|
||||
android:name="1"
|
||||
android:animation="@anim/dismiss_all_shape_animation_1" />
|
||||
<target
|
||||
android:name="rectangle_path_1"
|
||||
android:animation="@anim/dismiss_all_shape_animation_rectangle_path_1" />
|
||||
</animated-vector>
|
||||
@@ -1,31 +0,0 @@
|
||||
<!--
|
||||
~ Copyright (C) 2014 The Android Open Source Project
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:autoMirrored="true"
|
||||
android:viewportWidth="48.0"
|
||||
android:viewportHeight="48.0">
|
||||
<path
|
||||
android:fillColor="#ffffff"
|
||||
android:pathData="M8.0,19.994l32.0,0.0l0.0,8.0l-32.0,0.0z"/>
|
||||
<path
|
||||
android:fillColor="#ffffff"
|
||||
android:pathData="M0.0,32.0l32.0,0.0l0.0,7.979l-32.0,0.0z"/>
|
||||
<path
|
||||
android:fillColor="#ffffff"
|
||||
android:pathData="M16.0,8.0l32.0,0.0l0.0,8.0l-32.0,0.0z"/>
|
||||
</vector>
|
||||
@@ -20,13 +20,13 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
>
|
||||
<com.android.systemui.statusbar.DismissViewImageButton
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false">
|
||||
<com.android.systemui.statusbar.DismissViewButton
|
||||
android:id="@+id/dismiss_text"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_gravity="end"
|
||||
android:src="@drawable/ic_dismiss_all"
|
||||
android:background="@drawable/ripple_drawable"
|
||||
android:contentDescription="@string/accessibility_clear_all" />
|
||||
android:contentDescription="@string/accessibility_clear_all"/>
|
||||
</com.android.systemui.statusbar.DismissView>
|
||||
|
||||
@@ -17,12 +17,15 @@
|
||||
package com.android.systemui.statusbar;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
import com.android.systemui.R;
|
||||
|
||||
public class DismissView extends StackScrollerDecorView {
|
||||
private boolean mDismissAllInProgress;
|
||||
private DismissViewButton mDismissButton;
|
||||
|
||||
public DismissView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
@@ -33,6 +36,12 @@ public class DismissView extends StackScrollerDecorView {
|
||||
return findViewById(R.id.dismiss_text);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
mDismissButton = (DismissViewButton) findContentView();
|
||||
}
|
||||
|
||||
public void setOnButtonClickListener(OnClickListener listener) {
|
||||
mContent.setOnClickListener(listener);
|
||||
}
|
||||
@@ -43,4 +52,28 @@ public class DismissView extends StackScrollerDecorView {
|
||||
|| touchY < mContent.getY()
|
||||
|| touchY > mContent.getY() + mContent.getHeight();
|
||||
}
|
||||
|
||||
public void showClearButton() {
|
||||
mDismissButton.showButton();
|
||||
}
|
||||
|
||||
public void setDismissAllInProgress(boolean dismissAllInProgress) {
|
||||
if (dismissAllInProgress) {
|
||||
setClipBounds(null);
|
||||
}
|
||||
mDismissAllInProgress = dismissAllInProgress;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setClipBounds(Rect clipBounds) {
|
||||
if (mDismissAllInProgress) {
|
||||
// we don't want any clipping to happen!
|
||||
return;
|
||||
}
|
||||
super.setClipBounds(clipBounds);
|
||||
}
|
||||
|
||||
public boolean isButtonVisible() {
|
||||
return mDismissButton.isButtonStatic();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License
|
||||
*/
|
||||
|
||||
package com.android.systemui.statusbar;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.AnimatedVectorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.SystemClock;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Choreographer;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewRootImpl;
|
||||
import android.widget.Button;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.statusbar.stack.NotificationStackScrollLayout;
|
||||
|
||||
public class DismissViewButton extends Button {
|
||||
private AnimatedVectorDrawable mAnimatedDismissDrawable;
|
||||
private final Drawable mStaticDismissDrawable;
|
||||
private Drawable mActiveDrawable;
|
||||
|
||||
public DismissViewButton(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public DismissViewButton(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public DismissViewButton(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
this(context, attrs, defStyleAttr, 0);
|
||||
}
|
||||
|
||||
public DismissViewButton(Context context, AttributeSet attrs, int defStyleAttr,
|
||||
int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
mAnimatedDismissDrawable = (AnimatedVectorDrawable) getContext().getResources().getDrawable(
|
||||
R.drawable.dismiss_all_shape_animation).mutate();
|
||||
mAnimatedDismissDrawable.setCallback(this);
|
||||
mAnimatedDismissDrawable.setBounds(0,
|
||||
0,
|
||||
mAnimatedDismissDrawable.getIntrinsicWidth(),
|
||||
mAnimatedDismissDrawable.getIntrinsicHeight());
|
||||
mStaticDismissDrawable = getContext().getResources().getDrawable(
|
||||
R.drawable.dismiss_all_shape);
|
||||
mStaticDismissDrawable.setBounds(0,
|
||||
0,
|
||||
mStaticDismissDrawable.getIntrinsicWidth(),
|
||||
mStaticDismissDrawable.getIntrinsicHeight());
|
||||
mStaticDismissDrawable.setCallback(this);
|
||||
mActiveDrawable = mStaticDismissDrawable;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
canvas.save();
|
||||
int drawableHeight = mActiveDrawable.getBounds().height();
|
||||
boolean isRtl = (getLayoutDirection() == View.LAYOUT_DIRECTION_RTL);
|
||||
int dx = isRtl ? getWidth() / 2 + drawableHeight / 2 : getWidth() / 2 - drawableHeight / 2;
|
||||
canvas.translate(dx, getHeight() / 2.0f + drawableHeight /
|
||||
2.0f);
|
||||
canvas.scale(isRtl ? -1.0f : 1.0f, -1.0f);
|
||||
mActiveDrawable.draw(canvas);
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performClick() {
|
||||
if (!mAnimatedDismissDrawable.isRunning()) {
|
||||
mActiveDrawable = mAnimatedDismissDrawable;
|
||||
mAnimatedDismissDrawable.start();
|
||||
}
|
||||
return super.performClick();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean verifyDrawable(Drawable who) {
|
||||
return super.verifyDrawable(who)
|
||||
|| who == mAnimatedDismissDrawable
|
||||
|| who == mStaticDismissDrawable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlappingRendering() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the drawing rect for the view which is different from the regular
|
||||
* drawing rect, since we layout all children in the {@link NotificationStackScrollLayout} at
|
||||
* position 0 and usually the translation is neglected. The standard implementation doesn't
|
||||
* account for translation.
|
||||
*
|
||||
* @param outRect The (scrolled) drawing bounds of the view.
|
||||
*/
|
||||
@Override
|
||||
public void getDrawingRect(Rect outRect) {
|
||||
super.getDrawingRect(outRect);
|
||||
float translationX = ((ViewGroup) mParent).getTranslationX();
|
||||
float translationY = ((ViewGroup) mParent).getTranslationY();
|
||||
outRect.left += translationX;
|
||||
outRect.right += translationX;
|
||||
outRect.top += translationY;
|
||||
outRect.bottom += translationY;
|
||||
}
|
||||
|
||||
public void showButton() {
|
||||
mActiveDrawable = mStaticDismissDrawable;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Whether the button is currently static and not being animated.
|
||||
*/
|
||||
public boolean isButtonStatic() {
|
||||
return mActiveDrawable == mStaticDismissDrawable;
|
||||
}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License
|
||||
*/
|
||||
|
||||
package com.android.systemui.statusbar;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageButton;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.statusbar.stack.NotificationStackScrollLayout;
|
||||
|
||||
public class DismissViewImageButton extends ImageButton {
|
||||
public DismissViewImageButton(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public DismissViewImageButton(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public DismissViewImageButton(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
public DismissViewImageButton(Context context, AttributeSet attrs, int defStyleAttr,
|
||||
int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the drawing rect for the view which is different from the regular
|
||||
* drawing rect, since we layout all children in the {@link NotificationStackScrollLayout} at
|
||||
* position 0 and usually the translation is neglected. The standard implementation doesn't
|
||||
* account for translation.
|
||||
*
|
||||
* @param outRect The (scrolled) drawing bounds of the view.
|
||||
*/
|
||||
@Override
|
||||
public void getDrawingRect(Rect outRect) {
|
||||
super.getDrawingRect(outRect);
|
||||
float translationX = ((ViewGroup) mParent).getTranslationX();
|
||||
float translationY = ((ViewGroup) mParent).getTranslationY();
|
||||
outRect.left += translationX;
|
||||
outRect.right += translationX;
|
||||
outRect.top += translationY;
|
||||
outRect.bottom += translationY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlappingRendering() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -966,12 +966,12 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
// accelerating the swipes
|
||||
int rowDelayDecrement = 10;
|
||||
int currentDelay = 140;
|
||||
int totalDelay = 0;
|
||||
int totalDelay = 180;
|
||||
int numItems = hideAnimatedList.size();
|
||||
for (int i = 0; i < numItems; i++) {
|
||||
for (int i = numItems - 1; i >= 0; i--) {
|
||||
View view = hideAnimatedList.get(i);
|
||||
Runnable endRunnable = null;
|
||||
if (i == numItems - 1) {
|
||||
if (i == 0) {
|
||||
endRunnable = animationFinishAction;
|
||||
}
|
||||
mStackScroller.dismissViewAnimated(view, endRunnable, totalDelay, 260);
|
||||
|
||||
@@ -1604,6 +1604,12 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
((ExpandableView) child).setOnHeightChangedListener(this);
|
||||
generateAddAnimation(child, false /* fromMoreCard */);
|
||||
updateAnimationState(child);
|
||||
if (canChildBeDismissed(child)) {
|
||||
// Make sure the dismissButton is visible and not in the animated state.
|
||||
// We need to do this to avoid a race where a clearable notification is added after the
|
||||
// dismiss animation is finished
|
||||
mDismissView.showClearButton();
|
||||
}
|
||||
}
|
||||
|
||||
public void setAnimationsEnabled(boolean animationsEnabled) {
|
||||
@@ -2234,8 +2240,7 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
updateContentHeight();
|
||||
notifyHeightChangeListener(mDismissView);
|
||||
} else {
|
||||
mDismissView.setWillBeGone(true);
|
||||
mDismissView.performVisibilityAnimation(false, new Runnable() {
|
||||
Runnable dimissHideFinishRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mDismissView.setVisibility(GONE);
|
||||
@@ -2243,13 +2248,21 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
updateContentHeight();
|
||||
notifyHeightChangeListener(mDismissView);
|
||||
}
|
||||
});
|
||||
};
|
||||
if (mDismissView.isButtonVisible() && mIsExpanded) {
|
||||
mDismissView.setWillBeGone(true);
|
||||
mDismissView.performVisibilityAnimation(false, dimissHideFinishRunnable);
|
||||
} else {
|
||||
dimissHideFinishRunnable.run();
|
||||
mDismissView.showClearButton();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setDismissAllInProgress(boolean dismissAllInProgress) {
|
||||
mDismissAllInProgress = dismissAllInProgress;
|
||||
mDismissView.setDismissAllInProgress(dismissAllInProgress);
|
||||
}
|
||||
|
||||
public boolean isDismissViewNotGone() {
|
||||
|
||||
Reference in New Issue
Block a user