This commit is contained in:
Tony Tam 2020-07-14 22:52:55 -07:00
parent 62a6ac9078
commit 0cad3bce68
2 changed files with 11 additions and 6 deletions

View File

@ -53,6 +53,7 @@ public class CoverFragment extends Fragment {
private int displayedChapterIndex = -2;
private Playable media;
private int orientation = Configuration.ORIENTATION_UNDEFINED;
private int _position = -1;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
@ -142,6 +143,7 @@ public class CoverFragment extends Fragment {
}
private void displayCoverImage(int position) {
_position = position;
int chapter = ChapterUtils.getCurrentChapterIndex(media, position);
if (chapter != displayedChapterIndex) {
displayedChapterIndex = chapter;
@ -192,6 +194,9 @@ public class CoverFragment extends Fragment {
mainContainer.setOrientation(LinearLayout.HORIZONTAL);
params.weight = 1;
}
if (_position > -1) {
displayCoverImage(_position);
}
textContainer.setLayoutParams(params);
}

View File

@ -5,23 +5,23 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:orientation="horizontal"
android:id="@+id/cover_fragment"
android:padding="8dp"
android:gravity="center">
<de.danoeh.antennapod.view.SquareImageView
android:id="@+id/imgvCover"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:scaleType="fitCenter"
android:layout_marginLeft="32dp"
android:layout_marginRight="32dp"
tools:src="@android:drawable/sym_def_app_icon"
android:layout_weight="0"
android:foreground="?attr/selectableItemBackgroundBorderless"
android:importantForAccessibility="no"
squareImageView:direction="minimum" />
android:scaleType="fitCenter"
squareImageView:direction="height"
tools:src="@android:drawable/sym_def_app_icon" />
<LinearLayout
android:id="@+id/cover_fragment_text_container"