Convert more icons to ImageVector

This commit is contained in:
FooIbar committed 2023-10-27 11:43:47 +08:00
1 parent 0c78673870
commit 2733d2e58c
14 files changed
+204 -71

No files matched your search

@@ -0,0 +1,32 @@
@file:Suppress("ktlint:standard:property-naming")
package com.hippo.ehviewer.icons
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.unit.dp
object EhIcons {
object Filled
object Big {
object Filled
val Default = Filled
}
val Default = Filled
}
inline fun bigIcon(
name: String,
block: ImageVector.Builder.() -> ImageVector.Builder,
): ImageVector = ImageVector.Builder(
name = name,
defaultWidth = BigIconDimension.dp,
defaultHeight = BigIconDimension.dp,
viewportWidth = MaterialIconDimension,
viewportHeight = MaterialIconDimension,
).block().build()
const val BigIconDimension = 120f
const val MaterialIconDimension = 24f
@@ -0,0 +1,51 @@
package com.hippo.ehviewer.icons.big
import androidx.compose.material.icons.materialPath
import com.hippo.ehviewer.icons.EhIcons
import com.hippo.ehviewer.icons.bigIcon
import com.hippo.ehviewer.util.unsafeLazy
val EhIcons.Big.Filled.History by unsafeLazy {
bigIcon(name = "History") {
materialPath {
moveTo(5.5F, 2.0F)
horizontalLineTo(22.0F)
verticalLineTo(0.0F)
horizontalLineTo(5.0F)
curveTo(3.3F, 0.0F, 2.0F, 1.3F, 2.0F, 3.0F)
verticalLineTo(21.0F)
curveTo(2.0F, 22.7F, 3.3F, 24.0F, 5.0F, 24.0F)
horizontalLineTo(22.0F)
verticalLineTo(4.0F)
horizontalLineTo(5.5F)
curveTo(4.1F, 4.0F, 4.1F, 2.0F, 5.5F, 2.0F)
close()
moveTo(20.0F, 6.0F)
verticalLineTo(22.0F)
horizontalLineTo(6.0F)
verticalLineTo(6.0F)
horizontalLineTo(20.0F)
moveTo(12.5F, 11.8F)
verticalLineTo(14.4F)
lineTo(14.9F, 15.8F)
lineTo(15.3F, 15.2F)
lineTo(13.3F, 14.0F)
verticalLineTo(11.9F)
moveTo(13.3F, 9.3F)
curveTo(11.5F, 9.3F, 10.0F, 10.3F, 9.2F, 11.7F)
lineTo(8.0F, 10.5F)
verticalLineTo(13.8F)
horizontalLineTo(11.3F)
lineTo(9.9F, 12.4F)
curveTo(10.5F, 11.1F, 11.8F, 10.3F, 13.3F, 10.3F)
curveTo(15.4F, 10.3F, 17.1F, 12.0F, 17.1F, 14.1F)
reflectiveCurveTo(15.4F, 17.9F, 13.3F, 17.9F)
curveTo(11.7F, 17.9F, 10.3F, 16.9F, 9.8F, 15.4F)
horizontalLineTo(8.7F)
curveTo(9.3F, 17.4F, 11.1F, 18.9F, 13.3F, 18.9F)
curveTo(15.9F, 18.9F, 18.1F, 16.8F, 18.1F, 14.1F)
curveTo(18.0F, 11.4F, 15.9F, 9.3F, 13.3F, 9.3F)
close()
}
}
}
@@ -0,0 +1,53 @@
package com.hippo.ehviewer.icons.big
import androidx.compose.material.icons.materialPath
import com.hippo.ehviewer.icons.EhIcons
import com.hippo.ehviewer.icons.bigIcon
import com.hippo.ehviewer.util.unsafeLazy
val EhIcons.Big.Filled.SadAndroid by unsafeLazy {
bigIcon(name = "SadAndroid") {
materialPath {
moveTo(16.5F, 10.8F)
curveToRelative(-0.61F, 0.0F, -1.1F, 0.49F, -1.1F, 1.1F)
curveToRelative(0.0F, 0.61F, 0.49F, 1.1F, 1.1F, 1.1F)
reflectiveCurveToRelative(1.1F, -0.49F, 1.1F, -1.1F)
curveTo(17.6F, 11.29F, 17.11F, 10.8F, 16.5F, 10.8F)
close()
moveTo(8.2F, 10.1F)
curveToRelative(-0.61F, 0.0F, -1.1F, 0.49F, -1.1F, 1.1F)
reflectiveCurveToRelative(0.49F, 1.1F, 1.1F, 1.1F)
reflectiveCurveToRelative(1.1F, -0.49F, 1.1F, -1.1F)
reflectiveCurveTo(8.81F, 10.1F, 8.2F, 10.1F)
close()
moveTo(22.1F, 16.4F)
curveToRelative(-0.46F, -3.33F, -2.24F, -5.93F, -4.81F, -7.45F)
lineTo(19.5F, 6.3F)
curveToRelative(0.1F, -0.1F, 0.1F, -0.3F, 0.0F, -0.4F)
curveToRelative(-0.1F, -0.1F, -0.3F, -0.1F, -0.4F, 0.0F)
lineToRelative(-2.27F, 2.79F)
curveToRelative(-1.26F, -0.66F, -2.69F, -1.07F, -4.23F, -1.19F)
curveToRelative(-1.4F, -0.15F, -2.77F, -0.01F, -4.05F, 0.37F)
lineTo(6.7F, 4.7F)
curveTo(6.6F, 4.6F, 6.4F, 4.5F, 6.3F, 4.6F)
curveTo(6.2F, 4.7F, 6.1F, 4.9F, 6.2F, 5.0F)
lineToRelative(1.79F, 3.05F)
curveToRelative(-2.83F, 1.02F, -5.12F, 3.3F, -6.19F, 6.55F)
lineToRelative(15.44F, 1.37F)
curveToRelative(0.0F, 0.02F, -0.01F, 0.04F, -0.01F, 0.05F)
curveToRelative(0.0F, 0.59F, 0.48F, 1.07F, 1.07F, 1.07F)
curveToRelative(0.54F, 0.0F, 0.97F, -0.41F, 1.04F, -0.93F)
lineTo(22.1F, 16.4F)
close()
moveTo(2.63F, 14.07F)
curveToRelative(1.51F, -3.74F, 4.83F, -6.03F, 8.84F, -6.03F)
curveToRelative(0.35F, 0.0F, 0.71F, 0.02F, 1.07F, 0.06F)
curveToRelative(4.55F, 0.36F, 7.94F, 3.33F, 8.84F, 7.64F)
lineToRelative(-2.12F, -0.19F)
curveToRelative(-0.27F, -0.68F, -0.95F, -1.46F, -0.95F, -1.46F)
reflectiveCurveToRelative(-0.58F, 0.66F, -0.89F, 1.29F)
lineTo(2.63F, 14.07F)
close()
}
}
}
@@ -0,0 +1,47 @@
package com.hippo.ehviewer.icons.filled
import androidx.compose.material.icons.materialIcon
import androidx.compose.material.icons.materialPath
import com.hippo.ehviewer.icons.EhIcons
import com.hippo.ehviewer.util.unsafeLazy
val EhIcons.Filled.SadPanda by unsafeLazy {
materialIcon(name = "SadPanda") {
materialPath {
moveTo(21.1F, 7.8F)
curveTo(22.2F, 7.4F, 23.0F, 6.3F, 23.0F, 5.0F)
curveTo(23.0F, 3.3F, 21.7F, 2.0F, 20.0F, 2.0F)
curveTo(18.9F, 2.0F, 17.9F, 2.6F, 17.4F, 3.6F)
lineTo(21.1F, 7.8F)
moveTo(6.6F, 3.6F)
curveTo(6.1F, 2.6F, 5.1F, 2.0F, 4.0F, 2.0F)
curveTo(2.3F, 2.0F, 1.0F, 3.3F, 1.0F, 5.0F)
curveTo(1.0F, 6.3F, 1.8F, 7.4F, 2.9F, 7.8F)
lineTo(6.6F, 3.6F)
moveTo(10.1F, 13.0F)
lineTo(8.0F, 15.1F)
curveTo(7.4F, 15.7F, 6.5F, 15.7F, 5.9F, 15.1F)
lineTo(5.9F, 15.1F)
curveTo(5.3F, 14.5F, 5.3F, 13.6F, 5.9F, 13.0F)
lineTo(8.0F, 10.9F)
curveTo(8.6F, 10.3F, 9.5F, 10.3F, 10.1F, 10.9F)
lineTo(10.1F, 10.9F)
curveTo(10.7F, 11.5F, 10.7F, 12.4F, 10.1F, 13.0F)
moveTo(16.0F, 15.1F)
lineTo(13.9F, 13.0F)
curveTo(13.3F, 12.4F, 13.3F, 11.5F, 13.9F, 10.9F)
lineTo(13.9F, 10.9F)
curveTo(14.5F, 10.3F, 15.4F, 10.3F, 16.0F, 10.9F)
lineTo(18.1F, 13.0F)
curveTo(18.7F, 13.6F, 18.7F, 14.5F, 18.1F, 15.1F)
lineTo(18.1F, 15.1F)
curveTo(17.5F, 15.7F, 16.6F, 15.7F, 16.0F, 15.1F)
moveTo(12.0F, 17.0F)
curveTo(12.8F, 17.0F, 13.5F, 17.4F, 13.5F, 18.0F)
reflectiveCurveTo(12.8F, 19.0F, 12.0F, 19.0F)
reflectiveCurveTo(10.5F, 18.6F, 10.5F, 18.0F)
reflectiveCurveTo(11.2F, 17.0F, 12.0F, 17.0F)
close()
}
}
}
@@ -1,11 +1,12 @@
package com.hippo.ehviewer.icons.filled
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.materialIcon
import androidx.compose.material.icons.materialPath
import com.hippo.ehviewer.icons.EhIcons
import com.hippo.ehviewer.util.unsafeLazy
val Icons.Filled.EhSubscriptions by lazy {
materialIcon(name = "EhSubscriptions") {
val EhIcons.Filled.Subscriptions by unsafeLazy {
materialIcon(name = "Subscriptions") {
materialPath {
moveTo(20.0F, 8.0F)
horizontalLineTo(4.0F)
@@ -85,7 +85,8 @@ import com.hippo.ehviewer.client.parser.GalleryPageUrlParser
import com.hippo.ehviewer.databinding.ActivityMainBinding
import com.hippo.ehviewer.download.DownloadService
import com.hippo.ehviewer.download.downloadLocation
import com.hippo.ehviewer.icons.filled.EhSubscriptions
import com.hippo.ehviewer.icons.EhIcons
import com.hippo.ehviewer.icons.filled.Subscriptions
import com.hippo.ehviewer.image.Image.Companion.decodeBitmap
import com.hippo.ehviewer.ui.legacy.BaseDialogBuilder
import com.hippo.ehviewer.ui.legacy.EditTextDialogBuilder
@@ -113,7 +114,7 @@ import splitties.systemservices.connectivityManager
private val navItems = arrayOf(
Triple(R.id.nav_homepage, R.string.homepage, Icons.Default.Home),
Triple(R.id.nav_subscription, R.string.subscription, Icons.Default.EhSubscriptions),
Triple(R.id.nav_subscription, R.string.subscription, EhIcons.Default.Subscriptions),
Triple(R.id.nav_whats_hot, R.string.whats_hot, Icons.Default.Whatshot),
Triple(R.id.nav_toplist, R.string.toplist, Icons.Default.FormatListNumbered),
Triple(R.id.nav_favourite, R.string.favourite, Icons.Default.Favorite),
@@ -26,7 +26,6 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.dimensionResource
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.pluralStringResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
@@ -35,6 +34,8 @@ import com.hippo.ehviewer.R
import com.hippo.ehviewer.client.EhUtils
import com.hippo.ehviewer.client.data.GalleryDetail
import com.hippo.ehviewer.client.data.GalleryInfo
import com.hippo.ehviewer.icons.EhIcons
import com.hippo.ehviewer.icons.big.SadAndroid
@Composable
fun GalleryDetailHeaderInfoCard(
@@ -160,7 +161,7 @@ fun GalleryDetailErrorTip(error: String, onClick: () -> Unit) = Column(
verticalArrangement = Arrangement.Center,
) {
Icon(
painter = painterResource(id = R.drawable.big_sad_pandroid),
imageVector = EhIcons.Big.Default.SadAndroid,
contentDescription = null,
modifier = Modifier.clickable(onClick = onClick),
)
@@ -46,7 +46,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.platform.ComposeView
import androidx.compose.ui.res.dimensionResource
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.core.os.bundleOf
@@ -60,6 +59,8 @@ import androidx.paging.compose.itemKey
import com.hippo.ehviewer.EhDB
import com.hippo.ehviewer.R
import com.hippo.ehviewer.Settings.listThumbSize
import com.hippo.ehviewer.icons.EhIcons
import com.hippo.ehviewer.icons.big.History
import com.hippo.ehviewer.ui.doGalleryInfoAction
import com.hippo.ehviewer.ui.main.GalleryInfoListItem
import com.hippo.ehviewer.ui.setMD3Content
@@ -172,7 +173,7 @@ class HistoryScene : BaseScene() {
horizontalAlignment = Alignment.CenterHorizontally,
) {
Image(
painter = painterResource(id = R.drawable.big_history),
imageVector = EhIcons.Big.Default.History,
contentDescription = null,
Modifier.padding(16.dp),
)
@@ -21,13 +21,14 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.ComposeView
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.core.os.bundleOf
import androidx.navigation.fragment.findNavController
import com.hippo.ehviewer.R
import com.hippo.ehviewer.client.EhEngine
import com.hippo.ehviewer.icons.EhIcons
import com.hippo.ehviewer.icons.big.SadAndroid
import com.hippo.ehviewer.ui.setMD3Content
import com.hippo.ehviewer.util.ExceptionUtils
import eu.kanade.tachiyomi.util.lang.withUIContext
@@ -77,7 +78,7 @@ class ProgressScene : BaseScene() {
horizontalAlignment = Alignment.CenterHorizontally,
) {
Image(
painter = painterResource(id = R.drawable.big_sad_pandroid),
imageVector = EhIcons.Big.Default.SadAndroid,
contentDescription = null,
modifier = Modifier.padding(16.dp),
)
@@ -17,9 +17,10 @@ import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import com.hippo.ehviewer.R
import com.hippo.ehviewer.icons.EhIcons
import com.hippo.ehviewer.icons.filled.SadPanda
import com.hippo.ehviewer.ui.ABOUT_SETTINGS_SCREEN
import com.hippo.ehviewer.ui.ADVANCED_SETTINGS_SCREEN
import com.hippo.ehviewer.ui.DOWNLOAD_SETTINGS_SCREEN
@@ -47,7 +48,7 @@ fun BaseScreen() {
) {
Column(modifier = Modifier.padding(it).nestedScroll(scrollBehavior.nestedScrollConnection)) {
PreferenceHeader(
icon = painterResource(id = R.drawable.v_sad_panda_primary_x24),
icon = EhIcons.Default.SadPanda,
title = R.string.settings_eh,
childRouteName = EH_SETTINGS_SCREEN,
)
@@ -5,6 +5,8 @@ package com.hippo.ehviewer.util
import kotlin.reflect.KMutableProperty0
import kotlin.reflect.KProperty
fun <T> unsafeLazy(initializer: () -> T) = lazy(LazyThreadSafetyMode.NONE, initializer)
interface Lazy<T> {
var value: T
}
-28
View File
@@ -1,28 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2016 Hippo Seven
~
~ 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="120dp"
android:height="120dp"
android:tint="?colorTertiary"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="@string/pd_big_history" />
</vector>
@@ -1,28 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2016 Hippo Seven
~
~ 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:tint="?colorPrimary"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="@string/pd_sad_panda" />
</vector>
-2
View File
@@ -34,8 +34,6 @@
<string name="pd_refresh" translatable="false">M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z</string>
<string name="pd_file_image" translatable="false">M13,9H18.5L13,3.5V9M6,2H14L20,8V20A2,2 0 0,1 18,22H6C4.89,22 4,21.1 4,20V4C4,2.89 4.89,2 6,2M6,20H15L18,20V12L14,16L12,14L6,20M8,9A2,2 0 0,0 6,11A2,2 0 0,0 8,13A2,2 0 0,0 10,11A2,2 0 0,0 8,9Z</string>
<string name="pd_pencil" translatable="false">M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z</string>
<string name="pd_big_history" translatable="false">M5.5,2H22V0H5C3.3,0,2,1.3,2,3V21C2,22.7,3.3,24,5,24H22V4H5.5C4.1,4,4.1,2,5.5,2ZM20,6V22H6V6H20M12.5,11.8V14.4L14.9,15.8L15.3,15.2L13.3,14V11.9M13.3,9.3C11.5,9.3,10,10.3,9.2,11.7L8,10.5V13.8H11.3L9.9,12.4C10.5,11.1,11.8,10.3,13.3,10.3C15.4,10.3,17.1,12,17.1,14.1S15.4,17.9,13.3,17.9C11.7,17.9,10.3,16.9,9.8,15.4H8.7C9.3,17.4,11.1,18.9,13.3,18.9C15.9,18.9,18.1,16.8,18.1,14.1C18,11.4,15.9,9.3,13.3,9.3Z</string>
<string name="pd_big_download" translatable="false">M0,19V24H24V19H0ZM16,22H15V21H16V22ZM19,22H18V21H19V22ZM22,22H21V21H22V22M15,11L15,0L9,0L9,11L5,11L12,18L19,11Z</string>
<string name="pd_sad_panda" translatable="false">M21.1,7.8C22.2,7.4,23,6.3,23,5C23,3.3,21.7,2,20,2C18.9,2,17.9,2.6,17.4,3.6L21.1,7.8M6.6,3.6C6.1,2.6,5.1,2,4,2C2.3,2,1,3.3,1,5C1,6.3,1.8,7.4,2.9,7.8L6.6,3.6M10.1,13L8,15.1C7.4,15.7,6.5,15.7,5.9,15.1L5.9,15.1C5.3,14.5,5.3,13.6,5.9,13L8,10.9C8.6,10.3,9.5,10.3,10.1,10.9L10.1,10.9C10.7,11.5,10.7,12.4,10.1,13M16,15.1L13.9,13C13.3,12.4,13.3,11.5,13.9,10.9L13.9,10.9C14.5,10.3,15.4,10.3,16,10.9L18.1,13C18.7,13.6,18.7,14.5,18.1,15.1L18.1,15.1C17.5,15.7,16.6,15.7,16,15.1M12,17C12.8,17,13.5,17.4,13.5,18S12.8,19,12,19S10.5,18.6,10.5,18S11.2,17,12,17Z</string>
</resources>