removed error message for trailers
This commit is contained in:
@@ -31,8 +31,8 @@ public class FavoriteProviderHelper {
|
|||||||
|
|
||||||
public boolean isFavorite(Movie movie) {
|
public boolean isFavorite(Movie movie) {
|
||||||
String[] projection = {FavoriteColumns._ID};
|
String[] projection = {FavoriteColumns._ID};
|
||||||
String selection = FavoriteColumns.TITLE + "=?";
|
String selection = FavoriteColumns._ID + "=?";
|
||||||
String[] selectionArgs = new String[]{movie.getTitle()};
|
String[] selectionArgs = new String[]{String.valueOf(movie.getId())};
|
||||||
Cursor cursor = mResolver.query(FavoriteProvider.Favorites.FAVORITES_URI, projection, selection, selectionArgs, null);
|
Cursor cursor = mResolver.query(FavoriteProvider.Favorites.FAVORITES_URI, projection, selection, selectionArgs, null);
|
||||||
boolean isFavourite = (cursor != null && cursor.getCount() > 0);
|
boolean isFavourite = (cursor != null && cursor.getCount() > 0);
|
||||||
if(cursor != null)
|
if(cursor != null)
|
||||||
|
|||||||
@@ -126,13 +126,14 @@ public class MovieDetailsFragment extends Fragment implements Callback<VideoList
|
|||||||
mVideoList = response.body();
|
mVideoList = response.body();
|
||||||
if(getActivity() != null)
|
if(getActivity() != null)
|
||||||
showVideoList(mVideoList);
|
showVideoList(mVideoList);
|
||||||
|
} else {
|
||||||
|
trailerHolder.getChildAt(0).setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable t) {
|
public void onFailure(Throwable t) {
|
||||||
if(getActivity() != null)
|
trailerHolder.getChildAt(0).setVisibility(View.VISIBLE);
|
||||||
Toast.makeText(getActivity(), "Failed to load videos: " + t.getMessage(), Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnClick(R.id.movie_details_btReviews)
|
@OnClick(R.id.movie_details_btReviews)
|
||||||
@@ -173,6 +174,7 @@ public class MovieDetailsFragment extends Fragment implements Callback<VideoList
|
|||||||
private void showVideoList(@NonNull VideoList videoList) {
|
private void showVideoList(@NonNull VideoList videoList) {
|
||||||
List<Video> videos = videoList.getVideos();
|
List<Video> videos = videoList.getVideos();
|
||||||
if(videos.size() > 0) {
|
if(videos.size() > 0) {
|
||||||
|
trailerHolder.getChildAt(0).setVisibility(View.GONE);
|
||||||
for (Video video : videoList.getVideos()) {
|
for (Video video : videoList.getVideos()) {
|
||||||
View view = LayoutInflater.from(getActivity()).inflate(R.layout.movie_details_trailer_item, trailerHolder, false);
|
View view = LayoutInflater.from(getActivity()).inflate(R.layout.movie_details_trailer_item, trailerHolder, false);
|
||||||
TextView tv = (TextView) view.findViewById(R.id.trailer_item_tvName);
|
TextView tv = (TextView) view.findViewById(R.id.trailer_item_tvName);
|
||||||
|
|||||||
Reference in New Issue
Block a user