Remove useless file
This commit is contained in:
1 parent
86d42dd283
commit
ae7c8199bf
40 files changed
+101
-9432
No files matched your search
@@ -16,18 +16,21 @@
|
||||
|
||||
package com.hippo.effect.ripple;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.annotation.TargetApi;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Paint.Style;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Build;
|
||||
import android.view.animation.Interpolator;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
|
||||
import com.hippo.util.ApiHelper;
|
||||
import com.hippo.util.MathUtils;
|
||||
import com.nineoldandroids.animation.Animator;
|
||||
import com.nineoldandroids.animation.AnimatorListenerAdapter;
|
||||
import com.nineoldandroids.animation.ObjectAnimator;
|
||||
|
||||
/**
|
||||
* Draws a Material ripple.
|
||||
@@ -232,6 +235,7 @@ class Ripple {
|
||||
/**
|
||||
* Starts the enter animation.
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
|
||||
public void enter() {
|
||||
cancel();
|
||||
|
||||
@@ -239,23 +243,26 @@ class Ripple {
|
||||
(1000 * Math.sqrt(mOuterRadius / WAVE_TOUCH_DOWN_ACCELERATION * mDensity) + 0.5);
|
||||
|
||||
final ObjectAnimator radius = ObjectAnimator.ofFloat(this, "radiusGravity", 1);
|
||||
radius.setAutoCancel(true);
|
||||
radius.setDuration(radiusDuration);
|
||||
radius.setInterpolator(LINEAR_INTERPOLATOR);
|
||||
radius.setStartDelay(RIPPLE_ENTER_DELAY);
|
||||
|
||||
final ObjectAnimator cX = ObjectAnimator.ofFloat(this, "xGravity", 1);
|
||||
cX.setAutoCancel(true);
|
||||
cX.setDuration(radiusDuration);
|
||||
cX.setInterpolator(LINEAR_INTERPOLATOR);
|
||||
cX.setStartDelay(RIPPLE_ENTER_DELAY);
|
||||
|
||||
final ObjectAnimator cY = ObjectAnimator.ofFloat(this, "yGravity", 1);
|
||||
cY.setAutoCancel(true);
|
||||
cY.setDuration(radiusDuration);
|
||||
cY.setInterpolator(LINEAR_INTERPOLATOR);
|
||||
cY.setStartDelay(RIPPLE_ENTER_DELAY);
|
||||
|
||||
if (ApiHelper.HAS_AUTO_CANCEL_ON_ANIMATION) {
|
||||
radius.setAutoCancel(true);
|
||||
cX.setAutoCancel(true);
|
||||
cY.setAutoCancel(true);
|
||||
}
|
||||
|
||||
mAnimRadius = radius;
|
||||
mAnimX = cX;
|
||||
mAnimY = cY;
|
||||
@@ -321,28 +328,32 @@ class Ripple {
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
|
||||
private void exitSoftware(int radiusDuration, int opacityDuration) {
|
||||
final ObjectAnimator radiusAnim = ObjectAnimator.ofFloat(this, "radiusGravity", 1);
|
||||
radiusAnim.setAutoCancel(true);
|
||||
radiusAnim.setDuration(radiusDuration);
|
||||
radiusAnim.setInterpolator(DECEL_INTERPOLATOR);
|
||||
|
||||
final ObjectAnimator xAnim = ObjectAnimator.ofFloat(this, "xGravity", 1);
|
||||
xAnim.setAutoCancel(true);
|
||||
xAnim.setDuration(radiusDuration);
|
||||
xAnim.setInterpolator(DECEL_INTERPOLATOR);
|
||||
|
||||
final ObjectAnimator yAnim = ObjectAnimator.ofFloat(this, "yGravity", 1);
|
||||
yAnim.setAutoCancel(true);
|
||||
yAnim.setDuration(radiusDuration);
|
||||
yAnim.setInterpolator(DECEL_INTERPOLATOR);
|
||||
|
||||
final ObjectAnimator opacityAnim = ObjectAnimator.ofFloat(this, "opacity", 0);
|
||||
opacityAnim.setAutoCancel(true);
|
||||
opacityAnim.setDuration(opacityDuration);
|
||||
opacityAnim.setInterpolator(LINEAR_INTERPOLATOR);
|
||||
opacityAnim.addListener(mAnimationListener);
|
||||
|
||||
if (ApiHelper.HAS_AUTO_CANCEL_ON_ANIMATION) {
|
||||
radiusAnim.setAutoCancel(true);
|
||||
xAnim.setAutoCancel(true);
|
||||
yAnim.setAutoCancel(true);
|
||||
opacityAnim.setAutoCancel(true);
|
||||
}
|
||||
|
||||
mAnimRadius = radiusAnim;
|
||||
mAnimOpacity = opacityAnim;
|
||||
mAnimX = xAnim;
|
||||
|
||||
@@ -15,18 +15,21 @@
|
||||
|
||||
package com.hippo.effect.ripple;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.annotation.TargetApi;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Paint.Style;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Build;
|
||||
import android.view.animation.Interpolator;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
|
||||
import com.hippo.util.ApiHelper;
|
||||
import com.hippo.util.MathUtils;
|
||||
import com.nineoldandroids.animation.Animator;
|
||||
import com.nineoldandroids.animation.AnimatorListenerAdapter;
|
||||
import com.nineoldandroids.animation.ObjectAnimator;
|
||||
|
||||
/**
|
||||
* Draws a Material ripple.
|
||||
@@ -153,14 +156,17 @@ class RippleBackground {
|
||||
/**
|
||||
* Starts the enter animation.
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
|
||||
public void enter() {
|
||||
cancel();
|
||||
|
||||
final int outerDuration = (int) (1000 * 1.0f / WAVE_OUTER_OPACITY_ENTER_VELOCITY);
|
||||
final ObjectAnimator outer = ObjectAnimator.ofFloat(this, "outerOpacity", 0, 1);
|
||||
outer.setAutoCancel(true);
|
||||
outer.setDuration(outerDuration);
|
||||
outer.setInterpolator(LINEAR_INTERPOLATOR);
|
||||
if (ApiHelper.HAS_AUTO_CANCEL_ON_ANIMATION) {
|
||||
outer.setAutoCancel(true);
|
||||
}
|
||||
|
||||
mAnimOuterOpacity = outer;
|
||||
|
||||
@@ -211,15 +217,18 @@ class RippleBackground {
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
|
||||
private void exitSoftware(int opacityDuration, int inflectionDuration, int inflectionOpacity) {
|
||||
final ObjectAnimator outerOpacityAnim;
|
||||
if (inflectionDuration > 0) {
|
||||
// Outer opacity continues to increase for a bit.
|
||||
outerOpacityAnim = ObjectAnimator.ofFloat(this,
|
||||
"outerOpacity", inflectionOpacity / 255.0f);
|
||||
outerOpacityAnim.setAutoCancel(true);
|
||||
outerOpacityAnim.setDuration(inflectionDuration);
|
||||
outerOpacityAnim.setInterpolator(LINEAR_INTERPOLATOR);
|
||||
if (ApiHelper.HAS_AUTO_CANCEL_ON_ANIMATION) {
|
||||
outerOpacityAnim.setAutoCancel(true);
|
||||
}
|
||||
|
||||
// Chain the outer opacity exit animation.
|
||||
final int outerDuration = opacityDuration - inflectionDuration;
|
||||
@@ -229,9 +238,11 @@ class RippleBackground {
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
final ObjectAnimator outerFadeOutAnim = ObjectAnimator.ofFloat(
|
||||
RippleBackground.this, "outerOpacity", 0);
|
||||
outerFadeOutAnim.setAutoCancel(true);
|
||||
outerFadeOutAnim.setDuration(outerDuration);
|
||||
outerFadeOutAnim.setInterpolator(LINEAR_INTERPOLATOR);
|
||||
if (ApiHelper.HAS_AUTO_CANCEL_ON_ANIMATION) {
|
||||
outerFadeOutAnim.setAutoCancel(true);
|
||||
}
|
||||
|
||||
mAnimOuterOpacity = outerFadeOutAnim;
|
||||
|
||||
@@ -246,8 +257,10 @@ class RippleBackground {
|
||||
}
|
||||
} else {
|
||||
outerOpacityAnim = ObjectAnimator.ofFloat(this, "outerOpacity", 0);
|
||||
outerOpacityAnim.setAutoCancel(true);
|
||||
outerOpacityAnim.setDuration(opacityDuration);
|
||||
if (ApiHelper.HAS_AUTO_CANCEL_ON_ANIMATION) {
|
||||
outerOpacityAnim.setAutoCancel(true);
|
||||
}
|
||||
}
|
||||
|
||||
mAnimOuterOpacity = outerOpacityAnim;
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
*/
|
||||
package com.hippo.ehviewer.widget;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.support.v4.view.ViewCompat;
|
||||
import android.support.v4.view.ViewPropertyAnimatorCompat;
|
||||
import android.support.v4.view.ViewPropertyAnimatorListener;
|
||||
@@ -21,11 +24,6 @@ import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.RecyclerView.ViewHolder;
|
||||
import android.view.View;
|
||||
|
||||
import com.nineoldandroids.animation.Animator;
|
||||
import com.nineoldandroids.animation.ObjectAnimator;
|
||||
import com.nineoldandroids.animation.ValueAnimator;
|
||||
import com.nineoldandroids.view.ViewHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -215,7 +213,7 @@ public class SearchItemAnimator extends RecyclerView.ItemAnimator {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
animation.removeAllListeners();
|
||||
ViewHelper.setTranslationX(view, 0);
|
||||
view.setTranslationX(0);
|
||||
dispatchRemoveFinished(holder);
|
||||
mRemoveAnimations.remove(holder);
|
||||
dispatchFinishedWhenDone();
|
||||
@@ -238,7 +236,7 @@ public class SearchItemAnimator extends RecyclerView.ItemAnimator {
|
||||
@Override
|
||||
public boolean animateAdd(final ViewHolder holder) {
|
||||
endAnimation(holder);
|
||||
ViewHelper.setAlpha(holder.itemView, 0f);
|
||||
holder.itemView.setAlpha(0f);
|
||||
mPendingAdditions.add(holder);
|
||||
return true;
|
||||
}
|
||||
@@ -265,7 +263,7 @@ public class SearchItemAnimator extends RecyclerView.ItemAnimator {
|
||||
|
||||
@Override
|
||||
public void onAnimationCancel(Animator animation) {
|
||||
ViewHelper.setAlpha(view, 1f);
|
||||
view.setAlpha(1f);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Hippo Seven
|
||||
*
|
||||
* 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
|
||||
* 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.hippo.util;
|
||||
|
||||
import android.os.Build;
|
||||
|
||||
public class ApiHelper {
|
||||
|
||||
public static final boolean HAS_AUTO_CANCEL_ON_ANIMATION =
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2;
|
||||
}
|
||||
@@ -15,9 +15,13 @@
|
||||
|
||||
package com.hippo.widget;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
import android.util.AttributeSet;
|
||||
@@ -25,9 +29,8 @@ import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.hippo.util.ApiHelper;
|
||||
import com.hippo.util.MathUtils;
|
||||
import com.nineoldandroids.animation.Animator;
|
||||
import com.nineoldandroids.animation.ObjectAnimator;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -117,6 +120,7 @@ public class CheckTextView extends TextView implements OnClickListener, Hotspota
|
||||
}
|
||||
};
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
|
||||
private void startAnimator() {
|
||||
ObjectAnimator radiusAnim;
|
||||
if (mChecked) {
|
||||
@@ -126,9 +130,11 @@ public class CheckTextView extends TextView implements OnClickListener, Hotspota
|
||||
radiusAnim = ObjectAnimator.ofFloat(this, "radius",
|
||||
mMaxRadius, 0f);
|
||||
}
|
||||
radiusAnim.setAutoCancel(true);
|
||||
radiusAnim.setDuration(ANIMATION_DURATION); // TODO decide duration according to mMaxRadius
|
||||
radiusAnim.addListener(mAnimatorListener);
|
||||
if (ApiHelper.HAS_AUTO_CANCEL_ON_ANIMATION) {
|
||||
radiusAnim.setAutoCancel(true);
|
||||
}
|
||||
radiusAnim.start();
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
|
||||
package com.hippo.widget;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
@@ -31,9 +34,7 @@ import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.nineoldandroids.animation.Animator;
|
||||
import com.nineoldandroids.animation.AnimatorListenerAdapter;
|
||||
import com.nineoldandroids.animation.ObjectAnimator;
|
||||
import com.hippo.util.ApiHelper;
|
||||
|
||||
// Get code from https://gist.github.com/jromero/233cfd8ef22a8b8c29ea
|
||||
/**
|
||||
@@ -125,20 +126,24 @@ public class FloatLabelEditText extends FrameLayout {
|
||||
/**
|
||||
* Show the label using an animation
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
|
||||
protected void showLabel() {
|
||||
if (mLabel.getVisibility() != View.VISIBLE) {
|
||||
mLabel.setVisibility(View.VISIBLE);
|
||||
|
||||
final ObjectAnimator alphaAnim = ObjectAnimator.ofFloat(mLabel, "alpha",
|
||||
0f, 1f);
|
||||
alphaAnim.setAutoCancel(true);
|
||||
alphaAnim.setDuration(ANIMATION_DURATION);
|
||||
|
||||
final ObjectAnimator translationYAnim = ObjectAnimator.ofFloat(mLabel,
|
||||
"translationY", mLabel.getHeight(), 0f);
|
||||
translationYAnim.setAutoCancel(true);
|
||||
translationYAnim.setDuration(ANIMATION_DURATION);
|
||||
|
||||
if (ApiHelper.HAS_AUTO_CANCEL_ON_ANIMATION) {
|
||||
alphaAnim.setAutoCancel(true);
|
||||
translationYAnim.setAutoCancel(true);
|
||||
}
|
||||
|
||||
alphaAnim.start();
|
||||
translationYAnim.start();
|
||||
}
|
||||
@@ -147,16 +152,15 @@ public class FloatLabelEditText extends FrameLayout {
|
||||
/**
|
||||
* Hide the label using an animation
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
|
||||
protected void hideLabel() {
|
||||
if (mLabel.getVisibility() != View.GONE) {
|
||||
final ObjectAnimator alphaAnim = ObjectAnimator.ofFloat(mLabel, "alpha",
|
||||
1f, 0f);
|
||||
alphaAnim.setAutoCancel(true);
|
||||
alphaAnim.setDuration(ANIMATION_DURATION);
|
||||
|
||||
final ObjectAnimator translationYAnim = ObjectAnimator.ofFloat(mLabel,
|
||||
"translationY", 0f, mLabel.getHeight());
|
||||
translationYAnim.setAutoCancel(true);
|
||||
translationYAnim.setDuration(ANIMATION_DURATION);
|
||||
translationYAnim.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
@@ -165,6 +169,11 @@ public class FloatLabelEditText extends FrameLayout {
|
||||
}
|
||||
});
|
||||
|
||||
if (ApiHelper.HAS_AUTO_CANCEL_ON_ANIMATION) {
|
||||
alphaAnim.setAutoCancel(true);
|
||||
translationYAnim.setAutoCancel(true);
|
||||
}
|
||||
|
||||
alphaAnim.start();
|
||||
translationYAnim.start();
|
||||
}
|
||||
|
||||
@@ -1,110 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 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.hippo.widget;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
/**
|
||||
* Space is a lightweight View subclass that may be used to create gaps between components
|
||||
* in general purpose layouts.
|
||||
*/
|
||||
public final class Space extends View {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
public Space(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Space(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Space(Context context, AttributeSet attrs) {
|
||||
super(context, attrs, 0);
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Space(Context context) {
|
||||
//noinspection NullableProblems
|
||||
super(context, null);
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
if (getVisibility() == VISIBLE) {
|
||||
setVisibility(INVISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw nothing.
|
||||
*
|
||||
* @param canvas an unused parameter.
|
||||
*/
|
||||
@Override
|
||||
public void draw(Canvas canvas) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare to: {@link View#getDefaultSize(int, int)}
|
||||
* If mode is AT_MOST, return the child size instead of the parent size
|
||||
* (unless it is too big).
|
||||
*/
|
||||
private static int getDefaultSize2(int size, int measureSpec) {
|
||||
int result = size;
|
||||
int specMode = MeasureSpec.getMode(measureSpec);
|
||||
int specSize = MeasureSpec.getSize(measureSpec);
|
||||
|
||||
switch (specMode) {
|
||||
case MeasureSpec.UNSPECIFIED:
|
||||
result = size;
|
||||
break;
|
||||
case MeasureSpec.AT_MOST:
|
||||
result = Math.min(size, specSize);
|
||||
break;
|
||||
case MeasureSpec.EXACTLY:
|
||||
result = specSize;
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
setMeasuredDimension(
|
||||
getDefaultSize2(getSuggestedMinimumWidth(), widthMeasureSpec),
|
||||
getDefaultSize2(getSuggestedMinimumHeight(), heightMeasureSpec));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user