예제 #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.activity_photos);

            _recyclerView = FindViewById <MvxRecyclerView>(Resource.Id.recycler_photos_view);
            _searchEdt    = FindViewById <EditText>(Resource.Id.search_photos_view);
            _searchButton = FindViewById <Button>(Resource.Id.search_btn_photos_view);
            _progressBar  = FindViewById <ProgressBar>(Resource.Id.progressBar_photos_view);

            var adapter = new PhotosAdapter((IMvxAndroidBindingContext)BindingContext, OnCommand);

            _recyclerView.Adapter = adapter;

            Binding(adapter);
        }
예제 #2
0
        private void DestroyBasic()
        {
            try
            {
                MAdView?.Destroy();

                MAdapter           = null;
                SwipeRefreshLayout = null;
                MRecycler          = null;
                EmptyStateLayout   = null;
                ImageData          = null;
                Toolbar            = null;
                ActionButton       = null;
                MAdView            = null;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
예제 #3
0
        private void DestroyBasic()
        {
            try
            {
                MAdView?.Destroy();

                MAdapter           = null !;
                SwipeRefreshLayout = null !;
                MRecycler          = null !;
                EmptyStateLayout   = null !;
                ImageData          = null !;
                Toolbar            = null !;
                ActionButton       = null !;
                MAdView            = null !;
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
 private void DestroyBasic()
 {
     try
     {
         CollapsingToolbar = null !;
         MAdapter          = null !;
         ToolbarTitle      = null !;
         AddImage          = null !;
         TxtAlbumName      = null !;
         MAdapter          = null !;
         MRecycler         = null !;
         LayoutManager     = null !;
         PublishButton     = null !;
         ImageData         = null !;
         PathImage         = null !;
     }
     catch (Exception e)
     {
         Methods.DisplayReportResultTrack(e);
     }
 }
 private void DestroyBasic()
 {
     try
     {
         CollapsingToolbar = null;
         MAdapter          = null;
         ToolbarTitle      = null;
         AddImage          = null;
         TxtAlbumName      = null;
         MAdapter          = null;
         MRecycler         = null;
         LayoutManager     = null;
         PublishButton     = null;
         ImageData         = null;
         PathImage         = null;
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
예제 #6
0
        private void Binding(PhotosAdapter adapter)
        {
            var set = this.CreateBindingSet <PhotosView, PhotosViewModel>();

            set.Bind(adapter)
            .For(v => v.ItemsSource)
            .To(vm => vm.ListHits);

            set.Bind(_searchEdt)
            .For(v => v.Text)
            .To(vm => vm.SearchMessage);

            set.Bind(_searchButton)
            .To(vm => vm.ClickSearchCommand);

            set.Bind(_progressBar)
            .For(v => v.Visibility)
            .To(vm => vm.HiddenLoading)
            .WithConversion(new VisibleValueConverter());

            set.Apply();
        }
예제 #7
0
 private void SetRecyclerViewAdapters()
 {
     try
     {
         MAdapter = new PhotosAdapter(this)
         {
             PhotosList = new ObservableCollection <PhotoAlbumObject>()
         };
         LayoutManager = new GridLayoutManager(this, 2);
         LayoutManager.SetSpanSizeLookup(new MySpanSizeLookup(4, 1, 1)); //5, 1, 2
         MRecycler.SetLayoutManager(LayoutManager);
         MRecycler.HasFixedSize = true;
         MRecycler.SetItemViewCacheSize(10);
         MRecycler.GetLayoutManager().ItemPrefetchEnabled = true;
         var sizeProvider = new FixedPreloadSizeProvider(10, 10);
         var preLoader    = new RecyclerViewPreloader <PhotoAlbumObject>(this, MAdapter, sizeProvider, 10);
         MRecycler.AddOnScrollListener(preLoader);
         MRecycler.SetAdapter(MAdapter);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
예제 #8
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);

                IMethods.IApp.FullScreenApp(this);

                var view = MyContextWrapper.GetContentView(this, Settings.Lang, Resource.Layout.Albums_Layout);
                if (view != null)
                {
                    SetContentView(view);
                }
                else
                {
                    SetContentView(Resource.Layout.Albums_Layout);
                }

                var data = Intent.GetStringExtra("UserId") ?? "Data not available";
                if (data != "Data not available" && !string.IsNullOrEmpty(data))
                {
                    S_UserId = data;
                }

                var ToolBar = FindViewById <Toolbar>(Resource.Id.toolbar);
                if (ToolBar != null)
                {
                    if (S_UserId == UserDetails.User_id)
                    {
                        ToolBar.Title = GetText(Resource.String.Lbl_MyImages);
                    }
                    else
                    {
                        ToolBar.Title = GetText(Resource.String.Lbl_YourImages);
                    }

                    SetSupportActionBar(ToolBar);
                    SupportActionBar.SetDisplayShowCustomEnabled(true);
                    SupportActionBar.SetDisplayHomeAsUpEnabled(true);
                    SupportActionBar.SetHomeButtonEnabled(true);
                    SupportActionBar.SetDisplayShowHomeEnabled(true);
                }


                ImagesRecylerView = (RecyclerView)FindViewById(Resource.Id.RecylerImages);

                swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefreshLayout);
                swipeRefreshLayout.SetColorSchemeResources(Android.Resource.Color.HoloBlueLight,
                                                           Android.Resource.Color.HoloGreenLight, Android.Resource.Color.HoloOrangeLight,
                                                           Android.Resource.Color.HoloRedLight);
                swipeRefreshLayout.Refreshing = true;
                swipeRefreshLayout.Enabled    = true;

                photos_Empty = FindViewById <LinearLayout>(Resource.Id.Albums_LinerEmpty);

                Icon_photos = FindViewById <TextView>(Resource.Id.Albums_icon);
                IMethods.Set_TextViewIcon("2", Icon_photos, "\uf03e");

                ImagesRecylerView.Visibility = ViewStates.Visible;
                photos_Empty.Visibility      = ViewStates.Gone;

                photosAdapter = new PhotosAdapter(this);

                // Check if we're running on Android 5.0 or higher
                if ((int)Build.VERSION.SdkInt < 23)
                {
                    mLayoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.Vertical);
                    ImagesRecylerView.SetLayoutManager(mLayoutManager);
                }
                else
                {
                    mLayoutManager = new StaggeredGridLayoutManager(3, StaggeredGridLayoutManager.Vertical);
                    ImagesRecylerView.SetLayoutManager(mLayoutManager);
                }

                ImagesRecylerView.AddItemDecoration(new GridSpacingItemDecoration(2, 3, true));
                ImagesRecylerView.SetAdapter(photosAdapter);
                ImagesRecylerView.Visibility = ViewStates.Visible;

                Get_Data_local();
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }