Bläddra i källkod

code fixes after library bump

milan jurkulák 2 år sedan
förälder
incheckning
e72482f908

+ 1 - 1
buildSrc/src/main/kotlin/org/mjdev/gradle/plugin/AppPlugin.kt

@@ -162,7 +162,7 @@ class AppPlugin : BasePlugin() {
                     isDebuggable = false
                     isJniDebuggable = false
                     isMinifyEnabled = true
-                    isShrinkResources = true
+                    isShrinkResources = false
                     isCrunchPngs = true
                     signingConfig = signingConfigs[name]
                     // todo : move

+ 5 - 1
documentation/release-notes-1.3.1.md

@@ -1,4 +1,8 @@
-## Release notes 1.0.0 - 29. 8. 2024, 9:11:57
+## Release notes 1.0.0 - 29. 8. 2024, 10:22:22
+
+* 29.08.2024
+
+* [milan jurkulák] : ksp libs bump 
 
 * 28.08.2024
 

+ 1 - 1
gradle/libs.versions.toml

@@ -219,7 +219,7 @@ kotlin-annotationProcessingEmbeddable = { module = "org.jetbrains.kotlin:kotlin-
 kotlin-kapt4 = { module = "org.jetbrains.kotlin:kotlin-annotation-processing-compiler", version.ref = "kotlin" }
 kotlin-scriptingCompiler = { module = "org.jetbrains.kotlin:kotlin-scripting-compiler", version.ref = "kotlin" }
 kotlin-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" }
-#aalto-xml={ module="com.fasterxml:aalto-xml" , version="1.3.1"} # todo
+aalto-xml={ module="com.fasterxml:aalto-xml" , version="1.3.1"} # todo
 #
 #classpath("org.jetbrains.kotlin:kotlin-scripting-jsr223:1.9.22")
 #classpath("org.jetbrains.kotlin:kotlin-scripting-common:1.9.22")

+ 5 - 5
tvlib/src/main/kotlin/org/mjdev/tvlib/ui/components/gallery/Gallery.kt

@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) Milan Jurkulák 2023.
+ *  Copyright (c) Milan Jurkulák 2024.
  *  Contact:
  *  e: mimoccc@gmail.com
  *  e: mj@mjdev.org
@@ -16,6 +16,9 @@ import androidx.compose.foundation.layout.fillMaxSize
 import androidx.compose.foundation.layout.fillMaxWidth
 import androidx.compose.foundation.layout.height
 import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.lazy.LazyListState
+import androidx.compose.foundation.lazy.itemsIndexed
+import androidx.compose.foundation.lazy.rememberLazyListState
 import androidx.compose.runtime.Composable
 import androidx.compose.runtime.LaunchedEffect
 import androidx.compose.runtime.MutableIntState
@@ -32,9 +35,6 @@ import androidx.compose.ui.focus.FocusRequester
 import androidx.compose.ui.focus.focusRequester
 import androidx.compose.ui.layout.ContentScale
 import androidx.compose.ui.unit.dp
-import androidx.tv.foundation.lazy.list.TvLazyListState
-import androidx.tv.foundation.lazy.list.itemsIndexed
-import androidx.tv.foundation.lazy.list.rememberTvLazyListState
 import androidx.tv.material3.ExperimentalTvMaterial3Api
 import kotlinx.coroutines.delay
 import org.mjdev.tvlib.annotations.Previews
@@ -67,7 +67,7 @@ fun Gallery(
     ) {
         mutableStateOf(ContentScale.Crop)
     },
-    listState: TvLazyListState = rememberTvLazyListState(),
+    listState: LazyListState = rememberLazyListState(),
     switchImageScale: () -> Unit = {
         imageScaleType.value = when (imageScaleType.value) {
             ContentScale.Fit -> ContentScale.Crop

+ 3 - 3
tvlib/src/main/kotlin/org/mjdev/tvlib/ui/components/tv/AppsRow.kt

@@ -10,6 +10,8 @@ package org.mjdev.tvlib.ui.components.tv
 
 import android.content.ComponentName
 import android.content.Context
+import androidx.compose.foundation.lazy.LazyListState
+import androidx.compose.foundation.lazy.rememberLazyListState
 import androidx.compose.foundation.shape.RoundedCornerShape
 import androidx.compose.runtime.Composable
 import androidx.compose.runtime.State
@@ -20,8 +22,6 @@ import androidx.compose.ui.layout.ContentScale
 import androidx.compose.ui.platform.LocalContext
 import androidx.compose.ui.unit.Dp
 import androidx.compose.ui.unit.dp
-import androidx.tv.foundation.lazy.list.TvLazyListState
-import androidx.tv.foundation.lazy.list.rememberTvLazyListState
 import org.mjdev.tvlib.extensions.ComposeExt.computeCardWidth
 import org.mjdev.tvlib.helpers.apps.rememberAppsManager
 import org.mjdev.tvlib.R
@@ -33,7 +33,7 @@ import org.mjdev.tvlib.ui.components.card.ItemCard
 @Composable
 fun AppsRow(
     title: Any? = R.string.title_apps,
-    rowState: TvLazyListState = rememberTvLazyListState(),
+    rowState: LazyListState = rememberLazyListState(),
     padding: Dp = 8.dp,
     backgroundColor: Color = Color.DarkGray.copy(alpha = 0.3f),
     roundCornerSize: Dp = 8.dp,

+ 5 - 4
tvlib/src/main/kotlin/org/mjdev/tvlib/ui/components/tv/BrowseView.kt

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) Milan Jurkulák 2023.
+ *  Copyright (c) Milan Jurkulák 2024.
  *  Contact:
  *  e: mimoccc@gmail.com
  *  e: mj@mjdev.org
@@ -10,20 +10,21 @@ package org.mjdev.tvlib.ui.components.tv
 
 import android.os.Build
 import androidx.compose.foundation.gestures.scrollBy
+import androidx.compose.foundation.lazy.items
 import androidx.compose.foundation.layout.Arrangement
 import androidx.compose.foundation.layout.Column
 import androidx.compose.foundation.layout.PaddingValues
 import androidx.compose.foundation.layout.fillMaxSize
 import androidx.compose.foundation.layout.fillMaxWidth
 import androidx.compose.foundation.layout.heightIn
+import androidx.compose.foundation.lazy.LazyListState
+import androidx.compose.foundation.lazy.rememberLazyListState
 import androidx.compose.runtime.Composable
 import androidx.compose.runtime.State
 import androidx.compose.runtime.mutableStateOf
 import androidx.compose.runtime.rememberCoroutineScope
 import androidx.compose.ui.Modifier
 import androidx.compose.ui.unit.dp
-import androidx.tv.foundation.lazy.list.TvLazyListState
-import androidx.tv.foundation.lazy.list.rememberTvLazyListState
 import kotlinx.coroutines.launch
 import org.mjdev.tvlib.extensions.ComposeExt.isEditMode
 import org.mjdev.tvlib.interfaces.ItemWithTitle
@@ -61,7 +62,7 @@ fun BrowseView(
     onUserPicClicked: (() -> Unit)? = null,
     onItemFocused: ((item: Any?, fromUser: Boolean) -> Unit)? = null,
     onItemClicked: ((item: Any?) -> Unit)? = null,
-    state: TvLazyListState = rememberTvLazyListState(),
+    state: LazyListState = rememberLazyListState(),
     isEdit: Boolean = isEditMode()
 ) {
     val coroutineScope = rememberCoroutineScope()

+ 4 - 3
tvlib/src/main/kotlin/org/mjdev/tvlib/ui/components/tv/CategoryRow.kt

@@ -15,6 +15,8 @@ import androidx.compose.foundation.layout.Arrangement
 import androidx.compose.foundation.layout.Column
 import androidx.compose.foundation.layout.fillMaxWidth
 import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.lazy.LazyListState
+import androidx.compose.foundation.lazy.rememberLazyListState
 import androidx.compose.foundation.shape.RoundedCornerShape
 import androidx.compose.runtime.Composable
 import androidx.compose.runtime.LaunchedEffect
@@ -28,9 +30,8 @@ import androidx.compose.ui.layout.ContentScale
 import androidx.compose.ui.text.font.FontWeight
 import androidx.compose.ui.unit.Dp
 import androidx.compose.ui.unit.dp
-import androidx.tv.foundation.lazy.list.TvLazyListState
-import androidx.tv.foundation.lazy.list.rememberTvLazyListState
 import org.mjdev.tvlib.annotations.Previews
+import androidx.compose.foundation.lazy.items
 import org.mjdev.tvlib.extensions.ComposeExt.computeCardWidth
 import org.mjdev.tvlib.ui.components.card.PhotoCard
 import org.mjdev.tvlib.ui.components.text.TextAny
@@ -41,7 +42,7 @@ import org.mjdev.tvlib.ui.components.text.TextAny
 fun CategoryRow(
     title: Any? = "category",
     items: List<Any?> = listOf(Unit, Unit, Unit),
-    rowState: TvLazyListState = rememberTvLazyListState(),
+    rowState: LazyListState = rememberLazyListState(),
     padding: Dp = 8.dp,
     cardWidth: Dp = computeCardWidth(),
     contentScale: ContentScale = ContentScale.Crop,

+ 3 - 3
tvlib/src/main/kotlin/org/mjdev/tvlib/ui/components/tv/CursorRow.kt

@@ -19,6 +19,8 @@ import androidx.compose.foundation.layout.Arrangement
 import androidx.compose.foundation.layout.Column
 import androidx.compose.foundation.layout.fillMaxWidth
 import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.lazy.LazyListState
+import androidx.compose.foundation.lazy.rememberLazyListState
 import androidx.compose.foundation.shape.RoundedCornerShape
 import androidx.compose.runtime.Composable
 import androidx.compose.runtime.LaunchedEffect
@@ -33,8 +35,6 @@ import androidx.compose.ui.platform.LocalContext
 import androidx.compose.ui.text.font.FontWeight
 import androidx.compose.ui.unit.Dp
 import androidx.compose.ui.unit.dp
-import androidx.tv.foundation.lazy.list.TvLazyListState
-import androidx.tv.foundation.lazy.list.rememberTvLazyListState
 import org.mjdev.tvlib.annotations.Previews
 import org.mjdev.tvlib.extensions.ComposeExt.computeCardWidth
 import org.mjdev.tvlib.extensions.CursorExt.getData
@@ -49,7 +49,7 @@ import org.mjdev.tvlib.ui.components.text.TextAny
 @Composable
 fun CursorRow(
     title: Any? = null,
-    rowState: TvLazyListState = rememberTvLazyListState(),
+    rowState: LazyListState = rememberLazyListState(),
     padding: Dp = 16.dp,
     backgroundColor: Color = Color.DarkGray.copy(alpha = 0.3f),
     roundCornerSize: Dp = 8.dp,

+ 4 - 4
tvlib/src/main/kotlin/org/mjdev/tvlib/ui/components/tv/LocalAudioRow.kt

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) Milan Jurkulák 2023.
+ *  Copyright (c) Milan Jurkulák 2024.
  *  Contact:
  *  e: mimoccc@gmail.com
  *  e: mj@mjdev.org
@@ -10,6 +10,8 @@ package org.mjdev.tvlib.ui.components.tv
 
 import android.content.Context
 import android.database.Cursor
+import androidx.compose.foundation.lazy.LazyListState
+import androidx.compose.foundation.lazy.rememberLazyListState
 import androidx.compose.foundation.shape.RoundedCornerShape
 import androidx.compose.runtime.Composable
 import androidx.compose.ui.graphics.Color
@@ -17,8 +19,6 @@ import androidx.compose.ui.graphics.Shape
 import androidx.compose.ui.layout.ContentScale
 import androidx.compose.ui.unit.Dp
 import androidx.compose.ui.unit.dp
-import androidx.tv.foundation.lazy.list.TvLazyListState
-import androidx.tv.foundation.lazy.list.rememberTvLazyListState
 import org.mjdev.tvlib.R
 import org.mjdev.tvlib.annotations.Previews
 import org.mjdev.tvlib.extensions.ComposeExt.computeCardWidth
@@ -30,7 +30,7 @@ import org.mjdev.tvlib.helpers.cursor.CachingCursor.Companion.rememberCursor
 @Composable
 fun LocalAudioRow(
     title: Any? = R.string.title_audio_local,
-    rowState: TvLazyListState = rememberTvLazyListState(),
+    rowState: LazyListState = rememberLazyListState(),
     padding: Dp = 8.dp,
     backgroundColor: Color = Color.DarkGray.copy(alpha = 0.3f),
     roundCornerSize: Dp = 8.dp,

+ 3 - 3
tvlib/src/main/kotlin/org/mjdev/tvlib/ui/components/tv/LocalPhotosRow.kt

@@ -10,6 +10,8 @@ package org.mjdev.tvlib.ui.components.tv
 
 import android.content.Context
 import android.database.Cursor
+import androidx.compose.foundation.lazy.LazyListState
+import androidx.compose.foundation.lazy.rememberLazyListState
 import androidx.compose.foundation.shape.RoundedCornerShape
 import androidx.compose.runtime.Composable
 import androidx.compose.ui.graphics.Color
@@ -17,8 +19,6 @@ import androidx.compose.ui.graphics.Shape
 import androidx.compose.ui.layout.ContentScale
 import androidx.compose.ui.unit.Dp
 import androidx.compose.ui.unit.dp
-import androidx.tv.foundation.lazy.list.TvLazyListState
-import androidx.tv.foundation.lazy.list.rememberTvLazyListState
 import org.mjdev.tvlib.R
 import org.mjdev.tvlib.annotations.Previews
 import org.mjdev.tvlib.extensions.ComposeExt.computeCardWidth
@@ -30,7 +30,7 @@ import org.mjdev.tvlib.data.local.PhotoItem
 @Composable
 fun LocalPhotosRow(
     title: Any? = R.string.title_photo_local,
-    rowState: TvLazyListState = rememberTvLazyListState(),
+    rowState: LazyListState = rememberLazyListState(),
     padding: Dp = 8.dp,
     backgroundColor: Color = Color.DarkGray.copy(alpha = 0.3f),
     roundCornerSize: Dp = 8.dp,

+ 3 - 3
tvlib/src/main/kotlin/org/mjdev/tvlib/ui/components/tv/LocalVideoRow.kt

@@ -10,6 +10,8 @@ package org.mjdev.tvlib.ui.components.tv
 
 import android.content.Context
 import android.database.Cursor
+import androidx.compose.foundation.lazy.LazyListState
+import androidx.compose.foundation.lazy.rememberLazyListState
 import androidx.compose.foundation.shape.RoundedCornerShape
 import androidx.compose.runtime.Composable
 import androidx.compose.ui.graphics.Color
@@ -17,8 +19,6 @@ import androidx.compose.ui.graphics.Shape
 import androidx.compose.ui.layout.ContentScale
 import androidx.compose.ui.unit.Dp
 import androidx.compose.ui.unit.dp
-import androidx.tv.foundation.lazy.list.TvLazyListState
-import androidx.tv.foundation.lazy.list.rememberTvLazyListState
 import org.mjdev.tvlib.R
 import org.mjdev.tvlib.annotations.Previews
 import org.mjdev.tvlib.extensions.ComposeExt.computeCardWidth
@@ -30,7 +30,7 @@ import org.mjdev.tvlib.data.local.VideoItem
 @Composable
 fun LocalVideoRow(
     title: Any? = R.string.title_video_local,
-    rowState: TvLazyListState = rememberTvLazyListState(),
+    rowState: LazyListState = rememberLazyListState(),
     padding: Dp = 8.dp,
     backgroundColor: Color = Color.DarkGray.copy(alpha = 0.3f),
     roundCornerSize: Dp = 8.dp,

+ 8 - 11
tvlib/src/main/kotlin/org/mjdev/tvlib/ui/components/tv/ScrollableTvLazyColumn.kt

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) Milan Jurkulák 2023.
+ *  Copyright (c) Milan Jurkulák 2024.
  *  Contact:
  *  e: mimoccc@gmail.com
  *  e: mj@mjdev.org
@@ -13,17 +13,16 @@ import androidx.compose.foundation.gestures.scrollBy
 import androidx.compose.foundation.layout.Arrangement
 import androidx.compose.foundation.layout.PaddingValues
 import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.lazy.LazyColumn
+import androidx.compose.foundation.lazy.LazyListScope
+import androidx.compose.foundation.lazy.LazyListState
+import androidx.compose.foundation.lazy.rememberLazyListState
 import androidx.compose.runtime.Composable
 import androidx.compose.runtime.rememberCoroutineScope
 import androidx.compose.ui.Alignment
 import androidx.compose.ui.Modifier
 import androidx.compose.ui.input.pointer.pointerInput
 import androidx.compose.ui.unit.dp
-import androidx.tv.foundation.PivotOffsets
-import androidx.tv.foundation.lazy.list.TvLazyColumn
-import androidx.tv.foundation.lazy.list.TvLazyListScope
-import androidx.tv.foundation.lazy.list.TvLazyListState
-import androidx.tv.foundation.lazy.list.rememberTvLazyListState
 import kotlinx.coroutines.launch
 import org.mjdev.tvlib.annotations.Previews
 import org.mjdev.tvlib.extensions.ModifierExt.onEditMode
@@ -38,9 +37,8 @@ fun ScrollableTvLazyColumn(
     else Arrangement.Bottom,
     horizontalAlignment: Alignment.Horizontal = Alignment.Start,
     userScrollEnabled: Boolean = true,
-    pivotOffsets: PivotOffsets = PivotOffsets(),
-    state: TvLazyListState = rememberTvLazyListState(),
-    content: TvLazyListScope.() -> Unit = {}
+    state: LazyListState = rememberLazyListState(),
+    content: LazyListScope.() -> Unit = {}
 ) {
     val scope = rememberCoroutineScope()
     val scrollDelta: (delta: Float) -> Unit = { delta ->
@@ -48,7 +46,7 @@ fun ScrollableTvLazyColumn(
             state.scrollBy(delta)
         }
     }
-    TvLazyColumn(
+    LazyColumn(
         modifier = modifier
             .onEditMode { fillMaxSize() }
             .pointerInput(Unit) {
@@ -62,7 +60,6 @@ fun ScrollableTvLazyColumn(
         verticalArrangement = verticalArrangement,
         horizontalAlignment = horizontalAlignment,
         userScrollEnabled = userScrollEnabled,
-        pivotOffsets = pivotOffsets,
         content = {
             content.invoke(this)
         }

+ 8 - 25
tvlib/src/main/kotlin/org/mjdev/tvlib/ui/components/tv/TVRow.kt

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) Milan Jurkulák 2023.
+ *  Copyright (c) Milan Jurkulák 2024.
  *  Contact:
  *  e: mimoccc@gmail.com
  *  e: mj@mjdev.org
@@ -10,34 +10,31 @@ package org.mjdev.tvlib.ui.components.tv
 
 import androidx.compose.foundation.layout.Arrangement
 import androidx.compose.foundation.layout.PaddingValues
+import androidx.compose.foundation.lazy.LazyListScope
+import androidx.compose.foundation.lazy.LazyListState
+import androidx.compose.foundation.lazy.LazyRow
+import androidx.compose.foundation.lazy.rememberLazyListState
 import androidx.compose.runtime.Composable
 import androidx.compose.ui.Alignment
 import androidx.compose.ui.Modifier
 import androidx.compose.ui.unit.Dp
 import androidx.compose.ui.unit.dp
-import androidx.tv.foundation.PivotOffsets
-import androidx.tv.foundation.lazy.list.TvLazyListItemScope
-import androidx.tv.foundation.lazy.list.TvLazyListScope
-import androidx.tv.foundation.lazy.list.TvLazyListState
-import androidx.tv.foundation.lazy.list.TvLazyRow
-import androidx.tv.foundation.lazy.list.rememberTvLazyListState
 import org.mjdev.tvlib.annotations.Previews
 
 @Previews
 @Composable
 fun TVRow(
     modifier: Modifier = Modifier,
-    state: TvLazyListState = rememberTvLazyListState(),
+    state: LazyListState = rememberLazyListState(),
     contentPadding: Dp = 0.dp,
     reverseLayout: Boolean = false,
     horizontalArrangement: Arrangement.Horizontal = if (!reverseLayout) Arrangement.Start
     else Arrangement.End,
     verticalAlignment: Alignment.Vertical = Alignment.Top,
     userScrollEnabled: Boolean = true,
-    pivotOffsets: PivotOffsets = PivotOffsets(),
-    content: TvLazyListScope.() -> Unit = {}
+    content: LazyListScope.() -> Unit = {}
 ) {
-    TvLazyRow(
+    LazyRow(
         modifier = modifier,
         state = state,
         contentPadding = PaddingValues(contentPadding * 2, contentPadding),
@@ -45,20 +42,6 @@ fun TVRow(
         horizontalArrangement = horizontalArrangement,
         verticalAlignment = verticalAlignment,
         userScrollEnabled = userScrollEnabled,
-        pivotOffsets = pivotOffsets,
         content = content
     )
 }
-
-inline fun <T> TvLazyListScope.items(
-    items: List<T>,
-    noinline key: ((item: T) -> Any)? = null,
-    noinline contentType: (item: T) -> Any? = { null },
-    crossinline itemContent: @Composable TvLazyListItemScope.(item: T) -> Unit
-) = items(
-    count = items.size,
-    key = if (key != null) { index: Int -> key(items[index]) } else null,
-    contentType = { index: Int -> contentType(items[index]) }
-) {
-    itemContent(items[it])
-}