From a4376c4aa8ea0aef5499e65f96ac7947024012d8 Mon Sep 17 00:00:00 2001 From: "omer.habib" Date: Wed, 9 Oct 2024 18:47:10 +0500 Subject: [PATCH] fix: Address PR comments - 1 --- .../comments/DiscussionCommentsFragment.kt | 11 +++----- .../presentation/ui/DiscussionUI.kt | 26 ++++++++++--------- .../main/res/drawable/discussion_ic_like.xml | 13 ---------- .../drawable/discussion_ic_like_success.xml | 17 ------------ 4 files changed, 18 insertions(+), 49 deletions(-) delete mode 100644 discussion/src/main/res/drawable/discussion_ic_like.xml delete mode 100644 discussion/src/main/res/drawable/discussion_ic_like_success.xml diff --git a/discussion/src/main/java/org/openedx/discussion/presentation/comments/DiscussionCommentsFragment.kt b/discussion/src/main/java/org/openedx/discussion/presentation/comments/DiscussionCommentsFragment.kt index 54505c20c..164335846 100644 --- a/discussion/src/main/java/org/openedx/discussion/presentation/comments/DiscussionCommentsFragment.kt +++ b/discussion/src/main/java/org/openedx/discussion/presentation/comments/DiscussionCommentsFragment.kt @@ -24,8 +24,8 @@ import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.ui.Alignment import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.alpha import androidx.compose.ui.draw.clip -import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.ComposeView import androidx.compose.ui.platform.LocalFocusManager import androidx.compose.ui.platform.LocalSoftwareKeyboardController @@ -190,11 +190,7 @@ private fun DiscussionCommentsScreen( mutableStateOf("") } - val sendButtonColor = if (responseValue.isEmpty()) { - MaterialTheme.appColors.primaryButtonBackground.copy(alpha = 0.3f) - } else { - MaterialTheme.appColors.primaryButtonBackground - } + val sendButtonAlpha = if (responseValue.isEmpty()) 0.3f else 1f Scaffold( scaffoldState = scaffoldState, @@ -398,7 +394,8 @@ private fun DiscussionCommentsScreen( modifier = Modifier .size(48.dp) .clip(CircleShape) - .background(sendButtonColor) + .alpha(sendButtonAlpha) + .background(MaterialTheme.appColors.primaryButtonBackground) .clickable { keyboardController?.hide() focusManager.clearFocus() diff --git a/discussion/src/main/java/org/openedx/discussion/presentation/ui/DiscussionUI.kt b/discussion/src/main/java/org/openedx/discussion/presentation/ui/DiscussionUI.kt index c95790e31..30d78ac9d 100644 --- a/discussion/src/main/java/org/openedx/discussion/presentation/ui/DiscussionUI.kt +++ b/discussion/src/main/java/org/openedx/discussion/presentation/ui/DiscussionUI.kt @@ -29,6 +29,8 @@ import androidx.compose.material.Text import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.outlined.HelpOutline import androidx.compose.material.icons.filled.ChevronRight +import androidx.compose.material.icons.filled.ThumbUp +import androidx.compose.material.icons.outlined.ThumbUp import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.ExperimentalComposeUiApi @@ -77,10 +79,10 @@ fun ThreadMainItem( CoreR.drawable.core_ic_default_profile_picture } - val votePainter = if (thread.voted) { - painterResource(id = R.drawable.discussion_ic_like_success) + val voteIcon = if (thread.voted) { + Icons.Filled.ThumbUp } else { - painterResource(id = R.drawable.discussion_ic_like) + Icons.Outlined.ThumbUp } val reportText = if (thread.abuseFlagged) { stringResource(id = R.string.discussion_unreport) @@ -168,7 +170,7 @@ fun ThreadMainItem( thread.voteCount, thread.voteCount ), - painter = votePainter, + icon = voteIcon, color = MaterialTheme.appColors.textPrimary, textStyle = MaterialTheme.appTypography.labelLarge, onClick = { @@ -219,10 +221,10 @@ fun CommentItem( } else { MaterialTheme.appColors.textPrimary } - val votePainter = if (comment.voted) { - painterResource(id = R.drawable.discussion_ic_like_success) + val voteIcon = if (comment.voted) { + Icons.Filled.ThumbUp } else { - painterResource(id = R.drawable.discussion_ic_like) + Icons.Outlined.ThumbUp } val context = LocalContext.current @@ -317,7 +319,7 @@ fun CommentItem( comment.voteCount, comment.voteCount ), - painter = votePainter, + icon = voteIcon, color = MaterialTheme.appColors.textPrimary, textStyle = MaterialTheme.appTypography.labelLarge, onClick = { @@ -375,10 +377,10 @@ fun CommentMainItem( MaterialTheme.appColors.textPrimary } - val votePainter = if (comment.voted) { - painterResource(id = R.drawable.discussion_ic_like_success) + val voteIcon = if (comment.voted) { + Icons.Filled.ThumbUp } else { - painterResource(id = R.drawable.discussion_ic_like) + Icons.Outlined.ThumbUp } val context = LocalContext.current @@ -452,7 +454,7 @@ fun CommentMainItem( comment.voteCount, comment.voteCount ), - painter = votePainter, + icon = voteIcon, color = MaterialTheme.appColors.textPrimary, textStyle = MaterialTheme.appTypography.labelLarge, onClick = { diff --git a/discussion/src/main/res/drawable/discussion_ic_like.xml b/discussion/src/main/res/drawable/discussion_ic_like.xml deleted file mode 100644 index 163cf466f..000000000 --- a/discussion/src/main/res/drawable/discussion_ic_like.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - diff --git a/discussion/src/main/res/drawable/discussion_ic_like_success.xml b/discussion/src/main/res/drawable/discussion_ic_like_success.xml deleted file mode 100644 index cb62acf79..000000000 --- a/discussion/src/main/res/drawable/discussion_ic_like_success.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - -