List of usage examples for android.view.animation Animation setInterpolator
public void setInterpolator(Interpolator i)
From source file:com.orangemoo.com.beta.widget.ScrollFABBehavior.java
private void animateIn(FloatingActionButton button) { button.setVisibility(View.VISIBLE); if (Build.VERSION.SDK_INT >= 14) { ViewCompat.animate(button).scaleX(1.0F).scaleY(1.0F).alpha(1.0F).setInterpolator(INTERPOLATOR) .withLayer().setListener(null).setDuration(Utils.SWIPE_BEHAVIOR_ANIMATION_TIME).start(); } else {/*from www . j a v a2s.c o m*/ Animation anim = AnimationUtils.loadAnimation(button.getContext(), android.support.design.R.anim.design_fab_in); anim.setDuration(Utils.SWIPE_BEHAVIOR_ANIMATION_TIME); anim.setInterpolator(INTERPOLATOR); button.startAnimation(anim); } }
From source file:org.hawkular.client.android.fragment.TriggerDetailFragment.java
@OnClick(R.id.trigger_delete) public void trigger_delete() { Context context = getActivity(); final Animation myAnim = AnimationUtils.loadAnimation(context, R.anim.bounce); MyBounceInterpolator interpolator = new MyBounceInterpolator(0.2, 20); myAnim.setInterpolator(interpolator); deleteButton.startAnimation(myAnim); BackendClient.of(this).deleteTriggers(new DeleteTriggerCallback(this), trigger.getId()); }
From source file:org.hawkular.client.android.fragment.TriggerDetailFragment.java
@OnClick(R.id.favourite_button) public void toggleTriggerFavouriteStatus() { Context context = getActivity(); final Animation myAnim = AnimationUtils.loadAnimation(context, R.anim.bounce); MyBounceInterpolator interpolator = new MyBounceInterpolator(0.2, 20); myAnim.setInterpolator(interpolator); addButton.startAnimation(myAnim);//from w w w . j a v a 2 s. c o m SQLStore<Trigger> store = openStore(context); if (store.read(trigger.getId()) == null) { store.save(trigger); Snackbar snackbar = Snackbar.make(getView(), R.string.favourites_added, Snackbar.LENGTH_SHORT); snackbar.show(); addButton.setColorFilter(getResources().getColor(R.color.background_primary)); addButton.startAnimation(myAnim); } else { store.remove(trigger.getId()); Snackbar snackbar = Snackbar.make(getView(), R.string.favourites_removed, Snackbar.LENGTH_SHORT); snackbar.show(); addButton.setColorFilter(getResources().getColor(R.color.background_secondary)); addButton.startAnimation(myAnim); } store.close(); }
From source file:de.grobox.liberario.ui.LocationInputGPSView.java
public void activateGPS() { if (isSearching()) return;/*from ww w . j av a 2 s. c o m*/ // check permissions if (ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) { // we don't have a permission, so store the information that we are requesting it request_permission = true; // Should we show an explanation? if (ActivityCompat.shouldShowRequestPermissionRationale(context, Manifest.permission.ACCESS_FINE_LOCATION)) { Toast.makeText(context, R.string.permission_denied_gps, Toast.LENGTH_LONG).show(); } else { // No explanation needed, we can request the permission ActivityCompat.requestPermissions(context, new String[] { Manifest.permission.ACCESS_FINE_LOCATION }, caller); } return; } // we arrive here only once we have got the permission and are not longer requesting it request_permission = false; 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); } // check if there is a non-passive provider available if (providers.size() == 0 || (providers.size() == 1 && providers.get(0).equals(LocationManager.PASSIVE_PROVIDER))) { locationManager.removeUpdates(this); Toast.makeText(context, context.getResources().getString(R.string.error_no_location_provider), Toast.LENGTH_LONG).show(); return; } // clear input //noinspection deprecation setLocation(null, context.getResources().getDrawable(R.drawable.ic_gps)); ui.clear.setVisibility(View.VISIBLE); // clear current GPS location, because we are looking to find a new one gps_location = null; // 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); ui.status.setAnimation(animation); ui.location.setHint(R.string.stations_searching_position); ui.location.clearFocus(); searching = true; }
From source file:com.tr4android.support.extension.widget.LabelView.java
private void hideEclairMr1() { Animation anim = createAnimationSet(1.0f, 0.0f, 0, Math.round(mAnimationOffset)); anim.setInterpolator(AnimationUtils.FAST_OUT_LINEAR_IN_INTERPOLATOR); anim.setDuration(SHOW_HIDE_ANIM_DURATION); anim.setAnimationListener(new AnimationUtils.AnimationListenerAdapter() { @Override/*w w w .j a v a 2s .co m*/ public void onAnimationStart(Animation animation) { mIsHiding = true; } @Override public void onAnimationEnd(Animation animation) { mIsHiding = false; setVisibility(GONE); } }); startAnimation(anim); }
From source file:jp.tkgktyk.xposed.forcetouchdetector.app.util.fab.FloatingActionButtonEclairMr1.java
@Override void hide() {//from ww w . j a va 2s . co m if (mIsHiding || mView.getVisibility() != View.VISIBLE) { // A hide animation is in progress, or we're already hidden. Skip the call return; } Animation anim = android.view.animation.AnimationUtils.loadAnimation(mView.getContext(), R.anim.design_fab_out); anim.setInterpolator(AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR); anim.setDuration(SHOW_HIDE_ANIM_DURATION); anim.setAnimationListener(new AnimationUtils.AnimationListenerAdapter() { @Override public void onAnimationStart(Animation animation) { mIsHiding = true; } @Override public void onAnimationEnd(Animation animation) { mIsHiding = false; mView.setVisibility(View.GONE); } }); mView.startAnimation(anim); }
From source file:com.tr4android.support.extension.widget.LabelView.java
private void showEclairMr1() { clearAnimation();// w w w. j av a 2 s. c o m setVisibility(VISIBLE); Animation anim = createAnimationSet(0.0f, 1.0f, Math.round(mAnimationOffset), 0); anim.setDuration(SHOW_HIDE_ANIM_DURATION); anim.setInterpolator(AnimationUtils.LINEAR_OUT_SLOW_IN_INTERPOLATOR); startAnimation(anim); }
From source file:de.grobox.liberario.ui.LocationGpsView.java
public void activateGPS() { if (searching) return;/*from www. ja v a 2 s. c o m*/ // check permissions if (ContextCompat.checkSelfPermission(getContext(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) { // Should we show an explanation? if (ActivityCompat.shouldShowRequestPermissionRationale(activity, Manifest.permission.ACCESS_FINE_LOCATION)) { Toast.makeText(getContext(), R.string.permission_denied_gps, Toast.LENGTH_LONG).show(); } else { // No explanation needed, we can request the permission ActivityCompat.requestPermissions(activity, new String[] { Manifest.permission.ACCESS_FINE_LOCATION }, caller); } return; } searching = true; 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); } // check if there is a non-passive provider available if (providers.size() == 0 || (providers.size() == 1 && providers.get(0).equals(LocationManager.PASSIVE_PROVIDER))) { locationManager.removeUpdates(this); Toast.makeText(getContext(), getContext().getString(R.string.error_no_location_provider), Toast.LENGTH_LONG).show(); return; } // clear input setLocation(null, TransportrUtils.getTintedDrawable(getContext(), R.drawable.ic_gps)); ui.clear.setVisibility(View.VISIBLE); // clear current GPS location, because we are looking to find a new one gps_location = null; // 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); ui.status.startAnimation(animation); ui.location.setHint(R.string.stations_searching_position); ui.location.clearFocus(); if (gpsListener != null) gpsListener.activateGPS(); }
From source file:de.grobox.liberario.locations.LocationGpsView.java
public void activateGPS() { if (searching) return;//from w w w. j av a 2 s . c o m // check permissions if (ContextCompat.checkSelfPermission(getContext(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) { // Should we show an explanation? /* if(ActivityCompat.shouldShowRequestPermissionRationale(activity, Manifest.permission.ACCESS_FINE_LOCATION)) { Toast.makeText(getContext(), R.string.permission_denied_gps, Toast.LENGTH_LONG).show(); } else { // No explanation needed, we can request the permission ActivityCompat.requestPermissions(activity, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, caller); } */ return; } searching = true; 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); } // check if there is a non-passive provider available if (providers.size() == 0 || (providers.size() == 1 && providers.get(0).equals(LocationManager.PASSIVE_PROVIDER))) { locationManager.removeUpdates(this); Toast.makeText(getContext(), getContext().getString(R.string.error_no_location_provider), Toast.LENGTH_LONG).show(); // Set the flag that there is currently no active search. Otherwise the App won't // allow new searches even after GPS has been reenabled, because the app "hangs" in // a semistate where searching = true but now real search is active. searching = false; return; } // clear input setLocation(null, TransportrUtils.getTintedDrawable(getContext(), R.drawable.ic_gps)); ui.clear.setVisibility(View.VISIBLE); // clear current GPS location, because we are looking to find a new one gps_location = null; // 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); ui.status.startAnimation(animation); ui.location.setHint(R.string.stations_searching_position); ui.location.clearFocus(); if (gpsListener != null) gpsListener.activateGPS(); }
From source file:com.dbeginc.dbweather.utils.animations.widgets.RainFallView.java
@Override protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) { super.onSizeChanged(width, height, oldWidth, oldHeight); SecureRandom random = new SecureRandom(); Interpolator interpolator = new LinearInterpolator(); mRainFlakeCount = Math.max(width, height) / 20; coords = new int[mRainFlakeCount][]; drawables.clear();/*from ww w .java 2s .c o m*/ for (int i = 0; i < mRainFlakeCount; i++) { Animation animation = new TranslateAnimation(0, height / 10 - random.nextInt(height / 5), 0, height + 30); animation.setDuration(10 * height + random.nextInt(5 * height)); animation.setRepeatCount(-1); animation.initialize(10, 10, 10, 10); animation.setInterpolator(interpolator); coords[i] = new int[] { random.nextInt(width - 30), -30 }; drawables.add(new AnimateDrawable(mRainDrop, animation)); animation.setStartOffset(random.nextInt(20 * height)); animation.startNow(); int y; y = random.nextInt(2); if (y == 0) { drawables.add(new AnimateDrawable(mRainDrop, animation)); } else { drawables.add(new AnimateDrawable(mRainDrop)); } } }