Ejemplo n.º 1
0
        private AnimatorSet createContentTextShowAnimation(View currentContentText, View newContentText)
        {
            int         positionDeltaPx      = dpToPixels(CONTENT_TEXT_POS_DELTA_Y_DP);
            AnimatorSet animations           = new AnimatorSet();
            Animator    currentContentMoveUp = ObjectAnimator.OfFloat(currentContentText, "y", 0, -positionDeltaPx);

            currentContentMoveUp.SetDuration(ANIM_CONTENT_TEXT_HIDE_TIME);
            var endListener = new AnimatorEndListener();

            endListener.OnEndAnimation += () =>
            {
                mContentTextContainer.RemoveView(currentContentText);
            };
            currentContentMoveUp.AddListener(endListener);

            Animator currentContentFadeOut = ObjectAnimator.OfFloat(currentContentText, "alpha", 1, 0);

            currentContentFadeOut.SetDuration(ANIM_CONTENT_TEXT_HIDE_TIME);

            animations.PlayTogether(currentContentMoveUp, currentContentFadeOut);

            Animator newContentMoveUp = ObjectAnimator.OfFloat(newContentText, "y", positionDeltaPx, 0);

            newContentMoveUp.SetDuration(ANIM_CONTENT_TEXT_SHOW_TIME);

            Animator newContentFadeIn = ObjectAnimator.OfFloat(newContentText, "alpha", 0, 1);

            newContentFadeIn.SetDuration(ANIM_CONTENT_TEXT_SHOW_TIME);

            animations.PlayTogether(newContentMoveUp, newContentFadeIn);

            animations.SetInterpolator(new DecelerateInterpolator());

            return(animations);
        }
Ejemplo n.º 2
0
        public void SetCardImage(int drawableId, bool vertical)
        {
            int objectAnimation = vertical ? Resource.Animation.flipping_out_vert : Resource.Animation.flipping_out;
            int backAnim        = Resource.Animation.fade_out;

            CompatibilityAnimation compatibilityAnimationOut = new CompatibilityAnimation(Context, objectAnimation, backAnim);

            if (cardImageLayout.ChildCount > 0)
            {
                ImageView imageView = (ImageView)cardImageLayout.GetChildAt(0);
                compatibilityAnimationOut.Duration     = 350;
                compatibilityAnimationOut.AnimatioEnd += () => Handler.Post(() => cardImageLayout.RemoveView(imageView));

                compatibilityAnimationOut.StartAnimation(imageView);
            }

            ImageView imageView2 = new ImageView(Context);

            imageView2.SetImageResource(drawableId);
            imageView2.Visibility = ViewStates.Invisible;
            cardImageLayout.AddView(imageView2);

            objectAnimation = vertical ? Resource.Animation.flipping_in_vert : Resource.Animation.flipping_in;
            backAnim        = Resource.Animation.fade_in;

            CompatibilityAnimation compatibilityAnimationIn = new CompatibilityAnimation(Context, objectAnimation, backAnim);

            compatibilityAnimationIn.Duration        = 350;
            compatibilityAnimationIn.Delay           = 350;
            compatibilityAnimationIn.AnimationStart += () => imageView2.Visibility = ViewStates.Visible;

            compatibilityAnimationIn.StartAnimation(imageView2);
        }
Ejemplo n.º 3
0
        public static async Task <T> AttachAndRun <T>(this AView view, Func <T> action)
        {
            var layout = new FrameLayout(view.Context);

            layout.LayoutParameters = new FrameLayout.LayoutParams(500, 500);
            view.LayoutParameters   = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WrapContent, FrameLayout.LayoutParams.WrapContent)
            {
                Gravity = GravityFlags.Center
            };

            var act      = view.Context.GetActivity();
            var rootView = act.FindViewById <FrameLayout>(Android.Resource.Id.Content);

            rootView.AddView(layout);

            layout.AddView(view);
            layout.Measure(500, 500);
            layout.Layout(0, 0, 500, 500);

            await Task.Delay(100);

            try
            {
                var result = action();
                return(result);
            }
            finally
            {
                rootView.RemoveView(layout);
                layout.RemoveView(view);
            }
        }
        public override void OnShowCustomView(View view, WebChromeClient.ICustomViewCallback callback)
        {
            base.OnShowCustomView(view, callback);
            ((Activity)VideoView.Context).VolumeControlStream = Stream.Music;
            VideoView.mIsFullscreen = true;
            VideoView.mViewCallback = callback;
            if (view is FrameLayout)
            {
                FrameLayout frame = (FrameLayout)view;
                if (frame.FocusedChild is VideoView)
                {                //We are in 2.3
                    VideoView video = (VideoView)frame.FocusedChild;
                    frame.RemoveView(video);

                    VideoView.setupVideoLayout(video);

                    VideoView.mCustomVideoView = video;
                    VideoView.mCustomVideoView.SetOnCompletionListener(this);
                }
                else                  //Handle 4.x
                {
                    VideoView.setupVideoLayout(view);
                }
            }
        }
