Change the "see all cast" button to be the last image on the cast grid view
This commit is contained in:
parent
7816a2bcc3
commit
00c6e3d300
|
@ -78,8 +78,8 @@ public class AllCastActivity extends BaseActivity {
|
|||
public static Intent buildLaunchIntent(Context context,
|
||||
String title, ArrayList<VideoType.Cast> castArrayList) {
|
||||
return new Intent(context, AllCastActivity.class)
|
||||
.putExtra(AllCastActivity.EXTRA_TITLE, title)
|
||||
.putParcelableArrayListExtra(AllCastActivity.EXTRA_CAST_LIST, castArrayList);
|
||||
.putExtra(EXTRA_TITLE, title)
|
||||
.putParcelableArrayListExtra(EXTRA_CAST_LIST, castArrayList);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -101,7 +101,7 @@ public class AllCastActivity extends BaseActivity {
|
|||
castArrayList = savedInstanceState.getParcelableArrayList(EXTRA_CAST_LIST);
|
||||
}
|
||||
|
||||
LogUtils.LOGD(TAG, "Showing cast for: " + movie_tvshow_title);
|
||||
//LogUtils.LOGD(TAG, "Showing cast for: " + movie_tvshow_title);
|
||||
|
||||
// Configure the grid
|
||||
castGridView.setEmptyView(emptyView);
|
||||
|
@ -158,7 +158,9 @@ public class AllCastActivity extends BaseActivity {
|
|||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
navigationDrawerFragment.setDrawerIndicatorEnabled(false);
|
||||
actionBar.setTitle(getResources().getString(R.string.cast) + " - " + title);
|
||||
actionBar.setTitle((title != null) ?
|
||||
getResources().getString(R.string.cast) + " - " + title :
|
||||
getResources().getString(R.string.cast));
|
||||
}
|
||||
|
||||
public static class CastArrayAdapter extends ArrayAdapter<VideoType.Cast> {
|
||||
|
|
|
@ -138,7 +138,6 @@ public class MovieDetailsFragment extends Fragment
|
|||
@InjectView(R.id.media_description) TextView mediaDescription;
|
||||
@InjectView(R.id.directors) TextView mediaDirectors;
|
||||
@InjectView(R.id.cast_list) GridLayout videoCastList;
|
||||
@InjectView(R.id.see_all_cast) Button seeAllCast;
|
||||
|
||||
/**
|
||||
* Create a new instance of this, initialized to show the movie movieId
|
||||
|
@ -290,15 +289,6 @@ public class MovieDetailsFragment extends Fragment
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Callbacks for injected buttons
|
||||
*/
|
||||
@OnClick(R.id.see_all_cast)
|
||||
public void onSeeAllCastClicked(View v) {
|
||||
startActivity(AllCastActivity.buildLaunchIntent(getActivity(), movieTitle, castArrayList));
|
||||
getActivity().overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loader callbacks
|
||||
*/
|
||||
|
@ -632,10 +622,8 @@ public class MovieDetailsFragment extends Fragment
|
|||
cursor.getString(MovieCastListQuery.THUMBNAIL)));
|
||||
} while (cursor.moveToNext());
|
||||
|
||||
UIUtils.setupCastInfo(getActivity(), castArrayList, videoCastList);
|
||||
seeAllCast.setVisibility(
|
||||
(cursor.getCount() <= Settings.DEFAULT_MAX_CAST_PICTURES) ?
|
||||
View.GONE : View.VISIBLE);
|
||||
UIUtils.setupCastInfo(getActivity(), castArrayList, videoCastList,
|
||||
AllCastActivity.buildLaunchIntent(getActivity(), movieTitle, castArrayList));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -165,7 +165,6 @@ public class NowPlayingFragment extends Fragment
|
|||
|
||||
@InjectView(R.id.media_description) TextView mediaDescription;
|
||||
@InjectView(R.id.cast_list) GridLayout videoCastList;
|
||||
@InjectView(R.id.see_all_cast) Button seeAllCast;
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
|
@ -851,24 +850,12 @@ public class NowPlayingFragment extends Fragment
|
|||
currentSubtitleIndex = getPropertiesResult.currentsubtitle.index;
|
||||
|
||||
// Cast list
|
||||
UIUtils.setupCastInfo(getActivity(), getItemResult.cast, videoCastList);
|
||||
|
||||
seeAllCast.setVisibility(
|
||||
(getItemResult.cast.size() <= Settings.DEFAULT_MAX_CAST_PICTURES) ?
|
||||
View.GONE : View.VISIBLE);
|
||||
seeAllCast.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent launchIntent = AllCastActivity.buildLaunchIntent(
|
||||
getActivity(), title, (ArrayList<VideoType.Cast>) getItemResult.cast);
|
||||
startActivity(launchIntent);
|
||||
getActivity().overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||
}
|
||||
});
|
||||
UIUtils.setupCastInfo(getActivity(), getItemResult.cast, videoCastList,
|
||||
AllCastActivity.buildLaunchIntent(getActivity(), title,
|
||||
(ArrayList<VideoType.Cast>)getItemResult.cast));
|
||||
} else {
|
||||
overflowButton.setVisibility(View.GONE);
|
||||
videoCastList.setVisibility(View.GONE);
|
||||
seeAllCast.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -108,7 +108,6 @@ public class TVShowOverviewFragment extends Fragment
|
|||
|
||||
@InjectView(R.id.media_description) TextView mediaDescription;
|
||||
@InjectView(R.id.cast_list) GridLayout videoCastList;
|
||||
@InjectView(R.id.see_all_cast) Button seeAllCast;
|
||||
|
||||
/**
|
||||
* Create a new instance of this, initialized to show tvshowId
|
||||
|
@ -255,15 +254,6 @@ public class TVShowOverviewFragment extends Fragment
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Callbacks for injected buttons
|
||||
*/
|
||||
@OnClick(R.id.see_all_cast)
|
||||
public void onSeeAllCastClicked(View v) {
|
||||
startActivity(AllCastActivity.buildLaunchIntent(getActivity(), tvshowTitle, castArrayList));
|
||||
getActivity().overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loader callbacks
|
||||
*/
|
||||
|
@ -389,10 +379,8 @@ public class TVShowOverviewFragment extends Fragment
|
|||
cursor.getString(TVShowCastListQuery.THUMBNAIL)));
|
||||
} while (cursor.moveToNext());
|
||||
|
||||
UIUtils.setupCastInfo(getActivity(), castArrayList, videoCastList);
|
||||
seeAllCast.setVisibility(
|
||||
(cursor.getCount() <= Settings.DEFAULT_MAX_CAST_PICTURES) ?
|
||||
View.GONE : View.VISIBLE);
|
||||
UIUtils.setupCastInfo(getActivity(), castArrayList, videoCastList,
|
||||
AllCastActivity.buildLaunchIntent(getActivity(), tvshowTitle, castArrayList));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ package org.xbmc.kore.utils;
|
|||
|
||||
import android.animation.Animator;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
|
@ -226,22 +227,23 @@ public class UIUtils {
|
|||
* through the global setting, and only actors with images are presented.
|
||||
* The rest are presented in the additionalCastView TextView
|
||||
*
|
||||
* @param context Activity
|
||||
* @param activity Activity
|
||||
* @param castList Cast list
|
||||
* @param castListView GridLayout on which too show actors that have images
|
||||
*/
|
||||
public static void setupCastInfo(final Context context,
|
||||
List<VideoType.Cast> castList, GridLayout castListView) {
|
||||
HostManager hostManager = HostManager.getInstance(context);
|
||||
Resources resources = context.getResources();
|
||||
public static void setupCastInfo(final Activity activity,
|
||||
List<VideoType.Cast> castList, GridLayout castListView,
|
||||
final Intent allCastActivityLaunchIntent) {
|
||||
HostManager hostManager = HostManager.getInstance(activity);
|
||||
Resources resources = activity.getResources();
|
||||
DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||
WindowManager windowManager = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
|
||||
WindowManager windowManager = (WindowManager)activity.getSystemService(Context.WINDOW_SERVICE);
|
||||
windowManager.getDefaultDisplay().getMetrics(displayMetrics);
|
||||
|
||||
View.OnClickListener castListClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Utils.openImdbForPerson(context, (String)v.getTag());
|
||||
Utils.openImdbForPerson(activity, (String)v.getTag());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -254,30 +256,46 @@ public class UIUtils {
|
|||
int imageHeight = (int)(imageWidth * 1.5);
|
||||
|
||||
int maxCastPictures = Settings.DEFAULT_MAX_CAST_PICTURES;
|
||||
int currentPictureNumber = 0;
|
||||
for (int i = 0; i < castList.size(); i++) {
|
||||
|
||||
for (int i = 0; i < Math.min(castList.size(), maxCastPictures); i++) {
|
||||
VideoType.Cast actor = castList.get(i);
|
||||
|
||||
if ((currentPictureNumber < maxCastPictures) && (actor.thumbnail != null)) {
|
||||
// Present the picture
|
||||
currentPictureNumber++;
|
||||
View castView = LayoutInflater.from(context).inflate(R.layout.grid_item_cast, castListView, false);
|
||||
ImageView castPicture = (ImageView) castView.findViewById(R.id.picture);
|
||||
TextView castName = (TextView) castView.findViewById(R.id.name);
|
||||
TextView castRole = (TextView) castView.findViewById(R.id.role);
|
||||
View castView = LayoutInflater.from(activity).inflate(R.layout.grid_item_cast, castListView, false);
|
||||
ImageView castPicture = (ImageView) castView.findViewById(R.id.picture);
|
||||
TextView castName = (TextView) castView.findViewById(R.id.name);
|
||||
TextView castRole = (TextView) castView.findViewById(R.id.role);
|
||||
|
||||
castView.getLayoutParams().width = imageWidth;
|
||||
castView.getLayoutParams().height = imageHeight;
|
||||
castView.setTag(actor.name);
|
||||
castView.setOnClickListener(castListClickListener);
|
||||
castView.getLayoutParams().width = imageWidth;
|
||||
castView.getLayoutParams().height = imageHeight;
|
||||
castView.setTag(actor.name);
|
||||
|
||||
UIUtils.loadImageWithCharacterAvatar(activity, hostManager,
|
||||
actor.thumbnail, actor.name,
|
||||
castPicture, imageWidth, imageHeight);
|
||||
|
||||
if ((i == maxCastPictures - 1) && (castList.size() > i + 1)) {
|
||||
View castNameGroup = castView.findViewById(R.id.cast_name_group);
|
||||
View allCastGroup = castView.findViewById(R.id.all_cast_group);
|
||||
TextView remainingCastCount = (TextView)castView.findViewById(R.id.remaining_cast_count);
|
||||
|
||||
castNameGroup.setVisibility(View.GONE);
|
||||
allCastGroup.setVisibility(View.VISIBLE);
|
||||
remainingCastCount.setText(String.format(activity.getString(R.string.remaining_cast_count),
|
||||
castList.size() - maxCastPictures + 1));
|
||||
castView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
activity.startActivity(allCastActivityLaunchIntent);
|
||||
activity.overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
castName.setText(actor.name);
|
||||
castRole.setText(actor.role);
|
||||
UIUtils.loadImageWithCharacterAvatar(context, hostManager,
|
||||
actor.thumbnail, actor.name,
|
||||
castPicture, imageWidth, imageHeight);
|
||||
castListView.addView(castView);
|
||||
castView.setOnClickListener(castListClickListener);
|
||||
}
|
||||
|
||||
castListView.addView(castView);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -247,17 +247,6 @@
|
|||
android:columnCount="@integer/cast_grid_view_columns"
|
||||
android:orientation="horizontal"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/see_all_cast"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/cast_list"
|
||||
android:layout_alignRight="@id/cast_list"
|
||||
android:layout_alignEnd="@id/cast_list"
|
||||
android:layout_marginRight="@dimen/small_padding"
|
||||
android:layout_marginEnd="@dimen/small_padding"
|
||||
android:text="@string/see_all_cast"/>
|
||||
|
||||
</RelativeLayout>
|
||||
</com.melnykov.fab.ObservableScrollView>
|
||||
|
||||
|
|
|
@ -305,18 +305,6 @@
|
|||
android:layout_marginTop="@dimen/default_padding"
|
||||
android:columnCount="@integer/cast_grid_view_columns"
|
||||
android:orientation="horizontal"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/see_all_cast"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/cast_list"
|
||||
android:layout_alignRight="@id/cast_list"
|
||||
android:layout_alignEnd="@id/cast_list"
|
||||
android:layout_marginRight="@dimen/small_padding"
|
||||
android:layout_marginEnd="@dimen/small_padding"
|
||||
android:text="@string/see_all_cast"/>
|
||||
|
||||
</RelativeLayout>
|
||||
</ScrollView>
|
||||
|
||||
|
|
|
@ -180,17 +180,6 @@
|
|||
android:columnCount="@integer/cast_grid_view_columns"
|
||||
android:orientation="horizontal"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/see_all_cast"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/cast_list"
|
||||
android:layout_alignRight="@id/cast_list"
|
||||
android:layout_alignEnd="@id/cast_list"
|
||||
android:layout_marginRight="@dimen/small_padding"
|
||||
android:layout_marginEnd="@dimen/small_padding"
|
||||
android:text="@string/see_all_cast"/>
|
||||
|
||||
</RelativeLayout>
|
||||
</ScrollView>
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
Gridview, so i resort to a LinearLayout to position them
|
||||
-->
|
||||
<LinearLayout
|
||||
android:id="@+id/cast_name_group"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
|
@ -64,6 +65,28 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/all_cast_group"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="?attr/contentBackgroundColor"
|
||||
android:visibility="gone">
|
||||
|
||||
<ImageView
|
||||
android:id="@android:id/icon"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="?attr/iconOpenInNew"/>
|
||||
<TextView
|
||||
android:id="@+id/remaining_cast_count"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@android:id/icon"
|
||||
android:gravity="center_horizontal"
|
||||
style="@style/TextAppearance.Media.Info"/>
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
</RelativeLayout>
|
|
@ -102,4 +102,5 @@
|
|||
<attr name="iconChevronLeft" format="reference" />
|
||||
<attr name="iconChevronRight" format="reference" />
|
||||
|
||||
<attr name="iconOpenInNew" format="reference" />
|
||||
</resources>
|
|
@ -216,7 +216,8 @@
|
|||
<string name="cast">Cast</string>
|
||||
<string name="additional_cast">Additional cast</string>
|
||||
<string name="cast_list_text">%1$s as %2$s</string>
|
||||
<string name="see_all_cast">See all</string>
|
||||
<!-- String to be used as the text on the cast grid view, when there is more actors than are shown -->
|
||||
<string name="remaining_cast_count">%d more</string>
|
||||
|
||||
<string name="general_error_executing_action">Error executing action: %1$s</string>
|
||||
<string name="error_getting_playlist">Error fetching playlist</string>
|
||||
|
|
|
@ -135,6 +135,8 @@
|
|||
|
||||
<item name="iconSearch">@drawable/ic_search_white_24dp</item>
|
||||
<item name="iconSearchToolbar">@drawable/ic_search_white_24dp</item>
|
||||
|
||||
<item name="iconOpenInNew">@drawable/ic_open_in_new_white_24dp</item>
|
||||
</style>
|
||||
|
||||
<!-- Base Light theme. -->
|
||||
|
@ -254,6 +256,8 @@
|
|||
|
||||
<item name="iconSearch">@drawable/ic_search_black_24dp</item>
|
||||
<item name="iconSearchToolbar">@drawable/ic_search_white_24dp</item>
|
||||
|
||||
<item name="iconOpenInNew">@drawable/ic_open_in_new_black_24dp</item>
|
||||
</style>
|
||||
|
||||
<!-- Blue Grey theme. -->
|
||||
|
|
Loading…
Reference in New Issue