yayan 1 년 전
부모
커밋
cf0f07d384

+ 12 - 8
app/src/main/java/io/nexilis/alpha/ui/components/Attachments.kt

@@ -296,7 +296,7 @@ fun AttachmentButton(
     }
     }
 }
 }
 
 
-fun Context.getAttachmentItem(uri: Uri): AttachmentItem? {
+fun Context.toAttachmentItem(uri: Uri): AttachmentItem? {
     val item = contentResolver.query(uri, null, null, null, null)
     val item = contentResolver.query(uri, null, null, null, null)
         ?.use { cursor ->
         ?.use { cursor ->
             val nameIndex =
             val nameIndex =
@@ -357,6 +357,16 @@ val AttachmentItemListType = object : NavType<AttachmentItemList>(isNullableAllo
     }
     }
 }
 }
 
 
+fun AttachmentItemList.toArrayListUri() : ArrayList<Uri> {
+    val list = arrayListOf<Uri>()
+    this.list.forEach {
+        it?.let {
+            list.add(it.uri)
+        }
+    }
+    return list
+}
+
 @OptIn(ExperimentalLayoutApi::class)
 @OptIn(ExperimentalLayoutApi::class)
 @Composable
 @Composable
 fun AttachmentCaption(
 fun AttachmentCaption(
@@ -407,12 +417,6 @@ fun AttachmentCaption(
                 }
                 }
             }
             }
         }
         }
-        val list = arrayListOf<Uri>()
-        attachments.list.forEach {
-            it?.let {
-                list.add(it.uri)
-            }
-        }
         InputChat(
         InputChat(
             navController = navController,
             navController = navController,
             pin = pin,
             pin = pin,
@@ -421,7 +425,7 @@ fun AttachmentCaption(
             enableAttachment = false,
             enableAttachment = false,
             enableEmpty = true,
             enableEmpty = true,
             popAfterSent = true,
             popAfterSent = true,
-            attachments = list
+            attachments = attachments.toArrayListUri()
         )
         )
     }
     }
 }
 }

+ 3 - 3
app/src/main/java/io/nexilis/alpha/ui/components/BubleChat.kt

@@ -53,7 +53,7 @@ fun RightBubbleChat(
                     clip = true
                     clip = true
                 }
                 }
                 .combinedClickable(onLongClick = {}, onClick = {})
                 .combinedClickable(onLongClick = {}, onClick = {})
-                .background(color = MaterialTheme.colorScheme.primaryContainer),
+                .background(color = MaterialTheme.colorScheme.surfaceContainer),
             content = content
             content = content
         )
         )
         Row(
         Row(
@@ -67,7 +67,7 @@ fun RightBubbleChat(
                     message.server_date,
                     message.server_date,
                     DateUtils.FORMAT_SHOW_TIME
                     DateUtils.FORMAT_SHOW_TIME
                 ),
                 ),
-                color = MaterialTheme.colorScheme.onPrimaryContainer,
+                color = MaterialTheme.colorScheme.onSurface,
                 style = MaterialTheme.typography.bodySmall,
                 style = MaterialTheme.typography.bodySmall,
             )
             )
             Spacer(modifier = Modifier.width(6.dp))
             Spacer(modifier = Modifier.width(6.dp))
@@ -108,7 +108,7 @@ fun LeftBubbleChat(
                     clip = true
                     clip = true
                 }
                 }
                 .combinedClickable(onLongClick = {}, onClick = {})
                 .combinedClickable(onLongClick = {}, onClick = {})
