Example usage for android.widget TextView startAnimation

List of usage examples for android.widget TextView startAnimation

Introduction

In this page you can find the example usage for android.widget TextView startAnimation.

Prototype

public void startAnimation(Animation animation) 

Source Link

Document

Start the specified animation now.

Usage

From source file:Main.java

public static void SetFlickerAnimation(final TextView v, final String info, final String temp) {
    v.setText(info);/*  w w w  .ja  v a2 s.  c o m*/
    AlphaAnimation anim = new AlphaAnimation(0, 1);
    anim.setDuration(4000);
    anim.setRepeatCount(Animation.INFINITE);
    // anim1.setRepeatMode(Animation.REVERSE);
    anim.setAnimationListener(new AnimationListener() {
        @Override
        public void onAnimationStart(Animation arg0) {
            // TODO Auto-generated method stub
        }

        @Override
        public void onAnimationRepeat(Animation arg0) {
            // TODO Auto-generated method stub
            num++;
            if (num == 10) {
                num = 0;
            }
            if (num % 2 == 0) {
                v.setText(info);
            } else {
                v.setText(temp);
            }
        }

        @Override
        public void onAnimationEnd(Animation arg0) {
            // TODO Auto-generated method stub

        }
    });
    v.startAnimation(anim);

}

From source file:id.zelory.tanipedia.activity.LoginActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    if (PrefUtils.ambilString(this, "nama") != null) {
        Intent intent = new Intent(LoginActivity.this, CuacaActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
        startActivity(intent);//from   w w  w.  ja  v  a 2s.com
    }

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

    Animation animation = AnimationUtils.loadAnimation(this, R.anim.simple_grow);
    findViewById(R.id.tanipedia).startAnimation(animation);
    findViewById(R.id.card).startAnimation(animation);
    Button login = (Button) findViewById(R.id.login);
    login.startAnimation(animation);
    login.setOnClickListener(this);
    TextView daftar = (TextView) findViewById(R.id.register);
    daftar.startAnimation(animation);
    daftar.setOnClickListener(this);
    editEmail = (EditText) findViewById(R.id.email);
    editPass = (EditText) findViewById(R.id.password);
}

From source file:net.olejon.mdapp.WelcomeFirstFragment.java

private void animateTextView(TextView textView) {
    Animation animation = AnimationUtils.loadAnimation(getActivity(), R.anim.welcome_guide);

    textView.setVisibility(View.VISIBLE);
    textView.startAnimation(animation);
}

From source file:com.silentcircle.silenttext.activity.AccountCreationActivity.java

@Override
public void onError(final CharSequence message) {

    runOnUiThread(new Runnable() {

        @Override/*w  w w . ja  v a  2  s . c  om*/
        public void run() {
            TextView error = (TextView) findViewById(R.id.error);
            error.setText(
                    message == null || message.length() <= 0 ? getString(R.string.error_unknown) : message);
            error.setVisibility(View.VISIBLE);
            error.startAnimation(AnimationUtils.loadAnimation(error.getContext(), R.anim.slide_down));
            handler.removeCallbacks(hideError);
            handler.postDelayed(hideError, 5000);
        }

    });

}

From source file:com.artur.softwareproject.Main.java

private void stopRecording() {
    final Context context = this;

    AsyncTask<Void, Void, Void> task = new AsyncTask<Void, Void, Void>() {
        @Override/*from w w w.  j  a  v a  2 s  . c  o  m*/
        protected void onPreExecute() {
            pd = new ProgressDialog(context);
            pd.setTitle("Processing...");
            pd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
            pd.setMessage("Please wait.");
            pd.setCancelable(false);
            pd.setIndeterminate(true);
            pd.show();
        }

        @Override
        protected Void doInBackground(Void... params) {
            modelConstructed = rService.create3dModel();

            return null;
        }

        @Override
        protected void onPostExecute(Void result) {
            if (pd != null) {
                pd.dismiss();
            }

            if (rBound) {
                unbindService(mConnection);
                rBound = false;
            }

            MenuItem item = mainMenu.findItem(R.id.record_data);

            item.setIcon(R.drawable.ic_action_save);

            Animation a = AnimationUtils.loadAnimation(context, R.anim.textupslide);
            TextView tv = (TextView) findViewById(R.id.recordClock);
            tv.startAnimation(a);

            recordClock.setVisibility(View.GONE);

            recording = false;

            if (modelConstructed) {
                Toast.makeText(getApplicationContext(), "Recording stopped.\n3D model created.",
                        Toast.LENGTH_LONG).show();
            } else {
                Toast.makeText(getApplicationContext(), "Recording stopped.\n3D model creation failed.",
                        Toast.LENGTH_LONG).show();
            }
        }
    };

    task.execute((Void[]) null);

}

