-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
screen: AboutUs: Update for contact and website
Signed-off-by: Shashank Verma <[email protected]>
- Loading branch information
Showing
3 changed files
with
97 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
package com.mnnit.moticlubs.ui.components.aboutus | ||
|
||
import android.widget.Toast | ||
import android.content.Intent | ||
import android.net.Uri | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.imePadding | ||
|
@@ -28,6 +29,7 @@ import androidx.compose.ui.platform.LocalSoftwareKeyboardController | |
import androidx.compose.ui.text.input.KeyboardType | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.sp | ||
import com.mnnit.moticlubs.domain.util.getUserId | ||
import com.mnnit.moticlubs.domain.util.getValue | ||
import com.mnnit.moticlubs.domain.util.isTrimmedNotEmpty | ||
import com.mnnit.moticlubs.domain.util.publishedStateOf | ||
|
@@ -39,7 +41,7 @@ fun AboutUsContactForm(modifier: Modifier = Modifier) { | |
val context = LocalContext.current | ||
val keyboardController = LocalSoftwareKeyboardController.current | ||
|
||
var name by remember { publishedStateOf("") } | ||
var subject by remember { publishedStateOf("") } | ||
var postMsg by remember { publishedStateOf("") } | ||
|
||
Surface( | ||
|
@@ -58,10 +60,10 @@ fun AboutUsContactForm(modifier: Modifier = Modifier) { | |
modifier = Modifier | ||
.fillMaxWidth() | ||
.imePadding(), | ||
value = name, | ||
onValueChange = { name = it }, | ||
value = subject, | ||
onValueChange = { subject = it }, | ||
shape = RoundedCornerShape(24.dp), | ||
label = { Text(text = "Name") }, | ||
label = { Text(text = "Subject") }, | ||
keyboardOptions = KeyboardOptions.Default.copy(keyboardType = KeyboardType.Text), | ||
colors = OutlinedTextFieldDefaults.colors( | ||
disabledTextColor = contentColorFor(backgroundColor = colorScheme.background), | ||
|
@@ -89,14 +91,21 @@ fun AboutUsContactForm(modifier: Modifier = Modifier) { | |
AssistChip( | ||
onClick = { | ||
keyboardController?.hide() | ||
Toast.makeText(context, "No Domain 🤨", Toast.LENGTH_SHORT).show() | ||
context.startActivity( | ||
Intent(Intent.ACTION_SENDTO).apply { | ||
data = Uri.parse( | ||
"mailto:[email protected]?subject=[MotiClubs - Query] $subject" + | ||
"&body=[ID - ${context.getUserId()}]\n\n$postMsg", | ||
) | ||
}, | ||
) | ||
}, | ||
label = { | ||
Text( | ||
text = "Send", | ||
fontSize = 14.sp, | ||
color = contentColorFor( | ||
backgroundColor = if (postMsg.isTrimmedNotEmpty() && name.isTrimmedNotEmpty()) { | ||
backgroundColor = if (postMsg.isTrimmedNotEmpty() && subject.isTrimmedNotEmpty()) { | ||
colorScheme.primary | ||
} else { | ||
colorScheme.onSurface.copy(alpha = 0.38f) | ||
|
@@ -110,7 +119,7 @@ fun AboutUsContactForm(modifier: Modifier = Modifier) { | |
painter = rememberVectorPainter(image = Icons.Rounded.Send), | ||
contentDescription = "", | ||
tint = contentColorFor( | ||
backgroundColor = if (postMsg.isTrimmedNotEmpty() && name.isTrimmedNotEmpty()) { | ||
backgroundColor = if (postMsg.isTrimmedNotEmpty() && subject.isTrimmedNotEmpty()) { | ||
colorScheme.primary | ||
} else { | ||
colorScheme.onSurface.copy(alpha = 0.38f) | ||
|
@@ -124,7 +133,7 @@ fun AboutUsContactForm(modifier: Modifier = Modifier) { | |
.align(Alignment.End), | ||
shape = RoundedCornerShape(24.dp), | ||
colors = AssistChipDefaults.assistChipColors(containerColor = colorScheme.primary), | ||
enabled = postMsg.isTrimmedNotEmpty() && name.isTrimmedNotEmpty(), | ||
enabled = postMsg.isTrimmedNotEmpty() && subject.isTrimmedNotEmpty(), | ||
) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters