public static void ShowLoadingBar <TViewModel>(this BaseView <TViewModel> self) where TViewModel : class, IBaseViewModel { if (self.RootLayout != null && self.LoadingBarLayout == null) { ViewGroup.LayoutParams param = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); self.LoadingBarLayout = new RelativeLayout(self) { LayoutParameters = param, Alpha = self.AlphaVisible }; #pragma warning disable CS0618 // Type or member is obsolete self.LoadingBarLayout.SetBackgroundColor(self.Resources.GetColor(Resource.Color.progressbar_background)); #pragma warning restore CS0618 // Type or member is obsolete self.ProgressBar = new ProgressBar(self); self.LoadingBarLayout.SetGravity(GravityFlags.Center); self.RunOnUiThread(() => { self.LoadingBarLayout.AddView(self.ProgressBar); self.RootLayout.AddView(self.LoadingBarLayout); }); } self.RunOnUiThread(() => { AlphaAnimation showAnimation = new AlphaAnimation(self.AlphaHidden, self.AlphaVisible) { Duration = self.AnimationLoadingBarApperaringDuration, FillAfter = true }; self.LoadingBarLayout.StartAnimation(showAnimation); }); }
private void InitView() { Animation animation = AnimationUtils.LoadAnimation(this, Resource.Animation.anim_about_card_show); ScrollView scroll_about = FindViewById <ScrollView>(Resource.Id.scroll_about); scroll_about.StartAnimation(animation); LinearLayout ll_card_about_2_shop = FindViewById <LinearLayout>(Resource.Id.ll_card_about_2_shop); LinearLayout ll_card_about_2_email = FindViewById <LinearLayout>(Resource.Id.ll_card_about_2_email); LinearLayout ll_card_about_2_git_hub = FindViewById <LinearLayout>(Resource.Id.ll_card_about_2_git_hub); LinearLayout ll_card_about_source_licenses = FindViewById <LinearLayout>(Resource.Id.ll_card_about_source_licenses); ll_card_about_2_shop.SetOnClickListener(this); ll_card_about_2_email.SetOnClickListener(this); ll_card_about_2_git_hub.SetOnClickListener(this); ll_card_about_source_licenses.SetOnClickListener(this); FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab_about_share); fab.SetOnClickListener(this); AlphaAnimation alphaAnimation = new AlphaAnimation(0.0f, 1.0f); alphaAnimation.Duration = 300; alphaAnimation.StartOffset = 600; TextView tv_about_version = FindViewById <TextView>(Resource.Id.tv_about_version); tv_about_version.SetText(Utils.AppUtils.GetVersionName(this), TextView.BufferType.Normal); tv_about_version.StartAnimation(alphaAnimation); }
void Initialize() { Orientation = Orientation.Horizontal; var ps = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.MatchParent, 1.0f); ps.SetMargins(0, 0, 0, 0); mLeftView = new CardboardOverlayEyeView(Context); mLeftView.LayoutParameters = ps; AddView(mLeftView); mRightView = new CardboardOverlayEyeView(Context); mRightView.LayoutParameters = ps; AddView(mRightView); // Set some reasonable defaults. SetDepthOffset(0.016f); SetColor(Color.Rgb(150, 255, 180)); Visibility = ViewStates.Visible; mTextFadeAnimation = new AlphaAnimation(1.0f, 0.0f); mTextFadeAnimation.Duration = 5000; }
void cekanjePitanja() { if (stranaIgraca[igracNaPotezu] == 1) { this.RequestedOrientation = Android.Content.PM.ScreenOrientation.ReverseLandscape; } else if (stranaIgraca[igracNaPotezu] == 3) { this.RequestedOrientation = Android.Content.PM.ScreenOrientation.Landscape; } else if (stranaIgraca[igracNaPotezu] == 4) { this.RequestedOrientation = Android.Content.PM.ScreenOrientation.ReversePortrait; } else { this.RequestedOrientation = Android.Content.PM.ScreenOrientation.Portrait; } SetContentView(Resource.Layout.KlasicnaIgraLayout1); TextView igracNaPotezuTekst = FindViewById <TextView>(Resource.Id.igracNaPotezuTekst); AlphaAnimation animation = new AlphaAnimation(0.2f, 1.0f); animation.Duration = 2000; animation.FillAfter = true; animation.RepeatMode = RepeatMode.Reverse; animation.RepeatCount = Animation.Infinite; igracNaPotezuTekst.StartAnimation(animation); igracNaPotezuTekst.Text = "Igra igraè " + igracNaPotezu.ToString() + " ..."; }
void tocanOdgovor(bool tocno, int odg) { cekanjeOdgovora = false; Button odgovor1 = FindViewById <Button>(Resource.Id.odgovor1); Button odgovor2 = FindViewById <Button>(Resource.Id.odgovor2); Button odgovor3 = FindViewById <Button>(Resource.Id.odgovor3); Button odgovor4 = FindViewById <Button>(Resource.Id.odgovor4); Button[] odgovori = { odgovor1, odgovor2, odgovor3, odgovor4 }; odg--; if (tocno) { odgovori[odg].SetBackgroundResource(Resource.Drawable.tocno); igracOstajeNaPotezu = true; } else { odgovori[odg].SetBackgroundResource(Resource.Drawable.netocno); igracOstajeNaPotezu = false; } AlphaAnimation animation = new AlphaAnimation(0.0f, 1.0f); animation.Duration = 1000; animation.StartOffset = 0; animation.FillAfter = true; odgovori[odg].StartAnimation(animation); }
public override bool OnFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { if (Math.Abs(velocityX) < 500) { return(false); } _lastView = _parentActivity.LastView; var animationSet = new AnimationSet(true) { Interpolator = new AccelerateDecelerateInterpolator(), Duration = 300, FillAfter = true }; var animationRotate = new RotateAnimation(0, Math.Sign(velocityX) * 15); var animationTranslate = new TranslateAnimation(0, Math.Sign(velocityX) * 400, 0, 10); var animationAlpha = new AlphaAnimation(1, 0); animationSet.AddAnimation(animationRotate); animationSet.AddAnimation(animationTranslate); animationSet.AddAnimation(animationAlpha); animationSet.AnimationEnd += AnimationSet_AnimationEnd; _lastView.StartAnimation(animationSet); return(true); }
public void Hide() { if (Progress != null) { Progress.ProgressChanged -= ProgressAction; Progress = null; } var anim = new AlphaAnimation(ContentView.Alpha, 0.0f); anim.Duration = 250; anim.FillAfter = true; ContentView.StartAnimation(anim); Task.Run(async() => { // Wait a bit for ensuring that the dialog is created. // Because it sometimes crashes or freezes when executing a very short process. await Task.Delay(50); var dialog = FragmentManager.FindFragmentByTag <LoadingPlatformDialog>(LoadingImplementation.LoadingDialogTag); dialog?.Dismiss(); ContentView.RemoveFromParent(); if (!Configurations.LoadingConfig.IsReusable) { this.Dispose(); } }); }
private void animateAlphaTranslate(View view, float alphaFrom, float alphaTo, float xFrom, float xTo, bool requestFocus) { AnimationSet animationSet = new AnimationSet(true); AlphaAnimation fade = new AlphaAnimation(alphaFrom, alphaTo); fade.Duration = 350; TranslateAnimation slide = new TranslateAnimation(Dimension.RelativeToSelf, xFrom, Dimension.RelativeToSelf, xTo, Dimension.RelativeToSelf, 0, Dimension.RelativeToSelf, 0); slide.Duration = 350; animationSet.AddAnimation(fade); animationSet.AddAnimation(slide); view.StartAnimation(animationSet); if (requestFocus) { animationSet.AnimationEnd += (obj, args) => view.RequestFocus(); } }
public void ShowInvalid(string errorMessage) { nextMustBeDeleted = true; textErrorView.Text = errorMessage; AddView(textErrorView); textErrorView.Visibility = ViewStates.Visible; AnimationSet animationSet = new AnimationSet(true); AlphaAnimation fadeIn = new AlphaAnimation(0, 1); fadeIn.Duration = 300; AlphaAnimation fadeOut = new AlphaAnimation(1, 0); fadeOut.StartOffset = 300 + 300; fadeOut.Duration = 300; animationSet.AddAnimation(fadeIn); animationSet.AddAnimation(fadeOut); animationSet.FillAfter = true; animationSet.FillBefore = true; animationSet.AnimationEnd += (sender, args) => { textErrorView.Visibility = ViewStates.Gone; RemoveView(textErrorView); }; textErrorView.StartAnimation(animationSet); }
void HideProgressBar() { outAnimation = new AlphaAnimation(1f, 0f); inAnimation.Duration = 200; progressBarHolder.Animation = outAnimation; progressBarHolder.Visibility = ViewStates.Gone; }
async Task Dismiss() { var tcs = new TaskCompletionSource <bool>(); var anim = new AlphaAnimation(_contentView.Alpha, 0.0f); anim.Duration = 250; anim.FillAfter = true; void handler(object sender, Animation.AnimationEndEventArgs e) { tcs.SetResult(true); }; anim.AnimationEnd += handler; _contentView.StartAnimation(anim); await tcs.Task; anim.AnimationEnd -= handler; var dialog = FragmentManager.FindFragmentByTag <ExtraPlatformDialog>(_guid.ToString()); dialog.Dismiss(); _contentView.RemoveFromParent(); _platformDialog.Dispose(); _platformDialog = null; await Task.Delay(250); // wait for a bit time until the dialog is completely released. }
public static LayoutAnimationController getListAnimTranslate() { try { AnimationSet set = new AnimationSet(true); Animation animation = new AlphaAnimation(0.0f, 1.0f); animation.Duration = 500;//(500); set.AddAnimation(animation); animation = new TranslateAnimation(Dimension.RelativeToSelf, 0.0f, Dimension.RelativeToSelf, 0.0f, Dimension.RelativeToSelf, -1.0f, Dimension.RelativeToSelf, 0.0f); animation.Duration = 800; //(800); set.AddAnimation(animation); LayoutAnimationController controller = new LayoutAnimationController( set, 0.5f); controller.Order = DelayOrder.Random; return(controller); } catch (Exception) { return(null); } }
void ShowProgressBar() { inAnimation = new AlphaAnimation(0f, 1f); inAnimation.Duration = 200; progressBarHolder.Animation = inAnimation; progressBarHolder.Visibility = ViewStates.Visible; }
public static void FadeOutView(View view, int length, bool overrideAnim = false, Action callback = null) { if (overrideAnim) { view.Animation?.Cancel(); view.ClearAnimation(); view.Visibility = ViewStates.Visible; } else if (view.Visibility != ViewStates.Visible) { callback?.Invoke(); return; } var anim = new AlphaAnimation(1f, 0f) { Duration = length }; anim.AnimationEnd += delegate { view.Visibility = ViewStates.Invisible; callback?.Invoke(); }; view.StartAnimation(anim); }
public static void NoConnection() { var context = ViewHelper.CurrentActivity(); context.RunOnUiThread(delegate { var NoConnection = context.FindViewById(Resource.Id.NoConnection); if (NoConnection != null) { NoConnection.Visibility = ViewStates.Visible; new Handler().PostDelayed(delegate { Android.Views.Animations.Animation fadeOut = new AlphaAnimation(1, 0); fadeOut.Interpolator = new DecelerateInterpolator(); fadeOut.Duration = 1000; AnimationSet animation = new AnimationSet(false); animation.AddAnimation(fadeOut); NoConnection.Animation = animation; NoConnection.StartAnimation(animation); new Handler().PostDelayed(delegate { NoConnection.Visibility = ViewStates.Gone; }, 1000); }, 2000); } }); }
private Animation CreateAlphaInAnimation() { var an = new AlphaAnimation(0, 1); an.Duration = ALPHA_DURATION; return(an); }
public void Hide() { if (Progress != null) { Progress.ProgressChanged -= ProgressAction; Progress = null; //_loadingView.Progress = 0d; } var anim = new AlphaAnimation(ContentView.Alpha, 0.0f); anim.Duration = 250; anim.FillAfter = true; ContentView.StartAnimation(anim); _loadingView?.RunDismissalAnimation(); Task.Run(async() => { // Wait for ensuring that the dialog is created. // Because it sometimes crashes or freezes when executing a very short process. await IsDialogShownTcs.Task; var dialog = FragmentManager.FindFragmentByTag <LoadingPlatformDialog>(LoadingImplementation.LoadingDialogTag); dialog?.Dismiss(); ContentView.RemoveFromParent(); }); }
public void StartSecondaryCircleAnimation() { int bottomMovementAddition = (260 * parentWidth) / 700; TranslateAnimation translateAnimation = new TranslateAnimation(GetX(), GetX(), GetY(), GetY() + bottomMovementAddition) { StartOffset = 200, Duration = 1000 }; AlphaAnimation alphaAnimation = new AlphaAnimation(1, 0) { StartOffset = 1300, Duration = 200 }; AnimationSet animationSet = new AnimationSet(true) { FillAfter = true }; animationSet.AddAnimation(translateAnimation); animationSet.AddAnimation(alphaAnimation); animationSet.AnimationEnd += (s, e) => { SetState(AnimationState.SecondaryCircleFinished); }; StartAnimation(animationSet); }
public static void HideAnimationWithAlpha(View view) { AlphaAnimation animation = new AlphaAnimation(1, 0); animation.Duration = 50; view.StartAnimation(animation); }
public static AnimationSet getInAnimation(Context context) { AnimationSet _in = new AnimationSet(context, null); AlphaAnimation alpha = new AlphaAnimation(0.0f, 1.0f); alpha.Duration = 90; ScaleAnimation scale1 = new ScaleAnimation(0.8f, 1.05f, 0.8f, 1.05f, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f); scale1.Duration = 135; ScaleAnimation scale2 = new ScaleAnimation(1.05f, 0.95f, 1.05f, 0.95f, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f); scale2.Duration = 105; scale2.StartOffset = 135; ScaleAnimation scale3 = new ScaleAnimation(0.95f, 1f, 0.95f, 1.0f, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f); scale3.Duration = 60; scale3.StartOffset = 240; _in.AddAnimation(alpha); _in.AddAnimation(scale1); _in.AddAnimation(scale2); _in.AddAnimation(scale3); return(_in); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_fullscreen); mHandler = new Handler((message) => { switch (message.What) { case MESSAGE_HIDE_BARS: new FullscreenActivity().HideBars(); break; case MESSAGE_VIDEO_PREPARED: Animation animation = new AlphaAnimation(1.0f, 0.0f); animation.Duration = 500; relative_fullscreen.StartAnimation(animation); relative_fullscreen.Visibility = ViewStates.Gone; break; } }); var actionBar = SupportActionBar; if (actionBar != null) { actionBar.SetDisplayHomeAsUpEnabled(true); actionBar.Hide(); } progress_fullscreen = FindViewById <ProgressBar>(Resource.Id.progress_fullscreen); relative_fullscreen = FindViewById <RelativeLayout>(Resource.Id.relative_fullscreen); video_fullscreen = FindViewById <VideoView>(Resource.Id.video_fullscreen); }
void prikaziRezultate() { SetContentView(Resource.Layout.Dvoboj3); if (prviTocanOdgovor == 1) { bodoviIgrac1++; } if (prviTocanOdgovor == 2) { bodoviIgrac2++; } TextView bodovi1 = FindViewById <TextView>(Resource.Id.bodovi1); TextView bodovi2 = FindViewById <TextView>(Resource.Id.bodovi2); bodovi1.Text = bodoviIgrac1.ToString(); bodovi2.Text = bodoviIgrac2.ToString(); AlphaAnimation animation2 = new AlphaAnimation(0.0f, 1.0f); animation2.Duration = 1000; animation2.StartOffset = 0; animation2.FillAfter = true; bodovi1.StartAnimation(animation2); bodovi2.StartAnimation(animation2); }
protected override void OnCreate(Bundle savedInstanceState) { Window.RequestFeature(WindowFeatures.NoTitle); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Login); mLogin = FindViewById <Button>(Resource.Id.login); mUser = FindViewById <EditText>(Resource.Id.userName); mPass = FindViewById <EditText>(Resource.Id.password); mTitle = FindViewById <TextView>(Resource.Id.title); mLoading = FindViewById <ProgressBar>(Resource.Id.loading); mFail = FindViewById <TextView>(Resource.Id.loginfail); imm = (InputMethodManager)GetSystemService(Activity.InputMethodService); Typeface typeface = Typeface.CreateFromAsset(Assets, "fonts/OpenSans-Light.ttf"); mTitle.SetTypeface(typeface, TypefaceStyle.Normal); Animation anim = new AlphaAnimation(0, 1); anim.Duration = 1500; mUser.StartAnimation(anim); mPass.StartAnimation(anim); mTitle.StartAnimation(anim); mLogin.StartAnimation(anim); mLogin.Click += MLogin_Click; }
public static void FadeInView(View view, int duration, bool overrideAnim = false) { if (overrideAnim) { view.Animation?.Cancel(); view.ClearAnimation(); } if (view.Visibility != ViewStates.Invisible) { return; } var anim = new AlphaAnimation(0f, 1f) { Duration = duration }; anim.AnimationEnd += (sender, e) => { view.Visibility = ViewStates.Visible; }; view.StartAnimation(anim); }
private void OnReady() { if (_authListAdapter.Items.Count == 0) { AnimUtil.FadeInView(_emptyLayout, 200); } else { AnimUtil.FadeOutView(_emptyLayout, 200); } var anim = new AlphaAnimation(0f, 1f) { Duration = 200 }; anim.AnimationEnd += (sender, e) => { _authList.Visibility = ViewStates.Visible; _authList.RequestFocus(); }; _authList.StartAnimation(anim); _loadingLayout.Visibility = ViewStates.Invisible; }
public CardboardOverlayView(Context context, AttributeSet attrs) : base(context, attrs) { setOrientation(HORIZONTAL); LayoutParams @params = new LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, 1.0f); @params.setMargins(0, 0, 0, 0); leftView = new CardboardOverlayEyeView(context, attrs); leftView.setLayoutParams(@params); addView(leftView); rightView = new CardboardOverlayEyeView(context, attrs); rightView.setLayoutParams(@params); addView(rightView); // Set some reasonable defaults. setDepthOffset(0.016f); setColor(Color.rgb(150, 255, 180)); setVisibility(View.VISIBLE); textFadeAnimation = new AlphaAnimation(1.0f, 0.0f); textFadeAnimation.setDuration(5000); }
private void SetupTitleFade() { var myView = FindViewById <TextView>(Resource.Id.title); var fadeOut = new AlphaAnimation(1, 0); fadeOut.Interpolator = new DecelerateInterpolator(); fadeOut.Duration = 1000; var fadeIn = new AlphaAnimation(0, 1); fadeIn.Interpolator = new AccelerateInterpolator(); fadeIn.Duration = 1000; fadeIn.AnimationEnd += (s, e) => { ThreadPool.QueueUserWorkItem(state => { Thread.Sleep(1000); //wait 2 sec RunOnUiThread(() => { myView.StartAnimation(fadeOut); }); //fade out the view }); }; fadeOut.AnimationEnd += (s, e) => { myView.Alpha = 0; }; myView.StartAnimation(fadeIn); }
private Animation CreateAlphaOutAnimation() { var an = new AlphaAnimation(1, 0); an.Duration = ALPHA_DURATION; an.FillAfter = true; return(an); }
public static void StartAlphaAnimation(View v, long duration, ViewStates visibility) { AlphaAnimation alphaAnimation = visibility == ViewStates.Visible ? new AlphaAnimation(0f, 1f) : new AlphaAnimation(1f, 0f); alphaAnimation.Duration = duration; alphaAnimation.FillAfter = true; v.StartAnimation(alphaAnimation); }
private Animation CreateAlphaInAnimation() { AlphaAnimation an = new AlphaAnimation(0, 1); an.FillAfter = true; an.Duration = ALPHA_DURATION; return(an); }
private void showSubscriberWidget(bool show, bool animate) { if (mSubQualityContainer != null) { mSubQualityContainer.clearAnimation(); mSubscriberWidgetVisible = show; float dest = show ? 1.0f : 0.0f; AlphaAnimation aa = new AlphaAnimation(1.0f - dest, dest); aa.Duration = animate ? ANIMATION_DURATION : 1; aa.FillAfter = true; mSubQualityContainer.startAnimation(aa); if (show) { mSubQualityContainer.Visibility = View.VISIBLE; } else { mSubQualityContainer.Visibility = View.GONE; } } }