Example usage for android.view.animation Animation REVERSE

List of usage examples for android.view.animation Animation REVERSE

Introduction

In this page you can find the example usage for android.view.animation Animation REVERSE.

Prototype

int REVERSE

To view the source code for android.view.animation Animation REVERSE.

Click Source Link

Document

When the animation reaches the end and the repeat count is INFINTE_REPEAT or a positive value, the animation plays backward (and then forward again).

Usage

From source file:zjut.soft.finalwork.fragment.RightFragment.java

public void plannerScaleAction() {
    ScaleAnimation scaleanim1 = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);
    scaleanim1.setDuration(1500);/*from  w  w  w.j  av  a  2 s  .c  o m*/
    scaleanim1.setFillAfter(true);
    scaleanim1.setRepeatCount(Animation.INFINITE);
    scaleanim1.setRepeatMode(Animation.REVERSE);
    scaleanim1.setInterpolator(new AccelerateDecelerateInterpolator());

    plannerIV.setAnimation(scaleanim1);
    scaleanim1.startNow();
}

From source file:org.onebusaway.android.view.RealtimeIndicatorView.java

/**
 * Setup the animation/*w  ww.j a va2  s.c om*/
 */
private synchronized void initAnimation() {
    // Animate circle expand/contract
    mAnimation1 = new Animation() {
        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            int height = getHeight();
            mNewRadius = height * interpolatedTime;
            invalidate();
        }
    };

    mAnimation1.setDuration(mDuration);
    mAnimation1.setRepeatMode(Animation.REVERSE);
    mAnimation1.setInterpolator(new FastOutLinearInInterpolator());
    mAnimation1.setRepeatCount(Animation.INFINITE);
    startAnimation(mAnimation1);
    mInitComplete = true;
}

From source file:quickbeer.android.next.views.ProgressIndicatorBar.java

private void animateScroller() {
    Log.v(TAG, "animateScroller()");

    int animEnd = getWidth() - progressBarWidth;

    TranslateAnimation animation = new TranslateAnimation(0, animEnd, 0, 0);
    animation.setDuration(ANIMATION_SCROLL_DURATION);
    animation.setFillAfter(true);/*from   w w  w. jav  a2  s . c  om*/
    animation.setRepeatMode(Animation.REVERSE);
    animation.setRepeatCount(Animation.INFINITE);
    animation.setAnimationListener(new Animation.AnimationListener() {
        private int repeatCounter = 0;

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
            if (++repeatCounter % 2 == 0 && nextStatus != Status.INDEFINITE) {
                applyNextStatus();
            }
        }
    });

    progressBar.setVisibility(VISIBLE);
    progressBar.clearAnimation();
    progressBar.startAnimation(animation);
}

From source file:com.gigigo.vuforiaimplementation.VuforiaActivity.java

private void startBoringAnimation() {
    scanLine.setVisibility(View.VISIBLE);
    // Create animators for y axe
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
        int yMax = 0;
        yMax = getResources().getDisplayMetrics().heightPixels; //mVuforiaView.getDisplay().getHeight();
        yMax = (int) (yMax * 0.9);// 174;

        ObjectAnimator oay = ObjectAnimator.ofFloat(scanLine, "translationY", 0, yMax);
        oay.setRepeatCount(Animation.INFINITE);
        oay.setDuration(ANIM_DURATION);/*w ww  .j a  va  2  s  . c  om*/
        oay.setRepeatMode(Animation.REVERSE);

        oay.setInterpolator(new LinearInterpolator());
        oay.start();

        //for draw points near scanline
        markFakeFeaturePoint.setObjectAnimator(oay);
    }

    //scanAnimation.

}

From source file:de.grobox.liberario.ui.LocationInputGPSView.java

