Merge "Introduced fading views for the camera interaction on the lockscreen." into lmp-preview-dev
This commit is contained in:
@@ -130,6 +130,11 @@ public class KeyguardStatusView extends GridLayout {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlappingRendering() {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void updateOwnerInfo() {
|
||||
String ownerInfo = getOwnerInfo();
|
||||
if (!TextUtils.isEmpty(ownerInfo)) {
|
||||
|
||||
@@ -246,7 +246,9 @@ public class KeyguardPageSwipeHelper {
|
||||
private void startHintTranslationAnimations(float target, long duration,
|
||||
Interpolator interpolator) {
|
||||
ArrayList<View> targetViews = mCallback.getTranslationViews();
|
||||
for (View targetView : targetViews) {
|
||||
int length = targetViews.size();
|
||||
for (int i = 0; i < length; i++) {
|
||||
View targetView = targetViews.get(i);
|
||||
targetView.animate()
|
||||
.setDuration(duration)
|
||||
.setInterpolator(interpolator)
|
||||
@@ -259,8 +261,16 @@ public class KeyguardPageSwipeHelper {
|
||||
}
|
||||
|
||||
private void cancelAnimations() {
|
||||
ArrayList<View> targetViews = mCallback.getTranslationViews();
|
||||
for (View target : targetViews) {
|
||||
ArrayList<View> translatingViews = mCallback.getTranslationViews();
|
||||
int length = translatingViews.size();
|
||||
for (int i = 0; i < length; i++) {
|
||||
View target = translatingViews.get(i);
|
||||
target.animate().cancel();
|
||||
}
|
||||
ArrayList<View> fadingViews = mCallback.getFadingViews();
|
||||
length = fadingViews.size();
|
||||
for (int i = 0; i < length; i++) {
|
||||
View target = fadingViews.get(i);
|
||||
target.animate().cancel();
|
||||
}
|
||||
View targetView = mTranslation > 0 ? mLeftIcon : mRightIcon;
|
||||
@@ -291,6 +301,11 @@ public class KeyguardPageSwipeHelper {
|
||||
// translation Animation
|
||||
startTranslationAnimations(vel, target);
|
||||
|
||||
// fade animations
|
||||
if (snapBack) {
|
||||
startFadeInAnimations();
|
||||
}
|
||||
|
||||
// animate left / right icon
|
||||
startIconAnimation(vel, snapBack, target);
|
||||
|
||||
@@ -346,9 +361,20 @@ public class KeyguardPageSwipeHelper {
|
||||
mSwipeAnimator = animator;
|
||||
}
|
||||
|
||||
private void startFadeInAnimations() {
|
||||
ArrayList<View> fadingViews = mCallback.getFadingViews();
|
||||
int length = fadingViews.size();
|
||||
for (int i = 0; i < length; i++) {
|
||||
View targetView = fadingViews.get(i);
|
||||
targetView.animate().alpha(1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
private void startTranslationAnimations(float vel, float target) {
|
||||
ArrayList<View> targetViews = mCallback.getTranslationViews();
|
||||
for (View targetView : targetViews) {
|
||||
int length = targetViews.size();
|
||||
for (int i = 0; i < length; i++) {
|
||||
View targetView = targetViews.get(i);
|
||||
ViewPropertyAnimator animator = targetView.animate();
|
||||
mFlingAnimationUtils.apply(animator, mTranslation, target, vel);
|
||||
animator.translationX(target);
|
||||
@@ -375,8 +401,18 @@ public class KeyguardPageSwipeHelper {
|
||||
translation = leftSwipePossible() ? translation : Math.min(0, translation);
|
||||
if (translation != mTranslation || isReset) {
|
||||
ArrayList<View> translatedViews = mCallback.getTranslationViews();
|
||||
for (View view : translatedViews) {
|
||||
view.setTranslationX(translation);
|
||||
int length = translatedViews.size();
|
||||
for (int i = 0; i < length; i++) {
|
||||
View target = translatedViews.get(i);
|
||||
target.setTranslationX(translation);
|
||||
}
|
||||
float targetAlpha = 1.0f - Math.abs(translation / mMinTranslationAmount);
|
||||
targetAlpha = Math.max(0.0f, targetAlpha);
|
||||
ArrayList<View> fadingViews = mCallback.getFadingViews();
|
||||
length = fadingViews.size();
|
||||
for (int i = 0; i < length; i++) {
|
||||
View view = fadingViews.get(i);
|
||||
view.setAlpha(targetAlpha);
|
||||
}
|
||||
if (translation == 0.0f) {
|
||||
boolean animate = !isReset;
|
||||
@@ -494,6 +530,8 @@ public class KeyguardPageSwipeHelper {
|
||||
|
||||
ArrayList<View> getTranslationViews();
|
||||
|
||||
ArrayList<View> getFadingViews();
|
||||
|
||||
View getLeftIcon();
|
||||
|
||||
View getCenterIcon();
|
||||
|
||||
@@ -108,6 +108,7 @@ public class NotificationPanelView extends PanelView implements
|
||||
private KeyguardBottomAreaView mKeyguardBottomArea;
|
||||
private boolean mBlockTouches;
|
||||
private ArrayList<View> mSwipeTranslationViews = new ArrayList<>();
|
||||
private ArrayList<View> mSwipeFadingViews = new ArrayList<>();
|
||||
|
||||
public NotificationPanelView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
@@ -152,7 +153,7 @@ public class NotificationPanelView extends PanelView implements
|
||||
android.R.interpolator.fast_out_linear_in);
|
||||
mKeyguardBottomArea = (KeyguardBottomAreaView) findViewById(R.id.keyguard_bottom_area);
|
||||
mSwipeTranslationViews.add(mNotificationStackScroller);
|
||||
mSwipeTranslationViews.add(mKeyguardStatusView);
|
||||
mSwipeFadingViews.add(mKeyguardStatusView);
|
||||
mPageSwiper = new KeyguardPageSwipeHelper(this, getContext());
|
||||
}
|
||||
|
||||
@@ -957,6 +958,11 @@ public class NotificationPanelView extends PanelView implements
|
||||
return mSwipeTranslationViews;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<View> getFadingViews() {
|
||||
return mSwipeFadingViews;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getLeftIcon() {
|
||||
return getLayoutDirection() == LAYOUT_DIRECTION_RTL
|
||||
|
||||
Reference in New Issue
Block a user