Skip to content

Commit

Permalink
Merge branch 'master' into as-const-types
Browse files Browse the repository at this point in the history
  • Loading branch information
torgeilo committed Aug 21, 2024
2 parents 5ee92e4 + 074b81b commit b32ceda
Show file tree
Hide file tree
Showing 8 changed files with 473 additions and 161 deletions.
13 changes: 8 additions & 5 deletions .github/scripts/generate-android-vectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,14 @@ function generateKotlinValues() {

// Probably a more efficient way to do this, but I don't think it really matters
const expressiveVariant = generatedDrawables.find((element) => {
const isActiveVariant = drawable.match("__active")

if (isActiveVariant) {
// Active expressive variants are named "horse_expressive__active", if "_expressive" was always the postfix we could just handle it like non-active ones
return element == rawNormalIconName.replace("__active", "") + "_expressive__active.xml"
// Icon variants such as "nrk-bell--active", "nrk-media-play-expressive--fail", or " nrk-media-volume-expressive--1"
// Variants end with "--variant", with "-expressive" being infront of the variant type. For those we need to insert "_expressive" into the name
// instead of just adding it at the end like
const indexOfVariantStart = drawable.indexOf("__")

if (indexOfVariantStart != -1) {
// From "nrk_media_playe__fail" to "nrk_media_playe_expressive__fail"
return element == rawNormalIconName.substring(0, indexOfVariantStart) + "_expressive" + rawNormalIconName.substring(indexOfVariantStart) + ".xml"
} else {
return element == rawNormalIconName + "_expressive.xml"
}
Expand Down
23 changes: 14 additions & 9 deletions android/icons/src/main/kotlin/no/nrk/core/icons/NrkIcons.kt
Original file line number Diff line number Diff line change
Expand Up @@ -575,17 +575,17 @@ object NrkIcons {

val NrkMediaChromecast1 = NrkIcon(
normal = R.drawable.nrk_media_chromecast__1,
expressive = null
expressive = R.drawable.nrk_media_chromecast_expressive__1
)

val NrkMediaChromecast2 = NrkIcon(
normal = R.drawable.nrk_media_chromecast__2,
expressive = null
expressive = R.drawable.nrk_media_chromecast_expressive__2
)

val NrkMediaChromecast3 = NrkIcon(
normal = R.drawable.nrk_media_chromecast__3,
expressive = null
expressive = R.drawable.nrk_media_chromecast_expressive__3
)

val NrkMediaChromecastActive = NrkIcon(
Expand Down Expand Up @@ -705,7 +705,7 @@ object NrkIcons {

val NrkMediaPlayFail = NrkIcon(
normal = R.drawable.nrk_media_play__fail,
expressive = null
expressive = R.drawable.nrk_media_play_expressive__fail
)

val NrkMediaPlaylist = NrkIcon(
Expand Down Expand Up @@ -835,7 +835,7 @@ object NrkIcons {

val NrkMediaSubtitlesUnavailable = NrkIcon(
normal = R.drawable.nrk_media_subtitles__unavailable,
expressive = null
expressive = R.drawable.nrk_media_subtitles_expressive__unavailable
)

val NrkMediaTheater = NrkIcon(
Expand Down Expand Up @@ -870,22 +870,22 @@ object NrkIcons {

val NrkMediaVolume1 = NrkIcon(
normal = R.drawable.nrk_media_volume__1,
expressive = null
expressive = R.drawable.nrk_media_volume_expressive__1
)

val NrkMediaVolume2 = NrkIcon(
normal = R.drawable.nrk_media_volume__2,
expressive = null
expressive = R.drawable.nrk_media_volume_expressive__2
)

val NrkMediaVolume3 = NrkIcon(
normal = R.drawable.nrk_media_volume__3,
expressive = null
expressive = R.drawable.nrk_media_volume_expressive__3
)

val NrkMediaVolumeMuted = NrkIcon(
normal = R.drawable.nrk_media_volume__muted,
expressive = null
expressive = R.drawable.nrk_media_volume_expressive__muted
)

val NrkMening = NrkIcon(
Expand Down Expand Up @@ -963,6 +963,11 @@ object NrkIcons {
expressive = null
)

val NrkRadioActive = NrkIcon(
normal = R.drawable.nrk_radio__active,
expressive = R.drawable.nrk_radio_expressive__active
)

val NrkRefresh = NrkIcon(
normal = R.drawable.nrk_refresh,
expressive = R.drawable.nrk_refresh_expressive
Expand Down
13 changes: 13 additions & 0 deletions android/icons/src/main/res/drawable/nrk_radio__active.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="#FFF0F0F0"
android:pathData="M16 12a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z"/>
<path
android:fillColor="#FFF0F0F0"
android:fillType="evenOdd"
android:pathData="M12 19a7 7 0 1 0 0-14 7 7 0 0 0 0 14Zm0 2a9 9 0 1 0 0-18 9 9 0 0 0 0 18Z"/>
</vector>
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="#FFF0F0F0"
android:pathData="M16 12a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z"/>
<path
android:fillColor="#FFF0F0F0"
android:fillType="evenOdd"
android:pathData="M12 19a7 7 0 1 0 0-14 7 7 0 0 0 0 14Zm0 2a9 9 0 1 0 0-18 9 9 0 0 0 0 18Z"/>
</vector>
1 change: 1 addition & 0 deletions lib/expressive/nrk-radio-expressive--active.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions lib/icon/nrk-radio--active.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit b32ceda

Please sign in to comment.