Ejemplo n.º 5
0
        public override void OnPause()
        {
            base.OnPause();

            scanner.ShutdownCamera();

            frame.RemoveView(scanner);

            if (!UseCustomOverlayView)
            {
                frame.RemoveView(zxingOverlay);
            }
            else if (CustomOverlayView != null)
            {
                frame.RemoveView(CustomOverlayView);
            }
        }
        public override void OnPause()
        {
            base.OnPause();

            scanner.ShutdownCamera();

            frame.RemoveView(scanner);
        }
Ejemplo n.º 7
0
        public new XF.Item RemoveAt(int index)
        {
            var child = base.RemoveAt(index);

            if (child != null)
            {
                view.RemoveView(ViewOfItem(child));
            }
            return(child);
        }
Ejemplo n.º 8
0
        public override void OnStop()
        {
            if (scanner != null)
            {
                scanner.StopScanning();
                frame.RemoveView(scanner);
            }

            if (!UseCustomOverlayView)
            {
                frame.RemoveView(zxingOverlay);
            }
            else if (CustomOverlayView != null)
            {
                frame.RemoveView(CustomOverlayView);
            }

            base.OnStop();
        }
Ejemplo n.º 9
0
        private async void SearchResults_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            if (welcomeView != null)
            {
                dynamicLayout.RemoveView(welcomeView);
                welcomeView = null;

                InflateSong();
            }

            RunOnUiThread(() =>
            {
                dynamicLayout.Visibility = ViewStates.Visible;
            });

            #region UI Variables
            ProgressBar lyricsLoadingWheel = FindViewById <ProgressBar>(Resource.Id.lyricsLoadingWheel);
            ListView    searchResults      = FindViewById <ListView>(Resource.Id.searchResults);
            #endregion

            imm.HideSoftInputFromWindow(searchTxt.WindowToken, 0);
            nowPlayingMode = false;
            ClearLabels();

            songInfo ??= new SongBundle();
            songInfo = resultsToView.ElementAt(e.Position);

            Log(Type.Action, $"Attempting to display song at search position {e.Position}.");
            Analytics.TrackEvent("Attempting to display song from search", new Dictionary <string, string> {
                { "SongID", songInfo.Normal.Id.ToString() },
                { "ListPosition", e.Position.ToString() }
            });

            RunOnUiThread(() =>
            {
                lyricsLoadingWheel.Visibility = ViewStates.Visible;
                searchResults.Visibility      = ViewStates.Gone;
            });

            LoadSong();
        }
Ejemplo n.º 10
0
 public void hideBannerAds()
 {
     if (ll != null)
     {
         fl.RemoveView(ll);
         ll.RemoveView(bannerAd);
         bannerAd.Dispose();
         bannerAd = null;
         ll.Dispose();
         ll = null;
     }
 }
Ejemplo n.º 11
0
        public override void OnStop()
        {
            if (scanner != null)
            {
                scanner.ShutdownCamera();

                frame.RemoveView(scanner);
            }

            scanner = null;

            if (!UseCustomOverlayView)
            {
                frame.RemoveView(zxingOverlay);
            }
            else if (CustomOverlayView != null)
            {
                frame.RemoveView(CustomOverlayView);
            }

            base.OnStop();
        }
Ejemplo n.º 12
0
        public void HideBannerAd()
        {
            if (null != revmobBanner)
            {
                revmobBanner.Release();
            }
            revmobBanner = null;

            if (null != _bannerContainer)
            {
                _rootLayout.RemoveView(_bannerContainer);
            }
            _bannerContainer = null;
        }
