fix episodes not showing, if scroll is not needed in MediaFragment
This commit is contained in:
		| @ -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) | ||||
|  | ||||
| @ -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) | ||||
|         } | ||||
|  | ||||
| @ -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> | ||||
|  | ||||
| @ -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> | ||||
|  | ||||
		Reference in New Issue
	
	Block a user