|
1 | 1 | package cn.qqtheme.framework.picker; |
2 | 2 |
|
3 | | -import android.animation.Animator; |
4 | | -import android.animation.AnimatorSet; |
5 | | -import android.animation.ObjectAnimator; |
6 | 3 | import android.app.Activity; |
7 | 4 | import android.support.annotation.ColorInt; |
8 | 5 | import android.support.annotation.FloatRange; |
9 | 6 | import android.support.annotation.IntRange; |
10 | 7 | import android.support.annotation.Nullable; |
11 | 8 | import android.view.View; |
12 | 9 | import android.view.ViewGroup; |
13 | | -import android.view.animation.AccelerateInterpolator; |
14 | 10 | import android.widget.TextView; |
15 | 11 |
|
16 | 12 | import cn.qqtheme.framework.popup.ConfirmPopup; |
|
23 | 19 | * @since 2015/12/22 |
24 | 20 | */ |
25 | 21 | public abstract class WheelPicker extends ConfirmPopup<View> { |
26 | | - protected static final int DURATION = 500;//动画延时,单位为毫秒 |
27 | 22 | protected float lineSpaceMultiplier = WheelView.LINE_SPACE_MULTIPLIER; |
28 | 23 | protected int padding = WheelView.TEXT_PADDING; |
29 | 24 | protected int textSize = WheelView.TEXT_SIZE; |
@@ -216,52 +211,4 @@ protected TextView createLabelView() { |
216 | 211 | return labelView; |
217 | 212 | } |
218 | 213 |
|
219 | | - @Override |
220 | | - protected void showAfter() { |
221 | | - super.showAfter(); |
222 | | - View view = getRootView(); |
223 | | - //使用透明渐变位移动画,缓解选中项显示跳动问题 |
224 | | - ObjectAnimator alpha = ObjectAnimator.ofFloat(view, "alpha", 0, 1); |
225 | | - ObjectAnimator translation = ObjectAnimator.ofFloat(view, "translationY", 300, 0); |
226 | | - AnimatorSet animatorSet = new AnimatorSet(); |
227 | | - animatorSet.playTogether(alpha, translation); |
228 | | - animatorSet.setDuration(DURATION); |
229 | | - animatorSet.setInterpolator(new AccelerateInterpolator()); |
230 | | - animatorSet.start(); |
231 | | - } |
232 | | - |
233 | | - |
234 | | - @Override |
235 | | - public void dismiss() { |
236 | | - View view = getRootView(); |
237 | | - AnimatorSet animatorSet = new AnimatorSet(); |
238 | | - ObjectAnimator alpha = ObjectAnimator.ofFloat(view, "alpha", 1, 0); |
239 | | - ObjectAnimator translation = ObjectAnimator.ofFloat(view, "translationY", 0, 300); |
240 | | - animatorSet.playTogether(alpha, translation); |
241 | | - animatorSet.setDuration(DURATION); |
242 | | - animatorSet.setInterpolator(new AccelerateInterpolator()); |
243 | | - animatorSet.addListener(new Animator.AnimatorListener() { |
244 | | - @Override |
245 | | - public void onAnimationStart(Animator animation) { |
246 | | - |
247 | | - } |
248 | | - |
249 | | - @Override |
250 | | - public void onAnimationEnd(Animator animation) { |
251 | | - dismissImmediately(); |
252 | | - } |
253 | | - |
254 | | - @Override |
255 | | - public void onAnimationCancel(Animator animation) { |
256 | | - |
257 | | - } |
258 | | - |
259 | | - @Override |
260 | | - public void onAnimationRepeat(Animator animation) { |
261 | | - |
262 | | - } |
263 | | - }); |
264 | | - animatorSet.start(); |
265 | | - } |
266 | | - |
267 | 214 | } |
0 commit comments