mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 22:17:03 +05:30
common: add icon resources
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
8146c550d6
commit
f93c249020
12 changed files with 90 additions and 9 deletions
|
@ -0,0 +1,12 @@
|
|||
package dev.msfjarvis.claw.common.res
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import dev.msfjarvis.claw.common.R
|
||||
|
||||
actual val commentIcon
|
||||
@Composable get() = painterResource(R.drawable.ic_insert_comment_24px)
|
||||
actual val heartIcon
|
||||
@Composable get() = painterResource(R.drawable.ic_favorite_24px)
|
||||
actual val heartBorderIcon
|
||||
@Composable get() = painterResource(R.drawable.ic_favorite_border_24px)
|
12
common/src/androidMain/res/drawable/ic_favorite_24px.xml
Normal file
12
common/src/androidMain/res/drawable/ic_favorite_24px.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<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="#FF000000"
|
||||
android:pathData="M12,21.35l-1.45,-1.32C5.4,15.36 2,12.28 2,8.5 2,5.42 4.42,3 7.5,3c1.74,0 3.41,0.81 4.5,2.09C13.09,3.81 14.76,3 16.5,3 19.58,3 22,5.42 22,8.5c0,3.78 -3.4,6.86 -8.55,11.54L12,21.35z"
|
||||
/>
|
||||
</vector>
|
|
@ -0,0 +1,12 @@
|
|||
<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="#FF000000"
|
||||
android:pathData="M16.5,3c-1.74,0 -3.41,0.81 -4.5,2.09C10.91,3.81 9.24,3 7.5,3 4.42,3 2,5.42 2,8.5c0,3.78 3.4,6.86 8.55,11.54L12,21.35l1.45,-1.32C18.6,15.36 22,12.28 22,8.5 22,5.42 19.58,3 16.5,3zM12.1,18.55l-0.1,0.1 -0.1,-0.1C7.14,14.24 4,11.39 4,8.5 4,6.5 5.5,5 7.5,5c1.54,0 3.04,0.99 3.57,2.36h1.87C13.46,5.99 14.96,5 16.5,5c2,0 3.5,1.5 3.5,3.5 0,2.89 -3.14,5.74 -7.9,10.05z"
|
||||
/>
|
||||
</vector>
|
|
@ -0,0 +1,12 @@
|
|||
<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="#000000"
|
||||
android:pathData="M20,2L4,2c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h14l4,4L22,4c0,-1.1 -0.9,-2 -2,-2zM18,14L6,14v-2h12v2zM18,11L6,11L6,9h12v2zM18,8L6,8L6,6h12v2z"
|
||||
/>
|
||||
</vector>
|
4
common/src/androidMain/res/values/strings.xml
Normal file
4
common/src/androidMain/res/values/strings.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<resources>
|
||||
<string name="app_name">Claw β</string>
|
||||
</resources>
|
|
@ -15,6 +15,7 @@ import androidx.compose.foundation.layout.requiredSize
|
|||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.Icon
|
||||
import androidx.compose.material.IconButton
|
||||
import androidx.compose.material.IconToggleButton
|
||||
import androidx.compose.material.MaterialTheme
|
||||
|
@ -27,6 +28,9 @@ import androidx.compose.ui.draw.clip
|
|||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.google.accompanist.flowlayout.FlowRow
|
||||
import dev.msfjarvis.claw.common.res.commentIcon
|
||||
import dev.msfjarvis.claw.common.res.heartBorderIcon
|
||||
import dev.msfjarvis.claw.common.res.heartIcon
|
||||
import dev.msfjarvis.claw.common.theme.titleColor
|
||||
import dev.msfjarvis.lobsters.data.local.SavedPost
|
||||
import io.kamel.image.KamelImage
|
||||
|
@ -160,12 +164,11 @@ fun SaveButton(
|
|||
modifier = Modifier.requiredSize(32.dp).then(modifier),
|
||||
) {
|
||||
Crossfade(targetState = isSaved) { saved ->
|
||||
/*IconResource(
|
||||
resourceId = if (saved) R.drawable.ic_favorite_24px else R.drawable.ic_favorite_border_24px,
|
||||
Icon(
|
||||
painter = if (saved) heartIcon else heartBorderIcon,
|
||||
tint = MaterialTheme.colors.secondary,
|
||||
contentDescription =
|
||||
if (saved) Strings.RemoveFromSavedPosts.get() else Strings.AddToSavedPosts.get(),
|
||||
)*/
|
||||
contentDescription = if (saved) "Remove from saved posts" else "Add to saved posts",
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -179,11 +182,11 @@ fun CommentsButton(
|
|||
onClick = onClick,
|
||||
modifier = Modifier.requiredSize(32.dp).then(modifier),
|
||||
) {
|
||||
/*IconResource(
|
||||
resourceId = R.drawable.ic_insert_comment_24px,
|
||||
Icon(
|
||||
painter = commentIcon,
|
||||
tint = MaterialTheme.colors.secondary,
|
||||
contentDescription = Strings.OpenComments.get(),
|
||||
)*/
|
||||
contentDescription = "Open comments",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package dev.msfjarvis.claw.common.res
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.painter.Painter
|
||||
|
||||
expect val commentIcon: Painter
|
||||
@Composable get
|
||||
expect val heartIcon: Painter
|
||||
@Composable get
|
||||
expect val heartBorderIcon: Painter
|
||||
@Composable get
|
|
@ -0,0 +1,11 @@
|
|||
package dev.msfjarvis.claw.common.res
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.res.svgResource
|
||||
|
||||
actual val commentIcon
|
||||
@Composable get() = svgResource("comment_black_24dp.svg")
|
||||
actual val heartIcon
|
||||
@Composable get() = svgResource("favorite_black_24dp.svg")
|
||||
actual val heartBorderIcon
|
||||
@Composable get() = svgResource("favorite_border_black_24dp.svg")
|
1
common/src/desktopMain/resources/comment_black_24dp.svg
Normal file
1
common/src/desktopMain/resources/comment_black_24dp.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0z" fill="none"/><path d="M21.99 4c0-1.1-.89-2-1.99-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h14l4 4-.01-18zM18 14H6v-2h12v2zm0-3H6V9h12v2zm0-3H6V6h12v2z"/></svg>
|
After Width: | Height: | Size: 279 B |
1
common/src/desktopMain/resources/favorite_black_24dp.svg
Normal file
1
common/src/desktopMain/resources/favorite_black_24dp.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0z" fill="none"/><path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"/></svg>
|
After Width: | Height: | Size: 331 B |
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0z" fill="none"/><path d="M16.5 3c-1.74 0-3.41.81-4.5 2.09C10.91 3.81 9.24 3 7.5 3 4.42 3 2 5.42 2 8.5c0 3.78 3.4 6.86 8.55 11.54L12 21.35l1.45-1.32C18.6 15.36 22 12.28 22 8.5 22 5.42 19.58 3 16.5 3zm-4.4 15.55l-.1.1-.1-.1C7.14 14.24 4 11.39 4 8.5 4 6.5 5.5 5 7.5 5c1.54 0 3.04.99 3.57 2.36h1.87C13.46 5.99 14.96 5 16.5 5c2 0 3.5 1.5 3.5 3.5 0 2.89-3.14 5.74-7.9 10.05z"/></svg>
|
After Width: | Height: | Size: 500 B |
Loading…
Add table
Add a link
Reference in a new issue