mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-10 15:11:58 +01:00
align the artist top bar with the themed screens and scrim a busy name
- the artist top bar now uses the default app-bar title style and the art-derived heroBarColor instead of a hardcoded headline/black/white, so it follows the artist theme - add a bottom scrim behind the overlaid artist name only when the art under it is bright or noisy, measured from the seed bitmap (so no extra decode)
This commit is contained in:
@@ -40,6 +40,7 @@ import com.subtracks.playback.PlaybackState
|
||||
import com.subtracks.playback.QueueItem
|
||||
import com.subtracks.playback.RepeatMode
|
||||
import com.subtracks.ui.library.ALBUM_COVER_TAG
|
||||
import com.subtracks.ui.library.ARTIST_NAME_SCRIM_TAG
|
||||
import com.subtracks.ui.library.AlbumDetailScreen
|
||||
import com.subtracks.ui.library.ArtistDetailScreen
|
||||
import com.subtracks.ui.library.LibraryScreen
|
||||
@@ -280,6 +281,9 @@ class AppScreenshotTest {
|
||||
}
|
||||
}
|
||||
awaitText("Kid A")
|
||||
composeRule.waitUntil(timeoutMillis = 5_000) {
|
||||
composeRule.onAllNodesWithTag(ARTIST_NAME_SCRIM_TAG).fetchSemanticsNodes().isNotEmpty()
|
||||
}
|
||||
composeRule.onRoot().captureRoboImage("src/test/screenshots/artist_detail.png")
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.subtracks.ui.theme
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.Color
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.annotation.GraphicsMode
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@GraphicsMode(GraphicsMode.Mode.NATIVE)
|
||||
class ArtworkNameBandTest {
|
||||
private fun bitmap(bottom: (Int, Int) -> Int): Bitmap =
|
||||
Bitmap.createBitmap(64, 64, Bitmap.Config.ARGB_8888).apply {
|
||||
for (y in 0 until 64) {
|
||||
for (x in 0 until 64) {
|
||||
setPixel(x, y, if (y >= 46) bottom(x, y) else Color.rgb(20, 20, 20))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun darkCalmBandNeedsNoScrim() {
|
||||
assertFalse(ArtworkSeedCache.bottomBandBusy(bitmap { _, _ -> Color.rgb(24, 20, 34) }))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun brightBandNeedsAScrim() {
|
||||
assertTrue(ArtworkSeedCache.bottomBandBusy(bitmap { _, _ -> Color.rgb(235, 230, 220) }))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun noisyBandNeedsAScrim() {
|
||||
assertTrue(ArtworkSeedCache.bottomBandBusy(bitmap { x, y -> if ((x + y) % 2 == 0) Color.WHITE else Color.BLACK }))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user