Improve text style & appearance [2/2]

This commit is contained in:
Rahul Patel
2024-09-04 00:56:41 +05:30
committed by Aayush Gupta
parent 7f3ec54a35
commit 377a45f213
2 changed files with 45 additions and 19 deletions

View File

@@ -43,6 +43,7 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp
import androidx.compose.ui.util.fastForEach import androidx.compose.ui.util.fastForEach
@@ -112,10 +113,7 @@ class MoreDialogFragment : DialogFragment() {
Alignment.CenterVertically Alignment.CenterVertically
) )
) { ) {
AppBar( AppBar(onBackgroundColor = onPrimaryColor)
backgroundColor = primaryColor,
onBackgroundColor = onPrimaryColor
)
AccountHeader( AccountHeader(
backgroundColor = secondaryColor, backgroundColor = secondaryColor,
onBackgroundColor = onSecondaryColor onBackgroundColor = onSecondaryColor
@@ -155,7 +153,7 @@ class MoreDialogFragment : DialogFragment() {
} }
@Composable @Composable
fun AppBar(backgroundColor: Color = Color.Transparent, onBackgroundColor: Color) { fun AppBar(onBackgroundColor: Color) {
Row( Row(
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.SpaceBetween, horizontalArrangement = Arrangement.SpaceBetween,
@@ -194,7 +192,10 @@ class MoreDialogFragment : DialogFragment() {
Text( Text(
text = stringResource(id = R.string.privacy_policy_title), text = stringResource(id = R.string.privacy_policy_title),
fontWeight = FontWeight.Light, fontWeight = FontWeight.Light,
color = tintColor color = tintColor,
fontSize = 12.sp,
maxLines = 1,
overflow = TextOverflow.Ellipsis
) )
} }
Text(text = "", color = tintColor) Text(text = "", color = tintColor)
@@ -202,7 +203,10 @@ class MoreDialogFragment : DialogFragment() {
Text( Text(
text = stringResource(id = R.string.menu_terms), text = stringResource(id = R.string.menu_terms),
fontWeight = FontWeight.Light, fontWeight = FontWeight.Light,
color = tintColor color = tintColor,
fontSize = 12.sp,
maxLines = 1,
overflow = TextOverflow.Ellipsis
) )
} }
} }
@@ -234,7 +238,13 @@ class MoreDialogFragment : DialogFragment() {
) { ) {
SubcomposeAsyncImage( SubcomposeAsyncImage(
model = ImageRequest.Builder(LocalContext.current) model = ImageRequest.Builder(LocalContext.current)
.data(if (authProvider.isAnonymous) R.mipmap.ic_launcher else authProvider.authData?.userProfile?.artwork?.url) .data(
if (authProvider.isAnonymous) {
R.mipmap.ic_launcher
} else {
authProvider.authData?.userProfile?.artwork?.url
}
)
.placeholder(R.drawable.ic_account) .placeholder(R.drawable.ic_account)
.crossfade(true) .crossfade(true)
.build(), .build(),
@@ -249,16 +259,28 @@ class MoreDialogFragment : DialogFragment() {
horizontalAlignment = Alignment.Start horizontalAlignment = Alignment.Start
) { ) {
Text( Text(
text = if (authProvider.isAnonymous) "Anonymous" else authProvider.authData!!.userProfile!!.name, text = if (authProvider.isAnonymous) {
"Anonymous"
} else {
authProvider.authData!!.userProfile!!.name
},
fontWeight = FontWeight.Normal, fontWeight = FontWeight.Normal,
fontSize = 16.sp, color = onBackgroundColor,
color = onBackgroundColor fontSize = 15.sp,
maxLines = 1,
overflow = TextOverflow.Ellipsis
) )
Text( Text(
text = if (authProvider.isAnonymous) "anonymous@gmail.com" else authProvider.authData!!.userProfile!!.email, text = if (authProvider.isAnonymous) {
"anonymous@gmail.com"
} else {
authProvider.authData!!.userProfile!!.email
},
fontWeight = FontWeight.Light, fontWeight = FontWeight.Light,
color = onBackgroundColor,
fontSize = 14.sp, fontSize = 14.sp,
color = onBackgroundColor maxLines = 1,
overflow = TextOverflow.Ellipsis
) )
} }
} }
@@ -274,7 +296,9 @@ class MoreDialogFragment : DialogFragment() {
Text( Text(
text = stringResource(id = R.string.manage_account), text = stringResource(id = R.string.manage_account),
color = onBackgroundColor, color = onBackgroundColor,
fontWeight = FontWeight.Medium fontWeight = FontWeight.Normal,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
) )
} }
} }
@@ -306,7 +330,9 @@ class MoreDialogFragment : DialogFragment() {
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
text = stringResource(id = option.title), text = stringResource(id = option.title),
color = textColor, color = textColor,
fontSize = 15.sp, fontSize = 14.sp,
maxLines = 1,
overflow = TextOverflow.Ellipsis
) )
} }
} }

View File

@@ -31,8 +31,8 @@
tools:ignore="UselessParent"> tools:ignore="UselessParent">
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="match_parent"> android:layout_height="wrap_content">
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/btnPositive" android:id="@+id/btnPositive"
@@ -43,7 +43,7 @@
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
@@ -56,7 +56,7 @@
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton