android.view.animation.AlphaAnimation Java Examples
The following examples show how to use
android.view.animation.AlphaAnimation.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Reveal.java From mobile-sdk-android with Apache License 2.0 | 6 votes |
private void setOutAnimation(float[] direction, Interpolator interpolator, long duration) { Animation push = new TranslateAnimation( Animation.RELATIVE_TO_PARENT, direction[0], Animation.RELATIVE_TO_PARENT, direction[1], Animation.RELATIVE_TO_PARENT, direction[2], Animation.RELATIVE_TO_PARENT, direction[3] ); push.setInterpolator(interpolator); push.setDuration(duration); Animation fade = new AlphaAnimation(1, 0); fade.setDuration(duration); fade.setInterpolator(interpolator); AnimationSet set = new AnimationSet(false); set.addAnimation(push); set.addAnimation(fade); outAnimation = set; }
Example #2
Source File: StartActivity.java From HomeGenie-Android with GNU General Public License v3.0 | 6 votes |
public void showLogo() { _isLogoVisible = true; runOnUiThread(new Runnable() { @Override public void run() { Animation fadeIn = new AlphaAnimation(0, 0.8f); fadeIn.setInterpolator(new AccelerateInterpolator()); //and this fadeIn.setStartOffset(0); fadeIn.setDuration(500); // AnimationSet animation = new AnimationSet(false); //change to false animation.addAnimation(fadeIn); animation.setFillAfter(true); RelativeLayout ivLogo = (RelativeLayout) findViewById(R.id.logo); ivLogo.startAnimation(animation); } }); }
Example #3
Source File: TreeYMenu.java From YMenuView with Apache License 2.0 | 6 votes |
@Override public Animation createOptionDisappearAnimation(OptionButton optionButton, int index) { AnimationSet animationSet = new AnimationSet(true); TranslateAnimation translateAnimation= new TranslateAnimation( 0 ,getYMenuButton().getX() - optionButton.getX() ,0 ,getYMenuButton().getY() - optionButton.getY() ); translateAnimation.setDuration(getOptionSD_AnimationDuration()); AlphaAnimation alphaAnimation = new AlphaAnimation(1,0); alphaAnimation.setDuration(getOptionSD_AnimationDuration()); animationSet.addAnimation(translateAnimation); animationSet.addAnimation(alphaAnimation); //设置动画延时 animationSet.setStartOffset(60*(getOptionPositionCount() - index)); return animationSet; }
Example #4
Source File: StartActivity.java From HomeGenie-Android with GNU General Public License v3.0 | 6 votes |
public void hideLogo() { _isLogoVisible = false; runOnUiThread(new Runnable() { @Override public void run() { Animation fadeOut = new AlphaAnimation(0.8f, 0); fadeOut.setInterpolator(new AccelerateInterpolator()); //and this fadeOut.setStartOffset(0); fadeOut.setDuration(500); // AnimationSet animation = new AnimationSet(false); //change to false animation.addAnimation(fadeOut); animation.setFillAfter(true); RelativeLayout ivLogo = (RelativeLayout) findViewById(R.id.logo); ivLogo.startAnimation(animation); } }); }
Example #5
Source File: ViewHolder.java From OpenEyes with Apache License 2.0 | 6 votes |
/** * 设置透明度 * @param viewId * @param value * @return */ @SuppressLint("NewApi") public ViewHolder setAlpha(int viewId, float value) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { getView(viewId).setAlpha(value); } else { // Pre-honeycomb hack to set Alpha value AlphaAnimation alpha = new AlphaAnimation(value, value); alpha.setDuration(0); alpha.setFillAfter(true); getView(viewId).startAnimation(alpha); } return this; }
Example #6
Source File: AnimatorUtilityTests.java From scene with Apache License 2.0 | 6 votes |
@Test public void testResetViewStatus() { ActivityController<NavigationSourceUtility.TestActivity> controller = Robolectric.buildActivity(NavigationSourceUtility.TestActivity.class).create().start().resume(); NavigationSourceUtility.TestActivity testActivity = controller.get(); View view = new View(testActivity); view.setTranslationX(1); view.setTranslationY(1); view.setScaleX(2.0f); view.setScaleY(2.0f); view.setRotation(1.0f); view.setRotationX(1.0f); view.setRotationY(1.0f); view.setAlpha(0.5f); view.startAnimation(new AlphaAnimation(0.0f, 1.0f)); AnimatorUtility.resetViewStatus(view); assertEquals(0.0f, view.getTranslationX(), 0.0f); assertEquals(0.0f, view.getTranslationY(), 0.0f); assertEquals(1.0f, view.getScaleX(), 0.0f); assertEquals(1.0f, view.getScaleY(), 0.0f); assertEquals(0.0f, view.getRotation(), 0.0f); assertEquals(0.0f, view.getRotationX(), 0.0f); assertEquals(0.0f, view.getRotationY(), 0.0f); assertEquals(1.0f, view.getAlpha(), 0.0f); assertNull(view.getAnimation()); }
Example #7
Source File: AnimationService.java From Pocket-Plays-for-Twitch with GNU General Public License v3.0 | 6 votes |
public static void setAdapterInsertAnimation(final View aCard, int row, int height) { final int ANIMATION_DURATION = 650; final int BASE_DELAY = 50; TranslateAnimation translationAnimation = new TranslateAnimation(0,0, height,0); AlphaAnimation alphaAnimation = new AlphaAnimation(0f, 1f); final AnimationSet animationSet = new AnimationSet(true); animationSet.addAnimation(translationAnimation); animationSet.addAnimation(alphaAnimation); animationSet.setInterpolator(new AccelerateDecelerateInterpolator()); animationSet.setFillAfter(true); animationSet.setFillBefore(true); animationSet.setDuration(ANIMATION_DURATION + row * BASE_DELAY); aCard.setAnimation(animationSet); }
Example #8
Source File: HomeScreenActivity.java From Gazetti_Newspaper_Reader with MIT License | 6 votes |
private AnimationSet getEntryAnimation(int inAnimationDuration) { //In AnimationSet mInAnimationSet = new AnimationSet(false); TranslateAnimation mSlideInAnimation = new TranslateAnimation( TranslateAnimation.RELATIVE_TO_PARENT, 0.0f, TranslateAnimation.RELATIVE_TO_PARENT, 0.0f, TranslateAnimation.RELATIVE_TO_SELF, -1.0f, TranslateAnimation.RELATIVE_TO_SELF, 0.0f); mSlideInAnimation.setFillAfter(true); AlphaAnimation mFadeInAnimation = new AlphaAnimation(0.0f, 1.0f); mFadeInAnimation.setFillAfter(true); mInAnimationSet.addAnimation(mSlideInAnimation); mInAnimationSet.addAnimation(mFadeInAnimation); mInAnimationSet.setDuration(inAnimationDuration); return mInAnimationSet; }
Example #9
Source File: ZoomPageAnimator.java From Paginize with MIT License | 6 votes |
private void initAnimations() { Animation inScaleAnimation = new ScaleAnimation( 1.2f, 1, 1.2f, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); Animation inAlphaAnimation = new AlphaAnimation(0.0f, 1f); AnimationSet inAnimationSet = new AnimationSet(true); inAnimationSet.setDuration(ANIMATION_DURATION); inAnimationSet.addAnimation(inScaleAnimation); inAnimationSet.addAnimation(inAlphaAnimation); mInAnimation = inAnimationSet; Animation outScaleAnimation = new ScaleAnimation(1, 1.4f, 1, 1.4f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); Animation outAlphaAnimation = new AlphaAnimation(1f, 0f); AnimationSet outAnimationSet = new AnimationSet(true); outAnimationSet.setDuration(ANIMATION_DURATION); outAnimationSet.addAnimation(outScaleAnimation); outAnimationSet.addAnimation(outAlphaAnimation); mOutAnimation = outAnimationSet; }
Example #10
Source File: MarkActivity.java From school_shop with MIT License | 5 votes |
private void initSearchTagList() { searchListView = (ListView)findViewById(R.id.mark_tab_choose_listView); tagTextView = (EmojiconEditText)findViewById(R.id.search_tag_brand); String[] mStrings = { "Abbaye de Belloc", "\ue32dAbbaye du Mont des Cats", "Abertam", "Abondance", "Ackawi", "Acorn", "Adelost", "Affidelice au Chablis", "Afuega'l Pitu", "Airag", "Airedale", "Aisy Cendre", "Abertam", "Abondance", "Ackawi", "Acorn", "Adelost", "Affidelice au Chablis", "Afuega'l Pitu", "Airag", "Airedale", "Aisy Cendre" }; initSearchListener(); AnimationSet animationSet = new AnimationSet(false); Animation animation = new AlphaAnimation(0,1); //AlphaAnimation 控制渐变透明的动画效果 animation.setDuration(300); //动画时间毫秒数 animationSet.addAnimation(animation); //加入动画集合 LayoutAnimationController controller = new LayoutAnimationController(animationSet, 1); // 设置列表内容 mListItems = new ArrayList<String>(); mListItems.addAll(Arrays.asList(mStrings)); mListItems.set(0, getResources().getString(R.string.add_tag_text)); tagSearchAdapter = new TagSearchAdapter(this, R.layout.item_search_tag_list, mListItems); searchListView.setLayoutAnimation(controller); searchListView.setAdapter(tagSearchAdapter); }
Example #11
Source File: IndicatorSeekBar.java From IndicatorSeekBar with Apache License 2.0 | 5 votes |
/** * first showing when initial for indicator stay always. */ void showStayIndicator() { mIndicatorContentView.setVisibility(INVISIBLE); postDelayed(new Runnable() { @Override public void run() { Animation animation = new AlphaAnimation(0.1f, 1.0f); animation.setDuration(180); mIndicatorContentView.setAnimation(animation); updateStayIndicator(); mIndicatorContentView.setVisibility(VISIBLE); } }, 300); }
Example #12
Source File: ViewProperties.java From Effects-Pro with MIT License | 5 votes |
@SuppressLint("NewApi") public static void alpha(View view, float value) { if (Build.VERSION.SDK_INT < 11) { final AlphaAnimation animation = new AlphaAnimation(value, value); animation.setDuration(1); animation.setFillAfter(true); view.startAnimation(animation); } else { view.setAlpha(value); } }
Example #13
Source File: v.java From MiBandDecompiled with Apache License 2.0 | 5 votes |
static Animation a(Context context, float f1, float f2, float f3, float f4) { AnimationSet animationset = new AnimationSet(false); ScaleAnimation scaleanimation = new ScaleAnimation(f1, f2, f1, f2, 1, 0.5F, 1, 0.5F); scaleanimation.setInterpolator(E); scaleanimation.setDuration(220L); animationset.addAnimation(scaleanimation); AlphaAnimation alphaanimation = new AlphaAnimation(f3, f4); alphaanimation.setInterpolator(F); alphaanimation.setDuration(220L); animationset.addAnimation(alphaanimation); return animationset; }
Example #14
Source File: AwesomeFragment.java From AndroidNavigation with MIT License | 5 votes |
private void animateUpIn(@NonNull final View contentView) { TranslateAnimation translate = new TranslateAnimation( Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0f ); AlphaAnimation alpha = new AlphaAnimation(0, 1); AnimationSet set = new AnimationSet(true); set.addAnimation(translate); set.addAnimation(alpha); set.setInterpolator(new DecelerateInterpolator()); set.setDuration(200); set.setFillAfter(true); contentView.startAnimation(set); }
Example #15
Source File: BadgeView.java From RefreshActionItem-Native with Apache License 2.0 | 5 votes |
private void init(Context context, View target, int tabIndex) { this.context = context; this.target = target; this.targetTabIndex = tabIndex; // apply defaults badgePosition = DEFAULT_POSITION; badgeMarginH = dipToPixels(DEFAULT_MARGIN_DIP); badgeMarginV = badgeMarginH; badgeColor = DEFAULT_BADGE_COLOR; setTypeface(Typeface.DEFAULT_BOLD); int paddingPixels = dipToPixels(DEFAULT_LR_PADDING_DIP); setPadding(paddingPixels, 0, paddingPixels, 0); setTextColor(DEFAULT_TEXT_COLOR); fadeIn = new AlphaAnimation(0, 1); fadeIn.setInterpolator(new DecelerateInterpolator()); fadeIn.setDuration(200); fadeOut = new AlphaAnimation(1, 0); fadeOut.setInterpolator(new AccelerateInterpolator()); fadeOut.setDuration(200); isShown = false; if (this.target != null) { applyTo(this.target); } else { show(); } }
Example #16
Source File: AllFeedsFragment.java From umeng_community_android with MIT License | 5 votes |
@Override protected void showPostButtonWithAnim() { AlphaAnimation showAnim = new AlphaAnimation(0.5f, 1.0f); showAnim.setDuration(500); if (mPostBtn != null) { mPostBtn.setVisibility(View.VISIBLE); mPostBtn.startAnimation(showAnim); } }
Example #17
Source File: AnimationFactory.java From Android-Notification with Apache License 2.0 | 5 votes |
/** * Create push up animation for entering. * * @return Animation */ public static Animation pushUpIn() { AnimationSet animationSet = new AnimationSet(true); animationSet.setFillAfter(true); animationSet.addAnimation(new TranslateAnimation(0, 0, 100, 0)); animationSet.addAnimation(new AlphaAnimation(0.0f, 1.0f)); return animationSet; }
Example #18
Source File: RayMenu.java From UltimateAndroid with Apache License 2.0 | 5 votes |
private static Animation createItemDisapperAnimation(final long duration, final boolean isClicked) { AnimationSet animationSet = new AnimationSet(true); animationSet.addAnimation(new ScaleAnimation(1.0f, isClicked ? 2.0f : 0.0f, 1.0f, isClicked ? 2.0f : 0.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f)); animationSet.addAnimation(new AlphaAnimation(1.0f, 0.0f)); animationSet.setDuration(duration); animationSet.setInterpolator(new DecelerateInterpolator()); animationSet.setFillAfter(true); return animationSet; }
Example #19
Source File: ShowFullScreenQrView.java From bither-android with Apache License 2.0 | 5 votes |
public void hideToFromView() { if (vFrom != null) { AlphaAnimation animAlpha = new AlphaAnimation(1, 0); animAlpha.setDuration(AnimationDuration); vMask.startAnimation(animAlpha); int x = 0; int y = (screenHeight - statusBarHeight - screenWidth) / 2 + statusBarHeight; int[] location = new int[2]; vFrom.getLocationInWindow(location); int toX = location[0]; int toY = location[1]; float scale = (float) vFrom.getWidth() / (float) UIUtil.getScreenWidth(); ScaleAnimation animScale = new ScaleAnimation(1, scale, 1, scale); animScale.setDuration(AnimationDuration); TranslateAnimation animTrans = new TranslateAnimation(0, toX - x, 0, toY - y); animTrans.setDuration(AnimationDuration); AnimationSet animSet = new AnimationSet(true); animSet.addAnimation(animScale); animSet.addAnimation(animTrans); flImages.startAnimation(animSet); postDelayed(new Runnable() { @Override public void run() { setVisibility(View.GONE); } }, AnimationDuration); } else { setVisibility(View.GONE); } }
Example #20
Source File: PickerFragment.java From FacebookImageShareIntent with MIT License | 5 votes |
private static void setAlpha(View view, float alpha) { // Set the alpha appropriately (setAlpha is API >= 11, this technique works on all API levels). AlphaAnimation alphaAnimation = new AlphaAnimation(alpha, alpha); alphaAnimation.setDuration(0); alphaAnimation.setFillAfter(true); view.startAnimation(alphaAnimation); }
Example #21
Source File: AnimationController.java From FamilyChat with Apache License 2.0 | 5 votes |
public void slideFadeInFromTop(View view, long durationMillis, long delayMillis) { TranslateAnimation animation1 = new TranslateAnimation(rela1, 0, rela1, 0, rela1, -1, rela1, 0); AlphaAnimation animation2 = new AlphaAnimation(0, 1); AnimationSet animation = new AnimationSet(false); animation.addAnimation(animation1); animation.addAnimation(animation2); baseIn(view, animation, durationMillis, delayMillis); }
Example #22
Source File: SimpleChatManager.java From SimpleChatView with Apache License 2.0 | 5 votes |
private void showTipsAnimation(TextView newsView) { AlphaAnimation alphaAnimation = new AlphaAnimation(1.0f, 0.1f); alphaAnimation.setDuration(1100); alphaAnimation.setRepeatMode(Animation.RESTART); alphaAnimation.setRepeatCount(Animation.INFINITE); newsView.startAnimation(alphaAnimation); }
Example #23
Source File: DynamicDetailFragment.java From MiBandDecompiled with Apache License 2.0 | 5 votes |
private void a(ViewGroup viewgroup, ViewGroup viewgroup1) { viewgroup.setVisibility(4); viewgroup1.setVisibility(0); AnimationSet animationset = new AnimationSet(true); AlphaAnimation alphaanimation = new AlphaAnimation(0.0F, 1.0F); alphaanimation.setDuration(80L); animationset.addAnimation(alphaanimation); TranslateAnimation translateanimation = new TranslateAnimation(1, 0.0F, 1, 0.0F, 1, -1F, 1, 0.0F); translateanimation.setDuration(100L); translateanimation.setInterpolator(new DecelerateInterpolator()); animationset.addAnimation(translateanimation); viewgroup1.setLayoutAnimation(new LayoutAnimationController(animationset, 0.7F)); viewgroup1.requestLayout(); }
Example #24
Source File: RTMPActivity.java From cordova-rtmp-rtsp-stream with Apache License 2.0 | 5 votes |
private void _animateRecording(String icon) { if (icon.equals("ic_stop_white_36dp")) { Animation anim = new AlphaAnimation(0.0f, 1.0f); anim.setDuration(600); anim.setStartOffset(200); anim.setRepeatMode(Animation.REVERSE); anim.setRepeatCount(Animation.INFINITE); ic_record.startAnimation(anim); } else { ic_record.clearAnimation(); } }
Example #25
Source File: PickerFragment.java From Abelana-Android with Apache License 2.0 | 5 votes |
private static void setAlpha(View view, float alpha) { // Set the alpha appropriately (setAlpha is API >= 11, this technique works on all API levels). AlphaAnimation alphaAnimation = new AlphaAnimation(alpha, alpha); alphaAnimation.setDuration(0); alphaAnimation.setFillAfter(true); view.startAnimation(alphaAnimation); }
Example #26
Source File: CoreTeamEventActivity.java From Nimbus with GNU General Public License v3.0 | 5 votes |
public static void startAlphaAnimation(View v, long duration, int visibility) { AlphaAnimation alphaAnimation = (visibility == View.VISIBLE) ? new AlphaAnimation(0f, 1f) : new AlphaAnimation(1f, 0f); alphaAnimation.setDuration(duration); alphaAnimation.setFillAfter(true); v.startAnimation(alphaAnimation); }
Example #27
Source File: UIActionSheetDialog.java From Auie with GNU General Public License v2.0 | 5 votes |
/** * 展示控件 */ public void show() { builder(); setSheetItems(); AlphaAnimation animation1 = new AlphaAnimation(0.3f, 1.0f); animation1.setDuration(200); TranslateAnimation animation = new TranslateAnimation(0, 0, HEIGHT, 0); animation.setDuration(320); rootLayout.startAnimation(animation1); parentLayout.startAnimation(animation); showAtLocation(((ViewGroup)(((Activity) context).findViewById(android.R.id.content))).getChildAt(0), Gravity.BOTTOM, 0, 0); }
Example #28
Source File: AnimGuideActivity.java From easy-guide-android with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_anim); findViewById(R.id.btn_share).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { /* EasyGuide starts */ CommonGuideLayer layer = new CommonGuideLayer(AnimGuideActivity.this). addHighlightTarget(findViewById(R.id.btn_share)). withExtraView(LayoutInflater.from(AnimGuideActivity.this).inflate(R.layout.layer_share, null), (int) DisplayUtils.dp2px(AnimGuideActivity.this, 20f), (int) DisplayUtils.dp2px(AnimGuideActivity.this, -40f), Location.TO_BOTTOM); Animation enterAnimation = new AlphaAnimation(0f, 1f); enterAnimation.setDuration(600); enterAnimation.setFillAfter(true); layer.setEnterAnimation(enterAnimation); Animation exitAnimation = new AlphaAnimation(1f, 0f); exitAnimation.setDuration(600); exitAnimation.setFillAfter(true); layer.setExitAnimation(exitAnimation); new EasyGuideManager(AnimGuideActivity.this).addLayer(layer).show(); /* EasyGuide ends */ } }); }
Example #29
Source File: FadeInImageDisplayer.java From sketch with Apache License 2.0 | 5 votes |
@Override public void display(@NonNull SketchView sketchView, @NonNull Drawable newDrawable) { AlphaAnimation animation = new AlphaAnimation(0.0f, 1.0f); animation.setInterpolator(new DecelerateInterpolator()); animation.setDuration(duration); sketchView.clearAnimation(); sketchView.setImageDrawable(newDrawable); sketchView.startAnimation(animation); }
Example #30
Source File: ImitateWandoujiaActivity.java From AndroidStudyDemo with GNU General Public License v2.0 | 5 votes |
@SuppressLint("NewApi") private void setViewAlpha(View v, float alpha){ if(android.os.Build.VERSION.SDK_INT >= 11){ v.setAlpha(alpha); }else{ AlphaAnimation alphaAnim = new AlphaAnimation(alpha, alpha); alphaAnim.setDuration(0); alphaAnim.setFillAfter(true); v.startAnimation(alphaAnim); } }