Esempio n. 1
0
        public override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            this._movies = new Movies();
            this._movieResourceProvider = new MovieResourceProvider();

            // Create your fragment here
        }
Esempio n. 2
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Use this to return your custom view for this Fragment
            var rootView = inflater.Inflate(Resource.Layout.MovieInput, container, false);

            this._movieResourceProvider = new MovieResourceProvider();

            // Get our UI controls from the loaded layout
            var movieEditText = rootView.FindViewById <EditText>(Resource.Id.movieEditText);

            _searchButton = rootView.FindViewById <Button>(Resource.Id.searchButton);

            _loading            = rootView.FindViewById <ProgressBar>(Resource.Id.progressBar1);
            _loading.Visibility = ViewStates.Invisible;

            _searchButton.Click += async(sender, e) =>
            {
                _searchButton.Visibility = ViewStates.Gone;
                _searchButton.Enabled    = false;
                _loading.Visibility      = ViewStates.Visible;

                var manager = (InputMethodManager)this.Context.GetSystemService(Context.InputMethodService);
                manager.HideSoftInputFromWindow(movieEditText.WindowToken, 0);

                await this._movieResourceProvider.GetMoviesByTitle(this._movies, movieEditText.Text);

                var intent = new Intent(this.Context, typeof(MovieListActivity));
                intent.PutExtra("movieList", JsonConvert.SerializeObject(this._movies.MovieList));
                this.StartActivity(intent);
                _searchButton.Visibility = ViewStates.Visible;
                _searchButton.Enabled    = true;
                _loading.Visibility      = ViewStates.Gone;
            };

            return(rootView);
        }