Skip to content

Commit

Permalink
Update app icons
Browse files Browse the repository at this point in the history
  • Loading branch information
fibelatti committed Sep 21, 2024
1 parent 4d70f14 commit b0f468e
Show file tree
Hide file tree
Showing 35 changed files with 220 additions and 150 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.FloatingActionButton
import androidx.compose.material3.Icon
Expand Down Expand Up @@ -244,6 +245,7 @@ private fun MainBottomAppBar(
Icon(
painter = painterResource(id = icon),
contentDescription = null,
modifier = Modifier.size(24.dp),
tint = MaterialTheme.colorScheme.onSurfaceVariant,
)
}
Expand Down Expand Up @@ -313,6 +315,7 @@ private fun MenuItemsContent(
Icon(
painter = painterResource(id = menuItem.icon),
contentDescription = stringResource(id = menuItem.name),
modifier = Modifier.size(24.dp),
tint = MaterialTheme.colorScheme.onSurfaceVariant,
)
}
Expand Down Expand Up @@ -350,6 +353,7 @@ private fun SidePanelBottomAppBar(
Icon(
painter = painterResource(id = R.drawable.ic_chevron_left),
contentDescription = stringResource(id = R.string.cd_expand_menu),
modifier = Modifier.size(24.dp),
tint = MaterialTheme.colorScheme.onSurfaceVariant,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ data class MainState(

data object OpenInBrowser : MenuItemComponent(
name = R.string.menu_link_open_in_browser,
icon = R.drawable.ic_open_in_browser,
icon = R.drawable.ic_browser,
)

data object SaveBookmark : MenuItemComponent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ import androidx.compose.runtime.rememberUpdatedState
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.viewinterop.AndroidView
import androidx.hilt.navigation.compose.hiltViewModel
Expand Down Expand Up @@ -96,15 +98,18 @@ fun BookmarkDetailsScreen(

when {
post.isFile() -> {
FileBookmark(
BookmarkPlaceholder(
title = post.displayTitle,
url = post.url,
onOpenInFileViewerClicked = onOpenInFileViewerClicked,
onButtonClicked = onOpenInFileViewerClicked,
icon = painterResource(id = R.drawable.ic_mobile),
description = stringResource(id = R.string.posts_open_with_file_viewer_description),
buttonText = stringResource(id = R.string.posts_open_with_file_viewer),
)
}

!isConnected -> {
BookmarkError(
BookmarkPlaceholder(
title = post.displayTitle,
url = post.url,
onButtonClicked = onOpenInBrowserClicked,
Expand All @@ -113,7 +118,7 @@ fun BookmarkDetailsScreen(
}

hasError -> {
BookmarkError(
BookmarkPlaceholder(
title = post.displayTitle,
url = post.url,
onButtonClicked = onOpenInBrowserClicked,
Expand Down Expand Up @@ -199,56 +204,11 @@ fun BookmarkDetailsScreen(
}

@Composable
private fun FileBookmark(
title: String,
url: String,
onOpenInFileViewerClicked: () -> Unit,
) {
Column(
modifier = Modifier
.fillMaxSize()
.background(color = ExtendedTheme.colors.backgroundNoOverlay)
.padding(horizontal = 24.dp),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally,
) {
Icon(
painter = painterResource(id = R.drawable.ic_file),
contentDescription = null,
modifier = Modifier.size(60.dp),
tint = MaterialTheme.colorScheme.primary,
)

Text(
text = title,
modifier = Modifier.padding(top = 16.dp),
color = MaterialTheme.colorScheme.onSurface,
textAlign = TextAlign.Center,
style = MaterialTheme.typography.bodyLarge.copy(fontWeight = FontWeight.Bold),
)

Text(
text = url,
modifier = Modifier.padding(top = 8.dp),
color = MaterialTheme.colorScheme.onSurfaceVariant,
textAlign = TextAlign.Center,
style = MaterialTheme.typography.bodyMedium,
)

ElevatedButton(
onClick = onOpenInFileViewerClicked,
modifier = Modifier.padding(top = 24.dp),
) {
Text(text = stringResource(id = R.string.posts_open_with_file_viewer))
}
}
}

@Composable
private fun BookmarkError(
private fun BookmarkPlaceholder(
title: String,
url: String,
onButtonClicked: () -> Unit,
icon: Painter = painterResource(id = R.drawable.ic_browser),
description: String = stringResource(id = R.string.posts_url_error),
buttonText: String = stringResource(id = R.string.posts_open_in_browser),
) {
Expand All @@ -261,8 +221,8 @@ private fun BookmarkError(
horizontalAlignment = Alignment.CenterHorizontally,
) {
Icon(
painter = painterResource(id = R.drawable.ic_warning),
contentDescription = stringResource(id = R.string.cd_warning),
painter = icon,
contentDescription = null,
modifier = Modifier.size(60.dp),
tint = MaterialTheme.colorScheme.primary,
)
Expand All @@ -272,6 +232,8 @@ private fun BookmarkError(
modifier = Modifier.padding(top = 16.dp),
color = MaterialTheme.colorScheme.onSurface,
textAlign = TextAlign.Center,
overflow = TextOverflow.Ellipsis,
maxLines = 2,
style = MaterialTheme.typography.bodyLarge.copy(fontWeight = FontWeight.Bold),
)

Expand All @@ -280,6 +242,8 @@ private fun BookmarkError(
modifier = Modifier.padding(top = 8.dp),
color = MaterialTheme.colorScheme.onSurfaceVariant,
textAlign = TextAlign.Center,
overflow = TextOverflow.Ellipsis,
maxLines = 2,
style = MaterialTheme.typography.bodyMedium,
)

Expand All @@ -304,10 +268,13 @@ private fun BookmarkError(
@ThemePreviews
private fun FileBookmarkPreview() {
ExtendedTheme {
FileBookmark(
BookmarkPlaceholder(
title = "Some bookmark",
url = "https://www.bookmark.com",
onOpenInFileViewerClicked = {},
onButtonClicked = {},
icon = painterResource(id = R.drawable.ic_mobile),
description = stringResource(id = R.string.posts_open_with_file_viewer_description),
buttonText = stringResource(id = R.string.posts_open_with_file_viewer),
)
}
}
Expand All @@ -316,7 +283,7 @@ private fun FileBookmarkPreview() {
@ThemePreviews
private fun BookmarkErrorPreview() {
ExtendedTheme {
BookmarkError(
BookmarkPlaceholder(
title = "Some bookmark",
url = "https://www.bookmark.com",
onButtonClicked = {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,7 @@ private fun BookmarkFlags(
Icon(
painter = painterResource(id = R.drawable.ic_private),
contentDescription = null,
modifier = Modifier.size(16.dp),
tint = MaterialTheme.colorScheme.onSurfaceVariant,
)

Expand All @@ -533,6 +534,7 @@ private fun BookmarkFlags(
Icon(
painter = painterResource(id = R.drawable.ic_read_later),
contentDescription = null,
modifier = Modifier.size(16.dp),
tint = MaterialTheme.colorScheme.onSurfaceVariant,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ private sealed class PopularPostQuickActions(
override val post: Post,
) : PopularPostQuickActions(
title = R.string.quick_actions_open_in_browser,
icon = R.drawable.ic_open_in_browser,
icon = R.drawable.ic_browser,
)

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import com.fibelatti.pinboard.features.appstate.PostDetailContent
import com.fibelatti.pinboard.features.posts.domain.model.Post
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.onEach
import java.util.UUID
import javax.inject.Inject
import kotlinx.coroutines.flow.onEach

@AndroidEntryPoint
class PostDetailFragment @Inject constructor() : BaseFragment() {
Expand Down Expand Up @@ -82,13 +82,13 @@ class PostDetailFragment @Inject constructor() : BaseFragment() {

try {
startActivity(newIntent)
} catch (ignored: ActivityNotFoundException) {
requireView().showBanner(getString(R.string.posts_open_with_file_viewer_error))
} catch (_: ActivityNotFoundException) {
openUrlInExternalBrowser(post)
}
}

private fun openUrlInExternalBrowser(post: Post) {
startActivity(Intent(Intent.ACTION_VIEW).apply { data = Uri.parse(post.url) })
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(post.url)))
}

private fun setupViewModels() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,14 +410,14 @@ private sealed class PostQuickActions(
override val post: Post,
) : PostQuickActions(
title = R.string.quick_actions_open_in_browser,
icon = R.drawable.ic_open_in_browser,
icon = R.drawable.ic_browser,
)

data class SubmitToWayback(
override val post: Post,
) : PostQuickActions(
title = R.string.quick_actions_submit_to_wayback,
icon = R.drawable.ic_share,
icon = R.drawable.ic_send,
)

data class SearchWayback(
Expand Down
7 changes: 5 additions & 2 deletions app/src/main/res/drawable/ic_bookmarks.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/color_icon"
android:pathData="M19,18l2,1V3c0,-1.1 -0.9,-2 -2,-2H8.99C7.89,1 7,1.9 7,3h10c1.1,0 2,0.9 2,2v13zM15,5H5c-1.1,0 -2,0.9 -2,2v16l7,-3 7,3V7c0,-1.1 -0.9,-2 -2,-2z" />
android:fillColor="#00000000"
android:pathData="M5,6.2C5,5.08 5,4.52 5.218,4.092C5.41,3.716 5.716,3.41 6.092,3.218C6.52,3 7.08,3 8.2,3H15.8C16.92,3 17.48,3 17.908,3.218C18.284,3.41 18.59,3.716 18.782,4.092C19,4.52 19,5.08 19,6.2V21L12,16L5,21V6.2Z"
android:strokeWidth="2"
android:strokeColor="#000000"
android:strokeLineJoin="round" />
</vector>
13 changes: 13 additions & 0 deletions app/src/main/res/drawable/ic_browser.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<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="#00000000"
android:pathData="M3,10H21M6,7.5H6.01M9,7.5H18M6.2,19H17.8C18.92,19 19.48,19 19.908,18.782C20.284,18.59 20.59,18.284 20.782,17.908C21,17.48 21,16.92 21,15.8V8.2C21,7.08 21,6.52 20.782,6.092C20.59,5.716 20.284,5.41 19.908,5.218C19.48,5 18.92,5 17.8,5H6.2C5.08,5 4.52,5 4.092,5.218C3.716,5.41 3.41,5.716 3.218,6.092C3,6.52 3,7.08 3,8.2V15.8C3,16.92 3,17.48 3.218,17.908C3.41,18.284 3.716,18.59 4.092,18.782C4.52,19 5.08,19 6.2,19Z"
android:strokeWidth="2"
android:strokeColor="#000000"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
</vector>
11 changes: 6 additions & 5 deletions app/src/main/res/drawable/ic_clear_filter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/color_icon"
android:pathData="M19.79,5.61C20.3,4.95 19.83,4 19,4H6.83l7.97,7.97L19.79,5.61z" />
<path
android:fillColor="@color/color_icon"
android:pathData="M20.49,20.49L3.51,3.51c-0.39,-0.39 -1.02,-0.39 -1.41,0c-0.39,0.39 -0.39,1.02 0,1.41L10,13v5c0,1.1 0.9,2 2,2s2,-0.9 2,-2v-1.17l5.07,5.07c0.39,0.39 1.02,0.39 1.41,0S20.88,20.88 20.49,20.49z" />
android:fillColor="#00000000"
android:pathData="M15,15L21,21M21,15L15,21M10,21V14.663C10,14.418 10,14.296 9.972,14.181C9.948,14.079 9.907,13.981 9.853,13.892C9.791,13.791 9.704,13.704 9.531,13.531L3.469,7.469C3.296,7.296 3.209,7.209 3.147,7.108C3.093,7.019 3.052,6.921 3.028,6.819C3,6.704 3,6.582 3,6.337V4.6C3,4.04 3,3.76 3.109,3.546C3.205,3.358 3.358,3.205 3.546,3.109C3.76,3 4.04,3 4.6,3H19.4C19.96,3 20.24,3 20.454,3.109C20.642,3.205 20.795,3.358 20.891,3.546C21,3.76 21,4.04 21,4.6V6.337C21,6.582 21,6.704 20.972,6.819C20.948,6.921 20.907,7.019 20.853,7.108C20.791,7.209 20.704,7.296 20.531,7.469L17,11"
android:strokeWidth="2"
android:strokeColor="#000000"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
</vector>
7 changes: 5 additions & 2 deletions app/src/main/res/drawable/ic_copy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/color_icon"
android:pathData="M15,20H5V7c0,-0.55 -0.45,-1 -1,-1h0C3.45,6 3,6.45 3,7v13c0,1.1 0.9,2 2,2h10c0.55,0 1,-0.45 1,-1v0C16,20.45 15.55,20 15,20zM20,16V4c0,-1.1 -0.9,-2 -2,-2H9C7.9,2 7,2.9 7,4v12c0,1.1 0.9,2 2,2h9C19.1,18 20,17.1 20,16zM18,16H9V4h9V16z" />
android:fillColor="#00000000"
android:pathData="M15,3V6.4C15,6.96 15,7.24 15.109,7.454C15.205,7.642 15.358,7.795 15.546,7.891C15.76,8 16.04,8 16.6,8H20M10,8H6C4.895,8 4,8.895 4,10V19C4,20.105 4.895,21 6,21H12C13.105,21 14,20.105 14,19V16M16,3H13.2C12.08,3 11.52,3 11.092,3.218C10.716,3.41 10.41,3.716 10.218,4.092C10,4.52 10,5.08 10,6.2V12.8C10,13.92 10,14.48 10.218,14.908C10.41,15.284 10.716,15.59 11.092,15.782C11.52,16 12.08,16 13.2,16H16.8C17.92,16 18.48,16 18.908,15.782C19.284,15.59 19.59,15.284 19.782,14.908C20,14.48 20,13.92 20,12.8V7L16,3Z"
android:strokeWidth="2"
android:strokeColor="#000000"
android:strokeLineJoin="round" />
</vector>
8 changes: 6 additions & 2 deletions app/src/main/res/drawable/ic_delete.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/color_icon"
android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2V9c0,-1.1 -0.9,-2 -2,-2H8c-1.1,0 -2,0.9 -2,2v10zM18,4h-2.5l-0.71,-0.71c-0.18,-0.18 -0.44,-0.29 -0.7,-0.29H9.91c-0.26,0 -0.52,0.11 -0.7,0.29L8.5,4H6c-0.55,0 -1,0.45 -1,1s0.45,1 1,1h12c0.55,0 1,-0.45 1,-1s-0.45,-1 -1,-1z" />
android:fillColor="#00000000"
android:pathData="M18,6L17.199,18.013C17.129,19.065 17.094,19.591 16.867,19.99C16.667,20.341 16.365,20.624 16.001,20.8C15.588,21 15.061,21 14.006,21H9.994C8.939,21 8.412,21 7.999,20.8C7.635,20.624 7.333,20.341 7.133,19.99C6.906,19.591 6.871,19.065 6.801,18.013L6,6M4,6H20M16,6L15.729,5.188C15.467,4.401 15.336,4.008 15.093,3.717C14.878,3.46 14.602,3.261 14.29,3.139C13.938,3 13.523,3 12.694,3H11.306C10.477,3 10.062,3 9.71,3.139C9.398,3.261 9.122,3.46 8.907,3.717C8.664,4.008 8.533,4.401 8.271,5.188L8,6"
android:strokeWidth="2"
android:strokeColor="#000000"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
</vector>
8 changes: 6 additions & 2 deletions app/src/main/res/drawable/ic_done.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/color_icon"
android:pathData="M9,16.2l-3.5,-3.5c-0.39,-0.39 -1.01,-0.39 -1.4,0 -0.39,0.39 -0.39,1.01 0,1.4l4.19,4.19c0.39,0.39 1.02,0.39 1.41,0L20.3,7.7c0.39,-0.39 0.39,-1.01 0,-1.4 -0.39,-0.39 -1.01,-0.39 -1.4,0L9,16.2z" />
android:fillColor="#00000000"
android:pathData="M4,12.611L8.923,17.5L20,6.5"
android:strokeWidth="2"
android:strokeColor="#000000"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
</vector>
8 changes: 6 additions & 2 deletions app/src/main/res/drawable/ic_edit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/color_icon"
android:pathData="M3,17.46v3.04c0,0.28 0.22,0.5 0.5,0.5h3.04c0.13,0 0.26,-0.05 0.35,-0.15L17.81,9.94l-3.75,-3.75L3.15,17.1c-0.1,0.1 -0.15,0.22 -0.15,0.36zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z" />
android:fillColor="#00000000"
android:pathData="M15.5,5.501L18.328,8.329M13,21H21M3,21L3.047,20.668C3.215,19.493 3.299,18.905 3.49,18.357C3.66,17.87 3.891,17.407 4.179,16.979C4.503,16.497 4.923,16.077 5.763,15.238L17.411,3.59C18.192,2.809 19.458,2.809 20.239,3.59C21.02,4.371 21.02,5.637 20.239,6.418L8.377,18.28C7.616,19.042 7.235,19.422 6.801,19.725C6.416,19.994 6.001,20.217 5.564,20.389C5.072,20.582 4.544,20.689 3.488,20.902L3,21Z"
android:strokeWidth="2"
android:strokeColor="#000000"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
</vector>
8 changes: 6 additions & 2 deletions app/src/main/res/drawable/ic_expand.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/color_icon"
android:pathData="M5,20h14c0.55,0 1,0.45 1,1v0c0,0.55 -0.45,1 -1,1H5c-0.55,0 -1,-0.45 -1,-1v0C4,20.45 4.45,20 5,20zM5,2h14c0.55,0 1,0.45 1,1v0c0,0.55 -0.45,1 -1,1H5C4.45,4 4,3.55 4,3v0C4,2.45 4.45,2 5,2zM13,9h1.79c0.45,0 0.67,-0.54 0.35,-0.85l-2.79,-2.79c-0.2,-0.2 -0.51,-0.2 -0.71,0L8.85,8.15C8.54,8.46 8.76,9 9.21,9H11v6H9.21c-0.45,0 -0.67,0.54 -0.35,0.85l2.79,2.79c0.2,0.2 0.51,0.2 0.71,0l2.79,-2.79c0.31,-0.31 0.09,-0.85 -0.35,-0.85H13V9z" />
android:fillColor="#00000000"
android:pathData="M3,21L21,3M3,21H7.5M3,21L3,16.5M21,3H16.5M21,3V7.5"
android:strokeWidth="2"
android:strokeColor="#000000"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
</vector>
9 changes: 0 additions & 9 deletions app/src/main/res/drawable/ic_file.xml

This file was deleted.

8 changes: 6 additions & 2 deletions app/src/main/res/drawable/ic_filter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/color_icon"
android:pathData="M4.25,5.61C6.57,8.59 10,13 10,13v5c0,1.1 0.9,2 2,2h0c1.1,0 2,-0.9 2,-2v-5c0,0 3.43,-4.41 5.75,-7.39C20.26,4.95 19.79,4 18.95,4H5.04C4.21,4 3.74,4.95 4.25,5.61z" />
android:fillColor="#00000000"
android:pathData="M21,6H19M21,12H16M21,18H16M7,20V13.561C7,13.353 7,13.249 6.98,13.15C6.961,13.061 6.932,12.976 6.891,12.896C6.844,12.805 6.779,12.724 6.649,12.562L3.351,8.438C3.221,8.276 3.156,8.195 3.109,8.104C3.068,8.024 3.039,7.939 3.02,7.85C3,7.751 3,7.647 3,7.439V5.6C3,5.04 3,4.76 3.109,4.546C3.205,4.358 3.358,4.205 3.546,4.109C3.76,4 4.04,4 4.6,4H13.4C13.96,4 14.24,4 14.454,4.109C14.642,4.205 14.795,4.358 14.891,4.546C15,4.76 15,5.04 15,5.6V7.439C15,7.647 15,7.751 14.98,7.85C14.962,7.939 14.932,8.024 14.891,8.104C14.844,8.195 14.779,8.276 14.649,8.438L11.351,12.562C11.221,12.724 11.156,12.805 11.109,12.896C11.068,12.976 11.038,13.061 11.02,13.15C11,13.249 11,13.353 11,13.561V17L7,20Z"
android:strokeWidth="2"
android:strokeColor="#000000"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
</vector>
Loading

0 comments on commit b0f468e

Please sign in to comment.