Skip to content

Commit 6d43362

Browse files
committed
feat: use better trailer preview
1 parent 23f3a1f commit 6d43362

File tree

5 files changed

+91
-37
lines changed

5 files changed

+91
-37
lines changed

app/src/main/java/com/mrikso/anitube/app/ui/detail/DetailsAnimeFragmemt.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,8 @@ private void showDetails(AnimeDetailsModel animeDetails) {
213213
if (trailer != null) {
214214
binding.layoutTrailer.llVideo.setVisibility(View.VISIBLE);
215215

216-
ViewUtils.loadImage(binding.layoutTrailer.itemTrailer.sivScreenshot, trailer.getPreviewUrl());
217-
binding.layoutTrailer.itemTrailer.sivScreenshot.setOnClickListener(v -> {
216+
ViewUtils.loadImage(binding.layoutTrailer.itemTrailer.trailerPreview, trailer.getPreviewUrl());
217+
binding.layoutTrailer.itemTrailer.getRoot().setOnClickListener(v -> {
218218
IntentUtils.openInBrowser(requireContext(), trailer.getFullUrl());
219219
});
220220
}

app/src/main/res/layout/fragment_details_anime.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@
110110
android:layout_width="match_parent"
111111
android:layout_height="wrap_content"
112112
android:maxLines="3"
113-
android:fontFamily="@font/roboto_bold" />
113+
android:fontFamily="@font/roboto_bold"
114+
tools:text="Бліч"/>
114115
<TextView
115116
android:ellipsize="end"
116117
android:gravity="center"
@@ -120,7 +121,9 @@
120121
android:layout_height="wrap_content"
121122
android:layout_marginTop="4dp"
122123
android:maxLines="1"
123-
style="@style/TextLabelAlpha" />
124+
style="@style/TextLabelAlpha"
125+
tools:text="Bletch"
126+
/>
124127
</LinearLayout>
125128

126129
<LinearLayout
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:app="http://schemas.android.com/apk/res-auto"
4+
xmlns:tools="http://schemas.android.com/tools"
5+
android:layout_height="144dp"
6+
android:layout_width="250dp"
7+
android:minHeight="144dp"
8+
android:clickable="true"
9+
android:focusable="true"
10+
android:layout_gravity="center_horizontal"
11+
app:cardCornerRadius="8dp"
12+
app:cardElevation="0dp"
13+
app:cardUseCompatPadding="true"
14+
style="?attr/materialCardViewFilledStyle">
15+
16+
<FrameLayout
17+
android:layout_width="fill_parent"
18+
android:layout_height="fill_parent">
19+
20+
<ImageView
21+
android:id="@+id/trailer_preview"
22+
android:layout_height="fill_parent"
23+
android:layout_width="fill_parent"
24+
android:scaleType="centerCrop"
25+
android:contentDescription="@null"
26+
tools:src="@tools:sample/avatars" />
27+
28+
<!-- <View
29+
android:layout_width="match_parent"
30+
android:layout_height="200dp"
31+
android:layout_gravity="bottom" />-->
32+
33+
<LinearLayout
34+
android:layout_width="match_parent"
35+
android:layout_height="wrap_content"
36+
android:layout_gravity="center"
37+
android:gravity="center"
38+
android:orientation="horizontal"
39+
android:padding="20dp">
40+
41+
<ImageView
42+
android:layout_width="45dp"
43+
android:layout_height="45dp"
44+
android:contentDescription="@null"
45+
android:scaleType="fitCenter"
46+
android:src="@drawable/ic_play_triangle"
47+
app:tint="@color/white" />
48+
49+
</LinearLayout>
50+
51+
</FrameLayout>
52+
53+
</com.google.android.material.card.MaterialCardView>
Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,26 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<LinearLayout
3-
xmlns:android="http://schemas.android.com/apk/res/android"
4-
xmlns:app="http://schemas.android.com/apk/res-auto"
5-
android:layout_height="wrap_content"
6-
android:layout_width="fill_parent"
7-
android:visibility="gone"
8-
android:orientation="vertical"
9-
android:id="@+id/ll_sreenshots">
10-
11-
<TextView
12-
android:layout_height="wrap_content"
13-
android:layout_width="match_parent"
14-
android:padding="10dp"
15-
style="@style/LayoutHeader"
16-
android:fontFamily="@font/roboto_medium"
17-
android:text="@string/screenshots" />
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:app="http://schemas.android.com/apk/res-auto"
4+
android:id="@+id/ll_sreenshots"
5+
android:layout_width="fill_parent"
6+
android:layout_height="wrap_content"
7+
android:orientation="vertical"
8+
android:visibility="gone">
189

19-
<androidx.recyclerview.widget.RecyclerView
20-
android:layout_height="wrap_content"
21-
android:layout_width="fill_parent"
22-
android:overScrollMode="never"
23-
android:clipToPadding="false"
24-
android:orientation="horizontal"
25-
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
26-
android:id="@+id/recycler_view_screenshots"
27-
/>
10+
<TextView
11+
style="@style/LayoutHeader"
12+
android:layout_width="match_parent"
13+
android:layout_height="wrap_content"
14+
android:padding="10dp"
15+
android:text="@string/screenshots" />
16+
17+
<androidx.recyclerview.widget.RecyclerView
18+
android:id="@+id/recycler_view_screenshots"
19+
android:layout_width="fill_parent"
20+
android:layout_height="wrap_content"
21+
android:clipToPadding="false"
22+
android:orientation="horizontal"
23+
android:overScrollMode="never"
24+
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
2825

2926
</LinearLayout>
Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3-
xmlns:app="http://schemas.android.com/apk/res-auto"
4-
android:layout_height="wrap_content"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
android:id="@+id/ll_video"
55
android:layout_width="fill_parent"
6-
android:visibility="gone"
6+
android:layout_height="wrap_content"
77
android:orientation="vertical"
8-
android:id="@+id/ll_video">
8+
android:visibility="gone"
9+
tools:visibility="visible">
10+
911
<TextView
10-
android:layout_height="wrap_content"
12+
style="@style/LayoutHeader"
1113
android:layout_width="match_parent"
14+
android:layout_height="wrap_content"
1215
android:padding="10dp"
13-
style="@style/LayoutHeader"
1416
android:text="@string/trailer" />
1517

1618
<include
17-
android:layout_gravity="center"
1819
android:id="@+id/item_trailer"
19-
layout="@layout/item_screenshot" />
20+
layout="@layout/item_trailer" />
2021

2122
</LinearLayout>

0 commit comments

Comments
 (0)