public void activateGPS() {
    if (isSearching())
        return;//from w  w w.  j  ava 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:com.pentacog.mctracker.ServerListAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {

    RelativeLayout serverView = null;/*  ww  w. j a va 2 s .c om*/
    ServerViewHolder holder = null;
    Server server = serverList.get(position);
    server.id = position;
    if (convertView == null) {
        serverView = (RelativeLayout) LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item,
                parent, false);
        holder = new ServerViewHolder((int) getItemId(position), serverView);
        serverView.setTag(holder);
    } else {
        serverView = (RelativeLayout) convertView;
        holder = (ServerViewHolder) serverView.getTag();
        holder.id = (int) getItemId(position);
    }

    //set server name
    holder.serverTitle.setText(server.name);
    //set server IP
    String serverName = server.address.toString();
    if (!serverName.startsWith("/")) {
        int index = serverName.lastIndexOf('/');
        if (index != -1) {
            String tempString;
            tempString = serverName.substring(index + 1);
            serverName = serverName.substring(0, index);
            serverName += " " + tempString;
        }
    } else {
        serverName = serverName.replace("/", "");
    }
    if (server.port != 25565)
        serverName += ":" + server.port;
    holder.serverIp.setText(serverName);

    //set fav icon
    if (server.favorite) {
        holder.favStar.setVisibility(View.VISIBLE);
    } else {
        holder.favStar.setVisibility(View.INVISIBLE);
    }

    if (!server.queried) {
        AlphaAnimation a = new AlphaAnimation(1.0f, 0.2f);
        a.setRepeatCount(Animation.INFINITE);
        a.setRepeatMode(Animation.REVERSE);
        a.setDuration(300);
        holder.statusBar.setBackgroundColor(Color.BLUE);
        holder.statusBar.startAnimation(a);

        //         holder.loading.setVisibility(View.VISIBLE);
        holder.playerCount.setText("" + server.playerCount + "/" + server.maxPlayers);
        holder.serverData.setText(R.string.loading);
        holder.playerCount.setVisibility(View.INVISIBLE);
        holder.ping.setVisibility(View.INVISIBLE);
        new ServerViewUpdater(serverView, server);
    } else {
        setupServerCell(server, holder);
    }

    return serverView;
}

From source file:com.actionbarsherlock.sample.styledactionbar.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        // TODO handle clicking the app icon/logo
        return false;
    case R.id.menu_refresh:
        // switch to a progress animation
        item.setActionView(R.layout.indeterminate_progress_action);
        return true;
    case R.id.menu_both:
        // rotation animation of green fragment
        rotateLeftFrag();//from   ww w .  ja va 2s .c o  m
    case R.id.menu_text:
        // alpha animation of blue fragment
        if (IS_HONEYCOMB) {
            ObjectAnimatorAlpha.invoke(rightFrag.getView());
        } else {
            AlphaAnimation alpha = new AlphaAnimation(1f, 0f);
            alpha.setRepeatMode(Animation.REVERSE);
            alpha.setRepeatCount(1);
            alpha.setDuration(800);
            rightFrag.getView().startAnimation(alpha);
        }
        return true;
    case R.id.menu_logo:
        useLogo = !useLogo;
        item.setChecked(useLogo);
        getSupportActionBar().setDisplayUseLogoEnabled(useLogo);
        return true;
    case R.id.menu_up:
        showHomeUp = !showHomeUp;
        item.setChecked(showHomeUp);
        getSupportActionBar().setDisplayHomeAsUpEnabled(showHomeUp);
        return true;
    case R.id.menu_nav_tabs:
        item.setChecked(true);
        showTabsNav();
        return true;
    case R.id.menu_nav_label:
        item.setChecked(true);
        showStandardNav();
        return true;
    case R.id.menu_nav_drop_down:
        item.setChecked(true);
        showDropDownNav();
        return true;
    case R.id.menu_bak_none:
        item.setChecked(true);
        getSupportActionBar().setBackgroundDrawable(null);
        return true;
    case R.id.menu_bak_gradient:
        item.setChecked(true);
        getSupportActionBar()
                .setBackgroundDrawable(getResources().getDrawable(R.drawable.ad_action_bar_gradient_bak));
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}

From source file:quickbeer.android.views.ProgressIndicatorBar.java

