Skip to content

Commit

Permalink
ui: remove more xml icons
Browse files Browse the repository at this point in the history
  • Loading branch information
plateaukao committed Oct 6, 2024
1 parent cbfd178 commit 4e46c76
Show file tree
Hide file tree
Showing 25 changed files with 37 additions and 177 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import info.plateaukao.einkbro.preference.PaperSize
import org.koin.core.component.KoinComponent
import org.koin.core.component.inject

class PrinterDocumentPaperSizeDialog(val context: Context): KoinComponent {
class PrinterDocumentPaperSizeDialog(val context: Context) : KoinComponent {
private val config: ConfigManager by inject()

fun show() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.platform.AbstractComposeView
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.text.style.TextAlign
Expand Down Expand Up @@ -97,6 +98,7 @@ private fun ActionModeMenu(
ActionMenuItem(
info.title,
if (showIcons) info.drawable else null,
if (showIcons) info.imageVector else null,
onClicked = {
info.action?.invoke()
if (info.closeMenu) onClicked(info.intent)
Expand All @@ -114,6 +116,7 @@ private fun ActionModeMenu(
fun ActionMenuItem(
title: String,
iconDrawable: Drawable?,
imageVector: ImageVector? = null,
onClicked: () -> Unit = {},
onLongClicked: () -> Unit = {},
) {
Expand All @@ -127,7 +130,7 @@ fun ActionMenuItem(
else -> 45.dp
}

val fontSize = if (iconDrawable == null) 12.sp else
val fontSize = if (iconDrawable == null && imageVector == null) 12.sp else
if (configuration.screenWidthDp > 500) 10.sp else 8.sp
Column(
modifier = Modifier
Expand All @@ -153,6 +156,15 @@ fun ActionMenuItem(
.padding(horizontal = 6.dp),
)
}
if (imageVector != null) {
Image(
imageVector = imageVector,
contentDescription = null,
modifier = Modifier
.size(44.dp)
.padding(horizontal = 6.dp),
)
}
if (title.isNotEmpty()) {
Text(
modifier = Modifier
Expand All @@ -177,6 +189,7 @@ fun PreviewActionMenuItem() {
ActionMenuItem(
title = "Title",
iconDrawable = null,
imageVector = null,
onClicked = {},
onLongClicked = {},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import androidx.compose.material.Divider
import androidx.compose.material.Icon
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.DragHandle
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
Expand Down Expand Up @@ -363,7 +365,7 @@ fun BookmarkItem(
if (shouldShowDragHandle) {
Icon(
modifier = dragModifier.padding(8.dp),
imageVector = ImageVector.vectorResource(id = R.drawable.ic_drag),
imageVector = Icons.Outlined.DragHandle,
contentDescription = null,
tint = MaterialTheme.colors.onBackground
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import androidx.compose.material.Text
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.outlined.Article
import androidx.compose.material.icons.automirrored.outlined.ChromeReaderMode
import androidx.compose.material.icons.automirrored.outlined.Feed
import androidx.compose.material.icons.automirrored.outlined.KeyboardArrowRight
import androidx.compose.material.icons.automirrored.outlined.LibraryBooks
import androidx.compose.material.icons.automirrored.outlined.Logout
Expand All @@ -37,11 +38,13 @@ import androidx.compose.material.icons.filled.RecordVoiceOver
import androidx.compose.material.icons.outlined.AddHome
import androidx.compose.material.icons.outlined.AddLink
import androidx.compose.material.icons.outlined.Apps
import androidx.compose.material.icons.outlined.Backup
import androidx.compose.material.icons.outlined.BookmarkAdd
import androidx.compose.material.icons.outlined.BorderColor
import androidx.compose.material.icons.outlined.CancelPresentation
import androidx.compose.material.icons.outlined.CopyAll
import androidx.compose.material.icons.outlined.Copyright
import androidx.compose.material.icons.outlined.Download
import androidx.compose.material.icons.outlined.EditNote
import androidx.compose.material.icons.outlined.FormatSize
import androidx.compose.material.icons.outlined.Home
import androidx.compose.material.icons.outlined.InstallMobile
Expand All @@ -59,6 +62,7 @@ import androidx.compose.material.icons.outlined.TouchApp
import androidx.compose.material.icons.outlined.Translate
import androidx.compose.material.icons.outlined.ViewColumn
import androidx.compose.material.icons.outlined.ViewStream
import androidx.compose.material.icons.twotone.Copyright
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
Expand Down Expand Up @@ -163,7 +167,7 @@ private fun MenuItems(
.horizontalScroll(rememberScrollState()),
horizontalArrangement = Arrangement.SpaceBetween,
) {
MenuItem(R.string.menu_highlights, 0, Icons.Outlined.BorderColor) {
MenuItem(R.string.menu_highlights, 0, Icons.Outlined.EditNote) {
onClicked(MenuItemType.Highlights)
}
MenuItem(R.string.menu_fav, 0, Icons.Outlined.AddHome) { onClicked(MenuItemType.SetHome) }
Expand Down Expand Up @@ -241,15 +245,15 @@ private fun MenuItems(
R.string.menu_add_to_pocket,
R.drawable.ic_pocket
) { onClicked(AddToPocket) }
MenuItem(R.string.menu_save_epub, R.drawable.ic_book) { onClicked(SaveEpub) }
MenuItem(R.string.copy_link, R.drawable.ic_copy) { onClicked(CopyLink) }
MenuItem(R.string.menu_save_epub, Icons.AutoMirrored.Outlined.Feed) { onClicked(SaveEpub) }
MenuItem(R.string.copy_link, Icons.Outlined.CopyAll) { onClicked(CopyLink) }
MenuItem(
R.string.menu_share_link,
R.drawable.icon_menu_share
Icons.Outlined.Share
) { onClicked(ShareLink) }
MenuItem(
R.string.menu_expand_menu,
R.drawable.icon_arrow_right_gest,
Icons.AutoMirrored.Outlined.KeyboardArrowRight
) { currentShowShare = true; toggleShareSaveMenu() }
}
}
Expand Down Expand Up @@ -319,7 +323,7 @@ private fun MenuItems(
if (hasWhiteBkd) R.drawable.ic_white_background_active else R.drawable.ic_white_background
MenuItem(R.string.white_background, whiteRes) { onClicked(MenuItemType.WhiteBknd) }
val blackRes =
if (blackFont) R.drawable.ic_black_font_on else R.drawable.ic_black_font_off
if (blackFont) Icons.Outlined.Copyright else Icons.TwoTone.Copyright
MenuItem(R.string.black_font, blackRes) { onClicked(MenuItemType.BlackFont) }
val boldRes =
if (boldFont) R.drawable.ic_bold_font_active else R.drawable.ic_bold_font
Expand Down Expand Up @@ -493,8 +497,8 @@ fun MenuItem(
private fun PreviewItem() {
MyTheme {
Column {
MenuItem(R.string.title_appData, R.drawable.ic_copy, showIcon = false) {}
MenuItem(R.string.title, R.drawable.ic_location) {}
MenuItem(R.string.title_appData, Icons.Outlined.Backup, showIcon = false) {}
MenuItem(R.string.title, 0, Icons.Outlined.Translate) {}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import androidx.compose.material.MaterialTheme
import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.material.TextButton
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.DragHandle
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
Expand All @@ -32,7 +34,6 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import info.plateaukao.einkbro.R
import info.plateaukao.einkbro.view.compose.MyTheme
import info.plateaukao.einkbro.view.toolbaricons.ToolbarAction
import sh.calvin.reorderable.ReorderableItem
Expand Down Expand Up @@ -167,7 +168,7 @@ fun ToolbarToggleItem(
}
Icon(
modifier = modifier.padding(4.dp),
imageVector = ImageVector.vectorResource(id = R.drawable.ic_drag), contentDescription = null,
imageVector = Icons.Outlined.DragHandle, contentDescription = null,
tint = MaterialTheme.colors.onBackground
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import android.content.Intent
import android.content.pm.PackageManager
import android.graphics.Point
import android.view.ActionMode
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.EditNote
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.mutableStateOf
import androidx.core.content.ContextCompat
Expand Down Expand Up @@ -212,7 +214,7 @@ class ActionModeMenuViewModel : ViewModel(), KoinComponent {
menuInfos.add(
MenuInfo(
context.getString(R.string.highlight),
drawable = ContextCompat.getDrawable(context, R.drawable.ic_highlight),
imageVector = Icons.Outlined.EditNote,
action = {
_actionModeMenuState.value =
ActionModeMenuState.HighlightText(configManager.highlightStyle)
Expand Down
6 changes: 0 additions & 6 deletions app/src/main/res/drawable/ic_block.xml

This file was deleted.

9 changes: 0 additions & 9 deletions app/src/main/res/drawable/ic_bookmarks.xml

This file was deleted.

11 changes: 0 additions & 11 deletions app/src/main/res/drawable/ic_chat.xml

This file was deleted.

10 changes: 0 additions & 10 deletions app/src/main/res/drawable/ic_input_url.xml

This file was deleted.

6 changes: 0 additions & 6 deletions app/src/main/res/drawable/ic_link.xml

This file was deleted.

5 changes: 0 additions & 5 deletions app/src/main/res/drawable/ic_location.xml

This file was deleted.

9 changes: 0 additions & 9 deletions app/src/main/res/drawable/ic_media_continue.xml

This file was deleted.

5 changes: 0 additions & 5 deletions app/src/main/res/drawable/ic_menu.xml

This file was deleted.

9 changes: 0 additions & 9 deletions app/src/main/res/drawable/ic_page_down.xml

This file was deleted.

9 changes: 0 additions & 9 deletions app/src/main/res/drawable/ic_page_up.xml

This file was deleted.

11 changes: 0 additions & 11 deletions app/src/main/res/drawable/ic_toc.xml

This file was deleted.

14 changes: 0 additions & 14 deletions app/src/main/res/drawable/ic_translate_paragraph.xml

This file was deleted.

9 changes: 0 additions & 9 deletions app/src/main/res/drawable/ic_vertical_read.xml

This file was deleted.

9 changes: 0 additions & 9 deletions app/src/main/res/drawable/ic_volume.xml

This file was deleted.

8 changes: 0 additions & 8 deletions app/src/main/res/drawable/icon_cookie.xml

This file was deleted.

8 changes: 0 additions & 8 deletions app/src/main/res/drawable/icon_fullscreen.xml

This file was deleted.

8 changes: 0 additions & 8 deletions app/src/main/res/drawable/icon_java.xml

This file was deleted.

8 changes: 0 additions & 8 deletions app/src/main/res/drawable/icon_preview.xml

This file was deleted.

8 changes: 0 additions & 8 deletions app/src/main/res/drawable/icon_size.xml

This file was deleted.

0 comments on commit 4e46c76

Please sign in to comment.