From source file:com.artur.softwareproject.Main.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.disconnect:

        if (!recording) {
            stopService(bluetoothServiceIntent);

            final ProgressDialog disconnectingDialog = new ProgressDialog(Main.this);

            disconnectingDialog.setMessage("Disconnecting...");
            disconnectingDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
            disconnectingDialog.setCancelable(false);
            disconnectingDialog.show();/*w  w  w . jav a  2s.  c om*/

            disconDialog = disconnectingDialog;

            final DisconnectHandlerClass disconnectHandler = new DisconnectHandlerClass(this);

            disconnectThread = new Thread(new Runnable() {
                @Override
                public void run() {
                    int stop = 0;

                    while (stop == 0) {
                        stop = getDisconnect();
                        sleep(1500);
                    }

                    disconnectHandler.sendEmptyMessage(0);
                }
            });

            disconnectThread.start();
        }

        return true;

    case R.id.record_data:

        Log.d(TAG, "Record button was Pressed. Gps status: " + gpsStatus);

        if (!recording && gpsStatus) {
            Intent resetIntent = new Intent();

            resetIntent.putExtra("reset", "");
            resetIntent.setAction("resetFilter");

            LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(resetIntent);

            item.setIcon(R.drawable.ic_action_stop);

            Toast.makeText(getApplicationContext(), "Start recording data", Toast.LENGTH_LONG).show();

            currentTime = System.currentTimeMillis();
            recordClock.setVisibility(View.VISIBLE);

            Animation a = AnimationUtils.loadAnimation(this, R.anim.textslide);
            TextView tv = (TextView) findViewById(R.id.recordClock);

            tv.startAnimation(a);

            recording = true;

            if (!rBound) {
                Intent intent = new Intent(this, RecordService.class);
                bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
            }
        } else if (recording) {
            stopRecording();
        }

        return true;

    case R.id.vr_menu:

        if (!recording) {
            Intent vrIntent = new Intent(Main.this, VRmenuMap.class);
            Main.this.startActivity(vrIntent);
        }

        return true;

    default:

        return super.onOptionsItemSelected(item);
    }
}

From source file:org.libreoffice.impressremote.fragment.ComputersFragment.java

private void showProgressMessage() {
    TextView aProgressMessageView = getProgressMessageView();
    Animation aFadeInAnimation = AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in);

    aProgressMessageView.setText(getProgressMessage());

    aProgressMessageView.startAnimation(aFadeInAnimation);
    aProgressMessageView.setVisibility(View.VISIBLE);
}

From source file:org.secuso.privacyfriendlydicegame.MainActivity.java

public void flashResult() {

    Animation animation = new AlphaAnimation(0.0f, 1.0f);
    animation.setDuration(500);//ww w .  ja va 2  s .c  o  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.libreoffice.impressremote.fragment.ComputersFragment.java

private void showLearnMoreMessage() {
    TextView learnMoreView = (TextView) getView().findViewById(R.id.text_learn_more);
    Animation aFadeInAnimation = AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in);

    learnMoreView.setMovementMethod(LinkMovementMethod.getInstance());

    learnMoreView.startAnimation(aFadeInAnimation);
    learnMoreView.setVisibility(View.VISIBLE);
}

From source file:com.khoahuy.phototag.HomeActivity.java

private void showReady2ScanBlinkText() {

    TextView myText = (TextView) findViewById(R.id.text_ready2scan);

    Animation anim = new AlphaAnimation(0.4f, 1.0f);
    anim.setDuration(200); //You can manage the time of the blink with this parameter
    anim.setStartOffset(800);//w ww  .j a v a  2s .co  m
    anim.setRepeatMode(Animation.REVERSE);
    anim.setRepeatCount(Animation.INFINITE);
    myText.startAnimation(anim);

}