List of usage examples for android.widget ImageView startAnimation
public void startAnimation(Animation animation)
From source file:org.orange.querysystem.PostsActivity.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) private void startRefreshAnimation() { if (mRefreshMenuItem == null) return;//from w w w . j a v a2 s.co m /* Attach a rotating ImageView to the refresh item as an ActionView */ LayoutInflater inflater = (LayoutInflater) PostsActivity.this .getSystemService(Context.LAYOUT_INFLATER_SERVICE); ImageView iv = (ImageView) inflater.inflate(R.layout.action_refresh_view, null); Animation rotation = AnimationUtils.loadAnimation(PostsActivity.this, R.anim.clockwise_refresh); rotation.setRepeatCount(Animation.INFINITE); iv.startAnimation(rotation); mRefreshMenuItem.setActionView(iv); }
From source file:fr.alecanu.samplerssreader.RssReaderActivity.java
private void refreshItemAnimationStarted() { final LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); final LinearLayout iv = (LinearLayout) inflater.inflate(R.layout.action_view_refresh, null); final ImageView iconRefresh = (ImageView) iv.findViewById(R.id.action_view_refresh); final Animation rotation = AnimationUtils.loadAnimation(this, R.anim.refresh); if (rotation != null) { iconRefresh.startAnimation(rotation); mRefreshItem.setActionView(iv);//www.ja v a2 s .c o m } }
From source file:com.nextgis.firereporter.MainActivity.java
public void refresh() { if (refreshItem == null || mbRefreshing) return;/*from w w w.jav a 2s. c o m*/ LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); ImageView iv = (ImageView) inflater.inflate(R.layout.refresh_action_view, null); Animation rotation = AnimationUtils.loadAnimation(this, R.anim.clockwise_refresh); rotation.setRepeatCount(Animation.INFINITE); iv.startAnimation(rotation); refreshItem.setActionView(iv); mbRefreshing = true; }
From source file:fr.steren.cloudcup.ImageAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { View grid;/*from ww w . j ava 2s.co m*/ if (convertView == null) { grid = new View(mContext); grid = layoutInflater.inflate(R.layout.grid_view_item, parent, false); } else { grid = (View) convertView; } TextView textView = (TextView) grid.findViewById(R.id.grid_name); final ImageView imageView = (ImageView) grid.findViewById(R.id.grid_image); textView.setText(names.get(position)); String imageUrl = imageUrls.get(position); final Bitmap bitmap = imageCache.get(imageUrl); if (bitmap != null) { imageView.setImageDrawable(new RoundedAvatarDrawable(bitmap)); Animation myFadeInAnimation = AnimationUtils.loadAnimation(mContext, R.anim.abc_fade_in); imageView.startAnimation(myFadeInAnimation); } else { if (!downloadingImageUrls.contains(imageUrl)) { downloadingImageUrls.add(imageUrl); new DownloadImageAsyncTask(imageUrl).execute(); } } return grid; }
From source file:com.smartx.bill.mepad.mestore.uimgloader.AbsListViewBaseActivity.java
protected void setDialog() { dialog = new ProgressDialog(this, R.style.welcome_dialog); dialog.setCancelable(false);/*from www.ja va 2 s . c om*/ dialog.show(); LayoutInflater inflater = LayoutInflater.from(this); View v = inflater.inflate(R.layout.wlecome_dialog, null);// view LinearLayout layout = (LinearLayout) v.findViewById(R.id.dialog_view);// // main.xmlImageView ImageView spaceshipImage = (ImageView) v.findViewById(R.id.img); TextView tipTextView = (TextView) v.findViewById(R.id.tipTextView);// ?? // Animation hyperspaceJumpAnimation = AnimationUtils.loadAnimation(this, R.anim.loading_animation); // ImageView spaceshipImage.startAnimation(hyperspaceJumpAnimation); // tipTextView.setText(msg);// ? dialog.setContentView(layout); }
From source file:gov.wa.wsdot.android.wsdot.ui.mountainpasses.passitem.MountainPassItemActivity.java
private void startRefreshAnimation() { MenuItem item = mToolbar.getMenu().findItem(MENU_ITEM_REFRESH); if (item == null) { Log.e(TAG, "null"); return;/*from w w w . j a va2 s . c om*/ } // define the animation for rotation Animation animation = new RotateAnimation(360.0f, 0.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); animation.setDuration(1000); animation.setRepeatCount(Animation.INFINITE); animation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { mToolbar.getMenu().getItem(MENU_ITEM_REFRESH).setActionView(null); mToolbar.getMenu().getItem(MENU_ITEM_REFRESH).setIcon(R.drawable.ic_menu_refresh); } @Override public void onAnimationRepeat(Animation animation) { } }); ImageView imageView = new ImageView(this, null, android.R.style.Widget_Material_ActionButton); imageView.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_menu_refresh)); imageView.setPadding(31, imageView.getPaddingTop(), 32, imageView.getPaddingBottom()); imageView.startAnimation(animation); item.setActionView(imageView); }
From source file:org.videolan.myvlc.core.gui.about.AboutMainFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.about_main, container, false); TextView link = (TextView) v.findViewById(R.id.main_link); link.setText(Html.fromHtml(this.getString(R.string.about_link))); String builddate = Util.readAsset("builddate.txt", "Unknown"); String builder = Util.readAsset("builder.txt", "unknown"); String revision = Util.readAsset("revision.txt", "unknown"); 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(getResources().getString(R.string.revision) + " " + revision + " (" + builddate + ")"); final ImageView logo = (ImageView) v.findViewById(R.id.logo); logo.setOnClickListener(new OnClickListener() { @Override//from w w w. j a v a 2s . com 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); } }); return v; }
From source file:org.developfreedom.logmein.ui.MainActivity.java
private void startAnimation() { ImageView centerWheel = (ImageView) findViewById(org.developfreedom.logmein.R.id.center_wheel); View infoView = findViewById(org.developfreedom.logmein.R.id.info); Animation rotation = AnimationUtils.loadAnimation(this, org.developfreedom.logmein.R.anim.rotation_start); centerWheel.startAnimation(rotation); Animation slideLeft = AnimationUtils.loadAnimation(this, org.developfreedom.logmein.R.anim.slide_in_left); button_logout.startAnimation(slideLeft); Animation slideRight = AnimationUtils.loadAnimation(this, org.developfreedom.logmein.R.anim.slide_in_right); button_web.startAnimation(slideRight); Animation slideTop = AnimationUtils.loadAnimation(this, org.developfreedom.logmein.R.anim.slide_in_top); infoView.startAnimation(slideTop);//from ww w . jav a2s. co m button_login.startAnimation(slideTop); Animation slideBottom = AnimationUtils.loadAnimation(this, org.developfreedom.logmein.R.anim.slide_in_bottom); }
From source file:com.silentcircle.common.util.ViewUtil.java
public static void animateImageChange(final Context context, final ImageView imageView, final int newImage) { final Animation animOut = AnimationUtils.loadAnimation(context, android.R.anim.fade_out); final Animation animIn = AnimationUtils.loadAnimation(context, android.R.anim.fade_in); animOut.setAnimationListener(new Animation.AnimationListener() { @Override//from w w w .j a va 2 s . c o m public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { imageView.setImageResource(newImage); animIn.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { } }); imageView.startAnimation(animIn); } }); imageView.startAnimation(animOut); }
From source file:org.videolan.vlc.gui.AboutFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ((AppCompatActivity) getActivity()).getSupportActionBar().setTitle("VLC " + BuildConfig.VERSION_NAME); View v = inflater.inflate(R.layout.about, container, false); View aboutMain = v.findViewById(R.id.about_main); WebView t = (WebView) v.findViewById(R.id.webview); String revision = getString(R.string.build_revision); t.loadData(Util.readAsset("licence.htm", "").replace("!COMMITID!", revision), "text/html", "UTF8"); TextView link = (TextView) v.findViewById(R.id.main_link); link.setText(Html.fromHtml(this.getString(R.string.about_link))); String builddate = getString(R.string.build_time); String builder = 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(getResources().getString(R.string.revision) + " " + revision + " (" + builddate + ")"); final ImageView logo = (ImageView) v.findViewById(R.id.logo); logo.setOnClickListener(new OnClickListener() { @Override//from ww w . j a va 2s .c o m 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); } }); List<View> lists = Arrays.asList(aboutMain, t); String[] titles = new String[] { getString(R.string.about), getString(R.string.licence) }; mViewPager = (ViewPager) v.findViewById(R.id.pager); mViewPager.setOffscreenPageLimit(MODE_TOTAL - 1); mViewPager.setAdapter(new AudioPagerAdapter(lists, titles)); mTabLayout = (TabLayout) v.findViewById(R.id.sliding_tabs); mTabLayout.setupWithViewPager(mViewPager); return v; }