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

Rewrite details row with constraint layout #3729

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,6 @@ protected MyDetailsOverviewRow doInBackground(BaseItemDto... params) {
String primaryImageUrl = imageHelper.getValue().getLogoImageUrl(mBaseItem, 600, true);
if (primaryImageUrl == null) {
primaryImageUrl = imageHelper.getValue().getPrimaryImageUrl(mBaseItem, false, null, posterHeight);
if (item.getRunTimeTicks() != null && item.getRunTimeTicks() > 0 && item.getUserData() != null && item.getUserData().getPlaybackPositionTicks() > 0)
mDetailsOverviewRow.setProgress(((int) (item.getUserData().getPlaybackPositionTicks() * 100.0 / item.getRunTimeTicks())));
}

mDetailsOverviewRow.setSummary(item.getOverview());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.PopupMenu;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.TextView;

Expand Down Expand Up @@ -116,12 +115,6 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
mItemList = binding.songs;
mScrollView = binding.scrollView;

//adjust left frame
RelativeLayout leftFrame = detailsBinding.leftFrame;
ViewGroup.LayoutParams params = leftFrame.getLayoutParams();
params.width = Utils.convertDpToPixel(requireContext(), 100);


mMetrics = new DisplayMetrics();
requireActivity().getWindowManager().getDefaultDisplay().getMetrics(mMetrics);
mBottomScrollThreshold = (int) (mMetrics.heightPixels * .6);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.PopupMenu;
import android.widget.RelativeLayout;
import android.widget.ScrollView;

import androidx.annotation.NonNull;
Expand Down Expand Up @@ -76,11 +75,6 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
mItemList = binding.songs;
mScrollView = binding.scrollView;

//adjust left frame
RelativeLayout leftFrame = detailsBinding.leftFrame;
ViewGroup.LayoutParams params = leftFrame.getLayoutParams();
params.width = Utils.convertDpToPixel(requireContext(), 100);

mMetrics = new DisplayMetrics();
requireActivity().getWindowManager().getDefaultDisplay().getMetrics(mMetrics);
mBottomScrollThreshold = (int) (mMetrics.heightPixels * .6);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class MyDetailsOverviewRow @JvmOverloads constructor(
val item: BaseItemDto,
var imageDrawable: String? = null,
var summary: String? = null,
var progress: Int = 0,
var infoItem1: InfoItem? = null,
var infoItem2: InfoItem? = null,
var infoItem3: InfoItem? = null,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
package org.jellyfin.androidtv.ui.presentation

import android.view.ViewGroup
import android.widget.RelativeLayout
import androidx.core.view.isVisible
import androidx.core.view.updateLayoutParams
import androidx.leanback.widget.RowPresenter
import org.jellyfin.androidtv.ui.DetailRowView
import org.jellyfin.androidtv.ui.itemdetail.MyDetailsOverviewRow
import org.jellyfin.androidtv.util.InfoLayoutHelper
import org.jellyfin.androidtv.util.MarkdownRenderer
import org.jellyfin.androidtv.util.dp
import org.jellyfin.sdk.model.api.BaseItemKind

class MyDetailsOverviewRowPresenter(
Expand Down Expand Up @@ -38,24 +35,11 @@ class MyDetailsOverviewRowPresenter(

binding.mainImage.load(row.imageDrawable, null, null, 1.0, 0)

if (row.progress > 0 && row.imageDrawable != null) {
binding.fdProgress.progress = row.progress
binding.fdProgress.isVisible = true
}

setSummary(row.summary)

if (row.item.type == BaseItemKind.PERSON) {
binding.fdSummaryText.updateLayoutParams<RelativeLayout.LayoutParams> {
topMargin = 10
height = 185.dp(view.context)
}

binding.fdSummaryText.maxLines = 9
binding.fdGenreRow.isVisible = false
binding.leftFrame.updateLayoutParams<RelativeLayout.LayoutParams> {
width = 100.dp(view.context)
}
}

binding.fdButtonRow.removeAllViews()
Expand All @@ -69,11 +53,6 @@ class MyDetailsOverviewRowPresenter(

fun setTitle(title: String?) {
binding.fdTitle.text = title
if (binding.fdTitle.text.length > 28) {
binding.fdTitle.updateLayoutParams<RelativeLayout.LayoutParams> {
topMargin = 55.dp(view.context)
}
}
}

fun setSummary(summary: String?) {
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/drawable/expanded_text.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true">
<shape android:shape="rectangle">
<corners android:radius="?attr/cardRounding" />
<solid android:color="@color/black_transparent" />
</shape>
</item>
Expand Down
Loading
Loading