コード例 #1
0
ファイル: MovieStorage.java プロジェクト: yulingjie/Movies
 public String getMovieImageUrl(MovieParcelable movie, String size) {
   if (movie.getImgUrl() != null
       && movie.getImgUrl().length() > 0
       && !movie.getImgUrl().equals("null")) {
     Uri.Builder builder =
         Uri.parse(baseUrl).buildUpon().appendPath(size).appendEncodedPath(movie.getImgUrl());
     return builder.build().toString();
   }
   return "";
 }
コード例 #2
0
ファイル: MovieStorage.java プロジェクト: yulingjie/Movies
 public String[] getMovieImageUrls(String size) {
   List<String> imgUrls = new ArrayList<>();
   for (MovieParcelable movie : mMovies) {
     if (movie.getImgUrl() != null
         && movie.getImgUrl().length() > 0
         && !movie.getImgUrl().equals("null")) {
       Uri.Builder builder =
           Uri.parse(baseUrl).buildUpon().appendPath(size).appendEncodedPath(movie.getImgUrl());
       imgUrls.add(builder.build().toString());
     }
   }
   String[] arrImgUrls = new String[mMovies.length];
   return imgUrls.toArray(arrImgUrls);
 }
コード例 #3
0
ファイル: MovieStorage.java プロジェクト: yulingjie/Movies
 public void setMovies(Movie[] movies) {
   List<MovieParcelable> moviesParcelable = new ArrayList<>();
   for (Movie movie : movies) {
     MovieParcelable movieParcelable = new MovieParcelable();
     movieParcelable.setId(movie.getId());
     movieParcelable.setTitle(movie.getTitle());
     movieParcelable.setImgUrl(movie.getBackdrop_path());
     movieParcelable.setPlotSnippets(movie.getOverview());
     SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
     movieParcelable.setReleaseDate(dateFormat.format(movie.getReleaseDate()));
     movieParcelable.setVoteCount(movie.getVote_count());
     movieParcelable.setVoteRate(movie.getVode_average());
     moviesParcelable.add(movieParcelable);
   }
   MovieParcelable[] arrMovies = new MovieParcelable[movies.length];
   mMovies = moviesParcelable.toArray(arrMovies);
 }