Search in sources :

Example 76 with RotateAnimation

use of android.view.animation.RotateAnimation in project Signal-Android by WhisperSystems.

the class CameraXFragment method initializeFlipButton.

@SuppressLint({ "MissingPermission" })
private void initializeFlipButton(@NonNull View flipButton, @NonNull CameraXFlashToggleView flashButton) {
    if (getContext() == null) {
        Log.w(TAG, "initializeFlipButton called either before or after fragment was attached.");
        return;
    }
    if (camera.hasCameraWithLensFacing(CameraSelector.LENS_FACING_FRONT) && camera.hasCameraWithLensFacing(CameraSelector.LENS_FACING_BACK)) {
        flipButton.setVisibility(View.VISIBLE);
        flipButton.setOnClickListener(v -> {
            camera.toggleCamera();
            TextSecurePreferences.setDirectCaptureCameraId(getContext(), CameraXUtil.toCameraDirectionInt(camera.getCameraLensFacing()));
            Animation animation = new RotateAnimation(0, -180, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);
            animation.setDuration(200);
            animation.setInterpolator(new DecelerateInterpolator());
            flipButton.startAnimation(animation);
            flashButton.setAutoFlashEnabled(camera.hasFlash());
            flashButton.setFlash(camera.getFlash());
        });
        GestureDetector gestureDetector = new GestureDetector(requireContext(), new GestureDetector.SimpleOnGestureListener() {

            @Override
            public boolean onDoubleTap(MotionEvent e) {
                if (flipButton.isEnabled()) {
                    flipButton.performClick();
                }
                return true;
            }
        });
        camera.setOnTouchListener((v, event) -> gestureDetector.onTouchEvent(event));
    } else {
        flipButton.setVisibility(View.GONE);
    }
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) RotateAnimation(android.view.animation.RotateAnimation) Animation(android.view.animation.Animation) RotateAnimation(android.view.animation.RotateAnimation) GestureDetector(android.view.GestureDetector) MotionEvent(android.view.MotionEvent) SuppressLint(android.annotation.SuppressLint)

Example 77 with RotateAnimation

use of android.view.animation.RotateAnimation in project XRecyclerView by jianghejie.

the class ArrowRefreshHeader method initView.

