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