Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue #204 #419

Merged
merged 2 commits into from
Apr 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ dependencies {
implementation("androidx.palette:palette:1.0.0")
implementation("androidx.constraintlayout:constraintlayout:1.1.3")
implementation("androidx.recyclerview:recyclerview:1.1.0")
implementation("com.google.android:flexbox:2.0.1")

// Media players
implementation("com.amazon.android:exoplayer:2.11.3")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import android.widget.ScrollView;
import android.widget.TextView;

import com.google.android.flexbox.FlexboxLayout;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.Target;

Expand Down Expand Up @@ -72,7 +73,7 @@ public class ItemListActivity extends BaseActivity {
public static final String VIDEO_QUEUE = "VIDEO_QUEUE";

private TextView mTitle;
private LinearLayout mGenreRow;
private FlexboxLayout mGenreRow;
private ImageView mPoster;
private TextView mSummary;
private LinearLayout mButtonRow;
Expand Down Expand Up @@ -111,7 +112,7 @@ protected void onCreate(Bundle savedInstanceState) {
mTitle = (TextView) findViewById(R.id.fdTitle);
mTitle.setShadowLayer(5, 5, 5, Color.BLACK);
mTitle.setText(getString(R.string.loading));
mGenreRow = (LinearLayout) findViewById(R.id.fdGenreRow);
mGenreRow = (FlexboxLayout) findViewById(R.id.fdGenreRow);
mPoster = (ImageView) findViewById(R.id.mainImage);
mButtonRow = (LinearLayout) findViewById(R.id.fdButtonRow);
mSummary = (TextView) findViewById(R.id.fdSummaryText);
Expand Down Expand Up @@ -514,7 +515,7 @@ private void updatePoster(BaseItemDto item){
}
}

private void addGenres(LinearLayout layout) {
private void addGenres(FlexboxLayout layout) {
if (mBaseItem.getGenres() != null && mBaseItem.getGenres().size() > 0) {
boolean first = true;
for (String genre : mBaseItem.getGenres()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@

import androidx.leanback.widget.RowPresenter;

import com.google.android.flexbox.FlexboxLayout;

public class MyDetailsOverviewRowPresenter extends RowPresenter {

private ViewHolder viewHolder;

public final class ViewHolder extends RowPresenter.ViewHolder {
private LinearLayout mGenreRow;
private FlexboxLayout mGenreRow;
private LinearLayout mInfoRow;
private TextView mTitle;
private ImageView mPoster;
Expand Down Expand Up @@ -64,7 +66,7 @@ public ViewHolder(View rootView) {

mLeftFrame = (RelativeLayout) rootView.findViewById(R.id.leftFrame);

mGenreRow = (LinearLayout) rootView.findViewById(R.id.fdGenreRow);
mGenreRow = (FlexboxLayout) rootView.findViewById(R.id.fdGenreRow);
mInfoRow = (LinearLayout)rootView.findViewById(R.id.fdMainInfoRow);
mPoster = (ImageView) rootView.findViewById(R.id.mainImage);
//mStudioImage = (ImageView) rootView.findViewById(R.id.studioImage);
Expand Down Expand Up @@ -142,7 +144,7 @@ protected void onBindRowViewHolder(RowPresenter.ViewHolder holder, Object item)

}

private void addGenres(LinearLayout layout, BaseItemDto item) {
private void addGenres(FlexboxLayout layout, BaseItemDto item) {
layout.removeAllViews();
if (item.getGenres() != null && item.getGenres().size() > 0) {
boolean first = true;
Expand Down Expand Up @@ -197,7 +199,7 @@ public void setInfo3(InfoItem info) {

public LinearLayout getButtonRow() { return viewHolder.mButtonRow; }
public ImageView getPosterView() { return viewHolder.mPoster; }
public LinearLayout getGenreRow() { return viewHolder.mGenreRow; }
public FlexboxLayout getGenreRow() { return viewHolder.mGenreRow; }
public TextView getSummaryView() { return viewHolder.mSummary; }
public LinearLayout getInfoRow() { return viewHolder.mInfoRow; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import android.widget.LinearLayout;
import android.widget.TextView;

import com.google.android.flexbox.FlexboxLayout;

import org.jellyfin.androidtv.R;
import org.jellyfin.androidtv.TvApp;
import org.jellyfin.androidtv.itemhandling.BaseRowItem;
Expand Down Expand Up @@ -400,6 +402,13 @@ public static void addSpacer(Activity activity, LinearLayout layout, String sp,

}

public static void addSpacer(Activity activity, FlexboxLayout layout, String sp, int size) {
TextView mSpacer = new TextView(activity);
mSpacer.setTextSize(size);
mSpacer.setText(sp);
layout.addView(mSpacer);
}

public static void addResourceImage(Activity activity, LinearLayout layout, int imgResource, int width, int height) {
ImageView image = new ImageView(activity);
image.setImageResource(imgResource);
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/res/layout/new_details_overview_row.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,16 @@
android:layout_alignStart="@+id/fdTitle"
/>

<LinearLayout
android:orientation="horizontal"
<com.google.android.flexbox.FlexboxLayout
android:id="@+id/fdGenreRow"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/fdMainInfoRow"
android:id="@+id/fdGenreRow"
android:layout_alignStart="@+id/fdMainInfoRow"
android:divider="@drawable/whitedivider"
android:minHeight="22sp"
/>
android:orientation="horizontal"
app:flexWrap="wrap" />

<org.jellyfin.androidtv.ui.ExpandableTextView
android:layout_width="match_parent"
Expand Down