Exemple #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_mrec_programmatic);

            adStatusTextView = FindViewById <TextView>(Resource.Id.status_label);

            // Create MRec
            adView    = new AppLovinAdView(AppLovinAdSize.Mrec, this);
            adView.Id = ViewCompat.GenerateViewId();

            var mrecConstraintLayout = FindViewById <ConstraintLayout>(Resource.Id.mrec_programmatic_constraint_layout);
            var layoutParams         = new ConstraintLayout.LayoutParams(AppLovinSdkUtils.DpToPx(this, AppLovinAdSize.Mrec.Width), AppLovinSdkUtils.DpToPx(this, AppLovinAdSize.Mrec.Height));

            mrecConstraintLayout.AddView(adView, layoutParams);

            var set = new ConstraintSet();

            set.Clone(mrecConstraintLayout);
            set.Connect(adView.Id, ConstraintSet.Top, mrecConstraintLayout.Id, ConstraintSet.Top, AppLovinSdkUtils.DpToPx(this, 80));
            set.CenterHorizontally(adView.Id, mrecConstraintLayout.Id);
            set.ApplyTo(mrecConstraintLayout);

            var loadButton = FindViewById <Button>(Resource.Id.load_button);

            loadButton.Click += LoadButton_Click;

            adView.SetAdLoadListener(this);
            adView.SetAdDisplayListener(this);
            adView.SetAdClickListener(this);
            adView.SetAdViewEventListener(this);
        }