Ejemplo n.º 13
0
 private void Timer_Elapsed(object sender, ElapsedEventArgs e)
 {
     if (countVariable > 0)
     {
         RunOnUiThread(() => countdownView.Text = countVariable.ToString());
         countVariable--;
     }
     else
     {
         containerLayer.RemoveView(topLayerCount);
         timer.Stop();
         return;
     }
 }
 public void hideVideoView()
 {
     if (isFullscreen())
     {
         if (mCustomVideoView != null)
         {
             mCustomVideoView.StopPlayback();
         }
         mRootLayout.RemoveView(mVideoLayout);
         mViewCallback.OnCustomViewHidden();
         ((Activity)Context).VolumeControlStream = (Stream)AudioManager.UseDefaultStreamType;
         mIsFullscreen = false;
     }
 }
        private void addIndicatorViews()
        {
            PullMode    mode = Mode;
            FrameLayout refreshableViewWrapper = RefreshableViewWrapper;

            if (mode.showHeaderLoadingLayout() && null == mIndicatorIvTop)
            {
                // If the mode can pull down, and we don't have one set already
                mIndicatorIvTop = new IndicatorLayout(Context, PullMode.PULL_FROM_START);
                FrameLayout.LayoutParams @params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
                @params.RightMargin = Resources.GetDimensionPixelSize(Resource.Dimension.indicator_right_padding);
                @params.Gravity     = GravityFlags.Top | GravityFlags.Right;
                refreshableViewWrapper.AddView(mIndicatorIvTop, @params);
            }
            else if (!mode.showHeaderLoadingLayout() && null != mIndicatorIvTop)
            {
                // If we can't pull down, but have a View then remove it
                refreshableViewWrapper.RemoveView(mIndicatorIvTop);
                mIndicatorIvTop = null;
            }

            if (mode.showFooterLoadingLayout() && null == mIndicatorIvBottom)
            {
                // If the mode can pull down, and we don't have one set already
                mIndicatorIvBottom = new IndicatorLayout(Context, PullMode.PULL_FROM_END);
                FrameLayout.LayoutParams @params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
                @params.RightMargin = Resources.GetDimensionPixelSize(Resource.Dimension.indicator_right_padding);
                @params.Gravity     = GravityFlags.Bottom | GravityFlags.Right;
                refreshableViewWrapper.AddView(mIndicatorIvBottom, @params);
            }
            else if (!mode.showFooterLoadingLayout() && null != mIndicatorIvBottom)
            {
                // If we can't pull down, but have a View then remove it
                refreshableViewWrapper.RemoveView(mIndicatorIvBottom);
                mIndicatorIvBottom = null;
            }
        }
Ejemplo n.º 16
0
        public void AddItem(int resId, Action <View> listener)
        {
            var            frame = new FrameLayout(this.Context);
            LayoutInflater li    = (LayoutInflater)this.Context.GetSystemService(Context.LayoutInflaterService);

            li.Inflate(Resource.Layout.item, frame);

            var bgframe  = (FrameLayout)frame.GetChildAt(0);
            var identity = (ImageView)bgframe.GetChildAt(0);

            identity.SetImageResource(resId);
            frame.RemoveView(bgframe);

            this.AddItem(bgframe, listener);
        }
Ejemplo n.º 17
0
        public void HideVideoView()
        {
            if (this.IsFullScreen)
            {
                if (this.CustomVideoView != null)
                {
                    this.CustomVideoView.StopPlayback();
                }

                mRootLayout.RemoveView(mVideoLayout);
                this.ViewCallback.OnCustomViewHidden();

                ((Activity)this.Context).VolumeControlStream = Stream.NotificationDefault;

                this.IsFullScreen = false;
            }
        }
        // Releasing Camera
        private void ReleaseCamera()
        {
            if (_camera != null)
            {
                _camera.StopPreview();  // stop the preview

                _camera.Release();      // release the camera for other applications
                _camera = null;

                if (_preview != null)
                {
                    camera_preview.RemoveView(_preview);
                    _preview.Dispose();
                    _preview = null;
                }
            }
            mediaFilePath = "";
        }
