Exemple #1
0
        public void ShowBar(Action flashBarCallback, bool immediate = false, string withMessage = null, int withMessageId = -1)
        {
            if (withMessage != null)
            {
                this.message     = withMessage;
                messageView.Text = message;
            }
            if (withMessageId != -1)
            {
                this.message     = barView.Resources.GetString(withMessageId);
                messageView.Text = message;
            }

            this.flashBarCallback = flashBarCallback;
            hideHandler.RemoveCallbacks(hideRunnable);
            hideHandler.PostDelayed(hideRunnable, DefaultHideTime);

            barView.Visibility = ViewStates.Visible;
            if (immediate)
            {
                barView.Alpha = 1;
            }
            else
            {
                barAnimator.Cancel();
                barAnimator.Alpha(1);
                barAnimator.SetDuration(barView.Resources.GetInteger(Android.Resource.Integer.ConfigShortAnimTime));
                barAnimator.SetListener(null);
            }
        }
Exemple #2
0
            public void ShowBar(string message)
            {
                messageView.Text = message;

                barView.Visibility = ViewStates.Visible;

                barAnimator.Cancel();
                barAnimator.Alpha(1);
                barAnimator.SetDuration(300);
                barAnimator.SetListener(null);
            }
Exemple #3
0
        private void SwitchPositions()
        {
            // Remove the listner
            _animator.SetListener(null);
            _animator = null;

            RunOnUiThread(() =>
            {
                var width = _currentImageView.Width;

                var tmp           = _currentImageView;
                _currentImageView = _nextImageView;
                _currentImageView.TranslationX = 0;

                _nextImageView = tmp;
                _nextImageView.TranslationX = width;
                _nextImageView.SetImageBitmap(null);
                _nextImageView.DestroyDrawingCache();

                GC.Collect();

                ImageLoader.LoadImage(_images[_nextImageIndex], _nextImageView);
                _nextImageIndex++;

                if (_nextImageIndex >= _images.Count)
                {
                    _nextImageIndex = 0;
                }
            });
        }
Exemple #4
0
        protected static void Hide(View view)
        {
            ViewPropertyAnimator animator = view.Animate().TranslationY(viewY).SetInterpolator(INTERPOLATOR).SetDuration(300);

            animator.SetListener(new HideAnimatorListener(view));

            animator.Start();
        }
 private void RunOnAnimationEnd(ViewPropertyAnimator animator, Action runnable)
 {
     if (Build.VERSION.SdkInt >= BuildVersionCodes.JellyBean)
     {
         animator.WithEndAction(new Java.Lang.Runnable(runnable));
     }
     else
     {
         animator.SetListener(new Listener(runnable));
     }
 }
Exemple #6
0
        private static Task RunAnimationAsync(
            ViewPropertyAnimator animator)
        {
            if (null == animator)
            {
                throw new ArgumentNullException(nameof(animator));
            }

            AsyncAnimatorListener listener = new AsyncAnimatorListener();

            animator.SetListener(listener);
            animator.Start();

            return(listener.Task);
        }
Exemple #7
0
        public void OnClickClose(View view)
        {
            listFragment.ListView.ClearChoices();
            listFragment.ListView.RequestLayout();
            videoFragment.Pause();
            ViewPropertyAnimator animator = videoBox.Animate().TranslationYBy(videoBox.Height).SetDuration(ANIMATION_DURATION_MILLIS);

            animator.SetListener(new AinimatorListener()
            {
                AnimatorEnd = (a) =>
                {
                    if (videoBox.Height < 0)
                    {
                        videoBox.Visibility = ViewStates.Gone;
                    }
                }
            });
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.LockScreen2);
            ThreadPool.QueueUserWorkItem(isApphealthy =>
            {
                if (Checkers.IsNotificationListenerEnabled() == false || Checkers.IsThisAppADeviceAdministrator() == false)
                {
                    RunOnUiThread(() =>
                    {
                        Toast.MakeText(Application.Context, "You dont have the required permissions", ToastLength.Long).Show();
                        Finish();
                    }
                                  );
                }
            });

            startCamera          = FindViewById <Button>(Resource.Id.btnStartCamera);
            startDialer          = FindViewById <Button>(Resource.Id.btnStartPhone);
            clearAll             = FindViewById <Button>(Resource.Id.btnClearAllNotifications);
            lockscreen           = FindViewById <LinearLayout>(Resource.Id.contenedorPrincipal);
            viewPropertyAnimator = Window.DecorView.Animate();
            viewPropertyAnimator.SetListener(new LockScreenAnimationHelper(Window));
            livedisplayinfo            = FindViewById <TextView>(Resource.Id.livedisplayinfo);
            livedisplayinfo.Visibility = ViewStates.Gone;  //You won't be seeing this anymore.

            fadeoutanimation = AnimationUtils.LoadAnimation(Application.Context, Resource.Animation.abc_fade_out);
            fadeoutanimation.AnimationEnd += Fadeoutanimation_AnimationEnd;

            clearAll.Click    += BtnClearAll_Click;
            startCamera.Click += StartCamera_Click;
            startDialer.Click += StartDialer_Click;
            lockscreen.Touch  += Lockscreen_Touch;

            watchDog = new System.Timers.Timer
            {
                AutoReset = false
            };
            watchDog.Elapsed += WatchdogInterval_Elapsed;

            halfscreenheight = Resources.DisplayMetrics.HeightPixels / 2;

            WallpaperPublisher.NewWallpaperIssued += Wallpaper_NewWallpaperIssued;

            //CatcherHelper events
            CatcherHelper.NotificationListSizeChanged += CatcherHelper_NotificationListSizeChanged;

            using (recycler = FindViewById <RecyclerView>(Resource.Id.NotificationListRecyclerView))
            {
                using (layoutManager = new LinearLayoutManager(Application.Context))
                {
                    recycler.SetLayoutManager(layoutManager);
                    recycler.SetAdapter(CatcherHelper.notificationAdapter);
                }
            }
            LoadAllFragments();
            LoadConfiguration();

            WallpaperPublisher.CurrentWallpaperCleared  += WallpaperPublisher_CurrentWallpaperCleared;
            WidgetStatusPublisher.OnWidgetStatusChanged += WidgetStatusPublisher_OnWidgetStatusChanged;
        }