Exemple #2
0
        private void CreateBaseConstraints()
        {
            BaseMainConstraintLayout    = new ConstraintLayout(this);
            BaseMainConstraintLayout.Id = Resource.Id.BaseMainConstraintLayout;

            SetContentView(BaseMainConstraintLayout);

            BaseScrollView    = new ScrollView(this);
            BaseScrollView.Id = Resource.Id.BaseScrollView;
            BaseScrollView.VerticalScrollBarEnabled = false;
            ConstraintLayout.LayoutParams cplScrollView = new ConstraintLayout.LayoutParams(
                ConstraintLayout.LayoutParams.MatchConstraint, ConstraintLayout.LayoutParams.MatchConstraint);
            BaseScrollView.LayoutParameters = cplScrollView;

            BaseElementsConstraintLayout    = new ConstraintLayout(this);
            BaseElementsConstraintLayout.Id = Resource.Id.BaseElementsConstraintLayout;
            ConstraintLayout.LayoutParams cplBECL = new ConstraintLayout.LayoutParams(
                ConstraintLayout.LayoutParams.MatchParent, ConstraintLayout.LayoutParams.MatchParent);
            BaseElementsConstraintLayout.LayoutParameters       = cplBECL;
            BaseElementsConstraintLayout.DescendantFocusability = DescendantFocusability.BeforeDescendants;
            BaseElementsConstraintLayout.FocusableInTouchMode   = true;

            BasePreLoaderConstraintLayout    = new ConstraintLayout(this);
            BasePreLoaderConstraintLayout.Id = Resource.Id.BasePreLoaderConstraintLayout;
            ConstraintLayout.LayoutParams cplBPCL = new ConstraintLayout.LayoutParams(
                ConstraintLayout.LayoutParams.MatchParent, ConstraintLayout.LayoutParams.MatchParent);
            BasePreLoaderConstraintLayout.LayoutParameters = cplBPCL;
            BasePreLoaderConstraintLayout.SetBackgroundColor(Color.ParseColor("#5F555555"));
            BasePreLoaderConstraintLayout.Visibility = ViewStates.Invisible;
        }
        void CreateToolbar()
        {
            _toolbar    = new Toolbar(this);
            _toolbar.Id = Resource.Id.toolbar;
            ConstraintLayout.LayoutParams clptoolbar = new ConstraintLayout.LayoutParams(
                ConstraintLayout.LayoutParams.MatchParent, ConstraintLayout.LayoutParams.WrapContent);
            _toolbar.LayoutParameters = clptoolbar;
            //_toolbar.Title = "OCBB";
            _toolbar.SetTitleTextColor(Color.White);
            _toolbar.SetBackgroundColor(Color.ParseColor("#00bbcc"));
            _toolbar.SetSubtitleTextColor(Color.ParseColor("#ffffff"));
            _toolbar.SetSubtitleTextAppearance(this, Resource.Style.TextAppearance_Widget_AppCompat_Toolbar_Subtitle);

            BaseScrollView.RemoveView(BaseElementsConstraintLayout);
            BaseMainConstraintLayout.RemoveView(BaseScrollView);
            BaseMainConstraintLayout.RemoveView(BasePreLoaderConstraintLayout);
            BasePreLoaderConstraintLayout.RemoveView(BaseProgressBar);

            BaseElementsConstraintLayout.AddView(_toolbar);
            BaseMainConstraintLayout.AddView(BaseElementsConstraintLayout);

            BaseMainConstraintLayout.AddView(BasePreLoaderConstraintLayout);
            BasePreLoaderConstraintLayout.AddView(BaseProgressBar);
            CreateMainConstraintSet();
        }
 public void OnUPIAppsFetched(IList <IDictionary <string, string> > list)
 {
     if (list.Count == 0)
     {
         progressBar.Visibility = ViewStates.Gone;
         FindViewById <TextView>(Resource.Id.no_upi_apps).Visibility = ViewStates.Visible;
         return;
     }
     if (flow != null && parentLayout != null)
     {
         int i = 0;
         List <LinearLayout> imageList = new List <LinearLayout>();
         List <int>          refIds    = new List <int>();
         foreach (IDictionary <string, string> dict in list)
         {
             refIds.Add(i);
             imageList.Add(SetImage(dict["displayName"], dict["id"], dict["icon"], i));
             i++;
         }
         RunOnUiThread(() =>
         {
             progressBar.Visibility = ViewStates.Gone;
             foreach (LinearLayout view in imageList)
             {
                 ConstraintLayout.LayoutParams layoutParams = new ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.WrapContent,
                                                                                                ConstraintLayout.LayoutParams.WrapContent);
                 parentLayout.AddView(view, layoutParams);
             }
             flow.SetReferencedIds(refIds.ToArray());
         });
     }
 }
        private void InitLayout()
        {
            _constraintLayoutRoot = this.BindingInflate(LayoutId, null) as ConstraintLayout;

            ConstraintLayout.LayoutParams layoutParams = new ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.MatchConstraint, ConstraintLayout.LayoutParams.MatchConstraint);
            _constraintLayoutRoot.LayoutParameters = layoutParams;

            BaseMainConstraintLayout.RemoveView(BaseScrollView);
            BaseScrollView.RemoveView(BaseElementsConstraintLayout);
            BaseMainConstraintLayout.AddView(BaseElementsConstraintLayout);

            BaseMainConstraintLayout.BringChildToFront(BasePreLoaderConstraintLayout);

            var rootElementSet = new ConstraintSet();

            rootElementSet.Clone(BaseMainConstraintLayout);
            rootElementSet.Connect(BaseElementsConstraintLayout.Id, ConstraintSet.Top, BaseMainConstraintLayout.Id, ConstraintSet.Top);
            rootElementSet.Connect(BaseElementsConstraintLayout.Id, ConstraintSet.Bottom, BaseMainConstraintLayout.Id, ConstraintSet.Bottom);
            rootElementSet.Connect(BaseElementsConstraintLayout.Id, ConstraintSet.Left, BaseMainConstraintLayout.Id, ConstraintSet.Left);
            rootElementSet.Connect(BaseElementsConstraintLayout.Id, ConstraintSet.Right, BaseMainConstraintLayout.Id, ConstraintSet.Right);
            rootElementSet.ApplyTo(BaseMainConstraintLayout);

            BaseElementsConstraintLayout.AddView(_constraintLayoutRoot);

            ConstraintSet elementsSet = new ConstraintSet();

            elementsSet.Clone(BaseElementsConstraintLayout);

            elementsSet.Connect(_constraintLayoutRoot.Id, ConstraintSet.Top, _toolbar.Id, ConstraintSet.Bottom);
            elementsSet.Connect(_constraintLayoutRoot.Id, ConstraintSet.Bottom, BaseElementsConstraintLayout.Id, ConstraintSet.Bottom);
            elementsSet.Connect(_constraintLayoutRoot.Id, ConstraintSet.Left, BaseElementsConstraintLayout.Id, ConstraintSet.Left);
            elementsSet.Connect(_constraintLayoutRoot.Id, ConstraintSet.Right, BaseElementsConstraintLayout.Id, ConstraintSet.Right);

            elementsSet.ApplyTo(BaseElementsConstraintLayout);
        }
        private void CreateToolbar()
        {
            _toolbar    = new Toolbar(this);
            _toolbar.Id = Resource.Id.toolbar;
            ConstraintLayout.LayoutParams clptoolbar = new ConstraintLayout.LayoutParams(
                ConstraintLayout.LayoutParams.MatchConstraint, ConstraintLayout.LayoutParams.WrapContent);
            _toolbar.LayoutParameters = clptoolbar;
            _toolbar.TextAlignment    = TextAlignment.Center;
            //TODO: COLORS
            _toolbar.SetTitleTextColor(ContextCompat.GetColor(this, Android.Resource.Color.White));
            //_toolbar.SetBackgroundColor(Color.ParseColor(Resources.GetString(Resource.Color.gradient_start)));
            _toolbar.SetSubtitleTextAppearance(this, Resource.Style.TextAppearance_Widget_AppCompat_Toolbar_Subtitle);

            BaseElementsConstraintLayout.AddView(_toolbar);

            CreateMainConstraintSet();
        }
 private void LoadEmptyPictures(int count)
 {
     for (int index = 0; index < count; index++)
     {
         ImageView image = new ImageView(this)
         {
             Id = 1000 + index
         };
         ConstraintLayout.LayoutParams p = new ConstraintLayout.LayoutParams(TutorialFrame.Width, ViewGroup.LayoutParams.MatchParent);                 //using MatchParent for width will place the images on top of each other.
         if (index == 0)
         {
             p.LeftToLeft = Resource.Id.TutorialFrame;
         }
         else
         {
             p.LeftToRight = 1000 + index - 1;
         }
         image.LayoutParameters = p;
         TutorialFrame.AddView(image);
     }
 }