Ejemplo n.º 19
0
        public static async Task <T> AttachAndRun <T>(this AView view, Func <Task <T> > action)
        {
            if (view.Parent is WrapperView wrapper)
            {
                view = wrapper;
            }

            if (view.Parent == null)
            {
                var context = view.Context !;
                var layout  = new FrameLayout(context)
                {
                    LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent)
                };
                view.LayoutParameters = new FrameLayout.LayoutParams(view.Width, view.Height)
                {
                    Gravity = GravityFlags.Center
                };

                var act      = context.GetActivity() !;
                var rootView = act.FindViewById <FrameLayout>(Android.Resource.Id.Content) !;

                view.Id   = AView.GenerateViewId();
                layout.Id = AView.GenerateViewId();

                try
                {
                    await _attachAndRunSemaphore.WaitAsync();

                    layout.AddView(view);
                    rootView.AddView(layout);
                    return(await Run(view, action));
                }
                finally
                {
                    rootView.RemoveView(layout);
                    layout.RemoveView(view);
                    _attachAndRunSemaphore.Release();
                }
            }
            else
            {
                return(await Run(view, action));
            }
        protected void AddRightActionButton(Button actionButton)
        {
            if (RightActionButton != null)
            {
                _rightViewGroup.RemoveView(RightActionButton);
                RightActionButton = null;
                _rightActionColor = Color.Transparent;
            }

            if (actionButton != null)
            {
                RightActionButton = actionButton;
                if (RightActionButton.Background is ColorDrawable colorDrawable)
                {
                    _rightActionColor = colorDrawable.Color;
                }
                LayoutParams actionButtonLayoutParams = new LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.MatchParent, GravityFlags.Right);
                _rightViewGroup.AddView(RightActionButton, actionButtonLayoutParams);
            }
        }
Ejemplo n.º 21
0
 private void DrawLineChart()
 {
     if (columnChartAdded)
     {
         chartLayout.RemoveView(columnChart);
     }
     if (pieChartAdded)
     {
         chartLayout.RemoveView(pieChart);
     }
     if (!lineChartAdded)
     {
         chartLayout.AddView(lineChart);
     }
 }
Ejemplo n.º 22
0
        protected AnimatorSet createBGAnimatorSet(Android.Graphics.Color color)
        {
            View bgColorView = new ImageView(mAppContext);

            bgColorView.LayoutParameters = new RelativeLayout.LayoutParams(mRootLayout.Width, mRootLayout.Height);
            bgColorView.SetBackgroundColor(color);
            mBackgroundContainer.AddView(bgColorView);

            int[] pos = calculateCurrentCenterCoordinatesOfPagerElement(mActiveElementIndex);

            float finalRadius = mRootLayout.Width > mRootLayout.Height ? mRootLayout.Width : mRootLayout.Height;

            AnimatorSet bgAnimSet = new AnimatorSet();
            Animator    fadeIn    = ObjectAnimator.OfFloat(bgColorView, "alpha", 0, 1);

            if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
            {
                Animator circularReveal = ViewAnimationUtils.CreateCircularReveal(bgColorView, pos[0], pos[1], 0, finalRadius);
                circularReveal.SetInterpolator(new AccelerateInterpolator());
                bgAnimSet.PlayTogether(circularReveal, fadeIn);
            }
            else
            {
                bgAnimSet.PlayTogether(fadeIn);
            }

            bgAnimSet.SetDuration(ANIM_BACKGROUND_TIME);
            var endListener = new AnimatorEndListener();

            endListener.OnEndAnimation += () =>
            {
                mRootLayout.SetBackgroundColor(color);
                bgColorView.Visibility = ViewStates.Gone;
                mBackgroundContainer.RemoveView(bgColorView);
            };
            bgAnimSet.AddListener(endListener);
            return(bgAnimSet);
        }
Ejemplo n.º 23
0
        public static async Task <T> AttachAndRun <T>(this AView view, Func <T> action)
        {
            if (view.Parent is WrapperView wrapper)
            {
                view = wrapper;
            }

            var context = view.Context !;
            var layout  = new FrameLayout(context)
            {
                LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent)
            };

            view.LayoutParameters = new FrameLayout.LayoutParams(view.Width, view.Height)
            {
                Gravity = GravityFlags.Center
            };

            var act      = context.GetActivity() !;
            var rootView = act.FindViewById <FrameLayout>(Android.Resource.Id.Content) !;

            layout.AddView(view);
            rootView.AddView(layout);

            await Task.Delay(100);

            try
            {
                var result = action();
                return(result);
            }
            finally
            {
                rootView.RemoveView(layout);
                layout.RemoveView(view);
            }
        }
Ejemplo n.º 24
0
        protected override async void OnPause()
        {
            base.OnPause();
            _working = false;
            if (_camera != null && _cameraSurface != null)
            {
                await _takePhotoLock.WaitAsync();

                _cameraFrameLayout?.RemoveView(_cameraSurface);
                _cameraSurface.ReleaseResources();
                _cameraSurface = null;

                ReleaseCamera();
                UnsubscribeFromEvents();

                _takePhotoLock.Release();
            }
            else
            {
                UnsubscribeFromTakenPhotoButtonsBarEvents();
            }

            ViewModel.PropertyChanged -= ViewModel_PropertyChanged;
        }