Android Open Source - advanced-textview Animated Compound Drawable Activity






From Project

Back to project page advanced-textview.

License

The source code is released under:

Apache License

If you think the Android project advanced-textview listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.sqisland.android.advanced_textview;
/*from   www.j  a va2s . co m*/
import android.app.Activity;
import android.graphics.drawable.Animatable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.widget.TextView;

public class AnimatedCompoundDrawableActivity extends Activity {
  private TextView textView;

  private enum Operation {
    START, STOP
  }

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_animated_compound_drawable);
    textView = (TextView) findViewById(R.id.text);
  }

  @Override
  protected void onStart() {
    super.onStart();
    changeAnimation(Operation.START);
  }

  @Override
  protected void onStop() {
    super.onStop();
    changeAnimation(Operation.STOP);
  }

  private void changeAnimation(Operation operation) {
    Drawable[] drawables = textView.getCompoundDrawables();
    for (Drawable drawable : drawables) {
      if (drawable != null && drawable instanceof Animatable) {
        Animatable animatable = ((Animatable) drawable);
        switch (operation) {
          case START:
            animatable.start();
            break;
          case STOP:
            animatable.stop();
            break;
        }
      }
    }
  }
}




Java Source Code List

com.sqisland.android.advanced_textview.AboutActivity.java
com.sqisland.android.advanced_textview.AlignmentSpanActivity.java
com.sqisland.android.advanced_textview.AnimatedCompoundDrawableActivity.java
com.sqisland.android.advanced_textview.AnimatedRainbowSpanActivity.java
com.sqisland.android.advanced_textview.ClickableSpanActivity.java
com.sqisland.android.advanced_textview.CustomFontActivity.java
com.sqisland.android.advanced_textview.EmojiActivity.java
com.sqisland.android.advanced_textview.FractionActivity.java
com.sqisland.android.advanced_textview.FromHtmlActivity.java
com.sqisland.android.advanced_textview.GradientTextActivity.java
com.sqisland.android.advanced_textview.LinedPaperActivity.java
com.sqisland.android.advanced_textview.MainActivity.java
com.sqisland.android.advanced_textview.PatternedTextActivity.java
com.sqisland.android.advanced_textview.RainbowSpanActivity.java
com.sqisland.android.advanced_textview.ShadowTextActivity.java
com.sqisland.android.advanced_textview.StyledStringActivity.java
com.sqisland.android.advanced_textview.widget.LinedEditText.java