Example usage for android.widget ImageView startAnimation

List of usage examples for android.widget ImageView startAnimation

Introduction

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

Prototype

public void startAnimation(Animation animation) 

Source Link

Document

Start the specified animation now.

Usage

From source file:Main.java

public static void twoPoint(ImageView imageview, float f, float f1, int i, int j) {
    TranslateAnimation translateanimation = new TranslateAnimation(0.0F, f, 0.0F, f1);
    translateanimation.setFillAfter(true);
    translateanimation.setDuration(j);/*from  w ww  .j  a  v  a2  s .c o  m*/
    imageview.startAnimation(translateanimation);
}

From source file:org.videolan.vlc.gui.helpers.UiTools.java

public static void fillAboutView(View v) {
    TextView link = (TextView) v.findViewById(R.id.main_link);
    link.setText(Html.fromHtml(VLCApplication.getAppResources().getString(R.string.about_link)));

    String revision = VLCApplication.getAppResources().getString(R.string.build_revision) + " VLC: "
            + VLCApplication.getAppResources().getString(R.string.build_vlc_revision);
    String builddate = VLCApplication.getAppResources().getString(R.string.build_time);
    String builder = VLCApplication.getAppResources().getString(R.string.build_host);

    TextView compiled = (TextView) v.findViewById(R.id.main_compiled);
    compiled.setText(builder + " (" + builddate + ")");
    TextView textview_rev = (TextView) v.findViewById(R.id.main_revision);
    textview_rev.setText(VLCApplication.getAppResources().getString(R.string.revision) + " " + revision + " ("
            + builddate + ") " + BuildConfig.FLAVOR_abi);

    final ImageView logo = (ImageView) v.findViewById(R.id.logo);
    logo.setOnClickListener(new View.OnClickListener() {
        @Override//from www.j a  v a 2 s  .  c  om
        public void onClick(View v) {
            AnimationSet anim = new AnimationSet(true);
            RotateAnimation rotate = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f,
                    Animation.RELATIVE_TO_SELF, 0.5f);
            rotate.setDuration(800);
            rotate.setInterpolator(new DecelerateInterpolator());
            anim.addAnimation(rotate);
            logo.startAnimation(anim);
        }
    });
}

From source file:Main.java

public static void SetMenuAnimation(final ImageView v, final int bg1, final int bg2) {
    v.setImageResource(bg1);//from   w w w  .j a  v a 2  s  .c o  m
    AlphaAnimation anim = new AlphaAnimation(0.8f, 1);
    anim.setDuration(1000);
    anim.setRepeatCount(Animation.INFINITE);
    // anim1.setRepeatMode(Animation.REVERSE);
    anim.setInterpolator(new AccelerateInterpolator());
    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.setImageResource(bg1);
            } else {
                v.setImageResource(bg2);
            }
        }

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

        }
    });
    v.startAnimation(anim);

}

From source file:random.taiga.chat.truelecter.randomchat.LoginActivity.java

private void spinImage() {
    instance.runOnUiThread(new Runnable() {
        @Override// ww w  . jav a2s  .c om
        public void run() {
            Animation rot = AnimationUtils.loadAnimation(instance.getApplicationContext(), R.anim.rotate_logo);
            ImageView iv = (ImageView) findViewById(R.id.imgLogo);
            iv.startAnimation(rot);
        }
    });
}

From source file:com.android.argb.edhlc.Utils.java

public static void collapse(Context context, final CardView card, TextView title, ImageView selector,
        int minHeight, int maxHeight) {
    title.setTextColor(ContextCompat.getColor(context, R.color.secondary_text));

    Animation rotation = AnimationUtils.loadAnimation(context, R.anim.rotate_180_clockwise);
    selector.startAnimation(rotation);
    selector.setColorFilter(ContextCompat.getColor(context, R.color.secondary_text));

    ValueAnimator anim = ValueAnimator.ofInt(maxHeight, minHeight);
    anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override/* w ww  .  j  a  va2 s . c  o  m*/
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            int val = (Integer) valueAnimator.getAnimatedValue();
            ViewGroup.LayoutParams layoutParams = card.getLayoutParams();
            layoutParams.height = val;
            card.setLayoutParams(layoutParams);
        }
    });
    anim.start();
}

From source file:sh.ftp.rocketninelabs.meditationassistant.AboutActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setTheme(getMeditationAssistant().getMATheme());
    getActionBar().setDisplayHomeAsUpEnabled(true);
    setContentView(R.layout.activity_about);

    TextView txtAboutAppName = (TextView) findViewById(R.id.txtAboutAppName);
    TextView txtAboutAppVersion = (TextView) findViewById(R.id.txtAboutAppVersion);

    if (BuildConfig.FLAVOR.equals("free")) {
        txtAboutAppName.setText(getString(R.string.appName));
    } else {/*from  ww w.j a  v a2 s . com*/
        txtAboutAppName.setText(getString(R.string.appNameShort));
    }

    PackageInfo pInfo;
    try {
        pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
        txtAboutAppVersion.setText(String.format(getString(R.string.version), pInfo.versionName));
    } catch (PackageManager.NameNotFoundException e) {
        txtAboutAppVersion.setVisibility(View.GONE);
        e.printStackTrace();
    }

    LinearLayout layAbout = (LinearLayout) findViewById(R.id.layAbout);
    layAbout.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View arg0) {
            ImageView charis = (ImageView) findViewById(R.id.charis);
            charis.setVisibility(View.VISIBLE);
            charis.startAnimation(AnimationUtils.loadAnimation(getApplicationContext(), R.anim.spin));
            return true;
        }
    });

    getMeditationAssistant().utility.initializeTracker(this);
}

