Skip to content

Commit

Permalink
UI Fixes
Browse files Browse the repository at this point in the history
Signed-off-by: alperozturk <[email protected]>
  • Loading branch information
alperozturk96 committed Mar 4, 2024
1 parent 53bcb2a commit dd108a6
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 21 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ android {
}

composeOptions {
kotlinCompilerExtensionVersion = "1.5.9"
kotlinCompilerExtensionVersion = "1.5.10"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.nextcloud.client.assistant.repository.AssistantRepository
import com.nextcloud.common.NextcloudClient
import com.owncloud.android.MainApp
import com.owncloud.android.R
import com.owncloud.android.lib.resources.assistant.model.Task
import com.owncloud.android.lib.resources.assistant.model.TaskType
import kotlinx.coroutines.Dispatchers
Expand Down Expand Up @@ -84,7 +86,8 @@ class AssistantViewModel(client: NextcloudClient) : ViewModel() {

private fun getTaskTypes() {
viewModelScope.launch(Dispatchers.IO) {
val result = arrayListOf(TaskType(null, "All", null))
val allTaskType = MainApp.getAppContext().getString(R.string.assistant_screen_all_task_type)
val result = arrayListOf(TaskType(null, allTaskType, null))
val taskTypes = repository.getTaskTypes().resultData.types ?: listOf()
result.addAll(taskTypes)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,22 +117,17 @@ fun AssistantScreen(viewModel: AssistantViewModel) {
LinearProgressIndicator(progress = { pullRefreshState.progress }, modifier = Modifier.fillMaxWidth())
}

FloatingActionButton(
modifier = Modifier
.align(Alignment.BottomEnd)
.padding(16.dp),
onClick = {
if (selectedTaskType?.id != null) {
if (selectedTaskType?.name != stringResource(id = R.string.assistant_screen_all_task_type)) {
FloatingActionButton(
modifier = Modifier
.align(Alignment.BottomEnd)
.padding(16.dp),
onClick = {
showAddTaskAlertDialog = true
} else {
DisplayUtils.showSnackMessage(
activity,
activity.getString(R.string.assistant_screen_select_different_task_type_to_add)
)
}
) {
Icon(Icons.Filled.Add, "Add Task Icon")
}
) {
Icon(Icons.Filled.Add, "Add Task Icon")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ 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 androidx.compose.ui.unit.sp
import com.nextcloud.ui.composeComponents.bottomSheet.MoreActionsBottomSheet
import com.owncloud.android.R
import com.owncloud.android.lib.resources.assistant.model.Task
Expand Down Expand Up @@ -78,18 +79,22 @@ fun TaskView(
task.input?.let {
Text(
text = stringResource(id = R.string.assistant_screen_task_view_input, it),
color = Color.White
color = Color.White,
fontSize = 18.sp,
)
}

HorizontalDivider(modifier = Modifier.padding(horizontal = 4.dp, vertical = 8.dp))
Spacer(modifier = Modifier.height(16.dp))

task.output?.let {
HorizontalDivider(modifier = Modifier.padding(horizontal = 4.dp, vertical = 8.dp))

Text(
text = stringResource(
id = R.string.assistant_screen_task_view_output,
if (expanded) it else it.take(100) + "..."
),
fontSize = 12.sp,
color = Color.White,
modifier = Modifier
.animateContentSize(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class ComposeActivity : DrawerActivity() {

binding.composeView.setContent {
MaterialTheme(
colorScheme = viewThemeUtils.getColorScheme(this),
// colorScheme = viewThemeUtils.getColorScheme(this),
content = {
Content(destination, storageManager.user, this)
}
Expand Down
5 changes: 2 additions & 3 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
<string name="assistant_screen_delete_task_alert_dialog_title">Delete Task</string>
<string name="assistant_screen_delete_task_alert_dialog_description">Are you sure you want to delete this task?</string>

<string name="assistant_screen_select_different_task_type_to_add">Please select different task type to create a new task</string>

<string name="assistant_screen_task_more_actions_bottom_sheet_delete_action">Delete Task</string>

<string name="assistant_screen_task_create_success_message">Task successfully created</string>
Expand All @@ -36,7 +34,8 @@

<string name="assistant_screen_create_task_alert_dialog_input_field_placeholder">Type some text</string>

<string name="assistant_screen_task_view_input">Input\n%s</string>
<string name="assistant_screen_all_task_type">All</string>
<string name="assistant_screen_task_view_input">Input %s</string>
<string name="assistant_screen_task_view_output">Output\n%s</string>
<string name="assistant_screen_task_view_show_more">Show more</string>
<string name="assistant_screen_task_view_show_less">Show less</string>
Expand Down

0 comments on commit dd108a6

Please sign in to comment.