Browse Source

fix episodes not showing, if scroll is not needed in MediaFragment

pull/28/head
Jannik 1 year ago
parent
commit
7a95304ee1
Signed by: Seil0
GPG Key ID: E8459F3723C52C24
  1. 5
      app/src/main/java/org/mosad/teapod/ui/fragments/MediaFragment.kt
  2. 3
      app/src/main/java/org/mosad/teapod/util/adapter/EpisodeItemAdapter.kt
  3. 6
      app/src/main/res/layout/fragment_media.xml
  4. 1
      app/src/main/res/values/strings.xml

5
app/src/main/java/org/mosad/teapod/ui/fragments/MediaFragment.kt

@ -8,8 +8,6 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import jp.wasabeef.glide.transformations.BlurTransformation
@ -26,7 +24,6 @@ class MediaFragment(private val mediaId: Int) : Fragment() {
private lateinit var binding: FragmentMediaBinding
private lateinit var adapterRecEpisodes: EpisodeItemAdapter
private lateinit var viewManager: RecyclerView.LayoutManager
private lateinit var media: Media
private lateinit var tmdb: TMDBResponse
@ -95,8 +92,6 @@ class MediaFragment(private val mediaId: Int) : Fragment() {
// specific gui
if (media.type == MediaType.TVSHOW) {
adapterRecEpisodes = EpisodeItemAdapter(media.episodes)
viewManager = LinearLayoutManager(context)
recyclerEpisodes.layoutManager = viewManager
recyclerEpisodes.adapter = adapterRecEpisodes
binding.textEpisodesOrRuntime.text = getString(R.string.text_episodes_count, media.info.episodesCount)

3
app/src/main/java/org/mosad/teapod/util/adapter/EpisodeItemAdapter.kt

@ -1,5 +1,7 @@
package org.mosad.teapod.util.adapter
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.core.content.ContextCompat
@ -34,6 +36,7 @@ class EpisodeItemAdapter(private val episodes: List<Episode>) : RecyclerView.Ada
if (episodes[position].posterUrl.isNotEmpty()) {
Glide.with(context).load(ep.posterUrl)
.apply(RequestOptions.placeholderOf(ColorDrawable(Color.DKGRAY)))
.apply(RequestOptions.bitmapTransform(RoundedCornersTransformation(10, 0)))
.into(holder.binding.imageEpisode)
}

6
app/src/main/res/layout/fragment_media.xml

@ -9,8 +9,7 @@
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
@ -26,6 +25,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="false"
android:contentDescription="@string/media_poster_backdrop_desc"
android:maxHeight="231dp"
android:minHeight="220dp"
android:scaleType="centerCrop" />
@ -155,6 +155,8 @@
android:layout_marginStart="7dp"
android:layout_marginTop="17dp"
android:layout_marginEnd="7dp"
android:nestedScrollingEnabled="false"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:layout_editor_absoluteY="298dp"
tools:listitem="@layout/item_episode" />
</LinearLayout>

1
app/src/main/res/values/strings.xml

@ -15,6 +15,7 @@
<!-- search fragment -->
<string name="search_hint">Search for movies and series</string>
<string name="media_poster_desc" translatable="false">poster</string>
<string name="media_poster_backdrop_desc" translatable="false">poster backdrop</string>
<!-- media fragment -->
<string name="button_play">Play</string>

Loading…
Cancel
Save

Du besuchst diese Seite mit einem veralteten IPv4-Internetzugang. Möglicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterstützung.
You are visiting this site with an outdated IPv4 internet access. You may experience problems with accessibility and performance in the future. Please ask your ISP or network administrator for IPv6 support.
Weitere Infos | More Information
Klicke zum schließen | Click to close