use poster as backdrop if no backdrop is set, update to android studio
* update gradle to version 6.5 * update android gradle plugin to version 4.1
This commit is contained in:
parent
c947105a1f
commit
597271d4de
|
@ -41,8 +41,6 @@ dependencies {
|
||||||
implementation 'androidx.core:core-ktx:1.3.2'
|
implementation 'androidx.core:core-ktx:1.3.2'
|
||||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
|
implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
|
||||||
implementation 'androidx.navigation:navigation-fragment:2.3.0'
|
|
||||||
implementation 'androidx.navigation:navigation-ui:2.3.0'
|
|
||||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.0'
|
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.0'
|
||||||
implementation 'androidx.navigation:navigation-ui-ktx:2.3.0'
|
implementation 'androidx.navigation:navigation-ui-ktx:2.3.0'
|
||||||
implementation 'androidx.security:security-crypto:1.1.0-alpha02'
|
implementation 'androidx.security:security-crypto:1.1.0-alpha02'
|
||||||
|
|
|
@ -2,7 +2,6 @@ package org.mosad.teapod.ui
|
||||||
|
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.graphics.drawable.ColorDrawable
|
import android.graphics.drawable.ColorDrawable
|
||||||
import android.graphics.drawable.Drawable
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
|
@ -44,30 +43,20 @@ class MediaFragment(private val media: Media, private val tmdb: TMDBResponse) :
|
||||||
*/
|
*/
|
||||||
private fun initGUI() {
|
private fun initGUI() {
|
||||||
// generic gui
|
// generic gui
|
||||||
|
val backdropUrl = if (tmdb.backdropUrl.isNotEmpty()) tmdb.backdropUrl else media.posterLink
|
||||||
|
val posterUrl = if (tmdb.posterUrl.isNotEmpty()) tmdb.posterUrl else media.posterLink
|
||||||
|
|
||||||
|
Glide.with(requireContext()).load(backdropUrl)
|
||||||
|
.apply(RequestOptions.placeholderOf(ColorDrawable(Color.DKGRAY)))
|
||||||
|
.apply(RequestOptions.bitmapTransform(BlurTransformation(25, 3)))
|
||||||
|
.into(image_backdrop)
|
||||||
|
|
||||||
|
Glide.with(requireContext()).load(posterUrl)
|
||||||
|
.into(image_poster)
|
||||||
|
|
||||||
text_title.text = media.title
|
text_title.text = media.title
|
||||||
|
// TODO add year, fsk
|
||||||
if (tmdb.posterUrl.isNotEmpty()) {
|
text_overview.text = if (tmdb.overview.isNotEmpty()) tmdb.overview else media.shortDesc
|
||||||
Glide.with(requireContext()).load(tmdb.backdropUrl)
|
|
||||||
.apply(RequestOptions.placeholderOf(ColorDrawable(Color.DKGRAY)))
|
|
||||||
.apply(RequestOptions.bitmapTransform(BlurTransformation(25, 3)))
|
|
||||||
.into(image_backdrop)
|
|
||||||
} else {
|
|
||||||
Glide.with(requireContext()).load(ColorDrawable(Color.DKGRAY)).into(image_poster)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tmdb.posterUrl.isNotEmpty()) {
|
|
||||||
Glide.with(requireContext()).load(tmdb.posterUrl)
|
|
||||||
.into(image_poster)
|
|
||||||
} else {
|
|
||||||
Glide.with(requireContext()).load(media.posterLink)
|
|
||||||
.into(image_poster)
|
|
||||||
}
|
|
||||||
|
|
||||||
text_overview.text = if (tmdb.overview.isNotEmpty()) {
|
|
||||||
tmdb.overview
|
|
||||||
} else {
|
|
||||||
media.shortDesc
|
|
||||||
}
|
|
||||||
|
|
||||||
// specific gui
|
// specific gui
|
||||||
if (media.type == MediaType.TVSHOW) {
|
if (media.type == MediaType.TVSHOW) {
|
||||||
|
@ -94,7 +83,7 @@ class MediaFragment(private val media: Media, private val tmdb: TMDBResponse) :
|
||||||
|
|
||||||
// set onItemClick only in adapter is initialized
|
// set onItemClick only in adapter is initialized
|
||||||
if (this::adapterRecEpisodes.isInitialized) {
|
if (this::adapterRecEpisodes.isInitialized) {
|
||||||
adapterRecEpisodes.onItemClick = { item, position ->
|
adapterRecEpisodes.onItemClick = { _, position ->
|
||||||
playStream(media.episodes[position].streamUrl)
|
playStream(media.episodes[position].streamUrl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,9 +25,10 @@
|
||||||
android:id="@+id/image_backdrop"
|
android:id="@+id/image_backdrop"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="false"
|
||||||
android:maxHeight="231dp"
|
android:maxHeight="231dp"
|
||||||
android:minHeight="220dp" />
|
android:minHeight="220dp"
|
||||||
|
android:scaleType="centerCrop" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/image_poster"
|
android:id="@+id/image_poster"
|
||||||
|
|
|
@ -6,7 +6,7 @@ buildscript {
|
||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:4.0.2'
|
classpath 'com.android.tools.build:gradle:4.1.0'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#Thu Oct 08 16:06:13 CEST 2020
|
#Tue Oct 13 12:04:29 CEST 2020
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
|
||||||
|
|
Loading…
Reference in New Issue