Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
sowjanyakch 2024-07-18 21:58:28 +02:00 коммит произвёл Marcel Hibbe
Родитель acbda6f887
Коммит 9526825da7
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: C793F8B59F43CE7B
3 изменённых файлов: 47 добавлений и 64 удалений

Просмотреть файл

@ -15,7 +15,6 @@ import android.os.Bundle
import android.util.Log import android.util.Log
import androidx.activity.compose.setContent import androidx.activity.compose.setContent
import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.Image
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
@ -34,6 +33,7 @@ import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items import androidx.compose.foundation.lazy.items
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material.icons.automirrored.filled.List
import androidx.compose.material.icons.filled.Search import androidx.compose.material.icons.filled.Search
import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.ExperimentalMaterial3Api
@ -81,9 +81,9 @@ class ContactsActivityCompose : BaseActivity() {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
NextcloudTalkApplication.sharedApplication!!.componentApplication.inject(this) NextcloudTalkApplication.sharedApplication!!.componentApplication.inject(this)
contactsViewModel = ViewModelProvider(this, viewModelFactory)[ContactsViewModel::class.java] contactsViewModel = ViewModelProvider(this, viewModelFactory)[ContactsViewModel::class.java]
setContent { setContent {
val colorScheme = viewThemeUtils.getColorScheme(this) val colorScheme = viewThemeUtils.getColorScheme(this)
val uiState = contactsViewModel.contactsViewState.collectAsState()
MaterialTheme( MaterialTheme(
colorScheme = colorScheme colorScheme = colorScheme
) { ) {
@ -97,7 +97,6 @@ class ContactsActivityCompose : BaseActivity() {
) )
}, },
content = { content = {
val uiState = contactsViewModel.contactsViewState.collectAsState()
Column(Modifier.padding(it)) { Column(Modifier.padding(it)) {
ConversationCreationOptions(context = context) ConversationCreationOptions(context = context)
ContactsList( ContactsList(
@ -242,8 +241,10 @@ fun ContactItemRow(contact: AutocompleteUser, contactsViewModel: ContactsViewMod
fun AppBar(title: String, context: Context, contactsViewModel: ContactsViewModel) { fun AppBar(title: String, context: Context, contactsViewModel: ContactsViewModel) {
val searchQuery by contactsViewModel.searchQuery.collectAsState() val searchQuery by contactsViewModel.searchQuery.collectAsState()
val searchState = contactsViewModel.searchState.collectAsState() val searchState = contactsViewModel.searchState.collectAsState()
TopAppBar( TopAppBar(
title = { Text(text = title) }, title = { Text(text = title) },
navigationIcon = { navigationIcon = {
IconButton(onClick = { IconButton(onClick = {
(context as? Activity)?.finish() (context as? Activity)?.finish()
@ -278,14 +279,13 @@ fun ConversationCreationOptions(context: Context) {
modifier = Modifier.padding(start = 16.dp, end = 16.dp, top = 16.dp, bottom = 8.dp), modifier = Modifier.padding(start = 16.dp, end = 16.dp, top = 16.dp, bottom = 8.dp),
verticalAlignment = Alignment.CenterVertically verticalAlignment = Alignment.CenterVertically
) { ) {
Image( Icon(
painter = painterResource(id = R.drawable.baseline_chat_bubble_outline_24),
modifier = Modifier modifier = Modifier
.width(40.dp) .width(40.dp)
.height(40.dp) .height(40.dp)
.padding(8.dp), .padding(8.dp),
painter = painterResource(R.drawable.baseline_chat_bubble_outline_24), contentDescription = null
contentDescription = stringResource(R.string.new_conversation_creation_icon)
// colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.onSurface)
) )
Text( Text(
modifier = Modifier modifier = Modifier
@ -294,7 +294,6 @@ fun ConversationCreationOptions(context: Context) {
text = stringResource(R.string.nc_create_new_conversation), text = stringResource(R.string.nc_create_new_conversation),
maxLines = 1, maxLines = 1,
fontSize = 16.sp fontSize = 16.sp
// color = MaterialTheme.colorScheme.onSurface
) )
} }
Row( Row(
@ -306,14 +305,13 @@ fun ConversationCreationOptions(context: Context) {
}, },
verticalAlignment = Alignment.CenterVertically verticalAlignment = Alignment.CenterVertically
) { ) {
Image( Icon(
Icons.AutoMirrored.Filled.List,
modifier = Modifier modifier = Modifier
.width(40.dp) .width(40.dp)
.height(40.dp) .height(40.dp)
.padding(8.dp), .padding(8.dp),
painter = painterResource(R.drawable.baseline_format_list_bulleted_24), contentDescription = null
contentDescription = stringResource(R.string.join_open_conversations_icon)
// colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.onSurface)
) )
Text( Text(
modifier = Modifier modifier = Modifier

Просмотреть файл

@ -16,7 +16,6 @@ import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material.icons.filled.Close import androidx.compose.material.icons.filled.Close
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton import androidx.compose.material3.IconButton
import androidx.compose.material3.Surface
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.material3.TextField import androidx.compose.material3.TextField
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
@ -31,45 +30,36 @@ import com.nextcloud.talk.R
@Composable @Composable
fun DisplaySearch(text: String, onTextChange: (String) -> Unit, contactsViewModel: ContactsViewModel) { fun DisplaySearch(text: String, onTextChange: (String) -> Unit, contactsViewModel: ContactsViewModel) {
Surface( val keyboardController = LocalSoftwareKeyboardController.current
TextField(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.height(60.dp) .height(60.dp),
value = text,
onValueChange = { onTextChange(it) },
placeholder = {
Text(
text = stringResource(R.string.nc_search)
)
},
) { textStyle = TextStyle(
val keyboardController = LocalSoftwareKeyboardController.current fontSize = 16.sp
TextField( ),
modifier = Modifier singleLine = true,
.fillMaxWidth(), leadingIcon = {
// .background(MaterialTheme.colorScheme.surface), IconButton(
value = text, onClick = {
onValueChange = { onTextChange(it) }, onTextChange("")
placeholder = { contactsViewModel.updateSearchState(false)
Text(
text = stringResource(R.string.nc_search)
// color = MaterialTheme.colorScheme.onSurfaceVariant
)
},
textStyle = TextStyle(
// color = MaterialTheme.colorScheme.onSurface,
fontSize = 16.sp
),
singleLine = true,
leadingIcon = {
IconButton(
onClick = {
onTextChange("")
contactsViewModel.updateSearchState(false)
}
) {
Icon(
imageVector = Icons.AutoMirrored.Default.ArrowBack,
contentDescription = stringResource(R.string.back_button)
// tint = MaterialTheme.colorScheme.onSurface
)
} }
}, ) {
Icon(
imageVector = Icons.AutoMirrored.Default.ArrowBack,
contentDescription = stringResource(R.string.back_button)
)
}
},
trailingIcon = { trailingIcon = {
if (text.isNotEmpty()) { if (text.isNotEmpty()) {
@ -91,19 +81,15 @@ fun DisplaySearch(text: String, onTextChange: (String) -> Unit, contactsViewMode
imeAction = ImeAction.Search imeAction = ImeAction.Search
), ),
keyboardActions = KeyboardActions( keyboardActions = KeyboardActions(
onSearch = { onSearch = {
if (text.trim().isNotEmpty()) { if (text.trim().isNotEmpty()) {
keyboardController?.hide() keyboardController?.hide()
} else { } else {
return@KeyboardActions return@KeyboardActions
}
} }
), }
maxLines = 1 ),
// colors = TextFieldDefaults.colors( maxLines = 1
// cursorColor = Color.Blue )
// )
)
}
} }

Просмотреть файл

@ -7,5 +7,4 @@
package com.nextcloud.talk.contacts.apiService package com.nextcloud.talk.contacts.apiService
object FakeItem { object FakeItem
}