예제 #1
0
        /**
         * A utility function to get the {@link AnchorSheetBehavior} associated with the {@code view}.
         *
         * @param view The {@link View} with {@link AnchorSheetBehavior}.
         * @return The {@link AnchorSheetBehavior} associated with the {@code view}.
         */
        public static AnchorBottomSheetBehavior From <TView>(TView view) where TView : View
        {
            var @params = view.LayoutParameters;

            if (!(@params is CoordinatorLayout.LayoutParams))
            {
                throw new ArgumentException("The view is not a child of CoordinatorLayout", nameof(view));
            }
            CoordinatorLayout.Behavior behavior = ((CoordinatorLayout.LayoutParams)@params).Behavior;
            if (!(behavior is AnchorBottomSheetBehavior))
            {
                throw new ArgumentException("The view is not associated with AnchorSheetBehavior", nameof(view));
            }
            return((AnchorBottomSheetBehavior)behavior);
        }
예제 #2
0
 public static AHBottomNavigationBehavior <T> from(T view)
 {
     ViewGroup.LayoutParams param = view.LayoutParameters;
     if (!(param is CoordinatorLayout.LayoutParams))
     {
         throw new ArgumentException("The view is not a child of CoordinatorLayout");
     }
     CoordinatorLayout.Behavior behavior = ((CoordinatorLayout.LayoutParams)param)
                                           .Behavior;
     if (!(behavior is AHBottomNavigationBehavior <T>))
     {
         throw new ArgumentException(
                   "The view is not associated with AHBottomNavigationBehavior");
     }
     return((AHBottomNavigationBehavior <T>)behavior);
 }
예제 #3
0
        public override void SetupDialog(Dialog dialog, int style)
        {
            base.SetupDialog(dialog, style);
            View contentView = View.Inflate(Context, Resource.Layout.maintenance_description_dialog_modal, null);

            _fullDescriptionTextView      = contentView.FindViewById <TextView>(Resource.Id.full_description_textView);
            _fullDescriptionTextView.Text = _fullDescription;
            dialog.SetContentView(contentView);

            CoordinatorLayout.LayoutParams layoutParams =
                (CoordinatorLayout.LayoutParams)(( View )contentView.Parent).LayoutParameters;
            CoordinatorLayout.Behavior behavior = layoutParams.Behavior;
            if (behavior != null && behavior is BottomSheetBehavior)
            {
                (( BottomSheetBehavior )behavior).SetBottomSheetCallback(mBottomSheetBehaviorCallback);
            }
        }
 public static BottomSheet4StateBehaviour From(View view)
 {
     ViewGroup.LayoutParams lp = view.LayoutParameters;
     if (lp is CoordinatorLayout.LayoutParams clp)
     {
         CoordinatorLayout.Behavior behavior = clp.Behavior;
         if (behavior is BottomSheet4StateBehaviour bsb)
         {
             return(bsb);
         }
         else
         {
             throw new IllegalArgumentException("The view is not associated with BottomSheet4StateBehaviour");
         }
     }
     else
     {
         throw new IllegalArgumentException("The view is not a child of CoordinatorLayout");
     }
 }
예제 #5
0
        public override void SetupDialog(Dialog dialog, int style)
        {
            base.SetupDialog(dialog, style);

            View contentView = View.Inflate(Context, Resource.Layout.custom_bottom_sheet, null);

            dialog.SetContentView(contentView);

            CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams)((View)contentView.Parent).LayoutParameters;

            CoordinatorLayout.Behavior behavior = layoutParams.Behavior;

            if (behavior != null)
            {
                var bttomCallback = new BottomSheetBehaviorOverride(SetOffsetText, SetStateText);

                ((BottomSheetBehavior)behavior).SetBottomSheetCallback(bttomCallback);
            }

            //mOffsetText = contentView.FindViewById<TextView>(Resource.Id.offsetText);
            //mStateText = contentView.FindViewById<TextView>(Resource.Id.stateText);
        }
예제 #6
0
        public override void SetupDialog(Dialog dialog, int style)
        {
            try
            {
                base.SetupDialog(dialog, style);
                //Get the content View
                View contentView = View.Inflate(this.Context, Resource.Layout.AdmobNative_Layout, null);
                dialog.SetContentView(contentView);

                //Set the coordinator layout behavior
                CoordinatorLayout.LayoutParams Params   = (CoordinatorLayout.LayoutParams)((View)contentView.Parent).LayoutParameters;
                CoordinatorLayout.Behavior     behavior = Params.Behavior;

                //Set callback
                if (behavior != null && behavior.GetType() == typeof(BottomSheetBehavior))
                {
                    ((BottomSheetBehavior)behavior).SetBottomSheetCallback(mBottomSheetBehaviorCallback);
                }

                string android_id = Android.Provider.Settings.Secure.GetString(this.Context.ContentResolver, Android.Provider.Settings.Secure.AndroidId);

                native = contentView.FindViewById <NativeExpressAdView>(Resource.Id.adViewNative);
                // Create an ad request.
                AdRequest.Builder adRequestBuilder = new AdRequest.Builder();

                // Optionally populate the ad request builder.
                adRequestBuilder.AddTestDevice(android_id);

                // Start loading the ad.
                native.LoadAd(adRequestBuilder.Build());

                native.Visibility = ViewStates.Visible;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }