Exemple #1
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;
        }
        protected async override void OnCreate(Bundle savedInstanceState)
        {
            this.RequestWindowFeature(WindowFeatures.NoTitle);
            base.OnCreate(savedInstanceState);
            try
            {
                ConadaDataViewModel = new ConadaDataViewModel();
                await ConadaDataViewModel.ExecuteLoadItemsCommand();

                RowDataList = new List <Row>(ConadaDataViewModel.Items.CountryData);

                SetContentView(Resource.Layout.Layout1);

                rootLayout            = FindViewById <ConstraintLayout>(Resource.Id.root_layout);
                searchInput           = FindViewById <EditText>(Resource.Id.search_input);
                NewsRecyclerview      = FindViewById <RecyclerView>(Resource.Id.news_rv);
                fabSwitcher           = FindViewById <FloatingActionButton>(Resource.Id.fab_switcher);
                fabSwitcher.Clickable = true;
                fabSwitcher.SetOnClickListener(new FabClickLitner(this));

                #region tepmData
                //mData = new List<NewsItem>();
                //mData.Add(new NewsItem("OnePlus 6T Camera Review:", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.", "6 july 1994", Resource.Drawable.user));
                //mData.Add(new NewsItem("I love Programming And Design", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,", "6 july 1994", Resource.Drawable.circul6));
                //mData.Add(new NewsItem("My first trip to Thailand story ", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.", "6 july 1994", Resource.Drawable.uservoyager));
                //mData.Add(new NewsItem("After Facebook Messenger, Viber now gets...", "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,", "6 july 1994", Resource.Drawable.usertwo));
                //mData.Add(new NewsItem("Isometric Design Grid Concept", "lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit", "6 july 1994", Resource.Drawable.xamarin_logo));
                //mData.Add(new NewsItem("Android R Design Concept 4K", "lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit ", "6 july 1994", Resource.Drawable.xamarin_logo));
                //mData.Add(new NewsItem("OnePlus 6T Camera Review:", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.", "6 july 1994", Resource.Drawable.circul6));
                //mData.Add(new NewsItem("I love Programming And Design", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,", "6 july 1994", Resource.Drawable.xamarin_logo));
                //mData.Add(new NewsItem("My first trip to Thailand story ", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.", "6 july 1994", Resource.Drawable.xamarin_logo));
                //mData.Add(new NewsItem("After Facebook Messenger, Viber now gets...", "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,", "6 july 1994", Resource.Drawable.xamarin_logo));
                //mData.Add(new NewsItem("Isometric Design Grid Concept", "lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit", "6 july 1994", Resource.Drawable.xamarin_logo));
                //mData.Add(new NewsItem("Android R Design Concept 4K", "lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit ", "6 july 1994", Resource.Drawable.xamarin_logo));
                //mData.Add(new NewsItem("OnePlus 6T Camera Review:", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.", "6 july 1994", Resource.Drawable.xamarin_logo));
                //mData.Add(new NewsItem("I love Programming And Design", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,", "6 july 1994", Resource.Drawable.xamarin_logo));
                //mData.Add(new NewsItem("My first trip to Thailand story ", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.", "6 july 1994", Resource.Drawable.xamarin_logo));
                //mData.Add(new NewsItem("After Facebook Messenger, Viber now gets...", "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,", "6 july 1994", Resource.Drawable.xamarin_logo));
                //mData.Add(new NewsItem("Isometric Design Grid Concept", "lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit", "6 july 1994", Resource.Drawable.xamarin_logo));
                //mData.Add(new NewsItem("Android R Design Concept 4K", "lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit lorem ipsum dolor sit ", "6 july 1994", Resource.Drawable.xamarin_logo));
                #endregion

                isDark = GetThemeStatePref();
                if (isDark)
                {
                    searchInput.SetBackgroundResource(Resource.Drawable.search_input_dark_style);
                    rootLayout.SetBackgroundColor(this.Resources.GetColor(Resource.Color.black));
                }
                else
                {
                    searchInput.SetBackgroundResource(Resource.Drawable.search_input_style);
                    rootLayout.SetBackgroundColor(this.Resources.GetColor(Resource.Color.white));
                }

                countryDataAdaper = new CountryDataAdaper(this, RowDataList, isDark);
                NewsRecyclerview.SetAdapter(countryDataAdaper);
                NewsRecyclerview.SetLayoutManager(new LinearLayoutManager(this));
            }
            catch (System.Exception ex)
            {
            }
        }