Search in sources :

Example 11 with BounceInterpolator

use of android.view.animation.BounceInterpolator in project ride-read-android by Ride-Read.

the class MapFragment method addSignInMarker.

private void addSignInMarker(LatLng latLng) {
    final Marker marker = addMarker(latLng);
    if (marker != null) {
        final long start = SystemClock.uptimeMillis();
        Projection proj = mAMap.getProjection();
        Point markerPoint = proj.toScreenLocation(latLng);
        markerPoint.offset(0, -500);
        final LatLng startLatLng = proj.fromScreenLocation(markerPoint);
        final long duration = 2000;
        final Interpolator interpolator = new BounceInterpolator();
        mHandler.post(new Runnable() {

            @Override
            public void run() {
                long elapsed = SystemClock.uptimeMillis() - start;
                float t = interpolator.getInterpolation((float) elapsed / duration);
                double lng = t * latLng.longitude + (1 - t) * startLatLng.longitude;
                double lat = t * latLng.latitude + (1 - t) * startLatLng.latitude;
                marker.setPosition(new LatLng(lat, lng));
                if (t < 1.0) {
                    mHandler.postDelayed(this, 16);
                }
            }
        });
    }
    mHandler.postDelayed(() -> {
        mSignInDialogFragment = SignInDialogFragment.newInstance(AMapLocationUtils.getLocDetail());
        mSignInDialogFragment.show(getFragmentManager(), "sign_in");
    }, 1000L);
}
Also used : BounceInterpolator(android.view.animation.BounceInterpolator) Projection(com.amap.api.maps.Projection) BounceInterpolator(android.view.animation.BounceInterpolator) Interpolator(android.view.animation.Interpolator) Marker(com.amap.api.maps.model.Marker) LatLonPoint(com.amap.api.services.core.LatLonPoint) Point(android.graphics.Point) LatLng(com.amap.api.maps.model.LatLng)

Example 12 with BounceInterpolator

use of android.view.animation.BounceInterpolator in project WaveSwipeRefreshLayout by recruit-lifestyle.

the class WaveView method startWaveAnimation.

/**
   * @param h 波が始まる高さ
   */
public void startWaveAnimation(float h) {
    h = Math.min(h, MAX_WAVE_HEIGHT) * mWidth;
    mWaveReverseAnimator = ValueAnimator.ofFloat(h, 0.f);
    mWaveReverseAnimator.setDuration(WAVE_ANIMATOR_DURATION);
    mWaveReverseAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            float h = (Float) valueAnimator.getAnimatedValue();
            mWavePath.moveTo(0, 0);
            mWavePath.quadTo(0.25f * mWidth, 0, 0.333f * mWidth, h * 0.5f);
            mWavePath.quadTo(mWidth * 0.5f, h * 1.4f, 0.666f * mWidth, h * 0.5f);
            mWavePath.quadTo(0.75f * mWidth, 0, mWidth, 0);
            postInvalidate();
        }
    });
    mWaveReverseAnimator.setInterpolator(new BounceInterpolator());
    mWaveReverseAnimator.start();
}
Also used : BounceInterpolator(android.view.animation.BounceInterpolator) ValueAnimator(android.animation.ValueAnimator)

Example 13 with BounceInterpolator

use of android.view.animation.BounceInterpolator in project CurtainView by aicaprio.

the class MainActivity method showSample2.

private void showSample2() {
    setContentView(R.layout.activity_sample2);
    final CurtainView curtainView = (CurtainView) findViewById(R.id.cb1);
    final ImageView iv1 = (ImageView) findViewById(R.id.iv1);
    final GridView gv1 = (GridView) findViewById(R.id.gv1);
    final List<Map<String, Integer>> data = getData();
    gv1.setAdapter(new SimpleAdapter(this, data, R.layout.item_numbers, new String[] { TEXT_TAG }, new int[] { R.id.item_tvNum }));
    gv1.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            showToast(data.get(position).get(TEXT_TAG) + " clicked");
        }
    });
    iv1.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            curtainView.toggleStatus();
        }
    });
    curtainView.setScrollerInterpolator(new BounceInterpolator());
    curtainView.post(new Runnable() {

        @Override
        public void run() {
            curtainView.setCurtainGravityAndFixedValue(null, iv1.getHeight());
        }
    });
}
Also used : BounceInterpolator(android.view.animation.BounceInterpolator) SimpleAdapter(android.widget.SimpleAdapter) GridView(android.widget.GridView) CurtainView(org.aicaprio.curtainview.CurtainView) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) CurtainView(org.aicaprio.curtainview.CurtainView) AdapterView(android.widget.AdapterView) ImageView(android.widget.ImageView) GridView(android.widget.GridView) HashMap(java.util.HashMap) Map(java.util.Map)

Example 14 with BounceInterpolator

use of android.view.animation.BounceInterpolator in project WilliamChart by diogobernardino.

