From 4fd64601ef0492dbed146b7f82ac5c0e9a8b6b89 Mon Sep 17 00:00:00 2001
From: FooIbar <118464521+FooIbar@users.noreply.github.com>
Date: Thu, 26 Oct 2023 16:30:13 +0800
Subject: [PATCH] Use ImageVector icons
---
.../ehviewer/icons/filled/EhSubscriptions.kt | 68 +++++++++++++++++++
.../com/hippo/ehviewer/ui/MainActivity.kt | 29 +++++---
.../ic_baseline_format_list_numbered_24.xml | 28 --------
.../drawable/v_eh_subscription_black_x24.xml | 27 --------
.../main/res/drawable/v_fire_black_x24.xml | 28 --------
app/src/main/res/drawable/v_heart_x24.xml | 27 --------
.../main/res/drawable/v_history_black_x24.xml | 28 --------
.../res/drawable/v_homepage_black_x24.xml | 28 --------
.../res/drawable/v_settings_black_x24.xml | 28 --------
app/src/main/res/values/pathdata.xml | 6 --
gradle.properties | 2 +-
11 files changed, 88 insertions(+), 211 deletions(-)
create mode 100644 app/src/main/kotlin/com/hippo/ehviewer/icons/filled/EhSubscriptions.kt
delete mode 100644 app/src/main/res/drawable/ic_baseline_format_list_numbered_24.xml
delete mode 100644 app/src/main/res/drawable/v_eh_subscription_black_x24.xml
delete mode 100644 app/src/main/res/drawable/v_fire_black_x24.xml
delete mode 100644 app/src/main/res/drawable/v_heart_x24.xml
delete mode 100644 app/src/main/res/drawable/v_history_black_x24.xml
delete mode 100644 app/src/main/res/drawable/v_homepage_black_x24.xml
delete mode 100644 app/src/main/res/drawable/v_settings_black_x24.xml
diff --git a/app/src/main/kotlin/com/hippo/ehviewer/icons/filled/EhSubscriptions.kt b/app/src/main/kotlin/com/hippo/ehviewer/icons/filled/EhSubscriptions.kt
new file mode 100644
index 000000000..606e04188
--- /dev/null
+++ b/app/src/main/kotlin/com/hippo/ehviewer/icons/filled/EhSubscriptions.kt
@@ -0,0 +1,68 @@
+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 androidx.compose.ui.graphics.vector.ImageVector
+
+val Icons.Filled.EhSubscriptions: ImageVector
+ get() {
+ if (_ehSubscriptions != null) {
+ return _ehSubscriptions!!
+ }
+ _ehSubscriptions = materialIcon(name = "EhSubscriptions") {
+ materialPath {
+ moveTo(20.0F, 8.0F)
+ horizontalLineTo(4.0F)
+ verticalLineTo(6.0F)
+ horizontalLineToRelative(16.0F)
+ verticalLineTo(8.0F)
+ moveTo(18.0F, 2.0F)
+ horizontalLineTo(6.0F)
+ verticalLineToRelative(2.0F)
+ horizontalLineToRelative(12.0F)
+ verticalLineTo(2.0F)
+ moveTo(20.0F, 10.0F)
+ horizontalLineTo(4.0F)
+ curveToRelative(-1.1F, 0.0F, -2.0F, 0.9F, -2.0F, 2.0F)
+ verticalLineToRelative(8.0F)
+ curveToRelative(0.0F, 1.1F, 0.9F, 2.0F, 2.0F, 2.0F)
+ horizontalLineToRelative(16.0F)
+ curveToRelative(1.1F, 0.0F, 2.0F, -0.9F, 2.0F, -2.0F)
+ verticalLineToRelative(-8.0F)
+ curveTo(22.0F, 10.9F, 21.1F, 10.0F, 20.0F, 10.0F)
+
+ moveTo(11.0F, 14.0F)
+ horizontalLineTo(7.0F)
+ verticalLineToRelative(1.0F)
+ horizontalLineToRelative(4.0F)
+ verticalLineToRelative(2.0F)
+ horizontalLineTo(7.0F)
+ verticalLineToRelative(1.0F)
+ horizontalLineToRelative(4.0F)
+ verticalLineToRelative(2.0F)
+ horizontalLineTo(5.0F)
+ verticalLineToRelative(-8.0F)
+ horizontalLineToRelative(6.0F)
+ verticalLineTo(14.0F)
+
+ moveTo(19.0F, 20.0F)
+ horizontalLineToRelative(-2.0F)
+ verticalLineToRelative(-3.0F)
+ horizontalLineToRelative(-2.0F)
+ verticalLineToRelative(3.0F)
+ horizontalLineToRelative(-2.0F)
+ verticalLineToRelative(-8.0F)
+ horizontalLineToRelative(2.0F)
+ verticalLineToRelative(3.0F)
+ horizontalLineToRelative(2.0F)
+ verticalLineToRelative(-3.0F)
+ horizontalLineToRelative(2.0F)
+ verticalLineTo(20.0F)
+ close()
+ }
+ }
+ return _ehSubscriptions!!
+ }
+
+private var _ehSubscriptions: ImageVector? = null
diff --git a/app/src/main/kotlin/com/hippo/ehviewer/ui/MainActivity.kt b/app/src/main/kotlin/com/hippo/ehviewer/ui/MainActivity.kt
index 20733a162..7cf66331a 100644
--- a/app/src/main/kotlin/com/hippo/ehviewer/ui/MainActivity.kt
+++ b/app/src/main/kotlin/com/hippo/ehviewer/ui/MainActivity.kt
@@ -39,6 +39,14 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.systemBars
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.filled.Download
+import androidx.compose.material.icons.filled.Favorite
+import androidx.compose.material.icons.filled.FormatListNumbered
+import androidx.compose.material.icons.filled.History
+import androidx.compose.material.icons.filled.Home
+import androidx.compose.material.icons.filled.Settings
+import androidx.compose.material.icons.filled.Whatshot
import androidx.compose.material3.DrawerValue
import androidx.compose.material3.Icon
import androidx.compose.material3.ModalDrawerSheet
@@ -76,6 +84,7 @@ 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.image.Image.Companion.decodeBitmap
import com.hippo.ehviewer.ui.legacy.BaseDialogBuilder
import com.hippo.ehviewer.ui.legacy.EditTextDialogBuilder
@@ -102,14 +111,14 @@ import splitties.systemservices.clipboardManager
import splitties.systemservices.connectivityManager
private val navItems = arrayOf(
- Triple(R.id.nav_homepage, R.string.homepage, R.drawable.v_homepage_black_x24),
- Triple(R.id.nav_subscription, R.string.subscription, R.drawable.v_eh_subscription_black_x24),
- Triple(R.id.nav_whats_hot, R.string.whats_hot, R.drawable.v_fire_black_x24),
- Triple(R.id.nav_toplist, R.string.toplist, R.drawable.ic_baseline_format_list_numbered_24),
- Triple(R.id.nav_favourite, R.string.favourite, R.drawable.v_heart_x24),
- Triple(R.id.nav_history, R.string.history, R.drawable.v_history_black_x24),
- Triple(R.id.nav_downloads, R.string.downloads, R.drawable.v_download_x24),
- Triple(R.id.nav_settings, R.string.settings, R.drawable.v_settings_black_x24),
+ 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_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),
+ Triple(R.id.nav_history, R.string.history, Icons.Default.History),
+ Triple(R.id.nav_downloads, R.string.downloads, Icons.Default.Download),
+ Triple(R.id.nav_settings, R.string.settings, Icons.Default.Settings),
)
class MainActivity : EhActivity() {
@@ -242,7 +251,7 @@ class MainActivity : EhActivity() {
modifier = Modifier.fillMaxWidth().padding(bottom = 8.dp),
contentScale = ContentScale.FillWidth,
)
- navItems.forEach { (id, stringId, drawableId) ->
+ navItems.forEach { (id, stringId, icon) ->
NavigationDrawerItem(
label = {
Text(text = stringResource(id = stringId))
@@ -254,7 +263,7 @@ class MainActivity : EhActivity() {
},
modifier = Modifier.padding(horizontal = 12.dp),
icon = {
- Icon(painter = painterResource(id = drawableId), contentDescription = null)
+ Icon(imageVector = icon, contentDescription = null)
},
)
}
diff --git a/app/src/main/res/drawable/ic_baseline_format_list_numbered_24.xml b/app/src/main/res/drawable/ic_baseline_format_list_numbered_24.xml
deleted file mode 100644
index d2e71865b..000000000
--- a/app/src/main/res/drawable/ic_baseline_format_list_numbered_24.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
diff --git a/app/src/main/res/drawable/v_eh_subscription_black_x24.xml b/app/src/main/res/drawable/v_eh_subscription_black_x24.xml
deleted file mode 100644
index d98362f16..000000000
--- a/app/src/main/res/drawable/v_eh_subscription_black_x24.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
diff --git a/app/src/main/res/drawable/v_fire_black_x24.xml b/app/src/main/res/drawable/v_fire_black_x24.xml
deleted file mode 100644
index 137055912..000000000
--- a/app/src/main/res/drawable/v_fire_black_x24.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
diff --git a/app/src/main/res/drawable/v_heart_x24.xml b/app/src/main/res/drawable/v_heart_x24.xml
deleted file mode 100644
index 71e3a0d55..000000000
--- a/app/src/main/res/drawable/v_heart_x24.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
diff --git a/app/src/main/res/drawable/v_history_black_x24.xml b/app/src/main/res/drawable/v_history_black_x24.xml
deleted file mode 100644
index fef4f9232..000000000
--- a/app/src/main/res/drawable/v_history_black_x24.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
diff --git a/app/src/main/res/drawable/v_homepage_black_x24.xml b/app/src/main/res/drawable/v_homepage_black_x24.xml
deleted file mode 100644
index c92c6ae44..000000000
--- a/app/src/main/res/drawable/v_homepage_black_x24.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
diff --git a/app/src/main/res/drawable/v_settings_black_x24.xml b/app/src/main/res/drawable/v_settings_black_x24.xml
deleted file mode 100644
index 8b0f72ead..000000000
--- a/app/src/main/res/drawable/v_settings_black_x24.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
diff --git a/app/src/main/res/values/pathdata.xml b/app/src/main/res/values/pathdata.xml
index e192b0db4..365746cf4 100644
--- a/app/src/main/res/values/pathdata.xml
+++ b/app/src/main/res/values/pathdata.xml
@@ -21,13 +21,8 @@
M8,5.14V19.14L19,12.14L8,5.14Z
M0.41,13.41L6,19L7.41,17.58L1.83,12M22.24,5.58L11.66,16.17L7.5,12L6.07,13.41L11.66,19L23.66,7M18,7L16.59,5.58L10.24,11.93L11.66,13.34L18,7Z
M9,18V15H5V11H9V8L14,13M20,6H12L10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6Z
- M12,15.5A3.5,3.5 0 0,1 8.5,12A3.5,3.5 0 0,1 12,8.5A3.5,3.5 0 0,1 15.5,12A3.5,3.5 0 0,1 12,15.5M19.43,12.97C19.47,12.65 19.5,12.33 19.5,12C19.5,11.67 19.47,11.34 19.43,11L21.54,9.37C21.73,9.22 21.78,8.95 21.66,8.73L19.66,5.27C19.54,5.05 19.27,4.96 19.05,5.05L16.56,6.05C16.04,5.66 15.5,5.32 14.87,5.07L14.5,2.42C14.46,2.18 14.25,2 14,2H10C9.75,2 9.54,2.18 9.5,2.42L9.13,5.07C8.5,5.32 7.96,5.66 7.44,6.05L4.95,5.05C4.73,4.96 4.46,5.05 4.34,5.27L2.34,8.73C2.21,8.95 2.27,9.22 2.46,9.37L4.57,11C4.53,11.34 4.5,11.67 4.5,12C4.5,12.33 4.53,12.65 4.57,12.97L2.46,14.63C2.27,14.78 2.21,15.05 2.34,15.27L4.34,18.73C4.46,18.95 4.73,19.03 4.95,18.95L7.44,17.94C7.96,18.34 8.5,18.68 9.13,18.93L9.5,21.58C9.54,21.82 9.75,22 10,22H14C14.25,22 14.46,21.82 14.5,21.58L14.87,18.93C15.5,18.67 16.04,18.34 16.56,17.94L19.05,18.95C19.27,19.03 19.54,18.95 19.66,18.73L21.66,15.27C21.78,15.05 21.73,14.78 21.54,14.63L19.43,12.97Z
M21,13H13V21H11V13H3V11H11V3H13V11H21V13Z
M5,20H19V18H5M19,9H15V3H9V9H5L12,16L19,9Z
- M10,20V14H14V20H19V12H22L12,3L2,12H5V20H10Z
- M11.71,19C9.93,19 8.5,17.59 8.5,15.86C8.5,14.24 9.53,13.1 11.3,12.74C13.07,12.38 14.9,11.53 15.92,10.16C16.31,11.45 16.5,12.81 16.5,14.2C16.5,16.84 14.36,19 11.71,19M13.5,0.67C13.5,0.67 14.24,3.32 14.24,5.47C14.24,7.53 12.89,9.2 10.83,9.2C8.76,9.2 7.2,7.53 7.2,5.47L7.23,5.1C5.21,7.5 4,10.61 4,14A8,8 0 0,0 12,22A8,8 0 0,0 20,14C20,8.6 17.41,3.8 13.5,0.67Z
- M12,21.35L10.55,20.03C5.4,15.36 2,12.27 2,8.5C2,5.41 4.42,3 7.5,3C9.24,3 10.91,3.81 12,5.08C13.09,3.81 14.76,3 16.5,3C19.58,3 22,5.41 22,8.5C22,12.27 18.6,15.36 13.45,20.03L12,21.35Z
- M11,7V12.11L15.71,14.9L16.5,13.62L12.5,11.25V7M12.5,2C8.97,2 5.91,3.92 4.27,6.77L2,4.5V11H8.5L5.75,8.25C6.96,5.73 9.5,4 12.5,4A7.5,7.5 0 0,1 20,11.5A7.5,7.5 0 0,1 12.5,19C9.23,19 6.47,16.91 5.44,14H3.34C4.44,18.03 8.11,21 12.5,21C17.74,21 22,16.75 22,11.5A9.5,9.5 0 0,0 12.5,2Z
M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z
M13,13L17,17L21,13H18V10C18,6.1,14.9,3,11,3S4,6.1,4,10V17H6V10C6,7.2,8.2,5,11,5S16,7.2,16,10V13H13M,16,19H18V21H16V19Z
M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z
@@ -38,7 +33,6 @@
M19,3H5C3.9,3,3,3.9,3,5V19C3,20.1,3.9,21,5,21H19C20.1,21,21,20.1,21,19V5C21,3.9,20.1,3,19,3ZM12,17L7,12H10V8H14V12H17L12,17Z
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
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
- M20,8H4V6h16V8 M18,2H6v2h12V2 M20,10H4c-1.1,0-2,0.9-2,2v8c0,1.1,0.9,2,2,2h16c1.1,0,2-0.9,2-2v-8C22,10.9,21.1,10,20,10zM11,14H7v1h4v2H7v1h4v2H5v-8h6V14z M19,20h-2v-3h-2v3h-2v-8h2v3h2v-3h2V20z
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
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
M0,19V24H24V19H0ZM16,22H15V21H16V22ZM19,22H18V21H19V22ZM22,22H21V21H22V22M15,11L15,0L9,0L9,11L5,11L12,18L19,11Z
diff --git a/gradle.properties b/gradle.properties
index bfddba75b..a5f9e48ae 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -21,6 +21,6 @@ org.gradle.caching=true
android.useAndroidX=true
android.enableAppCompileTimeRClass=true
android.experimental.enableNewResourceShrinker.preciseShrinking=true
-android.experimental.lint.version=8.3.0-alpha09
+android.experimental.lint.version=8.3.0-alpha10
android.lint.useK2Uast=true
kotlin.experimental.tryK2=true