mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-06-13 10:59:18 +00:00
Fixed the Repository sheet bug
Fixed linting of optIn RepositoryItem Cleanup
This commit is contained in:
@ -54,7 +54,7 @@ android {
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = compileOptions.sourceCompatibility.toString()
|
||||
freeCompilerArgs = listOf("-Xjvm-default=compatibility")
|
||||
freeCompilerArgs = listOf("-Xjvm-default=compatibility", "-opt-in=kotlin.RequiresOptIn")
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
|
@ -34,7 +34,7 @@ fun RepositoryItem(
|
||||
onClick: (Repository) -> Unit = {},
|
||||
onLongClick: (Repository) -> Unit = {}
|
||||
) {
|
||||
var (isEnabled, enable) = remember(repository.enabled) {
|
||||
val (isEnabled, enable) = remember(repository.enabled) {
|
||||
mutableStateOf(repository.enabled)
|
||||
}
|
||||
val backgroundColor by animateColorAsState(
|
||||
@ -44,7 +44,7 @@ fun RepositoryItem(
|
||||
|
||||
Surface(
|
||||
modifier = modifier
|
||||
.padding(horizontal = 8.dp, vertical = 4.dp)
|
||||
.padding(horizontal = 16.dp, vertical = 4.dp)
|
||||
.fillMaxWidth()
|
||||
.clip(MaterialTheme.shapes.large)
|
||||
.combinedClickable(
|
||||
@ -55,7 +55,7 @@ fun RepositoryItem(
|
||||
onLongClick = { onLongClick(repository) }
|
||||
),
|
||||
color = backgroundColor,
|
||||
shape = MaterialTheme.shapes.large
|
||||
shape = MaterialTheme.shapes.extraLarge
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier.padding(
|
||||
@ -105,15 +105,3 @@ private fun RepositoryItemText(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//@Preview
|
||||
@Composable
|
||||
fun RepositoryItemPreview() {
|
||||
RepositoryItem(
|
||||
repository = Repository(
|
||||
name = "Test Repo",
|
||||
description = "Test Repo description written by looker, You are welcome"
|
||||
),
|
||||
onClick = {}
|
||||
)
|
||||
}
|
@ -34,11 +34,9 @@ class PrefsRepositoriesFragment : BaseNavFragment() {
|
||||
super.onCreate(savedInstanceState)
|
||||
lifecycleScope.launchWhenStarted {
|
||||
viewModel.showSheet.collectLatest {
|
||||
it?.let {
|
||||
RepositorySheetX(it).showNow(childFragmentManager, "Repository $it")
|
||||
}
|
||||
}
|
||||
}
|
||||
return ComposeView(requireContext()).apply {
|
||||
setContent { ReposPage() }
|
||||
}
|
||||
|
@ -11,7 +11,9 @@ import com.looker.droidify.database.entity.Repository.Companion.newRepository
|
||||
import com.looker.droidify.service.Connection
|
||||
import com.looker.droidify.service.SyncService
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.SharedFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import kotlinx.coroutines.launch
|
||||
@ -23,8 +25,8 @@ class RepositoriesViewModelX(val repositoryDao: RepositoryDao) : ViewModel() {
|
||||
|
||||
val syncConnection = Connection(SyncService::class.java)
|
||||
|
||||
private val _showSheet = MutableStateFlow<Long?>(null)
|
||||
val showSheet = _showSheet.asStateFlow()
|
||||
private val _showSheet = MutableSharedFlow<Long>()
|
||||
val showSheet: SharedFlow<Long> = _showSheet
|
||||
|
||||
private val _repositories = MutableStateFlow<List<Repository>>(emptyList())
|
||||
val repositories = _repositories.asStateFlow()
|
||||
|
Reference in New Issue
Block a user