Ejemplo n.º 1
0
        private async void SearchButton_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(searchText.Text))
            {
                progressBar.Visibility = ViewStates.Visible;
                movieModel             = await CoreService.GetMovieService(searchText.Text);

                if (movieModel != null)
                {
                    dataList.Clear();
                    dataList.Add(movieModel);

                    movieAdapter.NotifyDataSetChanged();
                }
                else
                {
                    dataList.Clear();
                    movieAdapter.NotifyDataSetChanged();
                    CustomAlertDialog.ShowAlertDialog(this.Context, "No movies found please try again !");
                }
                Activity.RunOnUiThread(() => {
                    progressBar.Visibility = ViewStates.Gone;
                });
            }
            else
            {
                searchText.SetError("Please enter searching title", null);
            }
        }
Ejemplo n.º 2
0
        public override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your fragment here
            dataList     = new List <MovieModel>();
            movieAdapter = new MovieRecyclerViewAdapter(this.Context, dataList);
            // inflate view
            rootView               = LayoutInflater.FromContext(this.Context).Inflate(Resource.Layout.fragment_movie_list, null);
            progressBar            = rootView.FindViewById <ProgressBar>(Resource.Id.progress_bar);
            progressBar.Visibility = ViewStates.Visible;
            var defaultTitle = "Russian";

            // check network
            wifiNetwork   = Reachability.IsConnectedWifi(this.Context);
            mobileNetwork = Reachability.IsConnectedMobile(this.Context);
            if (wifiNetwork || mobileNetwork)
            {
                LoadMovieData(defaultTitle);
            }
            else
            {
                CustomAlertDialog.ShowAlertDialog(this.Context, "Please check your network !");
            }
        }