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 {
|
kotlinOptions {
|
||||||
jvmTarget = compileOptions.sourceCompatibility.toString()
|
jvmTarget = compileOptions.sourceCompatibility.toString()
|
||||||
freeCompilerArgs = listOf("-Xjvm-default=compatibility")
|
freeCompilerArgs = listOf("-Xjvm-default=compatibility", "-opt-in=kotlin.RequiresOptIn")
|
||||||
}
|
}
|
||||||
|
|
||||||
buildFeatures {
|
buildFeatures {
|
||||||
|
@ -34,7 +34,7 @@ fun RepositoryItem(
|
|||||||
onClick: (Repository) -> Unit = {},
|
onClick: (Repository) -> Unit = {},
|
||||||
onLongClick: (Repository) -> Unit = {}
|
onLongClick: (Repository) -> Unit = {}
|
||||||
) {
|
) {
|
||||||
var (isEnabled, enable) = remember(repository.enabled) {
|
val (isEnabled, enable) = remember(repository.enabled) {
|
||||||
mutableStateOf(repository.enabled)
|
mutableStateOf(repository.enabled)
|
||||||
}
|
}
|
||||||
val backgroundColor by animateColorAsState(
|
val backgroundColor by animateColorAsState(
|
||||||
@ -44,7 +44,7 @@ fun RepositoryItem(
|
|||||||
|
|
||||||
Surface(
|
Surface(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.padding(horizontal = 8.dp, vertical = 4.dp)
|
.padding(horizontal = 16.dp, vertical = 4.dp)
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.clip(MaterialTheme.shapes.large)
|
.clip(MaterialTheme.shapes.large)
|
||||||
.combinedClickable(
|
.combinedClickable(
|
||||||
@ -55,7 +55,7 @@ fun RepositoryItem(
|
|||||||
onLongClick = { onLongClick(repository) }
|
onLongClick = { onLongClick(repository) }
|
||||||
),
|
),
|
||||||
color = backgroundColor,
|
color = backgroundColor,
|
||||||
shape = MaterialTheme.shapes.large
|
shape = MaterialTheme.shapes.extraLarge
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier.padding(
|
modifier = Modifier.padding(
|
||||||
@ -104,16 +104,4 @@ 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,9 +34,7 @@ class PrefsRepositoriesFragment : BaseNavFragment() {
|
|||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
lifecycleScope.launchWhenStarted {
|
lifecycleScope.launchWhenStarted {
|
||||||
viewModel.showSheet.collectLatest {
|
viewModel.showSheet.collectLatest {
|
||||||
it?.let {
|
RepositorySheetX(it).showNow(childFragmentManager, "Repository $it")
|
||||||
RepositorySheetX(it).showNow(childFragmentManager, "Repository $it")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ComposeView(requireContext()).apply {
|
return ComposeView(requireContext()).apply {
|
||||||
|
@ -11,7 +11,9 @@ import com.looker.droidify.database.entity.Repository.Companion.newRepository
|
|||||||
import com.looker.droidify.service.Connection
|
import com.looker.droidify.service.Connection
|
||||||
import com.looker.droidify.service.SyncService
|
import com.looker.droidify.service.SyncService
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
|
import kotlinx.coroutines.flow.SharedFlow
|
||||||
import kotlinx.coroutines.flow.asStateFlow
|
import kotlinx.coroutines.flow.asStateFlow
|
||||||
import kotlinx.coroutines.flow.collectLatest
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
@ -23,8 +25,8 @@ class RepositoriesViewModelX(val repositoryDao: RepositoryDao) : ViewModel() {
|
|||||||
|
|
||||||
val syncConnection = Connection(SyncService::class.java)
|
val syncConnection = Connection(SyncService::class.java)
|
||||||
|
|
||||||
private val _showSheet = MutableStateFlow<Long?>(null)
|
private val _showSheet = MutableSharedFlow<Long>()
|
||||||
val showSheet = _showSheet.asStateFlow()
|
val showSheet: SharedFlow<Long> = _showSheet
|
||||||
|
|
||||||
private val _repositories = MutableStateFlow<List<Repository>>(emptyList())
|
private val _repositories = MutableStateFlow<List<Repository>>(emptyList())
|
||||||
val repositories = _repositories.asStateFlow()
|
val repositories = _repositories.asStateFlow()
|
||||||
|
Reference in New Issue
Block a user