@Nullable @Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Bind view with id View view = inflater.inflate(R.layout.detail_movie_fragment, container, false); titleView = (TextView) view.findViewById(R.id.title); releaseYearView = (TextView) view.findViewById(R.id.release_year); scoreView = (TextView) view.findViewById(R.id.score); overviewView = (TextView) view.findViewById(R.id.overview); imagePoster = (ImageView) view.findViewById(R.id.image); insertTrailerPoint = (ViewGroup) view.findViewById(R.id.insert_trailer_point); insertReviewPoint = (ViewGroup) view.findViewById(R.id.insert_review_point); trailerVideo = new ArrayList<>(); reviewsList = new ArrayList<>(); // Parse json movie from intent extra Gson gson = new Gson(); String jsonMovie = getArguments().getString("movie"); Movie movie = gson.fromJson(jsonMovie, Movie.class); // Set text and source picture. titleView.setText(movie.getTitle()); releaseYearView.setText(movie.getRelease_date()); scoreView.setText(movie.getscore() + "/10"); String url = "http://image.tmdb.org/t/p/w185/" + movie.getimage_path(); Picasso.with(getActivity()).load(url).into(imagePoster); overviewView.setText(movie.getOverview()); // Start new thread FetchTrailerTask task = new FetchTrailerTask(); task.execute(movie.getId()); return view; }
/** * Parameter with a search-query for a specific movie, Returns Full information about the Movie+ a * Trailer. First->Clean the query, and then get the data from APIConnector and return it as * String (Already converted to JSON. * * @param query -search query * @return String */ public String info(String query) { /*//Fetch Trailer Movie movieTemp; movieTemp = gson.fromJson(controller.trailer(movie.getimdbID()), Movie.class); //Return as JSON movie.setTrailer(movieTemp.getTrailer()); return gson.toJson(movie); * */ Movie movie = apiC.getInfo(qc.info(query)); Movie movieTemp; movieTemp = gson.fromJson(trailerByImdb(movie.getimdbID()), Movie.class); if (movieTemp == null) { movieTemp = gson.fromJson(trailerByTitle(movie.getTitle()), Movie.class); } if (movieTemp != null) { movie.setTrailer(movieTemp.getTrailer()); } return gson.toJson(movie); // return apiC.getInfo(qc.info(query)); }
public static void main(String[] args) { String host = args[0]; int port = Integer.parseInt(args[1]); long id = Long.parseLong(args[2]); String character = args[3]; long actorId = Long.parseLong(args[4]); // Install an RMISecurityManager, if there is not a // SecurityManager already installed if (System.getSecurityManager() == null) { System.setSecurityManager(new RMISecurityManager()); } String name = "rmi://" + host + ":" + port + "/MovieDatabase"; try { MovieDatabase db = (MovieDatabase) Naming.lookup(name); db.noteCharacter(id, character, actorId); Movie movie = db.getMovie(id); out.println(movie.getTitle()); for (Map.Entry entry : movie.getCharacters().entrySet()) { out.println(" " + entry.getKey() + "\t" + entry.getValue()); } } catch (RemoteException | NotBoundException | MalformedURLException ex) { ex.printStackTrace(System.err); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_movie_screen); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); Intent intent = getIntent(); int moviePosition = intent.getIntExtra(MovieListAdapter.MOVIE_POSITION, 0); currentMovie = LocalStore.getMovies().get(moviePosition); TextView movieTitle = (TextView) findViewById(R.id.movieTitle); TextView movieGenre = (TextView) findViewById(R.id.movieGenre); TextView movieDescr = (TextView) findViewById(R.id.movieDescription); movieTitle.setText(currentMovie.getTitle()); // movieGenre.setText(currentMovie.get); movieDescr.setText(((Integer) currentMovie.getYear()).toString()); // implement viewList of reviews Button addRating = (Button) findViewById(R.id.addRatingButton); addRating.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { review(currentMovie.getId()); } }); }
@Override protected void onPostExecute(Bitmap result) { super.onPostExecute(result); if (movie.getTitle().equals(holder.title.getTag())) { holder.poster.setImageBitmap(result); } }
private void updateMetadata(final Movie movie) { final MediaMetadata.Builder metadataBuilder = new MediaMetadata.Builder(); String title = movie.getTitle().replace("_", " -"); metadataBuilder.putString(MediaMetadata.METADATA_KEY_DISPLAY_TITLE, title); metadataBuilder.putString(MediaMetadata.METADATA_KEY_DISPLAY_SUBTITLE, movie.getDescription()); metadataBuilder.putString(MediaMetadata.METADATA_KEY_DISPLAY_ICON_URI, movie.getCardImageUrl()); // And at minimum the title and artist for legacy support metadataBuilder.putString(MediaMetadata.METADATA_KEY_TITLE, title); metadataBuilder.putString(MediaMetadata.METADATA_KEY_ARTIST, movie.getStudio()); Glide.with(this) .load(Uri.parse(movie.getCardImageUrl())) .asBitmap() .into( new SimpleTarget<Bitmap>(500, 500) { @Override public void onResourceReady(Bitmap bitmap, GlideAnimation anim) { metadataBuilder.putBitmap(MediaMetadata.METADATA_KEY_ART, bitmap); mSession.setMetadata(metadataBuilder.build()); } }); }
public Movie getMovieByTitle(String title) { for (Movie movie : movies) { if (movie.getTitle().equals(title)) { return movie; } } return null; }
private Intent createShareMovieIntent() { Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); shareIntent.setType("text/plain"); shareIntent.putExtra( Intent.EXTRA_TEXT, mMovie.getTitle() + " " + "http://www.youtube.com/watch?v=" + mTrailer.getKey()); return shareIntent; }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.facebook); // 필요한 위젯들 전부 로딩 faceBook_myTitleTxtVw = (TextView) findViewById(R.id.faceBook_movieTitle); faceBook_myWhenTxtVw = (TextView) findViewById(R.id.faceBook_myWhenTxtVw); faceBook_myWhereTxtVw = (TextView) findViewById(R.id.faceBook_myWhereTxtVw); faceBook_myWithTxtVw = (TextView) findViewById(R.id.faceBook_myWhoTxtVw); faceBook_myGenreTxtVw = (TextView) findViewById(R.id.faceBook_myGenreTxtVw); faceBook_myOpenInfoTxtVw = (TextView) findViewById(R.id.faceBook_myOpenInfoTxtVw); faceBook_myActorTxtVw = (TextView) findViewById(R.id.faceBook_myActorTxtVw); faceBook_myDirectorTxtVw = (TextView) findViewById(R.id.faceBook_myDirectorTxtVw); faceBook_myThumbnail = (ImageView) findViewById(R.id.faceBook_myThumbnail); faceBook_myRatingBar = (RatingBar) findViewById(R.id.faceBook_myRatingBar); // 전달받은 인텐트를 가져온다. Intent intent = getIntent(); // 인텐트가 존재하면 if (intent != null) { // movie객체를 가져와서 데이터를 뿌려준다. Movie movie = (Movie) intent.getSerializableExtra("movie"); this.movie = movie; faceBook_myTitleTxtVw.setText(movie.getTitle()); String getWhen = movie.getWhen(); String year = getWhen.substring(0, 4); String month = getWhen.substring(4, 5); String day = getWhen.substring(5, 7); faceBook_myWhenTxtVw.setText(year + "년 " + month + "월 " + day + "일"); faceBook_myWithTxtVw.setText(movie.getWith()); faceBook_myWhereTxtVw.setText(movie.getWhere()); rating = (float) ((movie.getGrade().equals("")) ? 0.0 : Float.parseFloat(movie.getGrade())) / (float) 2.0; faceBook_myRatingBar.setRating(rating); faceBook_myGenreTxtVw.setText(" ● 장르 : " + movie.getGenre()); faceBook_myActorTxtVw.setText(" ● 감독 : " + movie.getDirector()); faceBook_myActorTxtVw.setText(" ● 배우 : " + Arrays.toString(movie.getActor())); faceBook_myOpenInfoTxtVw.setText(" ● 개봉일 : " + movie.getOpenInfo()); imageDownloader.download(movie.getThumbnail(), faceBook_myThumbnail); } mEtContent = (EditText) findViewById(R.id.faceBook_etContent); mBtnFeed = (Button) findViewById(R.id.faceBook_btnFeed); mBtnFeed.setOnClickListener(this); faceBook_btnLogout = (Button) findViewById(R.id.faceBook_btnLogout); faceBook_btnLogout.setOnClickListener(this); mFacebookAccessToken = getAppPreferences(this, "ACCESS_TOKEN"); if (!mFacebookAccessToken.equals("")) { mFacebook.setAccessToken(mFacebookAccessToken); } }
@TargetApi(Build.VERSION_CODES.KITKAT) @Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_movie_description, container, false); // Pull data from the intent passed from MainAcitivy Bundle b = getActivity().getIntent().getExtras(); // Get the Movie object from the Bundle Movie movie = b.getParcelable("MOVIE"); /* Test (and log results) to see if the movie object was successfully passed to the movie description fragment before loading content into the rootview. */ if (movie == null) { Log.v("THIS MOVIE: ", "IS <----- EMPTY ------"); } else { Log.v("THIS MOVIE BACK: ", movie.getBackdrop_path()); Log.v("BACKDROP PATH: ", movie.getBackdrop_path()); // Loading the backdrop image String checker = "empty"; ImageView image2 = (ImageView) rootView.findViewById(R.id.imageView); if (Objects.equals(movie.getBackdrop_path(), checker)) { Picasso.with(getActivity()).load(R.drawable.ic_insert_photo_black_24dp).into(image2); } else { Picasso.with(getActivity()).load(movie.getBackdrop_path()).into(image2); } // Loading the movie poster image ImageView image = (ImageView) rootView.findViewById(R.id.descImageView); if (Objects.equals(movie.getPoster_path(), checker)) { Picasso.with(getActivity()).load(R.drawable.ic_insert_photo_black_24dp).into(image); } else { Picasso.with(getActivity()).load(movie.getPoster_path()).into(image); } // Loading movie description ((TextView) rootView.findViewById(R.id.textView)).setText(movie.getDescription()); // Loading movie title ((TextView) rootView.findViewById(R.id.textView2)).setText(movie.getTitle()); // Loading movie rating ((TextView) rootView.findViewById(R.id.textView4)) .setText("Rating: " + movie.getVote_average()); // Loading movie release date ((TextView) rootView.findViewById(R.id.textView3)) .setText("Release date: " + movie.getRelease_date().toString()); } return rootView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { View view = convertView; holder = new ViewHolder(); if (view == null) { LayoutInflater vi = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = vi.inflate(R.layout.movie_item, parent, false); holder.poster = (ImageView) view.findViewById(R.id.poster); holder.title = (TextView) view.findViewById(R.id.title); holder.rating = (TextView) view.findViewById(R.id.rating); holder.critics_consensus = (TextView) view.findViewById(R.id.critics_consensus); holder.release_date = (TextView) view.findViewById(R.id.release_date); holder.rated = (TextView) view.findViewById(R.id.rated); holder.synopsis = (TextView) view.findViewById(R.id.synopsis); holder.year = (TextView) view.findViewById(R.id.year); holder.runtime = (TextView) view.findViewById(R.id.runtime); view.setTag(holder); } else { holder = (ViewHolder) view.getTag(); } Movie movie = movieData.get(position); if (movie != null) { Typeface typeface = Typeface.createFromAsset(getContext().getAssets(), "fonts/robotocondensed-bold.ttf"); holder.rating.setTypeface(typeface); holder.rating.setText("Rating: " + movie.getRating()); holder.title.setText("Title: " + movie.getTitle()); holder.title.setTag(movie.getTitle()); Log.i("TAG", "" + holder.title.getTag()); holder.poster.setImageBitmap(null); holder.critics_consensus.setText("consensus: " + movie.getCritics_consensus()); holder.release_date.setText("date: " + movie.getRelease_date()); holder.rated.setText("rated: " + movie.getRated()); holder.synopsis.setText("synopsis: " + movie.getSynopsis()); holder.year.setText("year: " + movie.getYear()); holder.runtime.setText("runtime: " + movie.getRuntime()); if (!movie.getPoster().equals("not found")) { new DownloadTask(holder, movie, manage).execute(movie.getPoster()); } } return view; }
public String toString() { return "id: " + id + " rate: " + rate + " movie: " + movie.getTitle() + " user: " + sisuser.getName(); }
@Override protected void onBindDescription(ViewHolder viewHolder, Object item) { Movie movie = (Movie) item; if (movie != null) { viewHolder.getTitle().setText(movie.getTitle()); viewHolder.getSubtitle().setText(movie.getStudio()); viewHolder.getBody().setText(movie.getDescription()); } }
/** Create a string, holding all movie records. */ private String buildFileContents() { String NEW_LINE = System.getProperty("line.separator"); StringBuilder result = new StringBuilder(); for (Movie movie : fTable.values()) { appendTo(result, movie.getTitle(), DELIMITER); appendTo(result, movie.getDateViewed(), DELIMITER); appendTo(result, movie.getRating(), DELIMITER); appendTo(result, movie.getComment(), NEW_LINE); } return result.toString(); }
public void collectMovie(String title, String format, String memberNum) { for (int i = 0; i < rentings.size(); i++) { Renting renting = rentings.get(i); if (renting.getMemberNum().equals(memberNum)) { Copy copy = renting.getCopy(); Movie movie = movieSystem.getMovieByCopy(copy.getId()); if (movie.getTitle().equals(title) && copy.getFormat().equals(format)) { rentings.remove(i); } } } }
@Test public void testGetters() throws Exception { assertEquals(ID, movie.getId()); assertEquals(TITLE, movie.getTitle()); assertEquals(OVERVIEW, movie.getOverview()); assertEquals(RELEASE_DATE, movie.getReleaseDate()); assertEquals(POSTER_PATH, movie.getPosterPath()); assertEquals(POPULARITY, movie.getPopularity(), 1e-5); assertEquals(ORIGINAL_TITLE, movie.getOriginalTitle()); assertEquals(AVERAGE_VOTE, movie.getAverageVote(), 1e-5); assertEquals(VOTE_COUNT, movie.getVoteCount()); assertEquals(BACKDROP_PATH, movie.getBackdropPath()); }
@Override public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) { Movie movie = (Movie) item; ((ViewHolder) viewHolder).setMovie(movie); Log.d(TAG, "onBindViewHolder"); if (movie.getCardImageUrl() != null) { ((ViewHolder) viewHolder).mCardView.setTitleText(movie.getTitle()); ((ViewHolder) viewHolder).mCardView.setContentText(movie.getStudio()); ((ViewHolder) viewHolder).mCardView.setMainImageDimensions(CARD_WIDTH, CARD_HEIGHT); ((ViewHolder) viewHolder).updateCardViewImage(movie.getCardImageURI()); } }
@Test public void testCategoryAndMovieIntegration() { Movie movie = new Movie(); movie.setTitle("The Iron Man"); movie.setBirthplace("EUA"); movie.setReleaseYear(2014); movie.setSinopse("Very cool!!"); movie.setStockQuantity(20); movie.setCoverPicture(""); Category category = new Category(); category.setName("Category test"); category.addMovie(movie); Assert.assertNotNull(category.getMovieByTitle(movie.getTitle())); }
@Override public List<Movie> findByName(String name) { // TODO Auto-generated method stub List<Movie> cinema = new ArrayList<Movie>(); String str_regex = "\\b" + name + "\\b"; Pattern p = Pattern.compile(str_regex); for (Movie mov : movielist) { Matcher m = p.matcher(mov.getTitle()); if (m.find()) cinema.add(mov); else throw new IllegalArgumentException( "This movie with " + name + "is not present in the list"); } return cinema; }
@Override public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) { Movie movie = (Movie) item; ImageCardView cardView = (ImageCardView) viewHolder.view; Log.d(TAG, "onBindViewHolder"); if (movie.getCardImageUrl() != null) { cardView.setTitleText(movie.getTitle()); cardView.setContentText(movie.getStudio()); cardView.setMainImageDimensions(CARD_WIDTH, CARD_HEIGHT); Glide.with(viewHolder.view.getContext()) .load(movie.getCardImageUrl()) .centerCrop() .error(mDefaultCardImage) .into(cardView.getMainImageView()); } }
public static void main(String[] args) { Movie movie = new Movie( "X_MEN", "X-MEN", "My Synopsis", "Zad", "Hocks," + " Cal, Fiefie", "Blockbuster", "Coming Soon"); System.out.println("Movie title: " + movie.getTitle()); System.out.println("Overall Rating: " + movie.getOverallRating()); System.out.println("Synopsis: " + movie.getSynopsis()); System.out.println("Director: " + movie.getDirector()); System.out.println("Casts : " + movie.getCast()); }
public void createMovie(Movie newMovie) { try { connection = ds.getConnection(); statement = connection.prepareStatement(createMovie); statement.setObject(1, newMovie.getId()); statement.setString(2, newMovie.getTitle()); statement.setString(3, newMovie.getPosterImage()); statement.setDate(4, new Date(newMovie.getReleaseDate().getTime())); statement.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } finally { try { connection.close(); } catch (SQLException e) { e.printStackTrace(); } } }
public void updateMovie(Integer movieId, Movie movie) { try { connection = ds.getConnection(); statement = connection.prepareStatement(updateMovie); statement.setInt(1, movie.getId()); statement.setString(2, movie.getTitle()); statement.setString(3, movie.getPosterImage()); statement.setDate(4, new Date(movie.getReleaseDate().getTime())); statement.setInt(5, movieId); statement.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } finally { try { connection.close(); } catch (SQLException e) { e.printStackTrace(); } } }
public static List<Movie> buildMovieList(String movieData) { List<Movie> movieList = new ArrayList<Movie>(); try { JSONObject jsonObject = new JSONObject(movieData); JSONArray movieArray = jsonObject.getJSONArray(ARRAY_KEY); Log.d("popular", "Movie Array length = " + movieArray.length()); for (int i = 0; i < movieArray.length(); i++) { Movie movie = buildMovie(movieArray.getJSONObject(i)); Log.d("popular", "added movie title: " + movie.getTitle()); movieList.add(movie); } } catch (JSONException e) { e.printStackTrace(); } return movieList; }
public void processFinish(final ArrayList<Movie> output) { // this you will received result fired from async class of onPostExecute(result) method. // Log.d("TAGT",output); // screensize = Utility.getDeviceResolution(); // Log.d("Screen",screensize); String imageurl = ""; /* if(screensize.equals("XHDPI")) { imageurl = "http://image.tmdb.org/t/p/w185/";} // String d = "http://image.tmdb.org/t/p/w342/"; else { imageurl = "http://image.tmdb.org/t/p/w342";} */ imageurl = "http://image.tmdb.org/t/p/w185/"; Log.d("TAGET", "result: " + output.size()); String[] mStringArray = new String[output.size()]; String[] mStringArray1 = new String[output.size()]; String[] mStringArray2 = new String[output.size()]; String[] mStringArray3 = new String[output.size()]; int i = 0; for (Movie x : output) { Log.d("TAGET", "movies: " + imageurl + x.getPosterpath()); mStringArray[i] = imageurl + x.getPosterpath(); mStringArray1[i] = x.getTitle(); mStringArray2[i] = x.getOverview(); mStringArray3[i] = x.getId(); Golfcourse gc = new Golfcourse(mStringArray1[i], mStringArray[i], mStringArray2[i], mStringArray3[i]); // gc.address = sTok.nextToken(); coursesArray.add(gc); i++; } }
private void populateMyMovies(ListView tLV) throws ParseException { List<Movie> movies = db.getAllMovies(sortStr, sortDir); List<Map<String, String>> list = new ArrayList<Map<String, String>>(); if (movies.size() < 1) { toastMessage(MainActivity.this, getString(R.string.no_movie_notice)); } else { for (Movie i : movies) { Map map = new HashMap(); map.put("id", i.getId()); map.put("title", i.getTitle()); String target = i.getDateStr(); DateFormat df = new SimpleDateFormat("EEE MMM dd kk:mm:ss z yyyy", Locale.ENGLISH); DateFormat newf = new SimpleDateFormat("EEE, MMM d, yyyy", Locale.ENGLISH); Date mDate = df.parse(target); String newDate = newf.format(mDate); map.put("date", newDate); map.put("rating", i.getRating()); map.put("lat", String.valueOf(i.getVenue().getLat())); map.put("lng", String.valueOf(i.getVenue().getLng())); map.put("type", i.getVenue().getVenue_type()); map.put("venue_name", i.getVenue().getVenue_name()); list.add(map); } movieAdapter = new SimpleAdapter( this, list, R.layout.my_movies_layout, new String[] {"title", "date", "rating", "type"}, new int[] { R.id.my_movie_title, R.id.my_movie_date, R.id.my_movie_rating, R.id.my_movie_icon }); movieAdapter.setViewBinder(new MyMovieBinder()); tLV.setAdapter(movieAdapter); tLV.setLongClickable(true); tLV.setOnItemClickListener( new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Map item = (Map) parent.getAdapter().getItem(position); LatLng latlong = new LatLng( Double.valueOf(item.get("lat").toString()), Double.valueOf(item.get("lng").toString())); mMap.clear(); Marker marker = mMap.addMarker( new MarkerOptions() .position(latlong) .title(item.get("title").toString()) .snippet(item.get("venue_name").toString())); // Zoom in, animating the camera. mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latlong, 13), 800, null); marker.showInfoWindow(); } }); } }
public void run3() { long testStartTime = System.nanoTime(); marktime = System.nanoTime(); // Session session = Factory.getSession(SessionType.CURRENT); try { timelog("Beginning graph2 test3..."); DElementStore crewStore = new DElementStore(); crewStore.setStoreKey(crewPath); crewStore.addType(Crew.class); DElementStore movieStore = new DElementStore(); movieStore.setStoreKey(moviePath); movieStore.addType(Movie.class); DElementStore characterStore = new DElementStore(); characterStore.setStoreKey(charactersPath); characterStore.addType(Character.class); DElementStore edgeStore = new DElementStore(); edgeStore.setStoreKey(edgePath); DConfiguration config = new DConfiguration(); graph = new DGraph(config); config.addElementStore(crewStore); config.addElementStore(movieStore); config.addElementStore(characterStore); config.addElementStore(edgeStore); config.setDefaultElementStore(edgeStore.getStoreKey()); DFramedGraphFactory factory = new DFramedGraphFactory(config); FramedTransactionalGraph<DGraph> framedGraph = factory.create(graph); Movie newhopeMovie = framedGraph.getVertex("Star Wars", Movie.class); Movie empireMovie = framedGraph.getVertex("The Empire Strikes Back", Movie.class); Movie jediMovie = framedGraph.getVertex("Return of the Jedi", Movie.class); Movie phantomMovie = framedGraph.getVertex("The Phantom Menace", Movie.class); Movie clonesMovie = framedGraph.getVertex("Attack of the Clones", Movie.class); Movie revengeMovie = framedGraph.getVertex("Revenge of the Sith", Movie.class); System.out.println("***************************"); System.out.println( "Don't miss " + newhopeMovie.getTitle() + " " + newhopeMovie.getDirectedBy().getRating() + " stars!"); List<Starring> starrings = (List) newhopeMovie.getStarring(); for (Starring starring : starrings) { Crew crew = starring.getStar(); Character character = crew.getPortraysCharacters().iterator().next(); System.out.println( crew.getFirstName() + " " + crew.getLastName() + " as " + character.getName()); } System.out.println("***************************"); System.out.println( "Don't miss " + empireMovie.getTitle() + " " + empireMovie.getDirectedBy().getRating() + " stars!"); starrings = (List) empireMovie.getStarring(); for (Starring starring : starrings) { Crew crew = starring.getStar(); Character character = crew.getPortraysCharacters().iterator().next(); System.out.println( crew.getFirstName() + " " + crew.getLastName() + " as " + character.getName()); } System.out.println("***************************"); System.out.println( "Don't miss " + jediMovie.getTitle() + " " + jediMovie.getDirectedBy().getRating() + " stars!"); starrings = (List) jediMovie.getStarring(); System.out.println("TEMP DEBUG found " + starrings.size() + " starrings"); for (Starring starring : starrings) { Crew crew = starring.getStar(); Character character = crew.getPortraysCharacters().iterator().next(); System.out.println( crew.getFirstName() + " " + crew.getLastName() + " as " + character.getName()); } } catch (Throwable t) { t.printStackTrace(); } }
@Test public void testGetTitle() throws Exception { assertEquals(movie.getTitle(), title); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Bundle arguments = getArguments(); if (arguments != null) { mMovie = arguments.getParcelable(DetailActivityFragment.DETAIL_MOVIE); } View rootView = inflater.inflate(R.layout.fragment_detail, container, false); mDetailLayout = (ScrollView) rootView.findViewById(R.id.detail_layout); if (mMovie != null) { mDetailLayout.setVisibility(View.VISIBLE); } else { mDetailLayout.setVisibility(View.INVISIBLE); } mImageView = (ImageView) rootView.findViewById(R.id.detail_image); mTitleView = (TextView) rootView.findViewById(R.id.detail_title); mOverviewView = (TextView) rootView.findViewById(R.id.detail_overview); mDateView = (TextView) rootView.findViewById(R.id.detail_date); mVoteAverageView = (TextView) rootView.findViewById(R.id.detail_vote_average); mTrailersView = (LinearListView) rootView.findViewById(R.id.detail_trailers); mReviewsView = (LinearListView) rootView.findViewById(R.id.detail_reviews); mReviewsCardview = (CardView) rootView.findViewById(R.id.detail_reviews_cardview); mTrailersCardview = (CardView) rootView.findViewById(R.id.detail_trailers_cardview); mTrailerAdapter = new TrailerAdapter(getActivity(), new ArrayList<Trailer>()); mTrailersView.setAdapter(mTrailerAdapter); mTrailersView.setOnItemClickListener( new LinearListView.OnItemClickListener() { @Override public void onItemClick(LinearListView linearListView, View view, int position, long id) { Trailer trailer = mTrailerAdapter.getItem(position); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("http://www.youtube.com/watch?v=" + trailer.getKey())); startActivity(intent); } }); mReviewAdapter = new ReviewAdapter(getActivity(), new ArrayList<Review>()); mReviewsView.setAdapter(mReviewAdapter); if (mMovie != null) { String image_url = Utility.buildImageUrl(mMovie.getImage2()); Glide.with(this).load(image_url).into(mImageView); mTitleView.setText(mMovie.getTitle()); mOverviewView.setText(mMovie.getOverview()); String movie_date = mMovie.getDate(); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); try { String date = DateUtils.formatDateTime( getActivity(), formatter.parse(movie_date).getTime(), DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_YEAR); mDateView.setText(date); } catch (ParseException e) { e.printStackTrace(); } mVoteAverageView.setText(Integer.toString(mMovie.getRating())); } return rootView; }