Пример #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.ActivityDetail);

            ivPoster    = FindViewById <ImageView>(Resource.Id.ivPoster);
            listSimilar = FindViewById <RecyclerView>(Resource.Id.listSimilar);

            ivBG = FindViewById <ImageView>(Resource.Id.ivBG);

            tvTitle       = FindViewById <TextView>(Resource.Id.tvTitle);
            tvDescr       = FindViewById <TextView>(Resource.Id.tvDescr);
            tvReleaseDate = FindViewById <TextView>(Resource.Id.tvReleaseDate);
            tvVotes       = FindViewById <TextView>(Resource.Id.tvVotes);
            btnFav        = FindViewById <Button>(Resource.Id.btnFav);
            btnPlay       = FindViewById <Button>(Resource.Id.btnPlay);
            ratingScore   = FindViewById <RatingBar>(Resource.Id.ratingScore);

            string jsonMovie = Intent.GetStringExtra("movie");

            try
            {
                movie = JsonConvert.DeserializeObject <Movie>(jsonMovie);
            }
            catch (Exception ex)
            {
                Log.Debug("DetailActivity", "OnCreate exception " + ex.Message);
            }

            datasource = new FavoriteDatasource(Constants.dbFavPath);
        }
Пример #2
0
        protected async override void OnStart()
        {
            base.OnStart();

            datasource = new FavoriteDatasource(Constants.dbFavPath);

            MovieLists.FavMovies = await datasource.GetFavorites();

            RunOnUiThread(() =>
            {
                favAdapter = new MovieAdapter(this, MovieLists.FavMovies);

                favListView.SetAdapter(favAdapter);
                favAdapter.ItemClick += FavAdapter_ItemClick;
                favListView.SetLayoutManager(new GridLayoutManager(this, 1, GridLayoutManager.Horizontal, false));
            });
        }
Пример #3
0
        private async Task GetData()
        {
            MovieAPI api = new MovieAPI();

            MovieLists.TopMovies = await api.GetTopRated();

            incrementProgBar(25);
            MovieLists.PopMovies = await api.GetPopular();

            incrementProgBar(25);
            MovieLists.NowMovies = await api.GetNowPlaying();

            incrementProgBar(25);

            await api.GetConfig();

            incrementProgBar(25);

            FavoriteDatasource datasource = new FavoriteDatasource(Constants.dbFavPath);

            MovieLists.FavMovies = await datasource.GetFavorites();
        }