Skip to content

New icon for "poll end" in both action menu and timeline item. #1203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,11 @@ fun aTimelineItemActionList(): ImmutableList<TimelineItemAction> {
}
fun aTimelineItemPollActionList(): ImmutableList<TimelineItemAction> {
return persistentListOf(
TimelineItemAction.Reply,
TimelineItemAction.EndPoll,
TimelineItemAction.Reply,
TimelineItemAction.Copy,
TimelineItemAction.Developer,
TimelineItemAction.ReportContent,
TimelineItemAction.Redact,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import io.element.android.libraries.designsystem.VectorIcons
import io.element.android.libraries.designsystem.preview.DayNightPreviews
import io.element.android.libraries.designsystem.preview.ElementPreview
import io.element.android.libraries.designsystem.theme.components.Icon
Expand Down Expand Up @@ -62,7 +63,7 @@ fun PollContentView(
.fillMaxWidth(),
verticalArrangement = Arrangement.spacedBy(16.dp),
) {
PollTitle(title = question)
PollTitle(title = question, isPollEnded = isPollEnded)

PollAnswers(answerItems = answerItems, onAnswerSelected = ::onAnswerSelected)

Expand All @@ -76,17 +77,26 @@ fun PollContentView(
@Composable
internal fun PollTitle(
title: String,
isPollEnded: Boolean,
modifier: Modifier = Modifier
) {
Row(
modifier = modifier,
horizontalArrangement = Arrangement.spacedBy(12.dp),
) {
Icon(
modifier = Modifier.size(22.dp),
imageVector = Icons.Outlined.Poll,
contentDescription = null
)
if (isPollEnded) {
Icon(
resourceId = VectorIcons.EndPoll,
contentDescription = null,
modifier = Modifier.size(22.dp)
)
} else {
Icon(
imageVector = Icons.Outlined.Poll,
contentDescription = null,
modifier = Modifier.size(22.dp)
)
}
Text(
text = title,
style = ElementTheme.typography.fontBodyLgMedium
Expand Down Expand Up @@ -170,7 +180,7 @@ internal fun PollContentEndedPreview() = ElementPreview {
question = "What type of food should we have at the party?",
answerItems = aPollAnswerItemList(isEnded = true),
pollKind = PollKind.Disclosed,
isPollEnded = false,
isPollEnded = true,
onAnswerSelected = { _, _ -> },
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ object VectorIcons {
val ReportContent = R.drawable.ic_report_content
val Groups = R.drawable.ic_groups
val Share = R.drawable.ic_share
val EndPoll = R.drawable.ic_done_24
val EndPoll = R.drawable.ic_poll_end
}
10 changes: 0 additions & 10 deletions libraries/designsystem/src/main/res/drawable/ic_done_24.xml

This file was deleted.

14 changes: 14 additions & 0 deletions libraries/designsystem/src/main/res/drawable/ic_poll_end.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="19dp"
android:viewportWidth="20"
android:viewportHeight="19">
<path
android:pathData="M18,8.659V17C18,17.55 17.804,18.021 17.413,18.413C17.021,18.804 16.55,19 16,19H2C1.45,19 0.979,18.804 0.587,18.413C0.196,18.021 0,17.55 0,17V3C0,2.45 0.196,1.979 0.587,1.587C0.979,1.196 1.45,1 2,1H10.341C10.12,1.626 10,2.299 10,3L2,3V17H16V9C16.701,9 17.374,8.88 18,8.659ZM5.713,14.712C5.521,14.904 5.283,15 5,15C4.717,15 4.479,14.904 4.287,14.712C4.096,14.521 4,14.283 4,14V9C4,8.717 4.096,8.479 4.287,8.288C4.479,8.096 4.717,8 5,8C5.283,8 5.521,8.096 5.713,8.288C5.904,8.479 6,8.717 6,9V14C6,14.283 5.904,14.521 5.713,14.712ZM9.712,14.712C9.521,14.904 9.283,15 9,15C8.717,15 8.479,14.904 8.288,14.712C8.096,14.521 8,14.283 8,14V6C8,5.717 8.096,5.479 8.288,5.287C8.479,5.096 8.717,5 9,5C9.283,5 9.521,5.096 9.712,5.287C9.904,5.479 10,5.717 10,6V14C10,14.283 9.904,14.521 9.712,14.712ZM13.712,14.712C13.521,14.904 13.283,15 13,15C12.717,15 12.479,14.904 12.288,14.712C12.096,14.521 12,14.283 12,14V12C12,11.717 12.096,11.479 12.288,11.288C12.479,11.096 12.717,11 13,11C13.283,11 13.521,11.096 13.712,11.288C13.904,11.479 14,11.717 14,12V14C14,14.283 13.904,14.521 13.712,14.712Z"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ⚠️ Very long vector path (1078 characters), which is bad for performance. Considering reducing precision, removing minor details or rasterizing vector.

android:fillColor="#1B1D22"
android:fillType="evenOdd"/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ⚠️ Attribute fillType is only used in API level 24 and higher (current min is 23)

<path
android:pathData="M19.707,0.293C20.098,0.683 20.098,1.317 19.707,1.707L15.707,5.707C15.317,6.098 14.683,6.098 14.293,5.707L12.293,3.707C11.902,3.317 11.902,2.683 12.293,2.293C12.683,1.902 13.317,1.902 13.707,2.293L15,3.586L18.293,0.293C18.683,-0.098 19.317,-0.098 19.707,0.293Z"
android:fillColor="#1B1D22"
android:fillType="evenOdd"/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ⚠️ Attribute fillType is only used in API level 24 and higher (current min is 23)

</vector>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.