List of usage examples for android.view.animation Animation setRepeatMode
public void setRepeatMode(int repeatMode)
From source file:eu.andlabs.studiolounge.lobby.LobbyFragment.java
private void animateHostMode() { pulseBeacon.setVisibility(View.VISIBLE); staticBeacon.setVisibility(View.INVISIBLE); Animation hyperspaceJumpAnimation = AnimationUtils.loadAnimation(getActivity(), R.anim.pulse); hyperspaceJumpAnimation.setRepeatMode(Animation.INFINITE); hyperspaceJumpAnimation.setRepeatCount(1000); pulseBeacon.startAnimation(hyperspaceJumpAnimation); // final ObjectAnimator alphaAnimation = // ObjectAnimator.ofFloat(pulseBeacon, "alpha", 0); ///*w w w . ja va 2 s .co m*/ // final ObjectAnimator scaleXAnimation = // ObjectAnimator.ofFloat(pulseBeacon, "scaleX", 1); // // final ObjectAnimator scaleYAnimation = // ObjectAnimator.ofFloat(pulseBeacon, "scaleY", 1); // // long duration= 300; // alphaAnimation.setDuration(duration); // // scaleXAnimation.setDuration(duration); // // scaleYAnimation.setDuration(duration); // // scaleYAnimation.setRepeatMode(ObjectAnimator.INFINITE); // scaleXAnimation.setRepeatMode(ObjectAnimator.INFINITE); // alphaAnimation.setRepeatMode(ObjectAnimator.INFINITE); // // scaleDown = new AnimatorSet(); // // // scaleDown.play(alphaAnimation).with(scaleXAnimation).with(scaleYAnimation); // scaleDown.start(); }
From source file:com.pwned.steamfriends.views.TwitterStream.java
@Override public void onCreate(Bundle savedInstanceState) { setMyTheme();/*from ww w . ja v a 2 s. co m*/ super.onCreate(savedInstanceState); tracker = GoogleAnalyticsTracker.getInstance(); tracker.start(Constants.UACODE, 20, this); tracker.trackPageView("/TwitterStream"); mManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); mManager.cancel(APP_ID); setContentView(R.layout.twitter); m_streams = new ArrayList<Stream>(); this.m_adapter = new TwitterStreamAdapter(this, R.layout.row, m_streams); setListAdapter(this.m_adapter); viewStream = new Thread() { @Override public void run() { getStream(); } }; Animation a = new RotateAnimation(0.0f, 360.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); a.setRepeatMode(Animation.RESTART); a.setRepeatCount(Animation.INFINITE); a.setDuration(750); a.setInterpolator(AnimationUtils.loadInterpolator(this, android.R.anim.linear_interpolator)); ivLoad = (ImageView) findViewById(R.id.loading_spinner); ivLoad.startAnimation(a); Thread thread = new Thread(null, viewStream, "SpecialsBackground"); thread.start(); //m_ProgressDialog = ProgressDialog.show(TwitterStream.this,"","Loading Twitter Stream...", true); steamHeader = (ImageView) findViewById(R.id.headerimage); steamHeader.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(Constants.HEADER_URL)); startActivity(myIntent); } }); }
From source file:com.wii.sean.wiimmfiitus.adapters.CustomWiiCyclerViewAdapter.java
private Animation getBlinkAnimation() { Animation animation = new AlphaAnimation(1, 0); animation.setDuration(500);//from w w w . j a v a2s.c om animation.setInterpolator(new LinearInterpolator()); animation.setRepeatCount(Animation.INFINITE); animation.setRepeatMode(Animation.REVERSE); return animation; }
From source file:de.grobox.liberario.ui.LocationInputGPSView.java
public void activateGPS() { if (isSearching()) return;/* w ww . java 2 s . co 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:de.grobox.liberario.ui.LocationGpsView.java
public void activateGPS() { if (searching) return;/* w w w .j a va2 s. c om*/ // 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;/* w w w . j ava 2 s . co 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.github.mobile.gauges.ui.ItemListFragment.java
private void showRefreshAnimation(MenuItem item) { hideRefreshAnimation();/*from ww w .j a v a2s .c om*/ refreshItem = item; ImageView refreshActionView = (ImageView) getActivity().getLayoutInflater().inflate(layout.action_view, null); refreshActionView.setImageResource(drawable.ic_action_refresh); refreshItem.setActionView(refreshActionView); Animation animation = AnimationUtils.loadAnimation(getActivity(), anim.refresh); animation.setRepeatMode(RESTART); animation.setRepeatCount(INFINITE); refreshActionView.startAnimation(animation); }
From source file:io.github.runassudo.ptoffline.ui.LocationGpsView.java
public void activateGPS() { if (searching) return;/*from w w w . ja v a 2 s . c om*/ // 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:org.secuso.privacyfriendlydicegame.MainActivity.java
public void flashResult() { Animation animation = new AlphaAnimation(0.0f, 1.0f); animation.setDuration(500);//ww w . j av a 2 s .co m animation.setStartOffset(20); animation.setRepeatMode(Animation.REVERSE); TextView finalResult = (TextView) findViewById(R.id.resultTextView); for (int i = 0; i < dice.length; i++) { if (!isLocked[i]) dice[i].startAnimation(animation); } if (roundCounter == 3) { finalResult.startAnimation(animation); } }
From source file:org.secuso.privacyfriendlypasswordgenerator.activities.MainActivity.java
public void hints(int position) { Animation anim = new AlphaAnimation(0.0f, 1.0f); if (metadatalist.size() == 0 || position == 0) { initialAlert.setVisibility(View.VISIBLE); anim.setDuration(1500);// ww w. j a v a 2s.co m anim.setStartOffset(20); anim.setRepeatMode(Animation.REVERSE); anim.setRepeatCount(Animation.INFINITE); initialAlert.startAnimation(anim); } else { initialAlert.setVisibility(View.GONE); initialAlert.clearAnimation(); } }