mirror of
https://github.com/nextcloud/android.git
synced 2024-11-22 13:15:35 +03:00
UI fixes
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
ae4cbb9e12
commit
bc1663616c
4 changed files with 14 additions and 19 deletions
|
@ -21,7 +21,6 @@
|
|||
|
||||
package com.nextcloud.client.assistant.component
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import androidx.compose.animation.animateContentSize
|
||||
import androidx.compose.animation.core.Spring
|
||||
import androidx.compose.animation.core.spring
|
||||
|
@ -34,9 +33,9 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
|||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.HorizontalDivider
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
|
@ -47,58 +46,54 @@ import androidx.compose.ui.graphics.Color
|
|||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.nextcloud.ui.composeActivity.ComposeActivity.Companion.schemeFlow
|
||||
import com.nextcloud.ui.composeActivity.ComposeActivity.Companion.colorScheme
|
||||
import com.nextcloud.ui.composeComponents.bottomSheet.MoreActionsBottomSheet
|
||||
import com.owncloud.android.R
|
||||
import com.owncloud.android.lib.resources.assistant.model.Task
|
||||
|
||||
@OptIn(ExperimentalFoundationApi::class)
|
||||
@SuppressLint("ResourceAsColor")
|
||||
@Suppress("LongMethod", "MagicNumber")
|
||||
@Composable
|
||||
fun TaskView(
|
||||
task: Task,
|
||||
showDeleteTaskAlertDialog: (Long) -> Unit
|
||||
) {
|
||||
val scheme = schemeFlow.collectAsState().value
|
||||
var expanded by remember { mutableStateOf(false) }
|
||||
var showMoreActionsBottomSheet by remember { mutableStateOf(false) }
|
||||
|
||||
// TODO Check color
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.clip(RoundedCornerShape(16.dp))
|
||||
.background(scheme.primary)
|
||||
.background(colorScheme.primary)
|
||||
.combinedClickable(onClick = {
|
||||
expanded = !expanded
|
||||
}, onLongClick = {
|
||||
showMoreActionsBottomSheet = true
|
||||
})
|
||||
.padding(start = 8.dp)
|
||||
) {
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
|
||||
Text(
|
||||
text = stringResource(id = R.string.assistant_screen_task_view_input),
|
||||
modifier = Modifier.padding(4.dp),
|
||||
color = Color.White
|
||||
)
|
||||
|
||||
task.input?.let {
|
||||
Text(
|
||||
text = it,
|
||||
modifier = Modifier.padding(4.dp),
|
||||
color = Color.White
|
||||
)
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
Spacer(modifier = Modifier.height(4.dp))
|
||||
HorizontalDivider()
|
||||
Spacer(modifier = Modifier.height(4.dp))
|
||||
|
||||
Text(
|
||||
text = stringResource(id = R.string.assistant_screen_task_view_output),
|
||||
color = Color.White,
|
||||
modifier = Modifier
|
||||
.padding(4.dp)
|
||||
)
|
||||
|
||||
task.output?.let {
|
||||
|
@ -112,7 +107,6 @@ fun TaskView(
|
|||
stiffness = Spring.StiffnessLow
|
||||
)
|
||||
)
|
||||
.padding(4.dp)
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,6 @@ import com.owncloud.android.lib.common.accounts.AccountUtils
|
|||
import com.owncloud.android.lib.common.utils.Log_OC
|
||||
import com.owncloud.android.ui.activity.DrawerActivity
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
class ComposeActivity : DrawerActivity() {
|
||||
|
@ -57,7 +56,7 @@ class ComposeActivity : DrawerActivity() {
|
|||
const val TITLE = "TITLE"
|
||||
const val MENU_ITEM = "MENU_ITEM"
|
||||
|
||||
lateinit var schemeFlow: MutableStateFlow<ColorScheme>
|
||||
lateinit var colorScheme: ColorScheme
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
|
@ -74,9 +73,7 @@ class ComposeActivity : DrawerActivity() {
|
|||
updateActionBarTitleAndHomeButtonByString(getString(titleId))
|
||||
|
||||
setupDrawer(menuItemId)
|
||||
|
||||
val colorScheme = viewThemeUtils.getScheme(this).toColorScheme()
|
||||
schemeFlow = MutableStateFlow(colorScheme)
|
||||
colorScheme = viewThemeUtils.getScheme(this).toColorScheme()
|
||||
|
||||
binding.composeView.setContent {
|
||||
MaterialTheme(
|
||||
|
|
|
@ -27,6 +27,7 @@ import androidx.compose.foundation.layout.fillMaxHeight
|
|||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.FilledTonalButton
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.runtime.Composable
|
||||
|
@ -72,7 +73,7 @@ fun SimpleAlertDialog(
|
|||
}
|
||||
},
|
||||
confirmButton = {
|
||||
TextButton(onClick = {
|
||||
FilledTonalButton(onClick = {
|
||||
onComplete()
|
||||
dismiss()
|
||||
}) {
|
||||
|
|
|
@ -14,10 +14,12 @@ import androidx.compose.foundation.layout.size
|
|||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.MaterialTheme.colorScheme
|
||||
import androidx.compose.material3.ModalBottomSheet
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.rememberModalBottomSheetState
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
|
@ -80,6 +82,7 @@ fun MoreActionsBottomSheet(
|
|||
Icon(
|
||||
painter = painterResource(id = action.first),
|
||||
contentDescription = "action icon",
|
||||
tint = colorScheme.primary,
|
||||
modifier = Modifier.size(20.dp)
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue