Removed Text custom element

This commit is contained in:
Juha Heinanen
2025-04-27 07:30:03 +03:00
parent 9f2faca51e
commit ec6cd0c362
5 changed files with 35 additions and 62 deletions

View File

@ -52,6 +52,7 @@ import androidx.compose.material3.IconButton
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
@ -80,7 +81,6 @@ import androidx.compose.ui.unit.sp
import androidx.lifecycle.Observer
import com.tutpro.baresip.CustomElements.AlertDialog
import com.tutpro.baresip.CustomElements.LabelText
import com.tutpro.baresip.CustomElements.Text
import com.tutpro.baresip.CustomElements.verticalScrollbar
import kotlinx.coroutines.launch
import java.text.DateFormat
@ -266,9 +266,8 @@ class ChatActivity : ComponentActivity() {
else
aor.split(":")[1]
Text(
text = headerText, modifier = Modifier
.fillMaxWidth()
.padding(top = 8.dp, bottom = 8.dp),
text = headerText,
modifier = Modifier.fillMaxWidth().padding(top = 8.dp, bottom = 8.dp),
fontSize = 18.sp,
fontWeight = FontWeight.SemiBold,
textAlign = TextAlign.Center
@ -470,7 +469,7 @@ class ChatActivity : ComponentActivity() {
val keyboardController = LocalSoftwareKeyboardController.current
OutlinedTextField(
value = newMessage,
placeholder = { Text(text = stringResource(R.string.new_message)) },
placeholder = { Text(stringResource(R.string.new_message)) },
onValueChange = { newMessage = it },
modifier = Modifier
.weight(1f)
@ -514,11 +513,7 @@ class ChatActivity : ComponentActivity() {
time.toString()
) != 0
) {
Toast.makeText(
ctx,
"${getString(R.string.message_failed)}!",
Toast.LENGTH_SHORT
).show()
Toast.makeText(ctx, "${getString(R.string.message_failed)}!", Toast.LENGTH_SHORT).show()
msg.direction = MESSAGE_UP_FAIL
msg.responseReason = getString(R.string.message_failed)
} else {
@ -551,7 +546,7 @@ class ChatActivity : ComponentActivity() {
modifier = Modifier.clickable { newMessage = "" }
)
} },
label = { LabelText(text = stringResource(R.string.new_message), fontSize = 16.sp) },
label = { LabelText(stringResource(R.string.new_message)) },
textStyle = TextStyle(fontSize = 18.sp),
keyboardOptions = KeyboardOptions(
capitalization = KeyboardCapitalization.Sentences,
@ -601,11 +596,7 @@ class ChatActivity : ComponentActivity() {
time.toString()
) != 0
) {
Toast.makeText(
ctx,
"${getString(R.string.message_failed)}!",
Toast.LENGTH_SHORT
).show()
Toast.makeText(ctx, "${getString(R.string.message_failed)}!", Toast.LENGTH_SHORT).show()
msg.direction = MESSAGE_UP_FAIL
msg.responseReason = getString(R.string.message_failed)
} else {

View File

@ -55,6 +55,7 @@ import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Scaffold
import androidx.compose.material3.SmallFloatingActionButton
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
@ -82,7 +83,6 @@ import com.tutpro.baresip.BaresipService.Companion.contactNames
import com.tutpro.baresip.CustomElements.AlertDialog
import com.tutpro.baresip.CustomElements.ImageAvatar
import com.tutpro.baresip.CustomElements.LabelText
import com.tutpro.baresip.CustomElements.Text
import com.tutpro.baresip.CustomElements.TextAvatar
import com.tutpro.baresip.CustomElements.verticalScrollbar
import com.tutpro.baresip.CustomElements.SelectableAlertDialog
@ -281,9 +281,9 @@ class ChatsActivity: ComponentActivity() {
else
aor.split(":")[1]
Text(
text = headerText, modifier = Modifier
.fillMaxWidth()
.padding(top = 8.dp, bottom = 8.dp),
text = headerText,
modifier = Modifier.fillMaxWidth().padding(top = 8.dp, bottom = 8.dp),
color = LocalCustomColors.current.itemText,
fontSize = 18.sp,
fontWeight = FontWeight.SemiBold,
textAlign = TextAlign.Center
@ -558,7 +558,7 @@ class ChatsActivity: ComponentActivity() {
OutlinedTextField(
value = newPeer,
placeholder = {
Text(text = stringResource(R.string.new_chat_peer))
Text(stringResource(R.string.new_chat_peer))
},
onValueChange = {
newPeer = it
@ -593,10 +593,7 @@ class ChatsActivity: ComponentActivity() {
)
},
label = {
LabelText(
text = stringResource(R.string.new_chat_peer),
fontSize = 16.sp
)
LabelText(stringResource(R.string.new_chat_peer))
},
textStyle = TextStyle(
fontSize = 18.sp,

View File

@ -596,7 +596,8 @@ class ConfigActivity : ComponentActivity() {
showAlert.value = true
},
textStyle = androidx.compose.ui.text.TextStyle(
fontSize = 18.sp, color = LocalCustomColors.current.itemText),
fontSize = 18.sp, color = LocalCustomColors.current.itemText
),
label = { LabelText(stringResource(R.string.dns_servers)) },
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text)
)

View File

@ -41,6 +41,7 @@ import androidx.compose.material3.IconButton
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.OutlinedTextFieldDefaults
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
@ -84,27 +85,6 @@ import androidx.core.content.ContextCompat.getString
object CustomElements {
@Composable
fun Text(
text: String,
modifier: Modifier = Modifier,
color: Color = LocalCustomColors.current.itemText,
fontSize: TextUnit = 16.sp,
fontWeight: FontWeight = FontWeight.Normal,
textAlign: TextAlign? = null,
maxLines: Int = Int.MAX_VALUE,
) {
androidx.compose.material3.Text(
text = text,
modifier = modifier,
color = color,
fontSize = fontSize,
fontWeight = fontWeight,
textAlign = textAlign,
maxLines = maxLines
)
}
@Composable
fun LabelText(
text: String,
@ -115,7 +95,7 @@ object CustomElements {
textAlign: TextAlign? = null,
maxLines: Int = 1,
) {
androidx.compose.material3.Text(
Text(
text = text,
modifier = modifier,
color = color,
@ -174,7 +154,12 @@ object CustomElements {
while (itemsIterator.hasNext()) {
val item = itemsIterator.next()
DropdownMenuItem(
text = { Text(item, color = LocalCustomColors.current.light) },
text = {
Text(
text = item,
color = LocalCustomColors.current.light,
fontSize = 16.sp
) },
onClick = { onItemClick(item) }
)
if (itemsIterator.hasNext())
@ -314,13 +299,13 @@ object CustomElements {
)
) {
Column(modifier = Modifier.padding(16.dp)) {
androidx.compose.material3.Text(
Text(
text = title,
fontSize = 20.sp,
color = LocalCustomColors.current.alert,
)
Spacer(modifier = Modifier.height(16.dp))
androidx.compose.material3.Text(
Text(
text = message,
fontSize = 16.sp,
color = LocalCustomColors.current.itemText,
@ -335,7 +320,7 @@ object CustomElements {
onPositiveClicked()
showDialog.value = false
}) {
androidx.compose.material3.Text(
Text(
text = positiveButtonText.uppercase(),
fontSize = 14.sp,
color = LocalCustomColors.current.alert,
@ -345,7 +330,7 @@ object CustomElements {
onNeutralClicked()
showDialog.value = false
}) {
androidx.compose.material3.Text(
Text(
text = neutralButtonText.uppercase(),
fontSize = 14.sp,
color = LocalCustomColors.current.alert
@ -355,7 +340,7 @@ object CustomElements {
onNegativeClicked()
showDialog.value = false
}) {
androidx.compose.material3.Text(
Text(
text = negativeButtonText.uppercase(),
fontSize = 14.sp,
color = LocalCustomColors.current.gray
@ -374,7 +359,7 @@ object CustomElements {
onNegativeClicked()
showDialog.value = false
}) {
androidx.compose.material3.Text(
Text(
text = negativeButtonText.uppercase(),
fontSize = 14.sp,
color = LocalCustomColors.current.gray
@ -385,7 +370,7 @@ object CustomElements {
onNeutralClicked()
showDialog.value = false
}) {
androidx.compose.material3.Text(
Text(
text = neutralButtonText.uppercase(),
fontSize = 14.sp,
color = LocalCustomColors.current.alert
@ -395,7 +380,7 @@ object CustomElements {
onPositiveClicked()
showDialog.value = false
}) {
androidx.compose.material3.Text(
Text(
text = positiveButtonText.uppercase(),
fontSize = 14.sp,
color = LocalCustomColors.current.alert,
@ -435,7 +420,7 @@ object CustomElements {
)
) {
Column(modifier = Modifier.padding(16.dp)) {
androidx.compose.material3.Text(
Text(
text = title,
fontSize = 20.sp,
color = LocalCustomColors.current.alert,
@ -457,7 +442,7 @@ object CustomElements {
},
modifier = Modifier.align(Alignment.End)
) {
androidx.compose.material3.Text(
Text(
text = item,
color = LocalCustomColors.current.itemText,
)
@ -471,7 +456,7 @@ object CustomElements {
openDialog.value = false
},
modifier = Modifier.align(Alignment.End)){
androidx.compose.material3.Text(
Text(
text = neutralButtonText.uppercase(),
color = LocalCustomColors.current.gray,
)

View File

@ -144,7 +144,6 @@ import com.tutpro.baresip.CustomElements.DropdownMenu
import com.tutpro.baresip.CustomElements.LabelText
import com.tutpro.baresip.CustomElements.PasswordDialog
import com.tutpro.baresip.CustomElements.SelectableAlertDialog
import com.tutpro.baresip.CustomElements.Text
import com.tutpro.baresip.CustomElements.verticalScrollbar
import kotlinx.coroutines.delay
import java.io.File
@ -1350,7 +1349,7 @@ class MainActivity : ComponentActivity() {
)
) {
Column(modifier = Modifier.padding(16.dp)) {
androidx.compose.material3.Text(
Text(
text = stringResource(R.string.call_transfer),
fontSize = 20.sp,
color = LocalCustomColors.current.alert,