/// <summary> /// Check is the ShowCaseView visible /// </summary> /// <param name="activity"></param> /// <returns></returns> public static bool IsVisible(Activity activity) { ViewGroup androidContent = activity.FindViewById <ViewGroup>(Android.Resource.Id.Content); ViewGroup mRoot = (ViewGroup)androidContent.Parent.Parent; ShowCaseView mContainer = (ShowCaseView)mRoot.FindViewWithTag(CONTAINER_TAG); return(mContainer != null); }
/// <summary> /// Hides the current ShowcaseView /// </summary> /// <param name="activity"></param> public static void HideCurrent(Activity activity) { ViewGroup androidContent = activity.FindViewById <ViewGroup>(Android.Resource.Id.Content); ViewGroup mRoot = (ViewGroup)androidContent.Parent.Parent; ShowCaseView mContainer = (ShowCaseView)mRoot.FindViewWithTag(CONTAINER_TAG); mContainer.Hide(); }
/// <summary> /// Determines visble view anit's circle positioning /// </summary> private void Focus() { mCalculator = new Calculator(mActivity, mFocusShape, mView, mFocusCircleRadiusFactor, mFitSystemWindows); ViewGroup androidContent = mActivity.FindViewById <ViewGroup>(Android.Resource.Id.Content); mRoot = (ViewGroup)androidContent.Parent.Parent; mRoot.PostDelayed(() => { if (mActivity == null || mActivity.IsFinishing) { return; } ShowCaseView visibleView = (ShowCaseView)mRoot.FindViewWithTag(CONTAINER_TAG); Clickable = !mEnableTouchOnFocusedView; if (visibleView == null) { Tag = CONTAINER_TAG; if (mCloseOnTouch) { SetupTouchListener(); } LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); mRoot.AddView(this); ShowCaseImageView imageView = new ShowCaseImageView(mActivity); imageView.SetFocusAnimationParameters(mFocusAnimationMaxValue, mFocusAnimationStep); if (mCalculator.HasFocus) { mCenterX = mCalculator.CircleCenterX; mCenterY = mCalculator.CircleCenterY; } imageView.SetParameters(mBackgroundColor, mCalculator); if (mFocusRectangleWidth > 0 && mFocusRectangleHeight > 0) { mCalculator.SetRectPosition(mFocusPositionX, mFocusPositionY, mFocusRectangleWidth, mFocusRectangleHeight); } if (mFocusCircleRadius > 0) { mCalculator.SetCirclePosition(mFocusPositionX, mFocusPositionY, mFocusCircleRadius); } imageView.SetAnimationEnabled(mFocusAnimationEnabled); imageView.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); if (mFocusBorderColor != 0 && mFocusBorderSize > 0) { imageView.SetBorderParameters(mFocusBorderColor, mFocusBorderSize); } if (mRoundRectRadius > 0) { imageView.setRoundRectRadius(mRoundRectRadius); } AddView(imageView); if (mCustomViewRes == 0) { InflateTitleView(); } else { InflateCustomView(mCustomViewRes, mViewInflateListener); } StartEnterAnimation(); WriteShown(); } }, mDelay); }