List of usage examples for android.view.animation LinearInterpolator LinearInterpolator
public LinearInterpolator()
From source file:com.gitstudy.rili.liarbry.CalendarLayout.java
/** * ??/* www . j a v a 2s . co m*/ */ @SuppressLint("NewApi") final void hideContentView() { if (mContentView == null) return; mContentView.animate().translationY(getHeight() - mMonthView.getHeight()).setDuration(220) .setInterpolator(new LinearInterpolator()).setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); mContentView.setVisibility(INVISIBLE); mContentView.clearAnimation(); } }); }
From source file:org.tomahawk.tomahawk_android.fragments.ContentHeaderFragment.java
private void setupFancyDropDownAnimation(final View view) { if (view != null) { final FancyDropDown fancyDropDown = (FancyDropDown) view.findViewById(R.id.fancydropdown); if (fancyDropDown != null) { final Runnable r = new Runnable() { @Override//w w w. j a v a 2 s .c om public void run() { // get resources first Resources resources = TomahawkApp.getContext().getResources(); int dropDownHeight = resources.getDimensionPixelSize(R.dimen.show_context_menu_icon_height); int actionBarHeight = resources .getDimensionPixelSize(R.dimen.abc_action_bar_default_height_material); int smallPadding = resources.getDimensionPixelSize(R.dimen.padding_small); int superLargePadding = resources.getDimensionPixelSize(R.dimen.padding_superlarge); // now calculate the animation goal and instantiate the animation int initialX = view.getWidth() / 2 - fancyDropDown.getWidth() / 2; int initialY = view.getHeight() / 2 - dropDownHeight / 2; PropertyValuesHolder pvhX = PropertyValuesHolder.ofFloat("x", initialX, superLargePadding); PropertyValuesHolder pvhY = PropertyValuesHolder.ofFloat("y", initialY, actionBarHeight + smallPadding); ValueAnimator animator = ObjectAnimator.ofPropertyValuesHolder(fancyDropDown, pvhX, pvhY) .setDuration(10000); animator.setInterpolator(new LinearInterpolator()); addAnimator(ANIM_FANCYDROPDOWN_ID, animator); refreshAnimations(); } }; r.run(); fancyDropDown.setOnSizeChangedListener(new OnSizeChangedListener() { @Override public void onSizeChanged(int w, int h, int oldw, int oldh) { r.run(); } }); } } }
From source file:com.zainsoft.ramzantimetable.QiblaActivity.java
private double rotateImageView(double newAngle, double fromDegree, ImageView imageView) { newAngle = newAngle % 360;//from w w w.j av a2 s . co m double rotationDegree = fromDegree - newAngle; rotationDegree = rotationDegree % 360; long duration = new Double(Math.abs(rotationDegree) * 2000 / 360).longValue(); if (rotationDegree > 180) rotationDegree -= 360; FrameLayout frameLayout = (FrameLayout) findViewById(R.id.qiblaLayout); float toDegree = new Double(newAngle % 360).floatValue(); final int width = Math.abs(frameLayout.getRight() - frameLayout.getLeft()); final int height = Math.abs(frameLayout.getBottom() - frameLayout.getTop()); // LinearLayout main = (LinearLayout) findViewById(R.id.mainLayout); float pivotX = width / 2f; float pivotY = height / 2f; animation = new RotateAnimation(new Double(fromDegree).floatValue(), toDegree, pivotX, pivotY); animation.setRepeatCount(0); animation.setDuration(duration); animation.setInterpolator(new LinearInterpolator()); animation.setFillEnabled(true); animation.setFillAfter(true); animation.setAnimationListener(this); /*Log.d(NAMAZ_LOG_TAG, "rotating image from degree:" + fromDegree + " degree to rotate: " + rotationDegree + " ImageView: " + imageView.getId());*/ imageView.startAnimation(animation); return toDegree; }
From source file:com.gitstudy.rili.liarbry.CalendarLayout.java
/** * // www.j a v a 2 s . c o m */ @SuppressLint("NewApi") final void showContentView() { if (mContentView == null) return; mContentView.setTranslationY(getHeight() - mMonthView.getHeight()); mContentView.setVisibility(VISIBLE); mContentView.animate().translationY(0).setDuration(180).setInterpolator(new LinearInterpolator()) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); } }); }
From source file:org.runbuddy.tomahawk.views.PlaybackPanel.java
public void setupStationContainerAnimation() { Resources resources = TomahawkApp.getContext().getResources(); int resolverIconSize = resources.getDimensionPixelSize(R.dimen.playback_panel_resolver_icon_size); int padding = resources.getDimensionPixelSize(R.dimen.padding_small); // Setup mStationContainer animation Keyframe kfX0 = Keyframe.ofFloat(0f, mStationContainer.getWidth() - resolverIconSize); Keyframe kfX1 = Keyframe.ofFloat(0.5f, Math.max(resolverIconSize + padding, mStationContainer.getWidth() / 2 - mStationContainerInner.getWidth() / 2)); Keyframe kfX2 = Keyframe.ofFloat(1f, mStationContainer.getWidth() - resolverIconSize); PropertyValuesHolder pvhX = PropertyValuesHolder.ofKeyframe("x", kfX0, kfX1, kfX2); ValueAnimator animator = ObjectAnimator.ofPropertyValuesHolder(mStationContainerInner, pvhX) .setDuration(20000);//from w w w .ja v a 2 s. c o m animator.setInterpolator(new LinearInterpolator()); animator.setCurrentPlayTime(mLastPlayTime); if (mStationContainerAnimation != null) { mAnimators.remove(mStationContainerAnimation); } mStationContainerAnimation = animator; mAnimators.add(mStationContainerAnimation); }
From source file:com.shollmann.igcparser.ui.activity.FlightPreviewActivity.java
private void animateMarker() { final Handler handler = new Handler(); final long start = SystemClock.uptimeMillis(); duration = 300000;//www . ja va 2s.co m final Interpolator interpolator = new LinearInterpolator(); handler.post(new Runnable() { int i = 0; @Override public void run() { long elapsed = SystemClock.uptimeMillis() - start; float t = interpolator.getInterpolation((float) elapsed / duration); if (i < listLatLngPoints.size()) { Double heading = SphericalUtil.computeHeading(markerGlider.getPosition(), listLatLngPoints.get(i)); markerGlider.setRotation(heading.floatValue()); markerGlider.setPosition(listLatLngPoints.get(i)); } i++; if (t < 1.0 && i < listLatLngPoints.size() && !isFinishReplay) { handler.postDelayed(this, replaySpeed); } else { finishReplay(); } } }); }
From source file:org.tomahawk.tomahawk_android.fragments.ContentHeaderFragment.java
private void setupButtonAnimation(final View view) { if (view != null) { View moreButton = view.findViewById(R.id.more_button); if (moreButton != null) { ViewUtils.afterViewGlobalLayout(new ViewUtils.ViewRunnable(moreButton) { @Override/*from ww w. j ava 2 s . c o m*/ public void run() { // get resources first Resources resources = TomahawkApp.getContext().getResources(); int buttonHeight = TomahawkApp.getContext().getResources() .getDimensionPixelSize(R.dimen.show_context_menu_icon_height); int largePadding = TomahawkApp.getContext().getResources() .getDimensionPixelSize(R.dimen.padding_large); int smallPadding = resources.getDimensionPixelSize(R.dimen.padding_small); int actionBarHeight = resources .getDimensionPixelSize(R.dimen.abc_action_bar_default_height_material); View pageIndicator = view.findViewById(R.id.page_indicator); int pageIndicatorHeight = 0; if (pageIndicator != null && pageIndicator.getVisibility() == View.VISIBLE) { pageIndicatorHeight = TomahawkApp.getContext().getResources() .getDimensionPixelSize(R.dimen.pager_indicator_height); } // now calculate the animation goal and instantiate the animation int initialY = view.getHeight() - buttonHeight - largePadding - pageIndicatorHeight; ValueAnimator animator = ObjectAnimator .ofFloat(getLayedOutView(), "y", initialY, actionBarHeight + smallPadding) .setDuration(10000); animator.setInterpolator(new LinearInterpolator()); addAnimator(ANIM_BUTTON_ID, animator); refreshAnimations(); } }); } } }
From source file:com.aliyun.homeshell.Folder.java
public void showSelectApps(int[] pos) { if (mRunningAnimatorSet != null) { if (!mRunningIsShow) { mRunningAnimatorSet.end();/* w w w. j a v a 2 s . co m*/ } else { return; } } if (mAppsSelectView == null) { mAppsSelectView = (FolderAppsSelectView) LayoutInflater.from(getContext()) .inflate(R.layout.folder_apps_select, null); mAppsSelectView.init(this, mInfo, mLauncher); mLauncher.getDragLayer().addView(mAppsSelectView); } mAppsSelectView.initSelectedState(mInfo); mAppsSelectView.setScaleX(0); mAppsSelectView.setScaleY(0); mAppsSelectView.setPivotX(pos[0]); mAppsSelectView.setPivotY(pos[1]); ObjectAnimator visToInvis = ObjectAnimator.ofFloat(this, "alpha", 1, 0); visToInvis.setDuration(mAnimatorDuration); ObjectAnimator invisToVisX = ObjectAnimator.ofFloat(mAppsSelectView, "scaleX", 0, 1); invisToVisX.setDuration(mAnimatorDuration); ObjectAnimator invisToVisY = ObjectAnimator.ofFloat(mAppsSelectView, "scaleY", 0, 1); invisToVisY.setDuration(mAnimatorDuration); List<Animator> animList = new ArrayList<Animator>(); animList.add(visToInvis); animList.add(invisToVisX); animList.add(invisToVisY); final AnimatorSet as = new AnimatorSet(); as.setInterpolator(new LinearInterpolator()); as.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animator) { mAppsSelectView.setVisibility(View.VISIBLE); mRunningAnimatorSet = as; mRunningIsShow = true; } @Override public void onAnimationEnd(Animator animator) { mRunningAnimatorSet = null; mRunningIsShow = false; Folder.this.setVisibility(View.INVISIBLE); mAppsSelectView.setVisibility(View.VISIBLE); DisplayMetrics metric = new DisplayMetrics(); mLauncher.getWindowManager().getDefaultDisplay().getMetrics(metric); int width = metric.widthPixels; int height = metric.heightPixels; mAppsSelectView.setPivotX(width / 2); mAppsSelectView.setPivotY(height / 2); mAppsSelectView.setFocusableInTouchMode(true); mAppsSelectView.setFocusable(true); mAppsSelectView.requestFocus(); } }); as.playTogether(animList); as.start(); }
From source file:org.runbuddy.tomahawk.ui.fragments.ContentHeaderFragment.java
private void setupFancyDropDownAnimation(final View view) { //?view//from w w w .j ava2s.c o m if (view != null) { final FancyDropDown fancyDropDown = (FancyDropDown) view.findViewById(R.id.fancydropdown); if (fancyDropDown != null) { final Runnable r = new Runnable() { @Override public void run() { // get resources first Resources resources = TomahawkApp.getContext().getResources(); int dropDownHeight = resources.getDimensionPixelSize(R.dimen.show_context_menu_icon_height); int actionBarHeight = resources .getDimensionPixelSize(R.dimen.abc_action_bar_default_height_material); int smallPadding = resources.getDimensionPixelSize(R.dimen.padding_small); int superLargePadding = resources.getDimensionPixelSize(R.dimen.padding_superlarge); // now calculate the animation goal and instantiate the animation int initialX = view.getWidth() / 2 - fancyDropDown.getWidth() / 2; int initialY = view.getHeight() / 2 - dropDownHeight / 2; PropertyValuesHolder pvhX = PropertyValuesHolder.ofFloat("x", initialX, superLargePadding); PropertyValuesHolder pvhY = PropertyValuesHolder.ofFloat("y", initialY, actionBarHeight + smallPadding); ValueAnimator animator = ObjectAnimator.ofPropertyValuesHolder(fancyDropDown, pvhX, pvhY) .setDuration(10000); animator.setInterpolator(new LinearInterpolator()); addAnimator(ANIM_FANCYDROPDOWN_ID, animator); refreshAnimations(); } }; r.run(); fancyDropDown.setOnSizeChangedListener(new OnSizeChangedListener() { @Override public void onSizeChanged(int w, int h, int oldw, int oldh) { r.run(); } }); } } }
From source file:de.grobox.liberario.DirectionsFragment.java
private void pressGpsButton() { List<String> providers = locationManager.getProviders(true); for (String provider : providers) { // Register the listener with the Location Manager to receive location updates locationManager.requestSingleUpdate(provider, this, null); Log.d(getClass().getSimpleName(), "Register provider for location updates: " + provider); }/*w ww . j a v a2 s. com*/ // check if there is a non-passive provider available if (providers.size() == 0 || (providers.size() == 1 && providers.get(0).equals(LocationManager.PASSIVE_PROVIDER))) { removeUpdates(); Toast.makeText(getActivity(), getResources().getString(R.string.error_no_location_provider), Toast.LENGTH_LONG).show(); return; } // show GPS button blinking final Animation animation = new AlphaAnimation(1, 0); animation.setDuration(500); animation.setInterpolator(new LinearInterpolator()); animation.setRepeatCount(Animation.INFINITE); animation.setRepeatMode(Animation.REVERSE); mView.findViewById(R.id.fromStatusButton).setAnimation(animation); mGpsPressed = true; gps_loc = null; }