-                .background(color = MaterialTheme.colorScheme.surface),
+                .background(color = MaterialTheme.colorScheme.surfaceContainerLowest),
             content = content
             content = content
         )
         )
         Row(
         Row(

+ 14 - 7
app/src/main/java/io/nexilis/alpha/ui/components/ContentChat.kt

@@ -48,7 +48,7 @@ fun ContentChat(modifier: Modifier, message: Message) {
                 painter = rememberAsyncImagePainter(uri),
                 painter = rememberAsyncImagePainter(uri),
                 contentDescription = "",
                 contentDescription = "",
                 modifier = modifier
                 modifier = modifier
-                    .aspectRatio(3f/4f)
+                    .aspectRatio(3f / 4f)
                     .graphicsLayer {
                     .graphicsLayer {
                         shape = RoundedCornerShape(12.dp)
                         shape = RoundedCornerShape(12.dp)
                         clip = true
                         clip = true
@@ -57,8 +57,9 @@ fun ContentChat(modifier: Modifier, message: Message) {
             )
             )
             if (message.message_text.isNotEmpty()) {
             if (message.message_text.isNotEmpty()) {
                 Text(
                 Text(
-                    modifier = Modifier.padding(8.dp),
                     text = message.message_text,
                     text = message.message_text,
+                    modifier = Modifier.padding(8.dp),
+                    color = MaterialTheme.colorScheme.onSurface,
                     style = MaterialTheme.typography.bodyMedium,
                     style = MaterialTheme.typography.bodyMedium,
                 )
                 )
             }
             }
@@ -74,7 +75,7 @@ fun ContentChat(modifier: Modifier, message: Message) {
                     shape = RoundedCornerShape(12.dp)
                     shape = RoundedCornerShape(12.dp)
                     clip = true
                     clip = true
                 }
                 }
-                .background(MaterialTheme.colorScheme.surfaceContainerHigh)) {
+                .background(MaterialTheme.colorScheme.surface)) {
                 Icon(
                 Icon(
                     modifier = Modifier
                     modifier = Modifier
                         .size(48.dp)
                         .size(48.dp)
@@ -94,12 +95,14 @@ fun ContentChat(modifier: Modifier, message: Message) {
                 ) {
                 ) {
                     Text(
                     Text(
                         text = message.message_text.split("|").first(),
                         text = message.message_text.split("|").first(),
+                        color = MaterialTheme.colorScheme.onSurface,
                         style = MaterialTheme.typography.bodyMedium,
                         style = MaterialTheme.typography.bodyMedium,
                         maxLines = 2,
                         maxLines = 2,
                         overflow = TextOverflow.Ellipsis
                         overflow = TextOverflow.Ellipsis
                     )
                     )
                     Text(
                     Text(
                         text = "11 KB • XLSX",
                         text = "11 KB • XLSX",
+                        color = MaterialTheme.colorScheme.onSurface,
                         style = MaterialTheme.typography.labelSmall,
                         style = MaterialTheme.typography.labelSmall,
                     )
                     )
                 }
                 }
@@ -107,8 +110,9 @@ fun ContentChat(modifier: Modifier, message: Message) {
             val messageText = message.message_text.split("|").last()
             val messageText = message.message_text.split("|").last()
             if (messageText.isNotEmpty()) {
             if (messageText.isNotEmpty()) {
                 Text(
                 Text(
-                    modifier = Modifier.padding(8.dp),
                     text = messageText,
                     text = messageText,
+                    modifier = Modifier.padding(8.dp),
+                    color = MaterialTheme.colorScheme.onSurface,
                     style = MaterialTheme.typography.bodyMedium,
                     style = MaterialTheme.typography.bodyMedium,
                 )
                 )
             }
             }
@@ -124,7 +128,7 @@ fun ContentChat(modifier: Modifier, message: Message) {
                     shape = RoundedCornerShape(12.dp)
                     shape = RoundedCornerShape(12.dp)
                     clip = true
                     clip = true
                 }
                 }
-                .background(MaterialTheme.colorScheme.surfaceContainerHigh)) {
+                .background(MaterialTheme.colorScheme.surface)) {
                 Icon(
                 Icon(
                     modifier = Modifier
                     modifier = Modifier
                         .size(48.dp)
                         .size(48.dp)
@@ -165,6 +169,7 @@ fun ContentChat(modifier: Modifier, message: Message) {
                             end = 8.dp,
                             end = 8.dp,
                             bottom = 8.dp
                             bottom = 8.dp
                         ),
                         ),
+                        color = MaterialTheme.colorScheme.onSurface,
                         text = message.message_text.split("|").first(),
                         text = message.message_text.split("|").first(),
                         style = MaterialTheme.typography.labelSmall,
                         style = MaterialTheme.typography.labelSmall,
                         maxLines = 1,
                         maxLines = 1,
@@ -175,16 +180,18 @@ fun ContentChat(modifier: Modifier, message: Message) {
             val messageText = message.message_text.split("|").last()
             val messageText = message.message_text.split("|").last()
             if (messageText.isNotEmpty()) {
             if (messageText.isNotEmpty()) {
                 Text(
                 Text(
-                    modifier = Modifier.padding(8.dp),
                     text = messageText,
                     text = messageText,
+                    modifier = Modifier.padding(8.dp),
+                    color = MaterialTheme.colorScheme.onSurface,
                     style = MaterialTheme.typography.bodyMedium,
                     style = MaterialTheme.typography.bodyMedium,
                 )
                 )
             }
             }
         }
         }
     } else {
     } else {
         Text(
         Text(
-            modifier = Modifier.padding(8.dp),
             text = message.message_text,
             text = message.message_text,
+            modifier = Modifier.padding(8.dp),
+            color = MaterialTheme.colorScheme.onSurface,
             style = MaterialTheme.typography.bodyMedium,
             style = MaterialTheme.typography.bodyMedium,
         )
         )
     }
     }

+ 12 - 12
app/src/main/java/io/nexilis/alpha/ui/components/InputChat.kt

@@ -75,11 +75,11 @@ fun InputChat(
                         shape = RoundedCornerShape(16.dp)
                         shape = RoundedCornerShape(16.dp)
                         clip = true
                         clip = true
                     }
                     }
-                    .background(MaterialTheme.colorScheme.surfaceContainer),
+                    .background(MaterialTheme.colorScheme.primaryContainer),
                 onAttachment = { list ->
                 onAttachment = { list ->
                     attachmentState.addAll(list)
                     attachmentState.addAll(list)
                     val items = list.map {
                     val items = list.map {
-                        context.getAttachmentItem(it)
+                        context.toAttachmentItem(it)
                     }
                     }
                     if (items.size == 1) {
                     if (items.size == 1) {
                         val params = AttachmentItemList(items)
                         val params = AttachmentItemList(items)
@@ -98,11 +98,11 @@ fun InputChat(
     TextField(
     TextField(
         modifier = Modifier
         modifier = Modifier
             .fillMaxWidth()
             .fillMaxWidth()
+            .padding(4.dp)
             .graphicsLayer {
             .graphicsLayer {
-                shape = CircleShape
+                shape = RoundedCornerShape(16.dp)
                 clip = true
                 clip = true
-            }
-            .padding(4.dp),
+            },
         value = textInput,
         value = textInput,
         onValueChange = { textInput = it },
         onValueChange = { textInput = it },
         label = null,
         label = null,
@@ -121,8 +121,8 @@ fun InputChat(
                     }
                     }
                     me.let {
                     me.let {
                         messageModel.send(
                         messageModel.send(
-                            context,
-                            Message(
+                            context = context,
+                            entity = Message(
                                 message_id = System.nanoTime().toString(),
                                 message_id = System.nanoTime().toString(),
                                 f_pin = it.f_pin,
                                 f_pin = it.f_pin,
                                 l_pin = pin,
                                 l_pin = pin,
@@ -150,9 +150,9 @@ fun InputChat(
             }
             }
         },
         },
         colors = TextFieldDefaults.colors(
         colors = TextFieldDefaults.colors(
-            focusedContainerColor = MaterialTheme.colorScheme.surfaceContainer,
-            unfocusedContainerColor = MaterialTheme.colorScheme.surfaceContainer,
-            disabledContainerColor = MaterialTheme.colorScheme.surfaceContainer,
+            focusedContainerColor = MaterialTheme.colorScheme.surfaceContainerHighest,
+            unfocusedContainerColor = MaterialTheme.colorScheme.surfaceContainerHighest,
+            disabledContainerColor = MaterialTheme.colorScheme.surfaceContainerHighest,
             focusedIndicatorColor = Color.Transparent,
             focusedIndicatorColor = Color.Transparent,
             unfocusedIndicatorColor = Color.Transparent,
             unfocusedIndicatorColor = Color.Transparent,
             disabledIndicatorColor = Color.Transparent,
             disabledIndicatorColor = Color.Transparent,
@@ -179,8 +179,8 @@ fun InputChat(
                             me.let {
                             me.let {
                                 attachmentState.forEach { uri ->
                                 attachmentState.forEach { uri ->
                                     messageModel.send(
                                     messageModel.send(
-                                        context,
-                                        Message(
+                                        context = context,
+                                        entity = Message(
                                             message_id = System.nanoTime().toString(),
                                             message_id = System.nanoTime().toString(),
                                             f_pin = it.f_pin,
                                             f_pin = it.f_pin,
                                             l_pin = pin,
                                             l_pin = pin,

+ 25 - 1
app/src/main/java/io/nexilis/alpha/ui/components/Person.kt

@@ -60,7 +60,31 @@ fun Person(buddy: Buddy) {
                     }
                     }
 
 
                     else -> {
                     else -> {
-                        Color(0xFF4c87ef)
+                        Color.Transparent
+                    }
+                }
+                Icon(
+                    imageVector = Icons.Default.Verified,
+                    contentDescription = "",
+                    modifier = Modifier
+                        .size(16.dp)
+                        .clip(CircleShape)
+                        .background(color = MaterialTheme.colorScheme.surface),
+                    tint = color
+                )
+            }
+            if (buddy.user_type != "0") {
+                val color: Color = when (buddy.user_type) {
+                    "23" -> {
+                        Color(0xFFFF0000)
+                    }
+
+                    "24" -> {
+                        Color(0xFFF89E00)
+                    }
+
+                    else -> {
+                        Color.Transparent
                     }
                     }
                 }
                 }
                 Icon(
                 Icon(

+ 4 - 1
app/src/main/java/io/nexilis/alpha/ui/components/Title.kt

@@ -9,6 +9,7 @@ import androidx.compose.runtime.getValue
 import androidx.compose.runtime.livedata.observeAsState
 import androidx.compose.runtime.livedata.observeAsState
 import androidx.compose.ui.Alignment
 import androidx.compose.ui.Alignment
 import androidx.compose.ui.Modifier
 import androidx.compose.ui.Modifier
+import androidx.compose.ui.text.style.TextOverflow
 import androidx.compose.ui.unit.dp
 import androidx.compose.ui.unit.dp
 import androidx.hilt.navigation.compose.hiltViewModel
 import androidx.hilt.navigation.compose.hiltViewModel
 import androidx.navigation.NavHostController
 import androidx.navigation.NavHostController
@@ -52,7 +53,9 @@ fun Title(navController: NavHostController, navMainController: NavHostController
                 Spacer(modifier = Modifier.width(8.dp))
                 Spacer(modifier = Modifier.width(8.dp))
                 Text(
                 Text(
                     modifier = Modifier.align(Alignment.CenterVertically),
                     modifier = Modifier.align(Alignment.CenterVertically),
-                    text = "${buddy?.first_name} ${it.last_name}".trim()
+                    text = "${buddy?.first_name} ${it.last_name}".trim(),
+                    overflow = TextOverflow.Ellipsis,
+                    maxLines = 1
                 )
                 )
             }
             }
         }
         }

+ 1 - 1
app/src/main/java/io/nexilis/alpha/ui/main/Contact.kt

@@ -35,7 +35,7 @@ fun Contact(navController: NavHostController) {
                     }),
                     }),
                     headlineContent = {
                     headlineContent = {
                         Text(
                         Text(
-                            it.first_name,
+                            "${it.first_name} ${it.last_name}".trim(),
                             style = MaterialTheme.typography.titleSmall
                             style = MaterialTheme.typography.titleSmall
                         )
                         )
                     },
                     },

+ 1 - 0
app/src/main/java/io/nexilis/alpha/ui/main/Friend.kt

@@ -190,6 +190,7 @@ fun SearchResultList(
                 TextButton(
                 TextButton(
                     onClick = {
                     onClick = {
                         viewModel.addFriend(buddy.f_pin)
                         viewModel.addFriend(buddy.f_pin)
+                        openAlertDialog.value = false
                     }
                     }
                 ) {
                 ) {
                     Text("Add")
                     Text("Add")