private void initView() {
    // 初始情况,设置下拉刷新view高度为0
    mContainer = (LinearLayout) LayoutInflater.from(getContext()).inflate(R.layout.listview_header, null);
    mHeaderRefreshTimeContainer = (LinearLayout) mContainer.findViewById(R.id.header_refresh_time_container);
    LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    lp.setMargins(0, 0, 0, 0);
    this.setLayoutParams(lp);
    this.setPadding(0, 0, 0, 0);
    addView(mContainer, new LayoutParams(LayoutParams.MATCH_PARENT, 0));
    setGravity(Gravity.BOTTOM);
    mArrowImageView = (ImageView) findViewById(R.id.listview_header_arrow);
    mStatusTextView = (TextView) findViewById(R.id.refresh_status_textview);
    // init the progress view
    mProgressBar = (SimpleViewSwitcher) findViewById(R.id.listview_header_progressbar);
    progressView = new AVLoadingIndicatorView(getContext());
    progressView.setIndicatorColor(0xffB5B5B5);
    progressView.setIndicatorId(ProgressStyle.BallSpinFadeLoader);
    if (mProgressBar != null)
        mProgressBar.setView(progressView);
    mRotateUpAnim = new RotateAnimation(0.0f, -180.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    mRotateUpAnim.setDuration(ROTATE_ANIM_DURATION);
    mRotateUpAnim.setFillAfter(true);
    mRotateDownAnim = new RotateAnimation(-180.0f, 0.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    mRotateDownAnim.setDuration(ROTATE_ANIM_DURATION);
    mRotateDownAnim.setFillAfter(true);
    mHeaderTimeView = (TextView) findViewById(R.id.last_refresh_time);
    measure(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    mMeasuredHeight = getMeasuredHeight();
}
Also used : RotateAnimation(android.view.animation.RotateAnimation) AVLoadingIndicatorView(com.jcodecraeer.xrecyclerview.progressindicator.AVLoadingIndicatorView)

Example 78 with RotateAnimation

use of android.view.animation.RotateAnimation in project StickyHeaderListView by sfsheng0322.

the class FilterView method rotateArrowDownAnimation.

// 旋转箭头向下
public static void rotateArrowDownAnimation(final ImageView iv) {
    if (iv == null)
        return;
    RotateAnimation animation = new RotateAnimation(180f, 0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    animation.setDuration(200);
    animation.setFillAfter(true);
    iv.startAnimation(animation);
}
Also used : RotateAnimation(android.view.animation.RotateAnimation)

Example 79 with RotateAnimation

use of android.view.animation.RotateAnimation in project ABPlayer by winkstu.

the class MultiColumnPullToRefreshListView method init.

private void init() {
    setVerticalFadingEdgeEnabled(false);
    headerContainer = (LinearLayout) LayoutInflater.from(getContext()).inflate(R.layout.ptr_header, null);
    header = (RelativeLayout) headerContainer.findViewById(R.id.ptr_id_header);
    text = (TextView) header.findViewById(R.id.ptr_id_text);
    lastUpdatedTextView = (TextView) header.findViewById(R.id.ptr_id_last_updated);
    image = (ImageView) header.findViewById(R.id.ptr_id_image);
    refreshingIcon = header.findViewById(R.id.ptr_id_spinner);
    pullToRefreshText = getContext().getString(R.string.ptr_pull_to_refresh);
    releaseToRefreshText = getContext().getString(R.string.ptr_release_to_refresh);
    refreshingText = getContext().getString(R.string.ptr_refreshing);
    lastUpdatedText = getContext().getString(R.string.ptr_last_updated);
    flipAnimation = new RotateAnimation(0, -180, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);
    flipAnimation.setInterpolator(new LinearInterpolator());
    flipAnimation.setDuration(ROTATE_ARROW_ANIMATION_DURATION);
    flipAnimation.setFillAfter(true);
    reverseFlipAnimation = new RotateAnimation(-180, 0, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);
    reverseFlipAnimation.setInterpolator(new LinearInterpolator());
    reverseFlipAnimation.setDuration(ROTATE_ARROW_ANIMATION_DURATION);
    reverseFlipAnimation.setFillAfter(true);
    refreshingAnimation = new RotateAnimation(0, 720, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);
    refreshingAnimation.setDuration(1200);
    refreshingAnimation.setInterpolator(new LinearInterpolator());
    refreshingAnimation.setRepeatCount(Integer.MAX_VALUE);
    refreshingAnimation.setRepeatMode(Animation.RESTART);
    addHeaderView(headerContainer);
    setState(State.PULL_TO_REFRESH);
    scrollbarEnabled = isVerticalScrollBarEnabled();
    ViewTreeObserver vto = header.getViewTreeObserver();
    vto.addOnGlobalLayoutListener(new PTROnGlobalLayoutListener());
// super.setOnItemClickListener(new PTROnItemClickListener());
// super.setOnItemLongClickListener(new PTROnItemLongClickListener());
}
Also used : RotateAnimation(android.view.animation.RotateAnimation) LinearInterpolator(android.view.animation.LinearInterpolator) ViewTreeObserver(android.view.ViewTreeObserver)

Example 80 with RotateAnimation

use of android.view.animation.RotateAnimation in project SmartAndroidSource by jaychou2012.

the class AutoReFreshListView method initPullImageAnimation.

/**
 * 实锟斤拷锟斤拷锟斤拷刷锟铰的硷拷头锟侥讹拷锟斤拷效锟斤拷
 */
private void initPullImageAnimation(final int pAnimDuration) {
    int _Duration;
    if (pAnimDuration > 0) {
        _Duration = pAnimDuration;
    } else {
        _Duration = 250;
    }
    // Interpolator _Interpolator;
    // switch (pAnimType) {
    // case 0:
    // _Interpolator = new AccelerateDecelerateInterpolator();
    // break;
    // case 1:
    // _Interpolator = new AccelerateInterpolator();
    // break;
    // case 2:
    // _Interpolator = new AnticipateInterpolator();
    // break;
    // case 3:
    // _Interpolator = new AnticipateOvershootInterpolator();
    // break;
    // case 4:
    // _Interpolator = new BounceInterpolator();
    // break;
    // case 5:
    // _Interpolator = new CycleInterpolator(1f);
    // break;
    // case 6:
    // _Interpolator = new DecelerateInterpolator();
    // break;
    // case 7:
    // _Interpolator = new OvershootInterpolator();
    // break;
    // default:
    // _Interpolator = new LinearInterpolator();
    // break;
    // }
    Interpolator _Interpolator = new LinearInterpolator();
    mArrowAnim = new RotateAnimation(0, -180, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);
    mArrowAnim.setInterpolator(_Interpolator);
    mArrowAnim.setDuration(_Duration);
    mArrowAnim.setFillAfter(true);
    mArrowReverseAnim = new RotateAnimation(-180, 0, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);
    mArrowReverseAnim.setInterpolator(_Interpolator);
    mArrowReverseAnim.setDuration(_Duration);
    mArrowReverseAnim.setFillAfter(true);
}
Also used : RotateAnimation(android.view.animation.RotateAnimation) LinearInterpolator(android.view.animation.LinearInterpolator) Interpolator(android.view.animation.Interpolator) LinearInterpolator(android.view.animation.LinearInterpolator)

Aggregations

RotateAnimation (android.view.animation.RotateAnimation)117 LinearInterpolator (android.view.animation.LinearInterpolator)39 Animation (android.view.animation.Animation)30 AnimationSet (android.view.animation.AnimationSet)24 ImageView (android.widget.ImageView)18 ScaleAnimation (android.view.animation.ScaleAnimation)17 View (android.view.View)16 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)16 TextView (android.widget.TextView)16 AlphaAnimation (android.view.animation.AlphaAnimation)13 TranslateAnimation (android.view.animation.TranslateAnimation)9 Context (android.content.Context)5 LinearLayout (android.widget.LinearLayout)5 SuppressLint (android.annotation.SuppressLint)4 Intent (android.content.Intent)4 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)4 IOException (java.io.IOException)4 Paint (android.graphics.Paint)3 Drawable (android.graphics.drawable.Drawable)3 RecyclerView (android.support.v7.widget.RecyclerView)3