mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-09 22:04:24 +01:00
Add button to add participants
Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
parent
eb75f488c5
commit
29d5293587
@ -20,8 +20,10 @@ import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.material3.TopAppBar
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
@ -54,23 +56,25 @@ fun AppBar(
|
||||
}
|
||||
},
|
||||
actions = {
|
||||
IconButton(onClick = onEnableSearch) {
|
||||
Icon(Icons.Filled.Search, contentDescription = stringResource(R.string.search_icon))
|
||||
}
|
||||
if (isAddParticipants) {
|
||||
Text(
|
||||
text = stringResource(id = R.string.nc_contacts_done),
|
||||
modifier = Modifier.clickable {
|
||||
val resultIntent = Intent().apply {
|
||||
putParcelableArrayListExtra(
|
||||
"selectedParticipants",
|
||||
ArrayList(autocompleteUsers)
|
||||
)
|
||||
if (!isSearchActive) {
|
||||
IconButton(onClick = onEnableSearch) {
|
||||
Icon(Icons.Filled.Search, contentDescription = stringResource(R.string.search_icon))
|
||||
}
|
||||
if (isAddParticipants) {
|
||||
Text(
|
||||
text = stringResource(id = R.string.nc_contacts_done),
|
||||
modifier = Modifier.clickable {
|
||||
val resultIntent = Intent().apply {
|
||||
putParcelableArrayListExtra(
|
||||
"selectedParticipants",
|
||||
ArrayList(autocompleteUsers)
|
||||
)
|
||||
}
|
||||
(context as? Activity)?.setResult(Activity.RESULT_OK, resultIntent)
|
||||
(context as? Activity)?.finish()
|
||||
}
|
||||
(context as? Activity)?.setResult(Activity.RESULT_OK, resultIntent)
|
||||
(context as? Activity)?.finish()
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
@ -84,6 +88,18 @@ fun AppBar(
|
||||
},
|
||||
onDisableSearch = onDisableSearch
|
||||
)
|
||||
|
||||
if (searchQuery.isNotEmpty() && isAddParticipants) {
|
||||
TextButton(
|
||||
modifier = Modifier.align(Alignment.CenterVertically),
|
||||
onClick = {
|
||||
onDisableSearch()
|
||||
onUpdateSearchQuery("")
|
||||
}
|
||||
) {
|
||||
Text(text = "Add")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,11 +36,10 @@ import com.nextcloud.talk.R
|
||||
@Composable
|
||||
fun SearchComponent(text: String, onTextChange: (String) -> Unit, onDisableSearch: () -> Unit) {
|
||||
val keyboardController = LocalSoftwareKeyboardController.current
|
||||
|
||||
TextField(
|
||||
modifier = Modifier
|
||||
.background(MaterialTheme.colorScheme.background)
|
||||
.fillMaxWidth()
|
||||
.fillMaxWidth(0.85f)
|
||||
.height(60.dp),
|
||||
value = text,
|
||||
onValueChange = { onTextChange(it) },
|
||||
|
Loading…
Reference in New Issue
Block a user