Use material icons while design system is not ready

This commit is contained in:
Florian Renaud
2023-03-08 11:41:05 +01:00
parent 93567aed02
commit b81f91b563
9 changed files with 44 additions and 88 deletions

View File

@@ -19,6 +19,9 @@ package io.element.android.features.createroom.root
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Close
import androidx.compose.material.icons.filled.Search
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.SearchBarDefaults
import androidx.compose.runtime.Composable
@@ -85,7 +88,7 @@ fun CreateRoomRootScreen(
if (!isSearchActive) {
TextIconButton(
modifier = Modifier.padding(start = 8.dp, top = 16.dp, end = 8.dp),
imageVector = ImageVector.vectorResource(DrawableR.drawable.ic_group),
imageVector = ImageVector.vectorResource(DrawableR.drawable.ic_groups),
text = stringResource(id = StringR.string.new_room),
onClick = onNewRoomClicked,
)
@@ -118,7 +121,7 @@ fun CreateRoomRootViewTopBar(
},
actions = {
IconButton(onClick = onClosePressed) {
Icon(resourceId = DrawableR.drawable.ic_close, contentDescription = stringResource(id = StringR.string.action_close))
Icon(imageVector = Icons.Default.Close, contentDescription = stringResource(id = StringR.string.action_close))
}
}
)
@@ -161,11 +164,11 @@ fun CreateRoomSearchBar(
trailingIcon = {
if (active) {
IconButton(onClick = { onTextChanged("") }) {
Icon(DrawableR.drawable.ic_close, stringResource(StringR.string.a11y_clear))
Icon(Icons.Default.Close, stringResource(StringR.string.a11y_clear))
}
} else {
Icon(
resourceId = DrawableR.drawable.ic_search,
imageVector = Icons.Default.Search,
contentDescription = stringResource(StringR.string.search),
modifier = Modifier.alpha(0.4f), // FIXME align on Design system theme (removing alpha should be fine)
)

View File

@@ -16,25 +16,25 @@
package io.element.android.libraries.designsystem.components.button
import androidx.annotation.DrawableRes
import androidx.compose.foundation.layout.Column
import androidx.compose.material.Text
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
import io.element.android.libraries.designsystem.preview.ElementPreviewLight
import io.element.android.libraries.designsystem.theme.components.Icon
import io.element.android.libraries.designsystem.theme.components.IconButton
import io.element.android.libraries.designsystem.R as DrawableR
import io.element.android.libraries.ui.strings.R as StringR
@Composable
fun BackButton(
onClick: () -> Unit,
modifier: Modifier = Modifier,
@DrawableRes icon: Int = DrawableR.drawable.ic_arrow_back,
imageVector: ImageVector = Icons.Default.ArrowBack,
contentDescription: String = stringResource(StringR.string.a11y_back),
enabled: Boolean = true
) {
@@ -43,7 +43,7 @@ fun BackButton(
onClick = onClick,
enabled = enabled,
) {
Icon(resourceId = icon, contentDescription = contentDescription)
Icon(imageVector = imageVector, contentDescription = contentDescription)
}
}

View File

@@ -75,7 +75,7 @@ private fun ContentToPreview() {
Column {
TextIconButton(
modifier = Modifier.padding(horizontal = 8.dp),
imageVector = ImageVector.vectorResource(R.drawable.ic_group),
imageVector = ImageVector.vectorResource(R.drawable.ic_groups),
text = "Click me!",
onClick = {},
)

View File

@@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="16dp"
android:viewportWidth="16"
android:viewportHeight="16">
<path
android:pathData="M16,7H3.83L9.42,1.41L8,0L0,8L8,16L9.41,14.59L3.83,9H16V7Z"
android:fillColor="#17191C"/>
</vector>

View File

@@ -1,10 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="14dp"
android:height="14dp"
android:tint="#000000"
android:viewportWidth="14"
android:viewportHeight="14">
<path
android:fillColor="@android:color/white"
android:pathData="M12.871,2.374C13.262,1.984 13.262,1.35 12.871,0.96C12.481,0.569 11.847,0.569 11.457,0.96L6.928,5.489L2.398,0.96C2.008,0.569 1.375,0.569 0.984,0.96C0.594,1.35 0.594,1.984 0.984,2.374L5.513,6.903L0.79,11.627C0.4,12.017 0.4,12.65 0.79,13.041C1.181,13.431 1.814,13.431 2.204,13.041L6.928,8.318L11.651,13.041C12.041,13.431 12.675,13.431 13.065,13.041C13.456,12.65 13.456,12.017 13.065,11.627L8.342,6.903L12.871,2.374Z" />
</vector>

View File

@@ -1,26 +0,0 @@
<!--
~ Copyright (c) 2023 New Vector Ltd
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="11dp"
android:tint="#000000"
android:viewportWidth="24"
android:viewportHeight="11">
<path
android:fillColor="#ffffff"
android:pathData="M1.365,10.788C1.12,10.788 0.915,10.706 0.749,10.54C0.583,10.374 0.5,10.168 0.5,9.923V9.569C0.5,8.894 0.844,8.346 1.531,7.927C2.219,7.508 3.126,7.298 4.251,7.298C4.454,7.298 4.647,7.305 4.829,7.318C5.011,7.332 5.187,7.355 5.358,7.389C5.168,7.681 5.028,7.996 4.94,8.332C4.852,8.668 4.808,9.025 4.808,9.4V10.788H1.365ZM7.408,10.788C7.147,10.788 6.931,10.702 6.759,10.529C6.586,10.355 6.5,10.141 6.5,9.885V9.439C6.5,8.483 7.006,7.713 8.018,7.128C9.03,6.543 10.356,6.25 11.996,6.25C13.651,6.25 14.982,6.543 15.989,7.128C16.996,7.713 17.5,8.483 17.5,9.439V9.885C17.5,10.141 17.413,10.355 17.24,10.529C17.067,10.702 16.852,10.788 16.596,10.788H7.408ZM19.192,10.788V9.4C19.192,9.025 19.145,8.668 19.05,8.332C18.955,7.996 18.819,7.681 18.642,7.389C18.813,7.355 18.989,7.332 19.17,7.318C19.352,7.305 19.545,7.298 19.75,7.298C20.875,7.298 21.781,7.508 22.469,7.927C23.156,8.346 23.5,8.894 23.5,9.569V9.923C23.5,10.168 23.417,10.374 23.251,10.54C23.085,10.706 22.88,10.788 22.635,10.788H19.192ZM12,7.75C10.954,7.75 10.059,7.892 9.315,8.176C8.572,8.46 8.159,8.799 8.077,9.192V9.289H15.923V9.192C15.831,8.789 15.415,8.447 14.677,8.168C13.938,7.889 13.046,7.75 12,7.75ZM4.25,6.327C3.777,6.327 3.375,6.159 3.044,5.824C2.713,5.489 2.548,5.086 2.548,4.615C2.548,4.145 2.713,3.742 3.044,3.407C3.375,3.072 3.777,2.904 4.25,2.904C4.723,2.904 5.127,3.072 5.461,3.407C5.794,3.742 5.961,4.145 5.961,4.615C5.961,5.086 5.794,5.489 5.459,5.824C5.124,6.159 4.721,6.327 4.25,6.327ZM19.75,6.327C19.277,6.327 18.873,6.159 18.539,5.824C18.205,5.489 18.038,5.086 18.038,4.615C18.038,4.145 18.206,3.742 18.541,3.407C18.876,3.072 19.279,2.904 19.75,2.904C20.223,2.904 20.625,3.072 20.956,3.407C21.286,3.742 21.452,4.145 21.452,4.615C21.452,5.086 21.286,5.489 20.956,5.824C20.625,6.159 20.223,6.327 19.75,6.327ZM12,5.5C11.279,5.5 10.666,5.248 10.161,4.743C9.656,4.238 9.404,3.625 9.404,2.904C9.404,2.183 9.656,1.57 10.161,1.065C10.666,0.56 11.279,0.308 12,0.308C12.721,0.308 13.334,0.56 13.839,1.065C14.344,1.57 14.596,2.183 14.596,2.904C14.596,3.625 14.344,4.238 13.839,4.743C13.334,5.248 12.721,5.5 12,5.5ZM12.002,1.808C11.691,1.808 11.431,1.913 11.22,2.122C11.009,2.332 10.904,2.592 10.904,2.902C10.904,3.212 11.009,3.473 11.218,3.684C11.428,3.895 11.688,4 11.998,4C12.308,4 12.569,3.895 12.78,3.685C12.991,3.476 13.096,3.216 13.096,2.906C13.096,2.596 12.991,2.335 12.781,2.124C12.572,1.913 12.312,1.808 12.002,1.808Z" />
</vector>

View File

@@ -0,0 +1,25 @@
<!--
~ Copyright (c) 2023 New Vector Ltd
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/black"
android:pathData="M1.365,17.788C1.12,17.788 0.915,17.705 0.749,17.54C0.583,17.374 0.5,17.168 0.5,16.923V16.569C0.5,15.894 0.844,15.346 1.531,14.927C2.219,14.508 3.126,14.298 4.251,14.298C4.454,14.298 4.647,14.305 4.829,14.318C5.011,14.332 5.187,14.355 5.358,14.389C5.168,14.681 5.028,14.995 4.94,15.332C4.852,15.668 4.808,16.024 4.808,16.4V17.788H1.365ZM7.408,17.788C7.147,17.788 6.931,17.702 6.759,17.529C6.586,17.355 6.5,17.141 6.5,16.885V16.438C6.5,15.483 7.006,14.713 8.018,14.128C9.03,13.543 10.356,13.25 11.996,13.25C13.651,13.25 14.982,13.543 15.989,14.128C16.996,14.713 17.5,15.483 17.5,16.438V16.885C17.5,17.141 17.413,17.355 17.24,17.529C17.067,17.702 16.852,17.788 16.596,17.788H7.408ZM19.192,17.788V16.4C19.192,16.024 19.145,15.668 19.05,15.332C18.955,14.995 18.819,14.681 18.642,14.389C18.813,14.355 18.989,14.332 19.17,14.318C19.352,14.305 19.545,14.298 19.75,14.298C20.875,14.298 21.781,14.508 22.469,14.927C23.156,15.346 23.5,15.894 23.5,16.569V16.923C23.5,17.168 23.417,17.374 23.251,17.54C23.085,17.705 22.88,17.788 22.635,17.788H19.192ZM12,14.75C10.954,14.75 10.059,14.892 9.315,15.176C8.572,15.46 8.159,15.799 8.077,16.192V16.288H15.923V16.192C15.831,15.788 15.415,15.447 14.677,15.168C13.938,14.889 13.046,14.75 12,14.75ZM4.25,13.327C3.777,13.327 3.375,13.159 3.044,12.824C2.713,12.489 2.548,12.086 2.548,11.615C2.548,11.145 2.713,10.742 3.044,10.407C3.375,10.071 3.777,9.904 4.25,9.904C4.723,9.904 5.127,10.071 5.461,10.407C5.794,10.742 5.961,11.145 5.961,11.615C5.961,12.086 5.794,12.489 5.459,12.824C5.124,13.159 4.721,13.327 4.25,13.327ZM19.75,13.327C19.277,13.327 18.873,13.159 18.539,12.824C18.205,12.489 18.038,12.086 18.038,11.615C18.038,11.145 18.206,10.742 18.541,10.407C18.876,10.071 19.279,9.904 19.75,9.904C20.223,9.904 20.625,10.071 20.956,10.407C21.286,10.742 21.452,11.145 21.452,11.615C21.452,12.086 21.286,12.489 20.956,12.824C20.625,13.159 20.223,13.327 19.75,13.327ZM12,12.5C11.279,12.5 10.666,12.248 10.161,11.743C9.656,11.238 9.404,10.625 9.404,9.904C9.404,9.183 9.656,8.57 10.161,8.065C10.666,7.56 11.279,7.308 12,7.308C12.721,7.308 13.334,7.56 13.839,8.065C14.344,8.57 14.596,9.183 14.596,9.904C14.596,10.625 14.344,11.238 13.839,11.743C13.334,12.248 12.721,12.5 12,12.5ZM12.002,8.808C11.691,8.808 11.431,8.913 11.22,9.122C11.009,9.332 10.904,9.592 10.904,9.902C10.904,10.212 11.009,10.473 11.218,10.684C11.428,10.895 11.688,11 11.998,11C12.308,11 12.569,10.895 12.78,10.685C12.991,10.476 13.096,10.216 13.096,9.906C13.096,9.595 12.991,9.335 12.781,9.124C12.572,8.913 12.312,8.808 12.002,8.808Z" />
</vector>

View File

@@ -1,26 +0,0 @@
<!--
~ Copyright (c) 2023 New Vector Ltd
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="18dp"
android:height="18dp"
android:tint="#000000"
android:viewportWidth="18"
android:viewportHeight="18">
<path
android:fillColor="#ffffff"
android:pathData="M11.76,10.27L17.49,16L16,17.49L10.27,11.76C9.2,12.53 7.91,13 6.5,13C2.91,13 0,10.09 0,6.5C0,2.91 2.91,0 6.5,0C10.09,0 13,2.91 13,6.5C13,7.91 12.53,9.2 11.76,10.27ZM6.5,2C4.01,2 2,4.01 2,6.5C2,8.99 4.01,11 6.5,11C8.99,11 11,8.99 11,6.5C11,4.01 8.99,2 6.5,2Z" />
</vector>

View File

@@ -15,12 +15,11 @@
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="18dp"
android:height="20dp"
android:tint="#000000"
android:viewportWidth="18"
android:viewportHeight="20">
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#ffffff"
android:pathData="M15.001,19.75C14.238,19.75 13.588,19.483 13.053,18.948C12.518,18.413 12.25,17.764 12.25,17C12.25,16.875 12.26,16.746 12.28,16.612C12.3,16.478 12.33,16.355 12.369,16.242L4.973,11.911C4.709,12.174 4.408,12.38 4.071,12.528C3.734,12.676 3.377,12.75 3,12.75C2.236,12.75 1.587,12.483 1.052,11.948C0.517,11.414 0.25,10.765 0.25,10.001C0.25,9.238 0.517,8.588 1.052,8.053C1.587,7.518 2.236,7.25 3,7.25C3.377,7.25 3.734,7.324 4.071,7.472C4.408,7.62 4.709,7.826 4.973,8.088L12.369,3.758C12.33,3.645 12.3,3.522 12.28,3.388C12.26,3.254 12.25,3.125 12.25,3C12.25,2.236 12.517,1.587 13.052,1.052C13.586,0.517 14.235,0.25 14.999,0.25C15.762,0.25 16.412,0.517 16.947,1.052C17.482,1.586 17.75,2.235 17.75,2.999C17.75,3.762 17.483,4.412 16.948,4.947C16.413,5.482 15.764,5.75 15,5.75C14.623,5.75 14.266,5.676 13.929,5.528C13.592,5.38 13.291,5.174 13.027,4.911L5.631,9.242C5.67,9.355 5.7,9.478 5.72,9.611C5.74,9.745 5.75,9.874 5.75,9.998C5.75,10.122 5.74,10.252 5.72,10.387C5.7,10.521 5.67,10.645 5.631,10.758L13.027,15.089C13.291,14.826 13.592,14.62 13.929,14.472C14.266,14.324 14.623,14.25 15,14.25C15.764,14.25 16.413,14.517 16.948,15.052C17.483,15.586 17.75,16.235 17.75,16.999C17.75,17.762 17.483,18.412 16.948,18.947C16.414,19.482 15.765,19.75 15.001,19.75ZM15,4.25C15.347,4.25 15.643,4.129 15.886,3.886C16.128,3.643 16.25,3.347 16.25,3C16.25,2.653 16.128,2.357 15.886,2.114C15.643,1.871 15.347,1.75 15,1.75C14.653,1.75 14.357,1.871 14.114,2.114C13.871,2.357 13.75,2.653 13.75,3C13.75,3.347 13.871,3.643 14.114,3.886C14.357,4.129 14.653,4.25 15,4.25ZM3,11.25C3.347,11.25 3.643,11.128 3.886,10.886C4.129,10.643 4.25,10.347 4.25,10C4.25,9.653 4.129,9.357 3.886,9.114C3.643,8.871 3.347,8.75 3,8.75C2.653,8.75 2.357,8.871 2.114,9.114C1.871,9.357 1.75,9.653 1.75,10C1.75,10.347 1.871,10.643 2.114,10.886C2.357,11.128 2.653,11.25 3,11.25ZM15,18.25C15.347,18.25 15.643,18.128 15.886,17.886C16.128,17.643 16.25,17.347 16.25,17C16.25,16.653 16.128,16.357 15.886,16.114C15.643,15.871 15.347,15.75 15,15.75C14.653,15.75 14.357,15.871 14.114,16.114C13.871,16.357 13.75,16.653 13.75,17C13.75,17.347 13.871,17.643 14.114,17.886C14.357,18.128 14.653,18.25 15,18.25Z" />
android:fillColor="@android:color/black"
android:pathData="M18.001,21.75C17.237,21.75 16.588,21.483 16.053,20.948C15.518,20.413 15.25,19.764 15.25,19C15.25,18.875 15.26,18.746 15.28,18.612C15.3,18.478 15.33,18.355 15.369,18.242L7.973,13.911C7.709,14.174 7.408,14.38 7.071,14.528C6.734,14.676 6.377,14.75 6,14.75C5.236,14.75 4.587,14.483 4.052,13.948C3.517,13.414 3.25,12.765 3.25,12.001C3.25,11.238 3.517,10.588 4.052,10.053C4.587,9.518 5.236,9.25 6,9.25C6.377,9.25 6.734,9.324 7.071,9.472C7.408,9.62 7.709,9.826 7.973,10.089L15.369,5.758C15.33,5.645 15.3,5.522 15.28,5.388C15.26,5.254 15.25,5.125 15.25,5C15.25,4.236 15.517,3.587 16.052,3.052C16.586,2.517 17.235,2.25 17.999,2.25C18.762,2.25 19.412,2.517 19.947,3.052C20.482,3.586 20.75,4.235 20.75,4.999C20.75,5.762 20.483,6.412 19.948,6.947C19.413,7.482 18.764,7.75 18,7.75C17.623,7.75 17.266,7.676 16.929,7.528C16.592,7.38 16.291,7.174 16.027,6.912L8.631,11.242C8.67,11.355 8.7,11.478 8.72,11.611C8.74,11.745 8.75,11.874 8.75,11.998C8.75,12.122 8.74,12.252 8.72,12.387C8.7,12.521 8.67,12.645 8.631,12.758L16.027,17.088C16.291,16.826 16.592,16.62 16.929,16.472C17.266,16.324 17.623,16.25 18,16.25C18.764,16.25 19.413,16.517 19.948,17.052C20.483,17.586 20.75,18.235 20.75,18.999C20.75,19.762 20.483,20.412 19.948,20.947C19.414,21.482 18.765,21.75 18.001,21.75ZM18,6.25C18.347,6.25 18.643,6.129 18.886,5.886C19.128,5.643 19.25,5.347 19.25,5C19.25,4.653 19.128,4.357 18.886,4.114C18.643,3.871 18.347,3.75 18,3.75C17.653,3.75 17.357,3.871 17.114,4.114C16.871,4.357 16.75,4.653 16.75,5C16.75,5.347 16.871,5.643 17.114,5.886C17.357,6.129 17.653,6.25 18,6.25ZM6,13.25C6.347,13.25 6.643,13.128 6.886,12.886C7.129,12.643 7.25,12.347 7.25,12C7.25,11.653 7.129,11.357 6.886,11.114C6.643,10.871 6.347,10.75 6,10.75C5.653,10.75 5.357,10.871 5.114,11.114C4.871,11.357 4.75,11.653 4.75,12C4.75,12.347 4.871,12.643 5.114,12.886C5.357,13.128 5.653,13.25 6,13.25ZM18,20.25C18.347,20.25 18.643,20.128 18.886,19.886C19.128,19.643 19.25,19.347 19.25,19C19.25,18.653 19.128,18.357 18.886,18.114C18.643,17.871 18.347,17.75 18,17.75C17.653,17.75 17.357,17.871 17.114,18.114C16.871,18.357 16.75,18.653 16.75,19C16.75,19.347 16.871,19.643 17.114,19.886C17.357,20.128 17.653,20.25 18,20.25Z" />
</vector>