List of usage examples for android.view View startAnimation
public void startAnimation(Animation animation)
From source file:com.elephant.widget.crouton.Manager.java
/** * Removes the {@link Crouton}'s view after it's display * durationInMilliseconds.//from ww w . j av a2 s. c om * * @param crouton * The {@link Crouton} added to a {@link ViewGroup} and should be * removed. */ protected void removeCrouton(Crouton crouton) { View croutonView = crouton.getView(); ViewGroup croutonParentView = (ViewGroup) croutonView.getParent(); if (null != croutonParentView) { croutonView.startAnimation(crouton.getOutAnimation()); // Remove the Crouton from the queue. Crouton removed = croutonQueue.poll(); // Remove the crouton from the view's parent. croutonParentView.removeView(croutonView); if (null != removed) { removed.detachActivity(); removed.detachViewGroup(); if (null != removed.getLifecycleCallback()) { removed.getLifecycleCallback().onRemoved(); } removed.detachLifecycleCallback(); } // Send a message to display the next crouton but delay it by the // out // animation duration to make sure it finishes sendMessageDelayed(crouton, Messages.DISPLAY_CROUTON, crouton.getOutAnimation().getDuration()); } }
From source file:net.naonedbus.fragment.CustomCursorFragment.java
/** * Afficher le contenu.//www .ja v a 2s . c o m */ protected void showContent() { mFragmentView.findViewById(R.id.fragmentLoading).setVisibility(View.GONE); if (mFragmentView.findViewById(R.id.fragmentMessage) != null) { mFragmentView.findViewById(R.id.fragmentMessage).setVisibility(View.GONE); } final View content = mFragmentView.findViewById(android.R.id.list); if (content.getVisibility() != View.VISIBLE) { content.setVisibility(View.VISIBLE); content.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in)); } }
From source file:com.ushahidi.android.ui.activity.BaseActivity.java
protected android.view.View fadeOut(final android.view.View view, final boolean animate) { if (view != null) { if (animate) { view.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out)); } else {//from w ww . ja v a 2s . c om view.clearAnimation(); } } return view; }
From source file:com.ushahidi.android.ui.activity.BaseActivity.java
protected android.view.View fadeIn(final android.view.View view, final boolean animate) { if (view != null) { if (animate) { view.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_in)); } else {/*from w w w . j a v a 2s . c o m*/ view.clearAnimation(); } } return view; }
From source file:hku.fyp14017.blencode.ui.fragment.AddBrickFragment.java
private void animateBrick(final Brick brick, PrototypeBrickAdapter adapter) { Context context = getActivity(); Animation animation = AnimationUtils.loadAnimation(context, hku.fyp14017.blencode.R.anim.blink); animation.setAnimationListener(new AnimationListener() { @Override//from w w w . java2 s . com public void onAnimationStart(Animation animation) { brick.setAnimationState(true); } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { brick.setAnimationState(false); } }); View view = brick.getView(context, 0, adapter); view.startAnimation(animation); }
From source file:com.arta.lib.widget.crouton.Manager.java
/** * Removes the {@link Crouton}'s view after it's display * durationInMilliseconds./* w ww . j a v a 2 s . c o m*/ * * @param crouton * The {@link Crouton} added to a {@link ViewGroup} and should be * removed. */ protected void removeCrouton(Crouton crouton) { View croutonView = crouton.getView(); ViewGroup croutonParentView = (ViewGroup) croutonView.getParent(); if (null != croutonParentView) { croutonView.startAnimation(crouton.getOutAnimation()); // Remove the Crouton from the queue. Crouton removed = croutonQueue.poll(); // Remove the crouton from the view's parent. croutonParentView.removeView(croutonView); if (null != removed) { removed.detachActivity(); removed.detachViewGroup(); if (null != removed.getLifecycleCallback()) { removed.getLifecycleCallback().onRemoved(); } removed.detachLifecycleCallback(); } // Send a message to display the next crouton but delay it by the out // animation duration to make sure it finishes sendMessageDelayed(crouton, Messages.DISPLAY_CROUTON, crouton.getOutAnimation().getDuration()); } }
From source file:com.xortech.multitag.TagAddMain.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.sender_tags); // REMOVE THE TITLE FROM THE ACTIONBAR ActionBar actionbar = getActionBar(); actionbar.setDisplayHomeAsUpEnabled(true); actionbar.setDisplayShowTitleEnabled(false); try {//from w w w. ja va 2 s . com tagList = (ListView) findViewById(R.id.tagList); tagList.setItemsCanFocus(false); addBtn = (Button) findViewById(R.id.add_btn); Set_Referash_Data(); } catch (Exception e) { Log.e("some error", "" + e); } addBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent addTag = new Intent(TagAddMain.this, TagAddUpdate.class); addTag.putExtra("called", "add"); addTag.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(addTag); finish(); } }); /** * LISTENER TO OPEN/CLOSE THE EXPANSION OF EACH CLICKED ITEM IN THE LISTVIEW */ tagList.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> parent, final View view, int position, long id) { View toolbar = view.findViewById(R.id.expandable2); // CREATE AND EXPAND ANIMATION FOR THE ITEM ExpandAnimation expandAni = new ExpandAnimation(toolbar, 500); // START ANIMATION ON THE TOOLBAR toolbar.startAnimation(expandAni); } }); }
From source file:Main.java
public static void expand(final View v, final int targetHeight, int duration, Interpolator interpolator, final Animation.AnimationListener listener) { final int initialHeight = v.getMeasuredHeight(); Animation a = new Animation() { @Override/*from ww w.j a v a 2s . c o m*/ protected void applyTransformation(float interpolatedTime, Transformation t) { v.getLayoutParams().height = initialHeight + (int) (targetHeight * interpolatedTime); v.requestLayout(); } @Override public boolean willChangeBounds() { return true; } }; a.setDuration(duration); if (interpolator != null) { a.setInterpolator(interpolator); } a.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { v.setLayerType(View.LAYER_TYPE_HARDWARE, null); if (listener != null) listener.onAnimationStart(animation); } @Override public void onAnimationEnd(Animation animation) { v.setLayerType(View.LAYER_TYPE_NONE, null); if (listener != null) listener.onAnimationEnd(animation); } @Override public void onAnimationRepeat(Animation animation) { if (listener != null) onAnimationRepeat(animation); } }); v.startAnimation(a); }
From source file:com.guoxiaoxing.kitty.ui.MainActivity.java
@Override public void onTabChanged(String tabId) { final int size = mTabHost.getTabWidget().getTabCount(); for (int i = 0; i < size; i++) { View view = mTabHost.getTabWidget().getChildAt(i); if (i == mTabHost.getCurrentTab()) { view.setSelected(true);/*w ww .java 2 s . c om*/ Animation animation = AnimationUtils.loadAnimation(MainActivity.this, R.anim.btn_zoom_in); view.startAnimation(animation); } else { view.setSelected(false); } } if (tabId.equals(getString(MainTab.MINE.getResName()))) { mBvNotice.setText(""); mBvNotice.hide(); } supportInvalidateOptionsMenu(); }
From source file:baasi.hackathon.sja.TalkActivity.java
/** * ?? ?? ?//w w w . ja v a 2s . c om * @param v View * @param Con Context * @param animationid animation id * @param StartOffset offset * @return animation */ public Animation PlayAnim(View v, Context Con, int animationid, int StartOffset) { if (v != null) { Animation animation = AnimationUtils.loadAnimation(Con, animationid); animation.setStartOffset(StartOffset); v.startAnimation(animation); return animation; } return null; }