List of usage examples for android.widget ImageView startAnimation
public void startAnimation(Animation animation)
From source file:com.koushikdutta.superuser.FragmentIntro.java
@Nullable @Override//from www . ja va 2s . c o m public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View parent = inflater.inflate(layoutResId, container, false); if (layoutResId != R.layout.fragment_intro_0) return parent; final ImageView superuser = (ImageView) parent.findViewById(R.id.superuser); final ImageView background = (ImageView) parent.findViewById(R.id.superuser_back); final TextView title = (TextView) parent.findViewById(R.id.title); final TextView desc = (TextView) parent.findViewById(R.id.tour); final Animation fadeIn, zoomIn; fadeIn = AnimationUtils.loadAnimation(getContext(), R.anim.fade_in); zoomIn = AnimationUtils.loadAnimation(getContext(), R.anim.zoom_in); fadeIn.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { background.startAnimation(zoomIn); background.setVisibility(View.VISIBLE); } @Override public void onAnimationRepeat(Animation animation) { } }); zoomIn.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { Animation fadeIn2 = AnimationUtils.loadAnimation(getContext(), R.anim.fade_in); fadeIn2.setDuration(1000); fadeIn2.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { Animation fadeIn3 = AnimationUtils.loadAnimation(getContext(), R.anim.fade_in); fadeIn3.setDuration(400); fadeIn3.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { ((ActivityIntro) getActivity()).setProgressButtonEnabled(true); } @Override public void onAnimationRepeat(Animation animation) { } }); desc.startAnimation(fadeIn3); desc.setVisibility(View.VISIBLE); } @Override public void onAnimationRepeat(Animation animation) { } }); title.startAnimation(fadeIn2); title.setVisibility(View.VISIBLE); } @Override public void onAnimationEnd(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } }); new Handler().postDelayed(new Runnable() { @Override public void run() { superuser.startAnimation(fadeIn); superuser.setVisibility(View.VISIBLE); } }, 600); return parent; }
From source file:com.huofu.RestaurantOS.ui.splash.activate.java
/** * ?//from w w w . ja va 2 s . c o m */ public void showLoadingDialog(String text) { LayoutInflater inflater = (LayoutInflater) ctxt.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View grid = inflater.inflate(R.layout.loading_layout, null); TextView tv = (TextView) grid.findViewById(R.id.textview_loading_content); tv.setText(text); ImageView iv = (ImageView) grid.findViewById(R.id.imageview_loading_pic); iv.startAnimation(AnimationUtils.loadAnimation(ctxt, R.anim.rotate_loading)); int width = CommonUtils.getScreenWidth(ctxt); int height = CommonUtils.getScreenHeight(ctxt); if (dialog_loading == null) { dialog_loading = new PopupWindow(grid, width, height, true); } else { dialog_loading.setContentView(grid); } dialog_loading.setFocusable(true); dialog_loading.setOutsideTouchable(true); dialog_loading.setAnimationStyle(R.style.AutoDialogAnimation); dialog_loading.setBackgroundDrawable(new BitmapDrawable()); if (hasFocus) { dialog_loading.showAtLocation(rl_activate, Gravity.NO_GRAVITY, 0, 0); } }
From source file:de.uni_weimar.m18.anatomiederstadt.SplashActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); final PathView pathView = (PathView) findViewById(R.id.pathView); pathView.useNaturalColors();/*from w ww.j a v a2 s . c om*/ int pathDelay = 1000; int pathDuration = 2500; final Animation a = new AlphaAnimation(0.00f, 1.00f); a.setStartOffset(3500); a.setDuration(1000); //pathView.setSvgResource(R.raw.vitruvian_man_weimar_kk3); pathView.getPathAnimator().delay(pathDelay).duration(pathDuration) .interpolator(new AccelerateDecelerateInterpolator()).start(); final ImageView logoImage = (ImageView) findViewById(R.id.logoImage); a.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { logoImage.setVisibility(View.VISIBLE); new Handler().postDelayed(new Runnable() { @Override public void run() { launchMainActivity(); } }, 1500); } @Override public void onAnimationRepeat(Animation animation) { } }); logoImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { launchMainActivity(); } }); logoImage.startAnimation(a); }
From source file:com.benefit.buy.library.http.query.callback.BitmapAjaxCallback.java
private static void setBmAnimate(ImageView iv, Bitmap bm, Bitmap preset, int fallback, int animation, float ratio, float anchor, int source) { bm = filter(iv, bm, fallback);/*from w w w . jav a 2 s. c o m*/ if (bm == null) { iv.setImageBitmap(null); return; } Drawable d = makeDrawable(iv, bm, ratio, anchor); Animation anim = null; if (fadeIn(animation, source)) { if (preset == null) { anim = new AlphaAnimation(0, 1); anim.setInterpolator(new DecelerateInterpolator()); anim.setDuration(FADE_DUR); } else { Drawable pd = makeDrawable(iv, preset, ratio, anchor); Drawable[] ds = new Drawable[] { pd, d }; TransitionDrawable td = new TransitionDrawable(ds); td.setCrossFadeEnabled(true); td.startTransition(FADE_DUR); d = td; } } else if (animation > 0) { anim = AnimationUtils.loadAnimation(iv.getContext(), animation); } iv.setImageDrawable(d); if (anim != null) { anim.setStartTime(AnimationUtils.currentAnimationTimeMillis()); iv.startAnimation(anim); } else { iv.setAnimation(null); } }
From source file:com.zhongsou.souyue.activity.SplashActivity.java
private void animationHide(ImageView iv) { try {/*from w w w .j ava2 s . c om*/ AlphaAnimation ai = new AlphaAnimation(1.0f, 0.0f); ai.setDuration(500); ai.setFillAfter(true); iv.startAnimation(ai); } catch (Exception ex) { } }
From source file:com.zhongsou.souyue.activity.SplashActivity.java
private void animationShow(ImageView iv) { try {/* w w w. j av a 2s . co m*/ AlphaAnimation ai = new AlphaAnimation(0.0f, 1.0f); ai.setDuration(500); ai.setFillAfter(true); iv.startAnimation(ai); } catch (Exception ex) { } }
From source file:com.evandroid.musica.fragment.LocalLyricsFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); if (this.isHidden()) return;/*from ww w . j a v a 2 s . c om*/ megaListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() { @Override public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) { final ImageView indicator = (ImageView) v.findViewById(R.id.group_indicator); RotateAnimation anim; if (megaListView.isGroupExpanded(groupPosition)) { megaListView.collapseGroupWithAnimation(groupPosition); if (indicator != null) { anim = new RotateAnimation(180f, 360f, indicator.getWidth() / 2, indicator.getHeight() / 2); anim.setInterpolator(new DecelerateInterpolator(3)); anim.setDuration(500); anim.setFillAfter(true); indicator.startAnimation(anim); } } else { megaListView.expandGroupWithAnimation(groupPosition); if (indicator != null) { anim = new RotateAnimation(0f, 180f, indicator.getWidth() / 2, indicator.getHeight() / 2); anim.setInterpolator(new DecelerateInterpolator(2)); anim.setDuration(500); anim.setFillAfter(true); indicator.startAnimation(anim); } } return true; } }); megaListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() { @Override public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { if (mSwiping) { mSwiping = false; return false; } final MainLyricActivity mainLyricActivity = (MainLyricActivity) getActivity(); megaListView.setOnChildClickListener(null); // prevents bug on double tap mainLyricActivity.updateLyricsFragment(R.animator.slide_out_start, R.animator.slide_in_start, true, lyricsArray.get(groupPosition).get(childPosition)); return true; } }); this.isActiveFragment = true; new DBContentLister(this).execute(); }
From source file:ac.robinson.ticqr.TicQRActivity.java
private void addTickHighlight(TickBoxHolder tickBox) { int tickIcon = R.drawable.ic_highlight_tick; Drawable tickDrawable = getResources().getDrawable(tickIcon); ImageView tickHighlight = new ImageView(TicQRActivity.this); tickHighlight.setImageResource(tickIcon); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); layoutParams.leftMargin = mImageView.getLeft() + Math.round(tickBox.imagePosition.x) - (tickDrawable.getIntrinsicWidth() / 2); layoutParams.topMargin = mImageView.getTop() + Math.round(tickBox.imagePosition.y) - (tickDrawable.getIntrinsicHeight() / 2); ((RelativeLayout) findViewById(R.id.tick_highlight_holder)).addView(tickHighlight, layoutParams); tickHighlight.startAnimation(AnimationUtils.loadAnimation(this, R.anim.pulse)); tickHighlight.setOnClickListener(mTickClickListener); tickHighlight.setTag(tickBox);//from www . ja v a 2s . c o m }
From source file:qr.cloud.qrpedia.MessageViewerActivity.java
private void setRefreshIcon(MenuItem item) { if (item != null) { mRefreshButtonItem = item;/* w w w .j a v a 2 s .c om*/ mRefreshButtonItem.setActionView(R.layout.refresh_button); ImageView refreshIcon = (ImageView) mRefreshButtonItem.getActionView() .findViewById(R.id.refresh_button); refreshIcon.startAnimation(mRotateAnimation); } else if (mRefreshButtonItem != null) { ImageView refreshIcon = (ImageView) mRefreshButtonItem.getActionView() .findViewById(R.id.refresh_button); refreshIcon.clearAnimation(); mRotateAnimation.cancel(); mRefreshButtonItem.setActionView(null); mRefreshButtonItem = null; } else { mRotateAnimation.cancel(); // always try to cancel the animation (even if we've rotated) } }
From source file:com.appbase.androidquery.callback.BitmapAjaxCallback.java
private static void setBmAnimate(ImageView iv, Bitmap bm, Bitmap preset, int fallback, int animation, float ratio, float anchor, int source) { bm = filter(iv, bm, fallback);/*from w w w. ja v a 2s.c om*/ if (bm == null) { iv.setImageBitmap(null); return; } Drawable d = makeDrawable(iv, bm, ratio, anchor); Animation anim = null; if (fadeIn(animation, source)) { if (preset == null) { anim = new AlphaAnimation(0, 1); anim.setInterpolator(new DecelerateInterpolator()); anim.setDuration(FADE_DUR); } else { Drawable pd = makeDrawable(iv, preset, ratio, anchor); Drawable[] ds = new Drawable[] { pd, d }; TransitionDrawable td = new TransitionDrawable(ds); td.setCrossFadeEnabled(true); td.startTransition(FADE_DUR); d = td; } } else if (animation > 0) { anim = AnimationUtils.loadAnimation(iv.getContext(), animation); } iv.setImageDrawable(d); if (anim != null) { anim.setStartTime(AnimationUtils.currentAnimationTimeMillis()); iv.startAnimation(anim); } else { iv.setAnimation(null); } }