private void animateScroller() {
    Timber.v("animateScroller()");
    checkNotNull(progressBar);// w  w w  .ja v a  2s.  c  o  m

    int animEnd = getWidth() - progressBarWidth;

    TranslateAnimation animation = new TranslateAnimation(0, animEnd, 0, 0);
    animation.setDuration(ANIMATION_SCROLL_DURATION);
    animation.setFillAfter(true);
    animation.setRepeatMode(Animation.REVERSE);
    animation.setRepeatCount(Animation.INFINITE);
    animation.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
            if (nextProgress.getStatus() != INDEFINITE) {
                applyNextStatus();
            }
        }
    });

    progressBar.setVisibility(VISIBLE);
    progressBar.clearAnimation();
    progressBar.startAnimation(animation);
}

From source file:heartware.com.heartware_master.ProfileFragment.java

/**
 * start the animation on the graph/*from w  w w . ja va 2s.  c  o  m*/
 */
private void triggerAnimation() {
    // set up animation
    Animation animation = AnimationUtils.loadAnimation(getActivity(), R.anim.animated_view);
    animation.setRepeatMode(Animation.REVERSE);
    animation.setRepeatCount(Animation.INFINITE);
    mGraph.startAnimation(animation);
}

From source file:org.span.manager.MainActivity.java

/** Called when the activity is first created. */
@Override/*from  www  .j  a v  a  2 s .com*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.d(TAG, "onCreate()"); // DEBUG

    setContentView(R.layout.main);

    app = (ManetManagerApp) getApplication();
    app.manet.registerObserver(this);

    // init table rows
    startTblRow = (TableRow) findViewById(R.id.startAdhocRow);
    stopTblRow = (TableRow) findViewById(R.id.stopAdhocRow);
    radioModeImage = (ImageView) findViewById(R.id.radioModeImage);
    batteryTemperatureLayout = (RelativeLayout) findViewById(R.id.layoutBatteryTemp);
    headerMainLayout = (RelativeLayout) findViewById(R.id.layoutHeaderMain);

    batteryTemperature = (TextView) findViewById(R.id.batteryTempText);
    tvIP = (TextView) findViewById(R.id.tvIP);
    tvSSID = (TextView) findViewById(R.id.tvSSID);

    // Update the IP and SSID display immediate when the Activity is shown and
    // when the orientation is changed.
    app.manet.sendManetConfigQuery();

    // define animation
    animation = new ScaleAnimation(0.9f, 1, 0.9f, 1, // From x, to x, from y, to y
            ScaleAnimation.RELATIVE_TO_SELF, 0.5f, ScaleAnimation.RELATIVE_TO_SELF, 0.5f);
    animation.setDuration(600);
    animation.setFillAfter(true);
    animation.setStartOffset(0);
    animation.setRepeatCount(1);
    animation.setRepeatMode(Animation.REVERSE);

    // start button
    startBtn = (ImageView) findViewById(R.id.startAdhocBtn);
    startBtnListener = new OnClickListener() {
        @Override
        public void onClick(View v) {
            Log.d(TAG, "StartBtn pressed ...");
            showDialog(ID_DIALOG_STARTING);
            currDialogId = ID_DIALOG_STARTING;
            app.manet.sendStartAdhocCommand();
        }
    };
    startBtn.setOnClickListener(this.startBtnListener);

    // stop button
    stopBtn = (ImageView) findViewById(R.id.stopAdhocBtn);
    stopBtnListener = new OnClickListener() {
        @Override
        public void onClick(View v) {
            Log.d(TAG, "StopBtn pressed ...");
            showDialog(ID_DIALOG_STOPPING);
            currDialogId = ID_DIALOG_STOPPING;
            app.manet.sendStopAdhocCommand();
        }
    };
    stopBtn.setOnClickListener(this.stopBtnListener);

    // start messenger service so that it runs even if no active activities are bound to it
    startService(new Intent(this, MessageService.class));
    Intent theIntent = getIntent();
    String action = theIntent.getAction();

    String intentData = theIntent.getDataString();
    if (action != null && action.equals(Intent.ACTION_VIEW)) {
        Bundle bundle = new Bundle(1);
        bundle.putString("filepath", intentData);
        showDialog(ID_DIALOG_CONFIG, bundle);
    }

    EulaHelper eula = new EulaHelper(this, this);
    eula.showDialog();
}