List of usage examples for android.view.animation DecelerateInterpolator DecelerateInterpolator
public DecelerateInterpolator()
From source file:org.shaastra.helper.SuperAwesomeCardFragment.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override//from ww w. j a va 2 s . c om public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); FrameLayout fl = new FrameLayout(getActivity()); fl.setLayoutParams(params); final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()); TextView v = new TextView(getActivity()); params.setMargins(margin, margin, margin, margin); v.setLayoutParams(params); v.setLayoutParams(params); v.setGravity(Gravity.CENTER); //v.setBackgroundResource(R.drawable.background_card); v.setText("CARD " + (position + 1)); if (position == 0) { View v1 = inflater.inflate(R.layout.event_info, container, false); v1.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); TextView t1 = (TextView) v1.findViewById(R.id.infotext); t1.setText(eintroduction); return v1; } else if (position == 1) { String Venue = new String(); Venue = evenue; final String SAC = elatlong; //String start=String.valueOf(l.getLatitude())+String.valueOf(l.getLongitude()); /* View v1=inflater.inflate(R.layout.map, container,false); v1.setLayoutParams(params); WebView wv=(WebView)v1.findViewById(R.id.wv1); wv.setWebChromeClient(new WebChromeClient()); //wv.loadUrl("https://maps.google.com/maps?saddr=13,80&daddr=13,80.02"); //wv.loadUrl("http://maps.googleapis.com/maps/api/directions/json?origin=Toronto&destination=Montreal&sensor=false"); wv.loadUrl("http://maps.google.com/maps?f=d&daddr=51.448,-0.972"); wv.getSettings().getBuiltInZoomControls(); */ View v1 = inflater.inflate(R.layout.map, container, false); v1.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); TextView location = (TextView) v1.findViewById(R.id.locationText); Button mapButton = (Button) v1.findViewById(R.id.mapButton); if (evenue.equalsIgnoreCase("NONE")) { mapButton.setAlpha(0); } else { mapButton.setAlpha(1); } location.setText(Venue); mapButton.setOnTouchListener(new View.OnTouchListener() { @TargetApi(Build.VERSION_CODES.HONEYCOMB) @SuppressLint("NewApi") @Override public boolean onTouch(View v, MotionEvent event) { // TODO Auto-generated method stub if (event.getAction() == MotionEvent.ACTION_DOWN) { v.setAlpha((float) 0.4); v.animate().setInterpolator(new DecelerateInterpolator()).scaleX(0.9f).scaleY(0.9f); } if (event.getAction() == MotionEvent.ACTION_UP) { v.setAlpha((float) 0.75); v.animate().setInterpolator(new OvershootInterpolator()).scaleX(1f).scaleY(1f); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://maps.google.com/maps?f=d&daddr=" + SAC)); intent.setComponent(new ComponentName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity")); startActivity(intent); } return false; } }); return v1; } else if (position == 2) { View v1 = inflater.inflate(R.layout.event_info, container, false); v1.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); TextView t1 = (TextView) v1.findViewById(R.id.infotext); t1.setText(eformat); return v1; } else if (position == 3) { View v1 = inflater.inflate(R.layout.prize, container, false); v1.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); TextView t1 = (TextView) v1.findViewById(R.id.prizeText); t1.setText(eprize); return v1; } else if (position == 4) { v.setBackgroundColor(Color.GREEN); } else if (position == 5) { v.setBackgroundColor(Color.MAGENTA); } else if (position == 6) { v.setBackgroundColor(Color.MAGENTA); } fl.addView(v); return fl; }
From source file:com.capricorn.ArcMenu.java
private static Animation createItemDisapperAnimation(final long duration, final boolean isClicked) { AnimationSet animationSet = new AnimationSet(true); animationSet.addAnimation(new ScaleAnimation(1.0f, isClicked ? 2.0f : 0.0f, 1.0f, isClicked ? 2.0f : 0.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f)); animationSet.addAnimation(new AlphaAnimation(1.0f, 0.0f)); animationSet.setDuration(duration);//from w w w . j av a 2 s .com animationSet.setInterpolator(new DecelerateInterpolator()); animationSet.setFillAfter(true); return animationSet; }
From source file:com.seek.ruler.SimpleRulerView.java
/** * set default//from w w w .j a v a 2 s. c o m * * @param attrs */ private void init(AttributeSet attrs) { DisplayMetrics dm = getResources().getDisplayMetrics(); mIntervalDis = dm.density * 5; mRulerLineWidth = dm.density * 2; mTextSize = dm.scaledDensity * 14; TypedArray typedArray = attrs == null ? null : getContext().obtainStyledAttributes(attrs, R.styleable.simpleRulerView); if (typedArray != null) { mHighlightColor = typedArray.getColor(R.styleable.simpleRulerView_highlightColor, mHighlightColor); mTextColor = typedArray.getColor(R.styleable.simpleRulerView_textColor, mTextColor); mRulerColor = typedArray.getColor(R.styleable.simpleRulerView_rulerColor, mRulerColor); mIntervalValue = typedArray.getFloat(R.styleable.simpleRulerView_intervalValue, mIntervalValue); mMaxValue = typedArray.getFloat(R.styleable.simpleRulerView_maxValue, mMaxValue); mMinValue = typedArray.getFloat(R.styleable.simpleRulerView_minValue, mMinValue); mTextSize = typedArray.getDimension(R.styleable.simpleRulerView_textSize, mTextSize); mRulerLineWidth = typedArray.getDimension(R.styleable.simpleRulerView_rulerLineWidth, mRulerLineWidth); mIntervalDis = typedArray.getDimension(R.styleable.simpleRulerView_intervalDistance, mIntervalDis); retainLength = typedArray.getInteger(R.styleable.simpleRulerView_retainLength, 0); } calculateTotal(); mRulerPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mRulerPaint.setStrokeWidth(mRulerLineWidth); mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); mTextPaint.setTextAlign(Paint.Align.CENTER); mTextPaint.setTextSize(mTextSize); mGestureDetectorCompat = new GestureDetectorCompat(getContext(), this); mScroller = new OverScroller(getContext(), new DecelerateInterpolator()); setSelectedIndex(0); }
From source file:com.mina.breathitout.AnalyzeActivity.java
public void animateProgressBar() { AnalyzeActivity.this.runOnUiThread(new Runnable() { @Override/*from w w w. j a va 2 s. co m*/ public void run() { if (android.os.Build.VERSION.SDK_INT >= 11) { // will update the "progress" propriety of seekbar until it reaches progress ObjectAnimator progressAnimation = ObjectAnimator.ofInt(progressBar, "progress", progressBar.getProgress(), lastMaxTime); progressAnimation.setDuration(1000); // 0.5 second progressAnimation.setInterpolator(new DecelerateInterpolator()); progressAnimation.start(); } else progressBar.setProgress(timerCounter); // no animation on Gingerbread or lower } }); }
From source file:net.archenemy.archenemyapp.presenter.PageFragment.java
private void animateEnterTransition() { swipeRefreshLayout.setTranslationY(recyclerView.getBottom()); final AnimatorListener listener = new AnimatorListener() { @Override// ww w . j a v a 2s . co m public void onAnimationCancel(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { swipeRefreshLayout.setTranslationY(0); } @Override public void onAnimationRepeat(Animator animation) { } @Override public void onAnimationStart(Animator animation) { } }; swipeRefreshLayout.animate().translationY(0).setInterpolator(new DecelerateInterpolator()).setDuration(300) .setListener(listener).start(); }
From source file:com.example.conallcurran.quick_click.English_Infants.java
private void zoomImageFromThumb(final View thumbView, int imageResId) { if (mCurrentAnimator != null) { mCurrentAnimator.cancel();//from w w w .ja va2s. co m } final ImageView expandedImageView = (ImageView) findViewById(R.id.expanded_image); expandedImageView.setImageResource(imageResId); final Rect startBounds = new Rect(); final Rect finalBounds = new Rect(); final Point globalOffset = new Point(); thumbView.getGlobalVisibleRect(startBounds); findViewById(R.id.container).getGlobalVisibleRect(finalBounds, globalOffset); startBounds.offset(-globalOffset.x, -globalOffset.y); finalBounds.offset(-globalOffset.x, -globalOffset.y); float startScale; if ((float) finalBounds.width() / finalBounds.height() > (float) startBounds.width() / startBounds.height()) { startScale = (float) startBounds.height() / finalBounds.height(); float startWidth = startScale * finalBounds.width(); float deltaWidth = (startWidth - startBounds.width()) / 2; startBounds.left -= deltaWidth; startBounds.right += deltaWidth; } else { // Extend start bounds vertically startScale = (float) startBounds.width() / finalBounds.width(); float startHeight = startScale * finalBounds.height(); float deltaHeight = (startHeight - startBounds.height()) / 2; startBounds.top -= deltaHeight; startBounds.bottom += deltaHeight; } thumbView.setAlpha(0f); expandedImageView.setVisibility(View.VISIBLE); expandedImageView.setPivotX(0f); expandedImageView.setPivotY(0f); AnimatorSet set = new AnimatorSet(); set.play(ObjectAnimator.ofFloat(expandedImageView, View.X, startBounds.left, finalBounds.left)) .with(ObjectAnimator.ofFloat(expandedImageView, View.Y, startBounds.top, finalBounds.top)) .with(ObjectAnimator.ofFloat(expandedImageView, View.SCALE_X, startScale, 1f)) .with(ObjectAnimator.ofFloat(expandedImageView, View.SCALE_Y, startScale, 1f)); set.setDuration(mShortAnimationDuration); set.setInterpolator(new DecelerateInterpolator()); set.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mCurrentAnimator = null; } @Override public void onAnimationCancel(Animator animation) { mCurrentAnimator = null; } }); set.start(); mCurrentAnimator = set; final float startScaleFinal = startScale; expandedImageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (mCurrentAnimator != null) { mCurrentAnimator.cancel(); } // Animate the four positioning/sizing properties in parallel, back to their // original values. AnimatorSet set = new AnimatorSet(); set.play(ObjectAnimator.ofFloat(expandedImageView, View.X, startBounds.left)) .with(ObjectAnimator.ofFloat(expandedImageView, View.Y, startBounds.top)) .with(ObjectAnimator.ofFloat(expandedImageView, View.SCALE_X, startScaleFinal)) .with(ObjectAnimator.ofFloat(expandedImageView, View.SCALE_Y, startScaleFinal)); set.setDuration(mShortAnimationDuration); set.setInterpolator(new DecelerateInterpolator()); set.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { thumbView.setAlpha(1f); expandedImageView.setVisibility(View.GONE); mCurrentAnimator = null; } @Override public void onAnimationCancel(Animator animation) { thumbView.setAlpha(1f); expandedImageView.setVisibility(View.GONE); mCurrentAnimator = null; } }); set.start(); mCurrentAnimator = set; } }); }
From source file:com.capricorn.ArcMenu.java
private static Animation createHintSwitchAnimation(final boolean expanded) { Animation animation = new RotateAnimation(expanded ? 45 : 0, expanded ? 0 : 45, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); animation.setStartOffset(0);/* w w w. j a va 2 s . co m*/ animation.setDuration(100); animation.setInterpolator(new DecelerateInterpolator()); animation.setFillAfter(true); return animation; }
From source file:com.dm.wallpaper.board.fragments.CollectionFragment.java
private void initAppBar() { mAppBar.addOnOffsetChangedListener((appBarLayout, verticalOffset) -> { int maxScroll = mAppBar.getTotalScrollRange(); float percentage = (float) Math.abs(verticalOffset) / (float) maxScroll; if (percentage == 1f) { if (mIsSearchBarShown) { mIsSearchBarShown = false; mSearchBar.animate().cancel(); mSearchBar.animate().translationY(-mSearchBarTranslationY) .setInterpolator(new DecelerateInterpolator()).setDuration(400).start(); }/* ww w. j a va2 s . c o m*/ } else if (percentage < 0.8f) { if (!mIsSearchBarShown) { mIsSearchBarShown = true; mSearchBar.animate().cancel(); mSearchBar.animate().translationY(0).setInterpolator(new LinearOutSlowInInterpolator()) .setDuration(400).start(); } } if (percentage < 0.2f) { if (!mIsAppBarExpanded) { mIsAppBarExpanded = true; int color = ColorHelper.getAttributeColor(getActivity(), R.attr.colorPrimary); ColorHelper.setupStatusBarIconColor(getActivity(), ColorHelper.isLightColor(color)); } } else if (percentage == 1.0f) { if (mIsAppBarExpanded) { mIsAppBarExpanded = false; ColorHelper.setupStatusBarIconColor(getActivity(), false); } } }); }
From source file:cn.refactor.ultraindicator.lib.UltraIndicatorView.java
/** * start checked animation//from w ww .j a v a 2s.c o m */ private void startCheckedAnim() { if (mValueAnimator != null && mValueAnimator.isRunning()) { return; } mValueAnimator = ValueAnimator.ofFloat(1.0f, 1.2f, 1.0f); mValueAnimator.setDuration(mAnimDuration); mValueAnimator.setInterpolator(new DecelerateInterpolator()); mValueAnimator.setRepeatCount(0); mValueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { float animatedValue = (float) animation.getAnimatedValue(); mCheckedRunningRadius = animatedValue * mRadius; invalidate(); } }); mValueAnimator.start(); }
From source file:org.fedorahosted.freeotp.main.ScanDialogFragment.java
@Override public void process(Frame frame) { byte[] i = frame.getImage(); Resolution r = frame.getSize();//from ww w . jav a 2 s .co m LuminanceSource ls = new PlanarYUVLuminanceSource(i, r.width, r.height, 0, 0, r.width, r.height, false); try { BinaryBitmap bb = new BinaryBitmap(new HybridBinarizer(ls)); final String uri = new QRCodeReader().decode(bb).getText(); int size = mImage.getWidth(); if (size > mImage.getHeight()) size = mImage.getHeight(); BitMatrix bm = new QRCodeWriter().encode(uri, BarcodeFormat.QR_CODE, size, size); mFotoapparat.stop(); final Bitmap b = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888); for (int x = 0; x < size; x++) { for (int y = 0; y < size; y++) { b.setPixel(x, y, bm.get(x, y) ? Color.BLACK : Color.WHITE); } } Vibrator v = (Vibrator) getContext().getSystemService(Context.VIBRATOR_SERVICE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { v.vibrate(VibrationEffect.createOneShot(250, VibrationEffect.DEFAULT_AMPLITUDE)); } else { v.vibrate(250); } mImage.post(new Runnable() { @Override public void run() { mProgress.setVisibility(View.INVISIBLE); mCamera.animate().setInterpolator(new DecelerateInterpolator()).setDuration(2000).alpha(0.0f) .start(); mImage.setImageBitmap(b); mImage.animate().setInterpolator(new DecelerateInterpolator()).setDuration(2000).alpha(1.0f) .withEndAction(new Runnable() { @Override public void run() { mImage.post(new Runnable() { @Override public void run() { Activity a = (Activity) getActivity(); a.addToken(Uri.parse(uri), true); } }); dismiss(); } }).start(); } }); } catch (NotFoundException | ChecksumException | FormatException | WriterException e) { e.printStackTrace(); } }