the class BarFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View layout = inflater.inflate(R.layout.fragment_bar, container, false);
    mChart = (BarChartView) layout.findViewById(R.id.chart);
    mFirstStage = true;
    layout.setOnClickListener(this);
    mChart.setOnClickListener(this);
    BarSet dataset = new BarSet(mLabels, mValues[0]);
    dataset.setColor(Color.parseColor("#eb993b"));
    mChart.addData(dataset);
    mChart.setBarSpacing(Tools.fromDpToPx(3));
    mChart.setXLabels(AxisRenderer.LabelPosition.NONE).setYLabels(AxisRenderer.LabelPosition.NONE).setXAxis(false).setYAxis(false);
    mChart.show(new Animation().setInterpolator(new BounceInterpolator()));
    return layout;
}
Also used : BarSet(com.db.chart.model.BarSet) BounceInterpolator(android.view.animation.BounceInterpolator) Animation(com.db.chart.animation.Animation) View(android.view.View) BarChartView(com.db.chart.view.BarChartView)

Example 15 with BounceInterpolator

use of android.view.animation.BounceInterpolator in project BeautifulRefreshLayout by android-cjj.

the class BeautifulRefreshLayout method init.

/**
     * 初始化
     */
private void init(AttributeSet attrs) {
    /**
         * attrs  需要在xml设置什么属性  自己自定义吧  啊哈哈
         */
    /**
         * 初始化headView
         */
    final View headView = LayoutInflater.from(getContext()).inflate(R.layout.view_head, null);
    final WaveView waveView = (WaveView) headView.findViewById(R.id.draweeView);
    final TextView tv_tip = (TextView) headView.findViewById(R.id.tv_tip);
    final RippleView rippleView = (RippleView) headView.findViewById(R.id.ripple);
    final RainView rain = (RainView) headView.findViewById(R.id.rain);
    rain.setVisibility(View.GONE);
    rippleView.setRippleListener(new RippleView.RippleListener() {

        @Override
        public void onRippleFinish() {
            if (listener != null) {
                listener.onRefresh(BeautifulRefreshLayout.this);
            }
        }
    });
    /**
         * 设置波浪的高度
         */
    setWaveHeight(DensityUtil.dip2px(getContext(), waveHeight));
    /**
         * 设置headView的高度
         */
    setHeaderHeight(DensityUtil.dip2px(getContext(), headHeight));
    /**
         * 设置headView
         */
    setHeaderView(headView);
    /**
         * 监听波浪变化监听
         */
    setPullWaveListener(new PullWaveListener() {

        @Override
        public void onPulling(RefreshLayout refreshLayout, float fraction) {
            float headW = DensityUtil.dip2px(getContext(), waveHeight);
            waveView.setHeadHeight((int) (DensityUtil.dip2px(getContext(), headHeight) * limitValue(1, fraction)));
            waveView.setWaveHeight((int) (headW * Math.max(0, fraction - 1)));
            waveView.invalidate();
            if (DensityUtil.dip2px(getContext(), headHeight) > (int) (DensityUtil.dip2px(getContext(), headHeight) * limitValue(1, fraction))) {
                tv_tip.setText("下拉下雨");
            } else {
                tv_tip.setText("松开下雨");
            }
        }

        @Override
        public void onPullReleasing(RefreshLayout refreshLayout, float fraction) {
            if (!refreshLayout.isRefreshing) {
            }
        }
    });
    /**
         * 松开后的监听
         */
    setPullToRefreshListener(new PullToRefreshListener() {

        @Override
        public void onRefresh(RefreshLayout refreshLayout) {
            tv_tip.setText("下雨中...");
            rain.setVisibility(View.VISIBLE);
            rain.StartRain();
            waveView.setHeadHeight((int) (DensityUtil.dip2px(getContext(), headHeight)));
            ValueAnimator animator = ValueAnimator.ofInt(waveView.getWaveHeight(), 0, -300, 0, -100, 0);
            animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

                @Override
                public void onAnimationUpdate(ValueAnimator animation) {
                    Log.i("anim", "value--->" + (int) animation.getAnimatedValue());
                    waveView.setWaveHeight((int) animation.getAnimatedValue());
                    waveView.invalidate();
                }
            });
            animator.setInterpolator(new BounceInterpolator());
            animator.setDuration(1000);
            animator.start();
            refreshLayout.postDelayed(new Runnable() {

                @Override
                public void run() {
                    rippleView.startReveal();
                    rain.stopRain();
                }
            }, 3000);
        }
    });
}
Also used : BounceInterpolator(android.view.animation.BounceInterpolator) ValueAnimator(com.nineoldandroids.animation.ValueAnimator) ImageView(android.widget.ImageView) TextView(android.widget.TextView) SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) View(android.view.View) TextView(android.widget.TextView)

Aggregations

BounceInterpolator (android.view.animation.BounceInterpolator)32 View (android.view.View)10 ImageView (android.widget.ImageView)8 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)6 LinearInterpolator (android.view.animation.LinearInterpolator)6 TextView (android.widget.TextView)6 ObjectAnimator (android.animation.ObjectAnimator)5 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)5 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)4 AnticipateInterpolator (android.view.animation.AnticipateInterpolator)4 AnticipateOvershootInterpolator (android.view.animation.AnticipateOvershootInterpolator)4 Interpolator (android.view.animation.Interpolator)4 OvershootInterpolator (android.view.animation.OvershootInterpolator)4 Scroller (android.widget.Scroller)4 Animator (android.animation.Animator)3 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)3 ViewGroup (android.view.ViewGroup)3 Animation (com.db.chart.animation.Animation)3 ValueAnimator (android.animation.ValueAnimator)2 SuppressLint (android.annotation.SuppressLint)2