diff --git a/.gitignore b/.gitignore index b7acfada51..836fd4d380 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,9 @@ play-account.json # Do not commit firebase config google-services.json + +# VS Code config +org.eclipse.buildship.core.prefs +.classpath +.project +bin/ \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 8592f19ed7..3bcd8aacb2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -186,8 +186,8 @@ dependencies { implementation project(':ui-recommended') implementation project(':ui-search') - implementation Libs.AndroidX.Lifecycle.extensions - implementation Libs.AndroidX.Lifecycle.viewmodelKtx + implementation Libs.AndroidX.Lifecycle.livedata + implementation Libs.AndroidX.Lifecycle.viewmodel implementation Libs.AndroidX.appcompat implementation Libs.AndroidX.browser diff --git a/base-android/src/main/java/app/tivi/util/Event.kt b/base-android/src/main/java/app/tivi/util/Event.kt deleted file mode 100644 index e5cebe7e98..0000000000 --- a/base-android/src/main/java/app/tivi/util/Event.kt +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package app.tivi.util - -import androidx.lifecycle.LifecycleOwner -import androidx.lifecycle.LiveData -import androidx.lifecycle.Observer - -/** - * Used as a wrapper for data that is exposed via a LiveData that represents an event. - */ -open class Event(private val content: T) { - var hasBeenHandled = false - private set // Allow external read but not write - - /** - * Returns the content and prevents its use again. - */ - fun getContentIfNotHandled(): T? { - return if (hasBeenHandled) { - null - } else { - hasBeenHandled = true - content - } - } - - /** - * Returns the content, even if it's already been handled. - */ - fun peekContent(): T = content -} - -/** - * An [Observer] for [Event]s, simplifying the pattern of checking if the [Event]'s content has - * already been handled. - * - * [onEventUnhandledContent] is *only* called if the [Event]'s contents has not been handled. - */ -class EventObserver(private val onEventUnhandledContent: (T) -> Unit) : Observer> { - override fun onChanged(event: Event?) { - event?.getContentIfNotHandled()?.let { value -> - onEventUnhandledContent(value) - } - } -} - -inline fun LiveData>.observeEvent( - owner: LifecycleOwner, - crossinline observer: (T) -> Unit -) { - observe(owner, EventObserver { observer(it) }) -} diff --git a/buildSrc/src/main/java/app/tivi/buildsrc/dependencies.kt b/buildSrc/src/main/java/app/tivi/buildsrc/dependencies.kt index 11e5c950b3..33c7587712 100644 --- a/buildSrc/src/main/java/app/tivi/buildsrc/dependencies.kt +++ b/buildSrc/src/main/java/app/tivi/buildsrc/dependencies.kt @@ -53,7 +53,7 @@ object Libs { } object Accompanist { - private const val version = "0.1.2" + private const val version = "0.1.3-SNAPSHOT" const val mdcTheme = "dev.chrisbanes.accompanist:accompanist-mdc-theme:$version" const val coil = "dev.chrisbanes.accompanist:accompanist-coil:$version" } @@ -134,7 +134,8 @@ object Libs { object Lifecycle { private const val version = "2.2.0" const val extensions = "androidx.lifecycle:lifecycle-extensions:$version" - const val viewmodelKtx = "androidx.lifecycle:lifecycle-viewmodel-ktx:$version" + const val livedata = "androidx.lifecycle:lifecycle-livedata-ktx:$version" + const val viewmodel = "androidx.lifecycle:lifecycle-viewmodel-ktx:$version" } object Room { @@ -152,7 +153,7 @@ object Libs { } object Compose { - const val version = "0.1.0-dev11" + const val version = "0.1.0-dev12" const val kotlinCompilerVersion = "1.3.70-dev-withExperimentalGoogleExtensions-20200424" const val runtime = "androidx.compose:compose-runtime:$version" diff --git a/common-entrygrid/build.gradle b/common-entrygrid/build.gradle index dd762bf2ac..55d967d1b4 100644 --- a/common-entrygrid/build.gradle +++ b/common-entrygrid/build.gradle @@ -52,8 +52,8 @@ dependencies { implementation project(':common-layouts') implementation project(':common-databinding') - implementation Libs.AndroidX.Lifecycle.extensions - implementation Libs.AndroidX.Lifecycle.viewmodelKtx + implementation Libs.AndroidX.Lifecycle.livedata + implementation Libs.AndroidX.Lifecycle.viewmodel implementation Libs.AndroidX.Paging.runtime diff --git a/common-ui-compose/build.gradle b/common-ui-compose/build.gradle index ee970f2fae..fbc00223b1 100644 --- a/common-ui-compose/build.gradle +++ b/common-ui-compose/build.gradle @@ -48,6 +48,7 @@ dependencies { api project(':common-imageloading') implementation Libs.AndroidX.coreKtx + implementation Libs.AndroidX.Lifecycle.livedata implementation Libs.AndroidX.Compose.runtime implementation Libs.AndroidX.UI.foundation diff --git a/common-ui-compose/src/main/java/app/tivi/common/compose/ComposeTypedArray.kt b/common-ui-compose/src/main/java/app/tivi/common/compose/ComposeTypedArray.kt deleted file mode 100644 index c321c4e381..0000000000 --- a/common-ui-compose/src/main/java/app/tivi/common/compose/ComposeTypedArray.kt +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package app.tivi.common.compose - -import android.content.res.TypedArray -import android.util.TypedValue -import androidx.core.content.res.getColorOrThrow -import androidx.ui.foundation.shape.corner.CornerSize -import androidx.ui.graphics.Color -import androidx.ui.text.font.FontFamily -import androidx.ui.text.font.asFontFamily -import androidx.ui.text.font.font -import androidx.ui.unit.Density -import androidx.ui.unit.TextUnit -import androidx.ui.unit.dp -import androidx.ui.unit.em -import androidx.ui.unit.px -import androidx.ui.unit.sp -import kotlin.concurrent.getOrSet - -private val tempTypedValue = ThreadLocal() - -fun TypedArray.getComposeColor( - index: Int, - fallbackColor: Color = Color.Unset -): Color = if (hasValue(index)) Color(getColorOrThrow(index)) else fallbackColor - -fun TypedArray.getFontFamily(index: Int, fallback: FontFamily): FontFamily { - return getFontFamilyOrNull(index) ?: fallback -} - -fun TypedArray.getFontFamilyOrNull(index: Int): FontFamily? { - val tv = tempTypedValue.getOrSet { TypedValue() } - if (getValue(index, tv) && tv.type == TypedValue.TYPE_STRING) { - return font(tv.resourceId).asFontFamily() - } - return null -} - -fun TypedArray.getTextUnit( - density: Density, - index: Int, - fallback: TextUnit = TextUnit.Inherit -): TextUnit = getTextUnitOrNull(density, index) ?: fallback - -fun TypedArray.getTextUnitOrNull( - density: Density, - index: Int -): TextUnit? { - val tv = tempTypedValue.getOrSet { TypedValue() } - if (getValue(index, tv) && tv.type == TypedValue.TYPE_DIMENSION) { - return when (tv.complexUnit) { - // For SP values, we convert the value directly to an TextUnit.Sp - TypedValue.COMPLEX_UNIT_SP -> TypedValue.complexToFloat(tv.data).sp - // For DIP values, we convert the value to an TextUnit.Em (roughly equivalent) - TypedValue.COMPLEX_UNIT_DIP -> TypedValue.complexToFloat(tv.data).em - // For another other types, we let the TypedArray flatten to a px value, and - // we convert it to an Sp based on the current density - else -> with(density) { getDimension(index, 0f).toSp() } - } - } - return null -} - -fun TypedArray.getCornerSizeOrNull(index: Int): CornerSize? { - val tv = tempTypedValue.getOrSet { TypedValue() } - if (getValue(index, tv)) { - return when (tv.type) { - TypedValue.TYPE_DIMENSION -> { - when (tv.complexUnit) { - // For DIP and PX values, we convert the value to the equivalent - TypedValue.COMPLEX_UNIT_DIP -> CornerSize(TypedValue.complexToFloat(tv.data).dp) - TypedValue.COMPLEX_UNIT_PX -> CornerSize(TypedValue.complexToFloat(tv.data).px) - // For another other dim types, we let the TypedArray flatten to a px value - else -> CornerSize(getDimensionPixelSize(index, 0).px) - } - } - TypedValue.TYPE_FRACTION -> CornerSize(tv.getFraction(1f, 1f)) - else -> null - } - } - return null -} - -fun TypedArray.getCornerSize(index: Int, fallback: CornerSize): CornerSize { - return getCornerSizeOrNull(index) ?: fallback -} diff --git a/common-ui-compose/src/main/java/app/tivi/common/compose/ExpandingSummary.kt b/common-ui-compose/src/main/java/app/tivi/common/compose/ExpandingSummary.kt index 84437c3721..1749a66838 100644 --- a/common-ui-compose/src/main/java/app/tivi/common/compose/ExpandingSummary.kt +++ b/common-ui-compose/src/main/java/app/tivi/common/compose/ExpandingSummary.kt @@ -22,18 +22,14 @@ import androidx.compose.setValue import androidx.compose.state import androidx.compose.stateFor import androidx.ui.core.Modifier -import androidx.ui.foundation.Box -import androidx.ui.foundation.Clickable import androidx.ui.foundation.Text -import androidx.ui.material.EmphasisAmbient +import androidx.ui.foundation.clickable import androidx.ui.material.MaterialTheme -import androidx.ui.material.ProvideEmphasis -import androidx.ui.material.ripple.ripple import androidx.ui.text.TextStyle import androidx.ui.text.style.TextOverflow @Composable -fun ExpandingSummary( +fun ExpandingText( text: String, textStyle: TextStyle = MaterialTheme.typography.body2, expandable: Boolean = true, @@ -42,25 +38,21 @@ fun ExpandingSummary( modifier: Modifier = Modifier ) { var canTextExpand by stateFor(text) { true } + var expanded by state { false } - Box(modifier = Modifier.ripple(bounded = true, enabled = expandable && canTextExpand)) { - var expanded by state { false } - - Clickable(onClick = { expanded = !expanded }, enabled = expandable && canTextExpand) { - ProvideEmphasis(emphasis = EmphasisAmbient.current.high) { - Text( - text = text, - style = textStyle, - overflow = TextOverflow.Ellipsis, - maxLines = if (expanded) expandedMaxLines else collapsedMaxLines, - modifier = modifier, - onTextLayout = { - if (!expanded) { - canTextExpand = it.hasVisualOverflow - } - } - ) + Text( + text = text, + style = textStyle, + overflow = TextOverflow.Ellipsis, + maxLines = if (expanded) expandedMaxLines else collapsedMaxLines, + modifier = Modifier.clickable( + onClick = { expanded = !expanded }, + enabled = expandable && canTextExpand + ).plus(modifier), + onTextLayout = { + if (!expanded) { + canTextExpand = it.hasVisualOverflow } } - } + ) } diff --git a/common-ui-compose/src/main/java/app/tivi/common/compose/PopupMenu.kt b/common-ui-compose/src/main/java/app/tivi/common/compose/PopupMenu.kt index e86b6b8cb1..1d00fe4c22 100644 --- a/common-ui-compose/src/main/java/app/tivi/common/compose/PopupMenu.kt +++ b/common-ui-compose/src/main/java/app/tivi/common/compose/PopupMenu.kt @@ -23,9 +23,8 @@ import androidx.ui.animation.Crossfade import androidx.ui.core.Alignment import androidx.ui.core.Modifier import androidx.ui.core.Popup -import androidx.ui.core.PopupProperties -import androidx.ui.foundation.Clickable import androidx.ui.foundation.Text +import androidx.ui.foundation.clickable import androidx.ui.layout.Column import androidx.ui.layout.padding import androidx.ui.layout.preferredSizeIn @@ -35,7 +34,6 @@ import androidx.ui.material.EmphasisAmbient import androidx.ui.material.MaterialTheme import androidx.ui.material.ProvideEmphasis import androidx.ui.material.Surface -import androidx.ui.material.ripple.ripple import androidx.ui.unit.IntPx import androidx.ui.unit.IntPxPosition import androidx.ui.unit.dp @@ -51,10 +49,8 @@ fun PopupMenu( Popup( alignment = alignment, offset = offset, - popupProperties = PopupProperties( - isFocusable = true, - onDismissRequest = { visible.value = false } - ) + isFocusable = true, + onDismissRequest = { visible.value = false } ) { Crossfade(current = visible.value) { Surface( @@ -67,25 +63,23 @@ fun PopupMenu( .preferredSizeIn(minWidth = 96.dp, maxWidth = 192.dp) ) { items.forEach { item -> - Clickable( - onClick = { - item.onClick?.invoke() - visible.value = false - }, - enabled = item.enabled, - modifier = Modifier.ripple(enabled = item.enabled) - ) { - val emphasis = when { - item.enabled -> EmphasisAmbient.current.high - else -> EmphasisAmbient.current.disabled - } - ProvideEmphasis(emphasis) { - Text( - text = item.title, - style = MaterialTheme.typography.body1, - modifier = Modifier.padding(16.dp) - ) - } + val emphasis = when { + item.enabled -> EmphasisAmbient.current.high + else -> EmphasisAmbient.current.disabled + } + ProvideEmphasis(emphasis) { + Text( + text = item.title, + style = MaterialTheme.typography.body1, + modifier = Modifier.clickable( + onClick = { + item.onClick?.invoke() + visible.value = false + }, + enabled = item.enabled + ) + .padding(16.dp) + ) } } } diff --git a/common-ui-compose/src/main/java/app/tivi/common/compose/ambients.kt b/common-ui-compose/src/main/java/app/tivi/common/compose/ambients.kt index a6ce8cf3cd..afb5899c8e 100644 --- a/common-ui-compose/src/main/java/app/tivi/common/compose/ambients.kt +++ b/common-ui-compose/src/main/java/app/tivi/common/compose/ambients.kt @@ -16,20 +16,7 @@ package app.tivi.common.compose -import androidx.compose.Composable -import androidx.compose.Providers import androidx.compose.staticAmbientOf import app.tivi.util.TiviDateFormatter val TiviDateFormatterAmbient = staticAmbientOf() - -@Composable -fun WrapWithAmbients( - tiviDateFormatter: TiviDateFormatter, - insetsHolder: InsetsHolder, - content: @Composable () -> Unit -) = Providers( - TiviDateFormatterAmbient provides tiviDateFormatter, - InsetsAmbient provides insetsHolder, - children = content -) diff --git a/common-ui-compose/src/main/java/app/tivi/common/compose/gradientscrim.kt b/common-ui-compose/src/main/java/app/tivi/common/compose/gradientscrim.kt index e650c838b5..3559516eca 100644 --- a/common-ui-compose/src/main/java/app/tivi/common/compose/gradientscrim.kt +++ b/common-ui-compose/src/main/java/app/tivi/common/compose/gradientscrim.kt @@ -26,8 +26,6 @@ import androidx.ui.core.composed import androidx.ui.core.drawWithContent import androidx.ui.graphics.Color import androidx.ui.graphics.VerticalGradient -import androidx.ui.unit.Px -import androidx.ui.unit.px import kotlin.math.pow /** @@ -59,8 +57,8 @@ fun Modifier.gradientScrim( val shader = remember(colors, height) { VerticalGradient( colors = colors, - startY = Px.Zero, - endY = height.px + startY = 0f, + endY = height ) } diff --git a/common-ui-compose/src/main/java/app/tivi/common/compose/insets.kt b/common-ui-compose/src/main/java/app/tivi/common/compose/insets.kt index 5af3c36bc6..8253e54067 100644 --- a/common-ui-compose/src/main/java/app/tivi/common/compose/insets.kt +++ b/common-ui-compose/src/main/java/app/tivi/common/compose/insets.kt @@ -18,61 +18,49 @@ package app.tivi.common.compose import android.view.View import androidx.compose.Composable -import androidx.compose.Model +import androidx.compose.Providers import androidx.compose.ambientOf -import androidx.compose.onCommit -import androidx.compose.remember import androidx.core.view.ViewCompat import androidx.core.view.WindowInsetsCompat import androidx.core.view.doOnAttach import androidx.core.view.doOnDetach import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData -import androidx.lifecycle.Observer +import androidx.lifecycle.Transformations +import androidx.ui.livedata.observeAsState import androidx.ui.unit.IntPx import androidx.ui.unit.ipx -@Model data class InsetsHolder( - var left: IntPx = IntPx.Zero, - var top: IntPx = IntPx.Zero, - var right: IntPx = IntPx.Zero, - var bottom: IntPx = IntPx.Zero + val left: IntPx = IntPx.Zero, + val top: IntPx = IntPx.Zero, + val right: IntPx = IntPx.Zero, + val bottom: IntPx = IntPx.Zero ) { + constructor(insets: WindowInsetsCompat) : this( + insets.systemWindowInsetLeft.ipx, + insets.systemWindowInsetTop.ipx, + insets.systemWindowInsetRight.ipx, + insets.systemWindowInsetBottom.ipx + ) + val horizontal get() = right + left val vertical get() = top + bottom } -fun InsetsHolder.setFrom(insets: WindowInsetsCompat) { - val newLeft = insets.systemWindowInsetLeft.ipx - if (left != newLeft) { - left = newLeft - } - val newTop = insets.systemWindowInsetTop.ipx - if (top != newTop) { - top = newTop - } - val newRight = insets.systemWindowInsetRight.ipx - if (right != newRight) { - right = newRight - } - val newBottom = insets.systemWindowInsetBottom.ipx - if (bottom != newBottom) { - bottom = newBottom - } -} - val InsetsAmbient = ambientOf { InsetsHolder() } @Composable -fun observeInsets(liveData: LiveData) { - val insetsHolder = InsetsAmbient.current - val observer = remember { - Observer { insets -> insets?.let(insetsHolder::setFrom) } - } - onCommit(liveData) { - liveData.observeForever(observer) - onDispose { liveData.removeObserver(observer) } +fun ProvideInsets( + liveData: LiveData, + children: @Composable () -> Unit +) { + val currentInsets = Transformations.map(liveData) { + it?.let(::InsetsHolder) ?: InsetsHolder() + }.observeAsState(InsetsHolder()) + + Providers(InsetsAmbient provides currentInsets.value) { + children() } } diff --git a/common-ui-compose/src/main/java/app/tivi/common/compose/layout.kt b/common-ui-compose/src/main/java/app/tivi/common/compose/layout.kt index 9a4aea1979..fe3eeaf4f4 100644 --- a/common-ui-compose/src/main/java/app/tivi/common/compose/layout.kt +++ b/common-ui-compose/src/main/java/app/tivi/common/compose/layout.kt @@ -21,11 +21,9 @@ import androidx.ui.core.LayoutCoordinates import androidx.ui.core.Modifier import androidx.ui.foundation.Box import androidx.ui.foundation.drawBackground -import androidx.ui.layout.absolutePadding import androidx.ui.layout.fillMaxWidth import androidx.ui.layout.preferredHeight import androidx.ui.material.MaterialTheme -import androidx.ui.unit.Dp import androidx.ui.unit.PxBounds import androidx.ui.unit.PxPosition import androidx.ui.unit.dp @@ -40,10 +38,6 @@ inline val LayoutCoordinates.positionInParent: PxPosition inline val LayoutCoordinates.boundsInParent: PxBounds get() = PxBounds(positionInParent, size.toPxSize()) -fun Modifier.paddingHV(horizontal: Dp = 0.dp, vertical: Dp = 0.dp): Modifier { - return absolutePadding(left = horizontal, top = vertical, right = horizontal, bottom = vertical) -} - @Composable fun HorizontalDivider() { Box( diff --git a/common-ui-resources/build.gradle b/common-ui-resources/build.gradle index c9a9d348d1..7d5ce2ae71 100644 --- a/common-ui-resources/build.gradle +++ b/common-ui-resources/build.gradle @@ -44,8 +44,8 @@ dependencies { implementation project(':data') implementation project(':base-android') - implementation Libs.AndroidX.Lifecycle.extensions - implementation Libs.AndroidX.Lifecycle.viewmodelKtx + implementation Libs.AndroidX.Lifecycle.livedata + implementation Libs.AndroidX.Lifecycle.viewmodel api Libs.AndroidX.appcompat api Libs.Google.material diff --git a/common-ui-view/build.gradle b/common-ui-view/build.gradle index e950e0b412..e6ba521463 100644 --- a/common-ui-view/build.gradle +++ b/common-ui-view/build.gradle @@ -45,8 +45,8 @@ dependencies { implementation project(':base-android') api project(':common-ui-resources') - implementation Libs.AndroidX.Lifecycle.extensions - implementation Libs.AndroidX.Lifecycle.viewmodelKtx + api Libs.AndroidX.Lifecycle.livedata + implementation Libs.AndroidX.Lifecycle.viewmodel api Libs.AndroidX.appcompat implementation Libs.AndroidX.recyclerview diff --git a/presenter-episodedetails/build.gradle b/presenter-episodedetails/build.gradle index cef1436884..409c5fe938 100644 --- a/presenter-episodedetails/build.gradle +++ b/presenter-episodedetails/build.gradle @@ -51,8 +51,8 @@ dependencies { implementation project(':domain') implementation project(':common-ui-view') - api Libs.AndroidX.Lifecycle.extensions - implementation Libs.AndroidX.Lifecycle.viewmodelKtx + api Libs.AndroidX.Lifecycle.livedata + implementation Libs.AndroidX.Lifecycle.viewmodel implementation Libs.Dagger.dagger kapt Libs.Dagger.compiler diff --git a/ui-account-presenter/build.gradle b/ui-account-presenter/build.gradle index 11bfcfa4de..23181f852e 100644 --- a/ui-account-presenter/build.gradle +++ b/ui-account-presenter/build.gradle @@ -46,8 +46,8 @@ dependencies { implementation project(':common-ui-view') implementation project(':trakt-auth') - api Libs.AndroidX.Lifecycle.extensions - implementation Libs.AndroidX.Lifecycle.viewmodelKtx + api Libs.AndroidX.Lifecycle.livedata + implementation Libs.AndroidX.Lifecycle.viewmodel implementation Libs.AndroidX.coreKtx diff --git a/ui-account-view/src/main/java/app/tivi/account/AccountUi.kt b/ui-account-view/src/main/java/app/tivi/account/AccountUi.kt index 063d60e51a..1518acd3ad 100644 --- a/ui-account-view/src/main/java/app/tivi/account/AccountUi.kt +++ b/ui-account-view/src/main/java/app/tivi/account/AccountUi.kt @@ -18,6 +18,7 @@ package app.tivi.account import android.view.ViewGroup import androidx.compose.Composable +import androidx.compose.Providers import androidx.compose.Recomposer import androidx.compose.getValue import androidx.core.view.WindowInsetsCompat @@ -26,8 +27,8 @@ import androidx.ui.core.Alignment import androidx.ui.core.Modifier import androidx.ui.core.clip import androidx.ui.core.setContent -import androidx.ui.foundation.Clickable import androidx.ui.foundation.Text +import androidx.ui.foundation.clickable import androidx.ui.foundation.shape.corner.RoundedCornerShape import androidx.ui.graphics.vector.VectorAsset import androidx.ui.layout.Column @@ -47,17 +48,14 @@ import androidx.ui.material.ProvideEmphasis import androidx.ui.material.TextButton import androidx.ui.material.icons.Icons import androidx.ui.material.icons.filled.Settings -import androidx.ui.material.ripple.ripple import androidx.ui.res.stringResource import androidx.ui.tooling.preview.Preview import androidx.ui.unit.dp import app.tivi.account.view.R import app.tivi.common.compose.HorizontalDivider -import app.tivi.common.compose.InsetsHolder +import app.tivi.common.compose.ProvideInsets +import app.tivi.common.compose.TiviDateFormatterAmbient import app.tivi.common.compose.VectorImage -import app.tivi.common.compose.WrapWithAmbients -import app.tivi.common.compose.observeInsets -import app.tivi.common.compose.paddingHV import app.tivi.data.entities.TraktUser import app.tivi.trakt.TraktAuthState import app.tivi.util.TiviDateFormatter @@ -74,12 +72,12 @@ fun composeAccountUi( tiviDateFormatter: TiviDateFormatter ): Any = viewGroup.setContent(Recomposer.current()) { MaterialThemeFromMdcTheme { - WrapWithAmbients(tiviDateFormatter, InsetsHolder()) { - observeInsets(insets) - - val viewState by state.observeAsState() - if (viewState != null) { - AccountUi(viewState!!, actioner) + Providers(TiviDateFormatterAmbient provides tiviDateFormatter) { + ProvideInsets(insets) { + val viewState by state.observeAsState() + if (viewState != null) { + AccountUi(viewState!!, actioner) + } } } } @@ -100,7 +98,7 @@ fun AccountUi( Row( modifier = Modifier.gravity(Alignment.End) - .paddingHV(horizontal = 16.dp) + .padding(horizontal = 16.dp) ) { if (viewState.authState == TraktAuthState.LOGGED_OUT) { OutlinedButton( @@ -181,29 +179,25 @@ private fun AppAction( onClick: () -> Unit, modifier: Modifier = Modifier ) { - Clickable( - onClick = onClick, - modifier = Modifier.ripple() + Row( + verticalGravity = Alignment.CenterVertically, + modifier = modifier.fillMaxWidth() + .preferredSizeIn(minHeight = 48.dp) + .clickable(onClick = onClick) + .padding(horizontal = 16.dp, vertical = 8.dp) ) { - Row( - verticalGravity = Alignment.CenterVertically, - modifier = modifier.fillMaxWidth() - .preferredSizeIn(minHeight = 48.dp) - .paddingHV(horizontal = 16.dp, vertical = 8.dp) - ) { - ProvideEmphasis(EmphasisAmbient.current.high) { - Spacer(modifier = Modifier.preferredWidth(8.dp)) + ProvideEmphasis(EmphasisAmbient.current.high) { + Spacer(modifier = Modifier.preferredWidth(8.dp)) - VectorImage(vector = icon) + VectorImage(vector = icon) - Spacer(modifier = Modifier.preferredWidth(16.dp)) + Spacer(modifier = Modifier.preferredWidth(16.dp)) - ProvideEmphasis(EmphasisAmbient.current.high) { - Text( - text = label, - style = MaterialTheme.typography.body2 - ) - } + ProvideEmphasis(EmphasisAmbient.current.high) { + Text( + text = label, + style = MaterialTheme.typography.body2 + ) } } } diff --git a/ui-account/build.gradle b/ui-account/build.gradle index 980b4d8201..4a5f5a91d7 100644 --- a/ui-account/build.gradle +++ b/ui-account/build.gradle @@ -48,8 +48,8 @@ dependencies { implementation project(':ui-account-view') api project(':ui-account-presenter') - implementation Libs.AndroidX.Lifecycle.extensions - implementation Libs.AndroidX.Lifecycle.viewmodelKtx + implementation Libs.AndroidX.Lifecycle.livedata + implementation Libs.AndroidX.Lifecycle.viewmodel implementation Libs.AndroidX.coreKtx implementation Libs.AndroidX.Fragment.fragment diff --git a/ui-account/src/main/java/app/tivi/account/AccountUiFragment.kt b/ui-account/src/main/java/app/tivi/account/AccountUiFragment.kt index 830824ac23..ca43128d04 100644 --- a/ui-account/src/main/java/app/tivi/account/AccountUiFragment.kt +++ b/ui-account/src/main/java/app/tivi/account/AccountUiFragment.kt @@ -23,7 +23,7 @@ import android.view.ViewGroup import android.widget.FrameLayout import androidx.lifecycle.lifecycleScope import androidx.navigation.fragment.findNavController -import app.tivi.TiviDialogFragment +import app.tivi.TiviBottomSheetFragment import app.tivi.common.compose.observeWindowInsets import app.tivi.extensions.navigateToNavDestination import app.tivi.util.TiviDateFormatter @@ -33,7 +33,7 @@ import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.sendBlocking import kotlinx.coroutines.launch -class AccountUiFragment : TiviDialogFragment(), AccountUiViewModel.FactoryProvider { +class AccountUiFragment : TiviBottomSheetFragment(), AccountUiViewModel.FactoryProvider { private val pendingActions = Channel() private val viewModel: AccountUiViewModel by fragmentViewModel() diff --git a/ui-discover/build.gradle b/ui-discover/build.gradle index 497c8cf23d..8d7ef6b91a 100644 --- a/ui-discover/build.gradle +++ b/ui-discover/build.gradle @@ -54,8 +54,8 @@ dependencies { implementation project(':common-imageloading') implementation project(':common-databinding') - implementation Libs.AndroidX.Lifecycle.extensions - implementation Libs.AndroidX.Lifecycle.viewmodelKtx + implementation Libs.AndroidX.Lifecycle.livedata + implementation Libs.AndroidX.Lifecycle.viewmodel implementation Libs.AndroidX.appcompat implementation Libs.AndroidX.recyclerview diff --git a/ui-episodedetails-compose/src/main/java/app/tivi/episodedetails/EpisodeDetails.kt b/ui-episodedetails-compose/src/main/java/app/tivi/episodedetails/EpisodeDetails.kt index 0cba997377..3b961dae4d 100644 --- a/ui-episodedetails-compose/src/main/java/app/tivi/episodedetails/EpisodeDetails.kt +++ b/ui-episodedetails-compose/src/main/java/app/tivi/episodedetails/EpisodeDetails.kt @@ -41,18 +41,18 @@ import androidx.ui.core.drawWithContent import androidx.ui.core.onPositioned import androidx.ui.core.setContent import androidx.ui.foundation.Box -import androidx.ui.foundation.Clickable import androidx.ui.foundation.ContentColorAmbient import androidx.ui.foundation.Icon import androidx.ui.foundation.Text import androidx.ui.foundation.VerticalScroller +import androidx.ui.foundation.clickable import androidx.ui.foundation.contentColor import androidx.ui.foundation.drawBackground import androidx.ui.foundation.shape.corner.RoundedCornerShape import androidx.ui.geometry.Offset import androidx.ui.graphics.Color import androidx.ui.graphics.RectangleShape -import androidx.ui.graphics.painter.clipRect +import androidx.ui.graphics.drawscope.clipRect import androidx.ui.graphics.vector.VectorAsset import androidx.ui.layout.Column import androidx.ui.layout.Row @@ -93,18 +93,15 @@ import androidx.ui.unit.dp import androidx.ui.unit.toOffset import app.tivi.animation.invoke import app.tivi.common.compose.AutoSizedCircularProgressIndicator -import app.tivi.common.compose.ExpandingSummary +import app.tivi.common.compose.ExpandingText import app.tivi.common.compose.InsetsAmbient -import app.tivi.common.compose.InsetsHolder +import app.tivi.common.compose.ProvideInsets import app.tivi.common.compose.SwipeDirection import app.tivi.common.compose.SwipeToDismiss import app.tivi.common.compose.TiviAlertDialog import app.tivi.common.compose.TiviDateFormatterAmbient -import app.tivi.common.compose.WrapWithAmbients import app.tivi.common.compose.boundsInParent import app.tivi.common.compose.center -import app.tivi.common.compose.observeInsets -import app.tivi.common.compose.paddingHV import app.tivi.data.entities.Episode import app.tivi.data.entities.EpisodeWatchEntry import app.tivi.data.entities.PendingAction @@ -131,12 +128,12 @@ fun ViewGroup.composeEpisodeDetails( tiviDateFormatter: TiviDateFormatter ): Any = setContent(Recomposer.current()) { MaterialThemeFromMdcTheme { - WrapWithAmbients(tiviDateFormatter, InsetsHolder()) { - observeInsets(insets) - - val viewState by state.observeAsState() - if (viewState != null) { - EpisodeDetails(viewState!!, actioner) + Providers(TiviDateFormatterAmbient provides tiviDateFormatter) { + ProvideInsets(insets) { + val viewState by state.observeAsState() + if (viewState != null) { + EpisodeDetails(viewState!!, actioner) + } } } } @@ -170,10 +167,13 @@ private fun EpisodeDetails( val episode = viewState.episode if (episode != null) { InfoPanes(episode) - ExpandingSummary( - episode.summary ?: "No summary", - modifier = Modifier.padding(16.dp) - ) + + ProvideEmphasis(emphasis = EmphasisAmbient.current.high) { + ExpandingText( + episode.summary ?: "No summary", + modifier = Modifier.padding(16.dp) + ) + } } val watches = viewState.watches @@ -250,12 +250,11 @@ private fun EpisodeDetails( Crossfade(current = viewState.error) { error -> if (error != null) { // TODO: Convert this to swipe-to-dismiss - Clickable(onClick = { actioner(ClearError) }) { - Snackbar( - text = { Text(error.message) }, - modifier = Modifier.padding(start = 16.dp, end = 16.dp, bottom = 16.dp) - ) - } + Snackbar( + text = { Text(error.message) }, + modifier = Modifier.clickable(onClick = { actioner(ClearError) }) + .padding(start = 16.dp, end = 16.dp, bottom = 16.dp) + ) } } } @@ -370,7 +369,7 @@ private fun EpisodeWatchesHeader(onSweepWatchesClick: () -> Unit) { Row { ProvideEmphasis(emphasis = EmphasisAmbient.current.high) { Text( - modifier = Modifier.paddingHV(horizontal = 16.dp, vertical = 8.dp) + modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp) .gravity(Alignment.CenterVertically) .weight(1f), text = stringResource(R.string.episode_watches), @@ -393,7 +392,7 @@ private fun EpisodeWatchesHeader(onSweepWatchesClick: () -> Unit) { private fun EpisodeWatch(episodeWatchEntry: EpisodeWatchEntry) { Surface { Row( - modifier = Modifier.paddingHV(horizontal = 16.dp, vertical = 8.dp) + modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp) .preferredSizeIn(minWidth = 40.dp, minHeight = 40.dp) ) { ProvideEmphasis(emphasis = EmphasisAmbient.current.high) { diff --git a/ui-episodedetails/build.gradle b/ui-episodedetails/build.gradle index 040cbb4f24..789ec96e4c 100644 --- a/ui-episodedetails/build.gradle +++ b/ui-episodedetails/build.gradle @@ -54,8 +54,8 @@ dependencies { api project(':presenter-episodedetails') - implementation Libs.AndroidX.Lifecycle.extensions - implementation Libs.AndroidX.Lifecycle.viewmodelKtx + implementation Libs.AndroidX.Lifecycle.livedata + implementation Libs.AndroidX.Lifecycle.viewmodel implementation Libs.AndroidX.coreKtx implementation Libs.AndroidX.Fragment.fragment diff --git a/ui-followed/build.gradle b/ui-followed/build.gradle index 3dc705d057..8972c79b71 100644 --- a/ui-followed/build.gradle +++ b/ui-followed/build.gradle @@ -61,8 +61,8 @@ dependencies { implementation project(':common-imageloading') implementation project(':common-databinding') - implementation Libs.AndroidX.Lifecycle.extensions - implementation Libs.AndroidX.Lifecycle.viewmodelKtx + implementation Libs.AndroidX.Lifecycle.livedata + implementation Libs.AndroidX.Lifecycle.viewmodel implementation Libs.AndroidX.Paging.runtime diff --git a/ui-popular/build.gradle b/ui-popular/build.gradle index b4f00ddfb7..6cccd181cb 100644 --- a/ui-popular/build.gradle +++ b/ui-popular/build.gradle @@ -56,8 +56,8 @@ dependencies { implementation project(':common-databinding') implementation project(':common-entrygrid') - implementation Libs.AndroidX.Lifecycle.extensions - implementation Libs.AndroidX.Lifecycle.viewmodelKtx + implementation Libs.AndroidX.Lifecycle.livedata + implementation Libs.AndroidX.Lifecycle.viewmodel implementation Libs.AndroidX.Paging.runtime diff --git a/ui-recommended/build.gradle b/ui-recommended/build.gradle index 23b0e51d2d..b293df6502 100644 --- a/ui-recommended/build.gradle +++ b/ui-recommended/build.gradle @@ -56,8 +56,8 @@ dependencies { implementation project(':common-databinding') implementation project(':common-entrygrid') - implementation Libs.AndroidX.Lifecycle.extensions - implementation Libs.AndroidX.Lifecycle.viewmodelKtx + implementation Libs.AndroidX.Lifecycle.livedata + implementation Libs.AndroidX.Lifecycle.viewmodel implementation Libs.AndroidX.Paging.runtime diff --git a/ui-search/build.gradle b/ui-search/build.gradle index b478bb4788..d77d0b6773 100644 --- a/ui-search/build.gradle +++ b/ui-search/build.gradle @@ -61,8 +61,8 @@ dependencies { implementation project(':common-imageloading') implementation project(':common-databinding') - implementation Libs.AndroidX.Lifecycle.extensions - implementation Libs.AndroidX.Lifecycle.viewmodelKtx + implementation Libs.AndroidX.Lifecycle.livedata + implementation Libs.AndroidX.Lifecycle.viewmodel implementation Libs.AndroidX.Paging.runtime diff --git a/ui-showdetails-presenter/build.gradle b/ui-showdetails-presenter/build.gradle index 7ac9305c0b..2ca87b9a7d 100644 --- a/ui-showdetails-presenter/build.gradle +++ b/ui-showdetails-presenter/build.gradle @@ -51,8 +51,8 @@ dependencies { implementation project(':domain') implementation project(':common-ui-view') - api Libs.AndroidX.Lifecycle.extensions - implementation Libs.AndroidX.Lifecycle.viewmodelKtx + api Libs.AndroidX.Lifecycle.livedata + implementation Libs.AndroidX.Lifecycle.viewmodel implementation Libs.AndroidX.coreKtx diff --git a/ui-showdetails-view/src/main/java/app/tivi/showdetails/details/view/ShowDetails.kt b/ui-showdetails-view/src/main/java/app/tivi/showdetails/details/view/ShowDetails.kt index adac877c4d..112d58ef89 100644 --- a/ui-showdetails-view/src/main/java/app/tivi/showdetails/details/view/ShowDetails.kt +++ b/ui-showdetails-view/src/main/java/app/tivi/showdetails/details/view/ShowDetails.kt @@ -37,17 +37,18 @@ import androidx.ui.core.ContentScale import androidx.ui.core.ContextAmbient import androidx.ui.core.DensityAmbient import androidx.ui.core.Modifier +import androidx.ui.core.clip import androidx.ui.core.drawOpacity import androidx.ui.core.onPositioned import androidx.ui.core.positionInRoot import androidx.ui.core.setContent import androidx.ui.foundation.Box -import androidx.ui.foundation.Clickable import androidx.ui.foundation.HorizontalScroller import androidx.ui.foundation.Icon import androidx.ui.foundation.ScrollerPosition import androidx.ui.foundation.Text import androidx.ui.foundation.VerticalScroller +import androidx.ui.foundation.clickable import androidx.ui.foundation.contentColor import androidx.ui.foundation.drawBackground import androidx.ui.foundation.drawBorder @@ -94,22 +95,19 @@ import androidx.ui.material.icons.filled.Refresh import androidx.ui.material.icons.filled.Star import androidx.ui.material.icons.filled.Visibility import androidx.ui.material.icons.filled.VisibilityOff -import androidx.ui.material.ripple.ripple import androidx.ui.res.stringResource import androidx.ui.tooling.preview.Preview import androidx.ui.unit.Dp import androidx.ui.unit.IntPx import androidx.ui.unit.dp import app.tivi.common.compose.AutoSizedCircularProgressIndicator -import app.tivi.common.compose.ExpandingSummary +import app.tivi.common.compose.ExpandingText import app.tivi.common.compose.InsetsAmbient -import app.tivi.common.compose.InsetsHolder import app.tivi.common.compose.PopupMenu import app.tivi.common.compose.PopupMenuItem +import app.tivi.common.compose.ProvideInsets +import app.tivi.common.compose.TiviDateFormatterAmbient import app.tivi.common.compose.VectorImage -import app.tivi.common.compose.WrapWithAmbients -import app.tivi.common.compose.observeInsets -import app.tivi.common.compose.paddingHV import app.tivi.common.imageloading.TrimTransparentEdgesTransformation import app.tivi.data.entities.Episode import app.tivi.data.entities.ImageType @@ -142,7 +140,6 @@ import app.tivi.showdetails.details.UnfollowPreviousSeasonsFollowedAction import app.tivi.ui.animations.lerp import app.tivi.util.TiviDateFormatter import coil.request.GetRequest -import coil.transform.RoundedCornersTransformation import dev.chrisbanes.accompanist.coil.CoilImage import dev.chrisbanes.accompanist.coil.CoilImageWithCrossfade import dev.chrisbanes.accompanist.mdctheme.MaterialThemeFromMdcTheme @@ -157,11 +154,12 @@ fun ViewGroup.composeShowDetails( tiviDateFormatter: TiviDateFormatter, textCreator: ShowDetailsTextCreator ): Any = setContent(Recomposer.current()) { - WrapWithAmbients(tiviDateFormatter, InsetsHolder()) { - Providers(ShowDetailsTextCreatorAmbient provides textCreator) { - MaterialThemeFromMdcTheme { - observeInsets(insets) - + Providers( + TiviDateFormatterAmbient provides tiviDateFormatter, + ShowDetailsTextCreatorAmbient provides textCreator + ) { + MaterialThemeFromMdcTheme { + ProvideInsets(insets) { val viewState by state.observeAsState() val uiEffects by pendingUiEffects.observeAsState(emptyList()) if (viewState != null) { @@ -225,19 +223,14 @@ fun ShowDetails( if (poster != null) { Spacer(modifier = Modifier.preferredWidth(16.dp)) - val cornerRadius = with(DensityAmbient.current) { 4.dp.toPx() } - val transforms = remember { - listOf(RoundedCornersTransformation(cornerRadius.value)) - } - CoilImageWithCrossfade( request = GetRequest.Builder(ContextAmbient.current) .data(poster) - .transformations(transforms) .build(), alignment = Alignment.TopStart, modifier = Modifier.weight(1f, fill = false) .aspectRatio(2 / 3f) + .clip(MaterialTheme.shapes.medium) ) } @@ -255,11 +248,13 @@ fun ShowDetails( Header(stringResource(R.string.details_about)) if (viewState.show.summary != null) { - ExpandingSummary( - viewState.show.summary!!, - modifier = Modifier.fillMaxWidth() - .paddingHV(horizontal = 16.dp, vertical = 8.dp) - ) + ProvideEmphasis(emphasis = EmphasisAmbient.current.high) { + ExpandingText( + viewState.show.summary!!, + modifier = Modifier.fillMaxWidth() + .padding(horizontal = 16.dp, vertical = 8.dp) + ) + } } val genres = viewState.show.genres @@ -393,12 +388,11 @@ fun ShowDetails( Crossfade(current = viewState.refreshError) { error -> if (error != null) { // TODO: Convert this to swipe-to-dismiss - Clickable(onClick = { actioner(ClearError) }) { - Snackbar( - text = { Text(error.message) }, - modifier = Modifier.padding(start = 16.dp, end = 16.dp, bottom = 16.dp) - ) - } + Snackbar( + text = { Text(error.message) }, + modifier = Modifier.clickable(onClick = { actioner(ClearError) }) + .padding(start = 16.dp, end = 16.dp, bottom = 16.dp) + ) } } @@ -515,7 +509,7 @@ private fun CertificateInfoPanel( size = 1.dp, color = MaterialTheme.colors.onSurface, shape = RoundedCornerShape(2.dp) - ).paddingHV(horizontal = 4.dp, vertical = 2.dp) + ).padding(horizontal = 4.dp, vertical = 2.dp) ) } } @@ -566,7 +560,7 @@ private fun Header(title: String) { text = title, style = MaterialTheme.typography.subtitle1, modifier = Modifier.fillMaxWidth() - .paddingHV(horizontal = 16.dp, vertical = 8.dp) + .padding(horizontal = 16.dp, vertical = 8.dp) ) } @@ -578,7 +572,7 @@ private fun Genres(show: TiviShow) { textCreator.genreString(show.genres).toString(), style = MaterialTheme.typography.body2, modifier = Modifier.fillMaxWidth() - .paddingHV(horizontal = 16.dp, vertical = 8.dp) + .padding(horizontal = 16.dp, vertical = 8.dp) ) } } @@ -592,21 +586,20 @@ private fun RelatedShows( // TODO: ideally we would use AdapterList here, but it only works for vertical lists, not // horizontal - HorizontalScroller(modifier = modifier.paddingHV(vertical = 8.dp)) { - Row(modifier.paddingHV(horizontal = 16.dp)) { + HorizontalScroller(modifier = modifier.padding(vertical = 8.dp)) { + Row(modifier.padding(horizontal = 16.dp)) { related.forEachIndexed { index, relatedEntry -> val poster = relatedEntry.images.findHighestRatedPoster() if (poster != null) { Card { - Clickable( - onClick = { actioner(OpenShowDetails(relatedEntry.show.id)) }, - modifier = Modifier.ripple() - ) { - CoilImageWithCrossfade( - poster, - modifier = Modifier.aspectRatio(2 / 3f).preferredWidth(64.dp) - ) - } + CoilImageWithCrossfade( + poster, + modifier = Modifier.aspectRatio(2 / 3f) + .preferredWidth(64.dp) + .clickable( + onClick = { actioner(OpenShowDetails(relatedEntry.show.id)) } + ) + ) } if (index + 1 < related.size) { // Add a spacer if there are still more items to add @@ -624,27 +617,26 @@ private fun NextEpisodeToWatch( episode: Episode, onClick: () -> Unit ) { - Clickable(onClick = onClick, modifier = Modifier.ripple()) { - Column( - modifier = Modifier.paddingHV(16.dp, 8.dp) - .fillMaxWidth() - .preferredHeightIn(minHeight = 48.dp) - .wrapContentSize(Alignment.CenterStart) - ) { - val textCreator = ShowDetailsTextCreatorAmbient.current + Column( + modifier = Modifier.fillMaxWidth() + .preferredHeightIn(minHeight = 48.dp) + .wrapContentSize(Alignment.CenterStart) + .clickable(onClick = onClick) + .padding(16.dp, 8.dp) + ) { + val textCreator = ShowDetailsTextCreatorAmbient.current - Text( - textCreator.seasonEpisodeTitleText(season, episode), - style = MaterialTheme.typography.caption - ) + Text( + textCreator.seasonEpisodeTitleText(season, episode), + style = MaterialTheme.typography.caption + ) - Spacer(modifier = Modifier.preferredHeight(4.dp)) + Spacer(modifier = Modifier.preferredHeight(4.dp)) - Text( - episode.title ?: stringResource(R.string.episode_title_fallback, episode.number!!), - style = MaterialTheme.typography.body1 - ) - } + Text( + episode.title ?: stringResource(R.string.episode_title_fallback, episode.number!!), + style = MaterialTheme.typography.body1 + ) } } @@ -752,30 +744,28 @@ private fun SeasonWithEpisodesRow( Column(modifier = Modifier.fillMaxWidth()) { if (expanded) VerticalDivider() - Clickable( - onClick = { actioner(ChangeSeasonExpandedAction(season.id, !expanded)) }, - enabled = !season.ignored, - modifier = Modifier.ripple(enabled = !season.ignored) - ) { - SeasonRow( - season, - episodes, - actioner, - modifier = Modifier.fillMaxWidth() - ) - } + SeasonRow( + season, + episodes, + actioner, + modifier = Modifier.fillMaxWidth() + .clickable( + onClick = { actioner(ChangeSeasonExpandedAction(season.id, !expanded)) }, + enabled = !season.ignored + ) + ) if (expanded) { episodes.forEach { episodeEntry -> - Clickable( - onClick = { actioner(OpenEpisodeDetails(episodeEntry.episode!!.id)) }, - modifier = Modifier.ripple() - ) { - EpisodeWithWatchesRow( - episodeEntry, - Modifier.fillMaxWidth() - ) - } + EpisodeWithWatchesRow( + episodeEntry, + modifier = Modifier.fillMaxWidth() + .clickable( + onClick = { + actioner(OpenEpisodeDetails(episodeEntry.episode!!.id)) + } + ) + ) } } } @@ -854,7 +844,7 @@ private fun EpisodeWithWatchesRow( Row( modifier = modifier.preferredHeightIn(minHeight = 48.dp) .wrapContentHeight(Alignment.CenterVertically) - .paddingHV(horizontal = 16.dp, vertical = 8.dp) + .padding(horizontal = 16.dp, vertical = 8.dp) ) { Column(modifier = Modifier.weight(1f)) { val textCreator = ShowDetailsTextCreatorAmbient.current diff --git a/ui-showdetails/build.gradle b/ui-showdetails/build.gradle index 13efa2111e..41218f784a 100644 --- a/ui-showdetails/build.gradle +++ b/ui-showdetails/build.gradle @@ -61,8 +61,8 @@ dependencies { implementation project(':ui-episodedetails') - implementation Libs.AndroidX.Lifecycle.extensions - implementation Libs.AndroidX.Lifecycle.viewmodelKtx + implementation Libs.AndroidX.Lifecycle.livedata + implementation Libs.AndroidX.Lifecycle.viewmodel implementation Libs.AndroidX.appcompat implementation Libs.AndroidX.coreKtx diff --git a/ui-trending/build.gradle b/ui-trending/build.gradle index b4f00ddfb7..6cccd181cb 100644 --- a/ui-trending/build.gradle +++ b/ui-trending/build.gradle @@ -56,8 +56,8 @@ dependencies { implementation project(':common-databinding') implementation project(':common-entrygrid') - implementation Libs.AndroidX.Lifecycle.extensions - implementation Libs.AndroidX.Lifecycle.viewmodelKtx + implementation Libs.AndroidX.Lifecycle.livedata + implementation Libs.AndroidX.Lifecycle.viewmodel implementation Libs.AndroidX.Paging.runtime diff --git a/ui-watched/build.gradle b/ui-watched/build.gradle index cb71dda649..23ff25d0cc 100644 --- a/ui-watched/build.gradle +++ b/ui-watched/build.gradle @@ -61,8 +61,8 @@ dependencies { implementation project(':common-imageloading') implementation project(':common-databinding') - implementation Libs.AndroidX.Lifecycle.extensions - implementation Libs.AndroidX.Lifecycle.viewmodelKtx + implementation Libs.AndroidX.Lifecycle.livedata + implementation Libs.AndroidX.Lifecycle.viewmodel implementation Libs.AndroidX.Paging.runtime