From source file:ua.com.spasetv.testintuitions.FragExerciseTwo.java

@Override
public void onAnimationEnd(Animation animation) {
    if (animation == animPauseBeforeOpenAll) {
        showAllAnswers();//w w w  .ja  v a 2  s. co  m
    } else if (animation == animPauseAfterOpenAll) {
        if (numberRepeatExercise < REPEAT_EX_TWO) {
            for (ImageView img : arrayButtons) {
                img.startAnimation(animScaleOut);
                img.setAlpha(0.6f);
                img.setImageResource(R.drawable.ic_help_outline_black_24dp);
                img.startAnimation(animScaleIn);
            }
            initExerciseBeforeRepeat();
            setProgressBar(numberRepeatExercise);
            setButtonsTouchListener(); //set touch listener to the all buttons
            isOnTouchKeyOn = true;
        } else {
            try {
                saveResultExercise();
            } catch (IOException e) {
                e.printStackTrace();
            }
            onExerciseFinishListener.onExerciseFinish(FRAGMENT_EXERCISE_TWO, (byte) totalCorrectAnswers);
        }
    }
    if (vibrator != null)
        vibrator.cancel();
}

From source file:uk.bcu.MusicDetailsActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    super.setTitle("Track Detail Info");
    super.setTitleColor(Color.rgb(56, 172, 236));

    setContentView(R.layout.details);//w  w w.  j  a  v  a 2  s.  c  o  m

    ImageView AlbumArt = (ImageView) findViewById(R.id.AlbumArt);
    Animation fadeInAnimation = AnimationUtils.loadAnimation(this, R.anim.fade_in);
    // Now Set your animation
    AlbumArt.startAnimation(fadeInAnimation);

    txtTitle = (TextView) findViewById(R.id.AlbumTitle);
    txtartist = (TextView) findViewById(R.id.Artist);
    txtmbid = (TextView) findViewById(R.id.MbidDetails);
    txtDescriptionTitle = (TextView) findViewById(R.id.UrlDetails);
    txtAlbum = (TextView) findViewById(R.id.ReleaseDateDetails);
    txtlisteners = (TextView) findViewById(R.id.ListenersDetails);
    txtplaycount = (TextView) findViewById(R.id.PlaycountDetails);

    imgTrack = (ImageView) findViewById(R.id.AlbumArt);

    String strmusic = this.getIntent().getExtras().getString("music");
    if (strmusic != null) {
        try {
            music = new JSONObject(strmusic);
            super.setTitle(music.getString("name"));

            txtTitle.setText(music.getString("name"));
            txtartist.setText(music.getString("artist"));
            txtmbid.setText(music.getString("mbid"));

            String id = music.getString("mbid");
            MusicDetailsService service = new MusicDetailsService(id);
            service.addListener(this);
            thread = new Thread(service);
            thread.start();

            // music image
            String imagePath = this.getDir("MymusicLib", Context.MODE_PRIVATE).getAbsolutePath()
                    + "/MymusicLib/" + id + ".png";
            File f = new File(imagePath);
            if (f.exists()) {
                imgTrack.setImageBitmap(BitmapFactory.decodeFile(imagePath));
            } else {
                ImageDownloadService downloadService = new ImageDownloadService(
                        music.getJSONArray("image").getJSONObject(2).getString("#text"), imagePath);
                downloadService.addListener(this);
                imageThread = new Thread(downloadService);
                imageThread.start();
            }
        } catch (JSONException ex) {
        }
    }
}

From source file:com.android.argb.edhlc.Utils.java

public static void expand(Context context, final CardView card, TextView title, ImageView selector,
        int minHeight, int maxHeight) {
    title.setTextColor(ContextCompat.getColor(context, R.color.accent_color_dark));

    Animation rotation = AnimationUtils.loadAnimation(context, R.anim.rotate_180_anticlockwise);
    selector.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.arrow_up));
    selector.setRotation(0);//from   w  w  w .  java 2s .c  o m
    selector.startAnimation(rotation);
    selector.setColorFilter(ContextCompat.getColor(context, R.color.accent_color_dark));

    ValueAnimator anim = ValueAnimator.ofInt(minHeight, maxHeight);
    anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            int val = (Integer) valueAnimator.getAnimatedValue();
            ViewGroup.LayoutParams layoutParams = card.getLayoutParams();
            layoutParams.height = val;
            card.setLayoutParams(layoutParams);
            Utils.makeViewVisible(card);
        }
    });
    anim.start();
}

From source file:com.calgen.udacity.lego.ui.ArticleDetailFragment.java

private void playAnimation(ImageView photoView) {
    Animation fadeIn = new AlphaAnimation(0, 1);
    fadeIn.setInterpolator(new AccelerateInterpolator());
    fadeIn.setDuration(500);//ww  w.j  av  a2 s  .com
    photoView.startAnimation(fadeIn);
    shareFab.setVisibility(View.VISIBLE);
    shareFab.startAnimation(fadeIn);
}