List of usage examples for android.view.animation AnimationUtils loadAnimation
public static Animation loadAnimation(Context context, @AnimRes int id) throws NotFoundException
From source file:com.hhwt.travelplanner.adapter.MyCategorylistadapter.java
@Override public void onBindViewHolder(final ViewHolder holder, final int position) { /* for (int i =0; i <items.size(); i++){*/ newsno = items.get(position).getSno(); // Sessiondata.getInstance().setSnonotes(newsno); Log.d("newsno", "" + newsno); // }/*from ww w . j a va 2 s.c o m*/ final Categorylistmodelmytrip item = items.get(position); if (position == 0) { daycount = 1; } snno = item.getSno(); AlertUtils.RatingColorGreen(mContext, holder.item_ratingBar); Log.d("create notes", "" + snno); try { Float rate = Float.parseFloat(item.getRating()); holder.item_ratingBar.setRating(rate); holder.item_ratingBar.setEnabled(false); } catch (NumberFormatException e) { holder.item_ratingBar.setRating(0); holder.item_ratingBar.setEnabled(false); } holder.title.setText(item.getName()); holder.subtitle.setText(item.getActivity()); holder.address.setText(item.getDescription()); String yourdate = Date_utill.Dateformatchangeforall(item.getDate()); if (emptydate.equalsIgnoreCase(yourdate)) { // holder.Dateis.setText("(Day " + daycount + ") " + yourdate); holder.Dateis.setText(yourdate); } else { emptydate = yourdate; // holder.Dateis.setText("(Day " + daycount + ") " + yourdate); holder.Dateis.setText(yourdate); ++daycount; } final ViewHolder vh = holder; if (item.photos.size() > 0) { try { final String s = item.getPhotos().get(0).getPhotourl(); // PicassoCache.getPicassoInstance(mContext).load(s).into(holder.image); Picasso.with(mContext).load(s).networkPolicy(NetworkPolicy.OFFLINE).into(holder.image, new Callback() { @Override public void onSuccess() { } @Override public void onError() { //Try again online if cache failed Picasso.with(mContext).load(s).error(R.drawable.background_default) .placeholder(R.drawable.loading).into(vh.image, new Callback() { @Override public void onSuccess() { } @Override public void onError() { // vs.Icon.setImageResource(R.drawable.groupchat_icon_48dp); } }); } }); } catch (Exception e) { e.printStackTrace(); } } Animation animation = AnimationUtils.loadAnimation(mContext, (position > lastPosition) ? R.anim.up_from_bottom : R.anim.down_from_top); holder.cd.startAnimation(animation); lastPosition = position; holder.itemView.setTag(item); holder.todeleteitem.findViewById(R.id.todeleteitem).setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View v) { if (onItemClickListener != null) { new Handler().postDelayed(new Runnable() { @Override public void run() { onItemClickListener.onDeleteitemClick(v, (Categorylistmodelmytrip) holder.itemView.getTag()); } }, 200); } } }); /* holder.editmenu.findViewById(R.id.editmenu); holder.editmenu.findViewById(R.id.editmenu).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Fragment fr = new newnotes(); FragmentChangeListener fc = (FragmentChangeListener) context; fc.replaceFragment(fr, context.getString(R.string.title_explore)); *//* Intent intents = new Intent(context, ShowGroupimage.class); ((Activity) context).startActivity(intents);*//* } });*/ holder.notes.findViewById(R.id.addnotes); // ------------------------------------------------- notescontent = Sessiondata.getInstance().getNotesno().get(position).getNotes(); Log.d("Notes", "" + notescontent); if (notescontent.equals("0")) { holder.notes.setText("Add Notes"); holder.notes.setBackgroundColor(context.getResources().getColor(R.color.bgyellow)); } else { holder.notes.setText("View Notes"); holder.notes.setBackgroundColor(context.getResources().getColor(R.color.orangedrak)); // --------------------------------------- } holder.notes.findViewById(R.id.addnotes).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.d("Arraylistvaluessno", "" + Sessiondata.getInstance().getNotesno().get(position).getSno()); parmetersno = Sessiondata.getInstance().getNotesno().get(position).getIdnumber(); Log.d("Name", "" + Sessiondata.getInstance().getNotesno().get(position).getName()); Log.d("Arjun", "" + parmetersno); Sessiondata.getInstance().setSnonotes(parmetersno); Notesalredyhave(); // showInputDialog(); } }); }
From source file:com.cssweb.android.base.BaseActivity.java
protected void initPopupWindow() { hideMenu = AnimationUtils.loadAnimation(this, R.anim.zr_popup_hide); showMenu = AnimationUtils.loadAnimation(this, R.anim.zr_popup_show); popupMenu = (TransPanel) findViewById(R.id.zr_popup_window); localListView = (ListView) findViewById(R.id.zr_menulist); initMenu();//from www .j a va2s . com setAdapter(localListView); }
From source file:com.nextgis.firereporter.MainActivity.java
public void refresh() { if (refreshItem == null || mbRefreshing) return;/*from w ww. j ava 2 s. 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:com.fatelon.partyphotobooth.kiosk.KioskActivity.java
@Override public void onNewPhotoAdded(boolean isPhotoStripComplete) { // Update current frame count. mCurrentFrame++;// w ww .java 2 s . c o m // Fade out flash screen. Animation animation = AnimationUtils.loadAnimation(this, R.anim.fade_out); animation.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { // Do nothing. } @Override public void onAnimationRepeat(Animation animation) { // Do nothing. } @Override public void onAnimationEnd(Animation animation) { mFlashScreen.setVisibility(View.GONE); } }); mFlashScreen.startAnimation(animation); // Transition right side fragment while flash animation is running. if (isPhotoStripComplete) { // Confirm submission of photo strip. launchConfirmationFragment(); } else { // Capture next frame. launchCaptureFragment(); } }
From source file:com.rowland.moviesquire.ui.fragments.DetailFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Let the fragment handle its menu items setHasOptionsMenu(true);// w ww. ja v a 2 s . c o m // Check if we have any arguments if (getArguments() != null) { // Acquire the selected movie identifier id = getArguments().getLong(DetailFragment.MOVIE_KEY); // Acquire movie instance mMovie = new MovieRepository().getWhereId(id); // Check for null if (mMovie != null) { // Is movie Favourite isFavourite = mMovie.getIsFavourite(); // Start services startReviewIntentService(); startTrailerIntentService(); // Initialize the review list mReviewList = new ArrayList<>(); // Initialize the trailer list mTrailerList = new ArrayList<>(); // Create an Animation simpleGrowAnimation = AnimationUtils.loadAnimation(getContext(), R.anim.grow_bigger); } } }
From source file:by.gravity.expensemanager.fragments.SherlockProgressFragment.java
/** * If the content is empty, then set true otherwise false. The default * content is not empty. You can't call this method if the content view has * not been initialized before {@link #setContentView(android.view.View)} * and content view not null./*from ww w . j av a 2s. co m*/ * * @param isEmpty * true if content is empty else false * @see #isContentEmpty() */ public void setContentEmpty(boolean isEmpty) { ensureContent(); if (isEmpty) { mProgressContainer.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out)); mContentContainer.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out)); if (mEmptyView != null) { mEmptyView.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in)); mEmptyView.setVisibility(View.VISIBLE); } mContentContainer.setVisibility(View.GONE); if (mProgressContainer.getVisibility() == View.VISIBLE) { mProgressContainer.setVisibility(View.GONE); } } else { mProgressContainer.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out)); mContentContainer.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in)); if (mEmptyView != null) { mEmptyView.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out)); mEmptyView.setVisibility(View.GONE); } mContentContainer.setVisibility(View.VISIBLE); mProgressContainer.setVisibility(View.GONE); } mIsContentEmpty = isEmpty; }
From source file:com.kkbox.toolkit.app.KKFragment.java
@Override public Animation onCreateAnimation(int transit, boolean enter, int nextAnim) { animationEnded = false;/*from w ww . j a v a 2 s .co m*/ Animation animation = null; if (enter && customEnterAnimation != 0) { animation = AnimationUtils.loadAnimation(activity, customEnterAnimation); } else if (!enter && customExitAnimation != 0) { animation = AnimationUtils.loadAnimation(activity, customExitAnimation); } else if (animationType == AnimationType.POP) { if (enter) { animation = AnimationUtils.loadAnimation(activity, R.anim.slide_in_left); } else { animation = AnimationUtils.loadAnimation(activity, R.anim.slide_out_right); } } else if (animationType == AnimationType.PUSH) { if (enter) { animation = AnimationUtils.loadAnimation(activity, R.anim.slide_in_right); } else { animation = AnimationUtils.loadAnimation(activity, R.anim.slide_out_left); } } else if (animationType == AnimationType.FADE_OUT) { if (enter) { animation = AnimationUtils.loadAnimation(activity, R.anim.fade_in); } else { animation = AnimationUtils.loadAnimation(activity, R.anim.fade_out); } } else if (animation == null) { animation = new Animation() { }; animation.setDuration(0); } animation.setAnimationListener(new AnimationListener() { @Override public void onAnimationEnd(Animation a) { animationEnded = true; if (dataFetchedStatus == DataFetchStatus.SUCCESS && !uiLoaded) { onLoadUI(); } } @Override public void onAnimationStart(Animation a) { } @Override public void onAnimationRepeat(Animation a) { } }); return animation; }
From source file:com.silentcircle.silenttext.activity.AccountCreationActivity.java
@Override public void onError(final CharSequence message) { runOnUiThread(new Runnable() { @Override/*from ww w.ja va 2 s .com*/ 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.nikhilnayak.games.octoshootar.ui.fragments.GameHomeFragment.java
private void updateTutoButtonAnimation() { final boolean hasTutoEverBeenSeen = PreferenceManager.getDefaultSharedPreferences(getActivity()) .getBoolean(HomeActivity.KEY_HAS_TUTO_BEEN_SEEN, false); final View buttonTutoHelp = getView().findViewById(R.id.home_help_tuto); if (buttonTutoHelp != null) { if (!hasTutoEverBeenSeen) { final Animation animation = AnimationUtils.loadAnimation(getActivity(), R.anim.tuto_anim); if (animation != null) { buttonTutoHelp.startAnimation(animation); }// w w w.j ava 2s . c o m } else { buttonTutoHelp.clearAnimation(); } } }
From source file:com.devspark.progressfragment.GridFragment.java
/** * Control whether the grid is being displayed. You can make it not * displayed if you are waiting for the initial data to show in it. During * this time an indeterminant progress indicator will be shown instead. * * @param shown If true, the grid view is shown; if false, the progress * indicator. The initial value is true. * @param animate If true, an animation will be used to transition to the * new state./* www. j a va 2 s. com*/ */ private void setGridShown(boolean shown, boolean animate) { ensureList(); if (mProgressContainer == null) { throw new IllegalStateException("Can't be used with a custom content view"); } if (mGridShown == shown) { return; } mGridShown = shown; if (shown) { if (animate) { mProgressContainer .startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out)); mGridContainer.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in)); } else { mProgressContainer.clearAnimation(); mGridContainer.clearAnimation(); } mProgressContainer.setVisibility(View.GONE); mGridContainer.setVisibility(View.VISIBLE); } else { if (animate) { mProgressContainer .startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in)); mGridContainer.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out)); } else { mProgressContainer.clearAnimation(); mGridContainer.clearAnimation(); } mProgressContainer.setVisibility(View.VISIBLE); mGridContainer.setVisibility(View.GONE); } }