Release 0.1.2 with navigation sounds and smoother Home scrolling
All checks were successful
Validate and publish Kaleido / android (push) Successful in 2m14s
All checks were successful
Validate and publish Kaleido / android (push) Successful in 2m14s
This commit is contained in:
parent
6269425b33
commit
430616330b
21 changed files with 232 additions and 18 deletions
|
|
@ -4,3 +4,5 @@ HPLtv/kaleido/app/FocusedBrowseKt**->**(**)**
|
|||
HPLtv/kaleido/app/BrowseScreensKt**->**(**)**
|
||||
HPLtv/kaleido/app/DiscoveryScreensKt**->**(**)**
|
||||
HPLtv/kaleido/app/ThemeKt**->**(**)**
|
||||
HPLtv/kaleido/app/NavigationSoundsKt**->**(**)**
|
||||
HPLtv/kaleido/app/NavigationSoundController;->**(**)**
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ private fun anticipateTileMove(vm:KaleidoViewModel,items:List<Title>,index:Int,d
|
|||
val requester=remember{FocusRequester()}
|
||||
val scale by animateFloatAsState(if(focused)1.035f else 1f,tween(180),label="artworkFocus")
|
||||
LaunchedEffect(Unit){if(vm.focusId==focusKey){delay(220);runCatching{requester.requestFocus()}}}
|
||||
Column((if(fillWidth)Modifier.fillMaxWidth()else Modifier.width(if(landscape)216.dp else 132.dp)).onPreviewKeyEvent{if(it.type==KeyEventType.KeyDown)onMove(it.key);false}.graphicsLayer{scaleX=scale;scaleY=scale}.focusRequester(requester).onFocusChanged{focused=it.isFocused;if(it.isFocused)vm.focusId=focusKey}.clickable{vm.open(item)}) {
|
||||
Column((if(fillWidth)Modifier.fillMaxWidth()else Modifier.width(if(landscape)216.dp else 132.dp)).onPreviewKeyEvent{if(it.type==KeyEventType.KeyDown)onMove(it.key);false}.graphicsLayer{scaleX=scale;scaleY=scale}.focusRequester(requester).navigationSound().onFocusChanged{focused=it.isFocused;if(it.isFocused)vm.focusId=focusKey}.clickable{vm.open(item)}) {
|
||||
Box(Modifier.fillMaxWidth().aspectRatio(if(landscape)16f/9f else 2f/3f).graphicsLayer{shadowElevation=if(focused)12.dp.toPx()else 0f;shape=RoundedCornerShape(Cinema.radius)}.clip(RoundedCornerShape(Cinema.radius))) {
|
||||
val artwork=if(landscape&&item.type=="episode")item.thumb.ifBlank{item.art}else if(landscape)item.art.ifBlank{item.thumb}else item.thumb
|
||||
Artwork(vm.api,artwork,Modifier.fillMaxSize(),if(landscape)720 else 450,if(landscape)405 else 675)
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ package tv.kaleido.app
|
|||
import androidx.compose.foundation.*
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.lazy.*
|
||||
import androidx.compose.foundation.lazy.layout.LazyLayoutCacheWindow
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.foundation.gestures.BringIntoViewSpec
|
||||
import androidx.compose.foundation.gestures.LocalBringIntoViewSpec
|
||||
|
|
@ -54,7 +55,12 @@ private suspend fun LazyListState.animateBrowseTo(index:Int) {
|
|||
val source=if(home)vm.homeHubs else vm.discoverHubs
|
||||
val hubs=remember(source,destination){editorialHubs(source,destination)}
|
||||
val restore=remember(hubs){hubs.withIndex().firstNotNullOfOrNull{(row,h)->val column=h.items.indexOfFirst{"${h.id}:${it.id}"==vm.focusId};if(column>=0)row to column else null}}
|
||||
val list=rememberLazyListState(initialFirstVisibleItemIndex=restore?.let{it.first+if(home)1 else 0} ?: 0)
|
||||
val initialRow=restore?.let{it.first+if(home)1 else 0} ?: 0
|
||||
// Keep the hero and adjacent rows prepared across the large Home scroll.
|
||||
// Without a behind window, every return discards and recomposes those cards.
|
||||
val list=if(home)rememberLazyListState(initialFirstVisibleItemIndex=initialRow,
|
||||
cacheWindow=remember{LazyLayoutCacheWindow(aheadFraction=1f,behindFraction=1f)})
|
||||
else rememberLazyListState(initialFirstVisibleItemIndex=initialRow)
|
||||
val rowStates=remember(hubs){List(hubs.size){row->LazyListState(firstVisibleItemIndex=if(restore?.first==row)restore.second else 0)}}
|
||||
val requesters=remember(hubs){mutableMapOf<Pair<Int,Int>,FocusRequester>()}
|
||||
val columns=remember(hubs){mutableMapOf<Int,Int>()}
|
||||
|
|
@ -245,7 +251,7 @@ private suspend fun LazyListState.animateBrowseTo(index:Int) {
|
|||
val width=if(poster)120.dp else if(wideEpisode)264.dp else 214.dp
|
||||
val image=if(poster)item.poster.ifBlank{item.thumb}else if(item.type=="episode")item.still.ifBlank{item.thumb}.ifBlank{item.art}else item.art.ifBlank{item.thumb}
|
||||
LaunchedEffect(Unit){if(vm.focusId==focusKey){withFrameNanos{};runCatching{requester.requestFocus()};onHovered(item)}}
|
||||
Column(modifier.width(width).then(if(entry!=null)Modifier.focusRequester(entry)else Modifier).focusRequester(requester).onFocusChanged{
|
||||
Column(modifier.width(width).then(if(entry!=null)Modifier.focusRequester(entry)else Modifier).focusRequester(requester).navigationSound().onFocusChanged{
|
||||
focused=it.isFocused
|
||||
if(it.isFocused){vm.focusId=focusKey;onHovered(item)}
|
||||
}.clickable{vm.open(item)}.clearAndSetSemantics{
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ class KaleidoViewModel(app: Application): AndroidViewModel(app) {
|
|||
var downloading by mutableStateOf(false); private set
|
||||
var playbackMode by mutableStateOf(preferences.getInt("playbackModeV2",1)); private set
|
||||
var watchedPercent by mutableStateOf(preferences.getInt("watchedPercent",80).coerceIn(50,100)); private set
|
||||
var navigationSounds by mutableStateOf(preferences.getBoolean("navigationSounds",true)); private set
|
||||
var episodeQueue by mutableStateOf(emptyList<Title>());private set
|
||||
var relatedShows by mutableStateOf(emptyList<Title>());private set
|
||||
var transitioningEpisode by mutableStateOf(false);private set
|
||||
|
|
@ -260,6 +261,7 @@ class KaleidoViewModel(app: Application): AndroidViewModel(app) {
|
|||
fun stopPlayback(){playing=null;sectionCache.clear();detailsCache.clear();previews.clear();cancelAnticipation();launchLoad {homeHubs=loadHome();detail?.let {if(it.type in listOf("movie","episode"))detail=api.details(it.id)}}}
|
||||
fun choosePlaybackMode(value: Int){playbackMode=value;preferences.edit().putInt("playbackModeV2",value).apply()}
|
||||
fun chooseWatchedPercent(value:Int){watchedPercent=value.coerceIn(50,100);preferences.edit().putInt("watchedPercent",watchedPercent).apply()}
|
||||
fun chooseNavigationSounds(value:Boolean){navigationSounds=value;preferences.edit().putBoolean("navigationSounds",value).apply()}
|
||||
fun chooseQuality(value: Int){quality=value;preferences.edit().putInt("quality",value).apply()}
|
||||
fun checkUpdate(manual: Boolean=true){viewModelScope.launch {
|
||||
if(!manual&&System.currentTimeMillis()-preferences.getLong("lastUpdateCheck",0)<6*3600_000L)return@launch
|
||||
|
|
|
|||
34
app/src/main/java/tv/kaleido/app/NavigationSounds.kt
Normal file
34
app/src/main/java/tv/kaleido/app/NavigationSounds.kt
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
package tv.kaleido.app
|
||||
|
||||
import android.view.SoundEffectConstants
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.focus.onFocusChanged
|
||||
import androidx.compose.ui.platform.LocalView
|
||||
|
||||
/** One cue per actual focus change; blocked/repeated key presses stay silent. */
|
||||
internal class NavigationSoundController(private val play:()->Unit) {
|
||||
var enabled=false
|
||||
private var previous:Any?=null
|
||||
fun focused(target:Any) {
|
||||
val changed=previous!=null&&previous!==target
|
||||
previous=target
|
||||
if(enabled&&changed)play()
|
||||
}
|
||||
}
|
||||
|
||||
private val LocalNavigationSounds=staticCompositionLocalOf<NavigationSoundController?>{null}
|
||||
|
||||
@Composable internal fun NavigationSounds(enabled:Boolean,content:@Composable ()->Unit) {
|
||||
val view=LocalView.current
|
||||
// Native UI tick follows the TV's sound-effects setting, volume and output route.
|
||||
val controller=remember(view){NavigationSoundController{view.playSoundEffect(SoundEffectConstants.CLICK)}}
|
||||
SideEffect{controller.enabled=enabled}
|
||||
CompositionLocalProvider(LocalNavigationSounds provides controller,content=content)
|
||||
}
|
||||
|
||||
@Composable internal fun Modifier.navigationSound():Modifier {
|
||||
val controller=LocalNavigationSounds.current
|
||||
val target=remember{Any()}
|
||||
return onFocusChanged{if(it.isFocused)controller?.focused(target)}
|
||||
}
|
||||
|
|
@ -69,7 +69,7 @@ import kotlinx.coroutines.delay
|
|||
LazyRow(horizontalArrangement=Arrangement.spacedBy(12.dp)) {
|
||||
items(titles,key={it.id}){title->
|
||||
var focused by remember{mutableStateOf(false)}
|
||||
Column(Modifier.width(167.dp).onFocusChanged{focused=it.isFocused}.semantics{contentDescription=title.displayTitle+" "+title.subtitle}.clickable{choose(title)}) {
|
||||
Column(Modifier.width(167.dp).navigationSound().onFocusChanged{focused=it.isFocused}.semantics{contentDescription=title.displayTitle+" "+title.subtitle}.clickable{choose(title)}) {
|
||||
Box(Modifier.fillMaxWidth().aspectRatio(16f/9f).clip(RoundedCornerShape(4.dp))) {
|
||||
Artwork(vm.api,if(title.type=="episode")title.still.ifBlank{title.thumb}else title.art.ifBlank{title.thumb},Modifier.fillMaxSize(),384,216,animate=false)
|
||||
if(focused)Box(Modifier.fillMaxSize().border(2.dp,Accent,RoundedCornerShape(4.dp)))
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ import kotlinx.coroutines.delay
|
|||
val displayed=controller.scrubPosition ?: controller.position
|
||||
val progress=if(controller.duration>0)(displayed.toFloat()/controller.duration).coerceIn(0f,1f)else 0f
|
||||
val buffered=if(controller.duration>0)(controller.bufferedPosition.toFloat()/controller.duration).coerceIn(0f,1f)else 0f
|
||||
BoxWithConstraints(modifier.height(18.dp).onFocusChanged{focused=it.isFocused;if(it.isFocused)onInteraction()else controller.commitScrub()}.onPreviewKeyEvent{event->
|
||||
BoxWithConstraints(modifier.height(18.dp).navigationSound().onFocusChanged{focused=it.isFocused;if(it.isFocused)onInteraction()else controller.commitScrub()}.onPreviewKeyEvent{event->
|
||||
if(event.type!=KeyEventType.KeyDown)false else when(event.key) {
|
||||
Key.DirectionLeft,Key.DirectionRight->{val delta=if(event.nativeKeyEvent.repeatCount>5)30000L else 10000L;controller.scrubBy(if(event.key==Key.DirectionLeft)-delta else delta);onInteraction();true}
|
||||
Key.DirectionCenter,Key.Enter->{if(controller.scrubPosition!=null)controller.commitScrub()else controller.toggle();onInteraction();true}
|
||||
|
|
@ -208,7 +208,7 @@ import kotlinx.coroutines.delay
|
|||
var focused by remember{mutableStateOf(false)}
|
||||
val requester=remember{FocusRequester()}
|
||||
LaunchedEffect(initialFocus){if(initialFocus){delay(80);runCatching{requester.requestFocus()}}}
|
||||
Row(Modifier.fillMaxWidth().heightIn(min=35.dp).focusRequester(requester).onFocusChanged{focused=it.isFocused}.clip(RoundedCornerShape(5.dp)).background(if(focused)Color.White.copy(alpha=.14f)else Color.Transparent).clickable(onClick=onClick).padding(horizontal=9.dp,vertical=8.dp),verticalAlignment=Alignment.CenterVertically,horizontalArrangement=Arrangement.spacedBy(9.dp)) {
|
||||
Row(Modifier.fillMaxWidth().heightIn(min=35.dp).focusRequester(requester).navigationSound().onFocusChanged{focused=it.isFocused}.clip(RoundedCornerShape(5.dp)).background(if(focused)Color.White.copy(alpha=.14f)else Color.Transparent).clickable(onClick=onClick).padding(horizontal=9.dp,vertical=8.dp),verticalAlignment=Alignment.CenterVertically,horizontalArrangement=Arrangement.spacedBy(9.dp)) {
|
||||
if(selected)Icon(Icons.Outlined.Check,null,tint=Accent,modifier=Modifier.size(15.dp))else Spacer(Modifier.width(15.dp))
|
||||
Text(label,color=if(focused||selected)Accent else Muted,fontSize=12.sp,lineHeight=16.sp,maxLines=2,overflow=TextOverflow.Ellipsis)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ import java.io.File
|
|||
BackHandler(enabled=vm.linkingAccount||vm.playing!=null||vm.pages.size>1||vm.page.kind!="home"){
|
||||
if(vm.linkingAccount)vm.cancelAccountLink()else if(vm.playing==null&&vm.pages.size==1&&vm.page.kind in listOf("movies","tv")&&vm.allTitles)vm.setAll(false)else vm.back()
|
||||
}
|
||||
NavigationSounds(vm.navigationSounds&&!startup) {
|
||||
Box(Modifier.fillMaxSize().background(Ink).onPreviewKeyEvent{startup}) {
|
||||
if(vm.servers.isNotEmpty()) ServerPicker(vm) else if(vm.session==null||vm.linkingAccount) SignIn(vm) else {
|
||||
Column(Modifier.fillMaxSize().graphicsLayer{
|
||||
|
|
@ -98,6 +99,7 @@ import java.io.File
|
|||
vm.playing?.let {item-> androidx.compose.runtime.key(item.id) {PlaybackScreen(vm,item)} }
|
||||
if(startup)StartupSplash(splash.value){brandReady=true}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
val sortLabels=listOf("titleSort:asc" to "Title: A–Z","titleSort:desc" to "Title: Z–A","addedAt:desc" to "Recently added","year:desc" to "Newest release","year:asc" to "Oldest release","audienceRating:desc" to "Audience rating","duration:asc" to "Shortest first")
|
||||
|
|
@ -132,6 +134,10 @@ val sortLabels=listOf("titleSort:asc" to "Title: A–Z","titleSort:desc" to "Tit
|
|||
TvButton("Mark watched at ${vm.watchedPercent}%",onClick={watchedDialog=true})
|
||||
Text("A resumed title gets its checkmark at this playback percentage. Completed titles keep their Plex watched status.",color=Muted,fontSize=12.sp,lineHeight=18.sp,modifier=Modifier.padding(top=10.dp))
|
||||
}}
|
||||
item{SettingsPanel("Interface") {
|
||||
TvButton("Navigation sounds: "+if(vm.navigationSounds)"On"else "Off",onClick={vm.chooseNavigationSounds(!vm.navigationSounds)})
|
||||
Text("Play the TV's system tap when focus moves. Follows your TV's sound-effects setting.",color=Muted,fontSize=12.sp,lineHeight=18.sp,modifier=Modifier.padding(top=10.dp))
|
||||
}}
|
||||
item{SettingsPanel("Software updates") {Text("Kaleido ${BuildConfig.VERSION_NAME}",color=Color.White,fontSize=20.sp,fontWeight=FontWeight.Bold);Text(vm.updateStatus,color=Muted,fontSize=12.sp,modifier=Modifier.padding(vertical=8.dp));Text("Updates are checked automatically every six hours while Kaleido is in use.",color=Muted,fontSize=12.sp);Spacer(Modifier.height(14.dp));Row(horizontalArrangement=Arrangement.spacedBy(10.dp)){TvButton("Check for updates",onClick={vm.checkUpdate()});if(vm.update!=null&&!vm.downloading)TvButton("Download & install ${vm.update!!.version}",primary=true,onClick={vm.downloadUpdate()})};vm.update?.let{if(it.notes.isNotBlank())Text(it.notes.take(1800),color=Muted,fontSize=11.sp,modifier=Modifier.padding(top=12.dp))};Text("git.elijahkuntz.com/Elijah/Kaleido",color=Accent,fontSize=10.sp,modifier=Modifier.padding(top=14.dp))}}
|
||||
}
|
||||
if(confirmSignOut)ChoiceDialog("Sign out of Plex?",listOf("Keep watching","Sign out"),0,{confirmSignOut=false}){if(it==1)vm.signOut();confirmSignOut=false}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ object Cinema {
|
|||
val fg=if(focused||primary) Ink else Accent
|
||||
val scale by animateFloatAsState(if(focused)1.025f else 1f,tween(160),label="buttonScale")
|
||||
LaunchedEffect(initialFocus){if(initialFocus){withFrameNanos{};runCatching{requester.requestFocus()}}}
|
||||
Box(modifier.graphicsLayer{scaleX=scale;scaleY=scale}.focusRequester(requester).onFocusChanged{focused=it.isFocused}.clip(RoundedCornerShape(Cinema.radius)).background(bg).clickable(onClick=onClick).padding(horizontal=13.dp,vertical=8.dp)) {
|
||||
Box(modifier.graphicsLayer{scaleX=scale;scaleY=scale}.focusRequester(requester).navigationSound().onFocusChanged{focused=it.isFocused}.clip(RoundedCornerShape(Cinema.radius)).background(bg).clickable(onClick=onClick).padding(horizontal=13.dp,vertical=8.dp)) {
|
||||
Text(label,color=fg,fontSize=12.sp,lineHeight=16.sp,fontWeight=FontWeight.Medium,maxLines=1)
|
||||
}
|
||||
}
|
||||
|
|
@ -68,7 +68,7 @@ object Cinema {
|
|||
val background by animateColorAsState(if(focused||primary)Accent else Color.White.copy(alpha=.12f),tween(160),label="actionSurface")
|
||||
val foreground=if(focused||primary)Ink else Accent
|
||||
LaunchedEffect(initialFocus){if(initialFocus){withFrameNanos{};runCatching{requester.requestFocus()}}}
|
||||
Row(modifier.height(34.dp).graphicsLayer{scaleX=scale;scaleY=scale}.focusRequester(requester).onFocusChanged{focused=it.isFocused}.clip(RoundedCornerShape(5.dp)).background(background).clickable(onClick=onClick).padding(horizontal=14.dp),verticalAlignment=Alignment.CenterVertically,horizontalArrangement=Arrangement.spacedBy(7.dp)) {
|
||||
Row(modifier.height(34.dp).graphicsLayer{scaleX=scale;scaleY=scale}.focusRequester(requester).navigationSound().onFocusChanged{focused=it.isFocused}.clip(RoundedCornerShape(5.dp)).background(background).clickable(onClick=onClick).padding(horizontal=14.dp),verticalAlignment=Alignment.CenterVertically,horizontalArrangement=Arrangement.spacedBy(7.dp)) {
|
||||
Icon(icon,null,tint=foreground,modifier=Modifier.size(17.dp))
|
||||
Text(label,color=foreground,fontSize=12.sp,lineHeight=16.sp,fontWeight=FontWeight.SemiBold)
|
||||
}
|
||||
|
|
@ -81,7 +81,7 @@ object Cinema {
|
|||
val bg by animateColorAsState(if(focused)Accent else if(selected)Color.White.copy(alpha=.16f)else Color.Transparent,tween(140),label="iconBackground")
|
||||
val scale by animateFloatAsState(if(focused)1.08f else 1f,tween(160),label="iconFocus")
|
||||
LaunchedEffect(initialFocus){if(initialFocus){withFrameNanos{};runCatching{focus.requestFocus()}}}
|
||||
Box(modifier.size(size).graphicsLayer{scaleX=scale;scaleY=scale}.focusRequester(focus).onFocusChanged{focused=it.isFocused;if(it.isFocused)onFocused()}.clip(CircleShape).background(bg).semantics{contentDescription=label}.clickable(onClick=onClick),contentAlignment=Alignment.Center) {
|
||||
Box(modifier.size(size).graphicsLayer{scaleX=scale;scaleY=scale}.focusRequester(focus).navigationSound().onFocusChanged{focused=it.isFocused;if(it.isFocused)onFocused()}.clip(CircleShape).background(bg).semantics{contentDescription=label}.clickable(onClick=onClick),contentAlignment=Alignment.Center) {
|
||||
Icon(icon,null,tint=if(focused)Ink else Accent,modifier=Modifier.size(iconSize))
|
||||
}
|
||||
}
|
||||
|
|
@ -92,7 +92,7 @@ object Cinema {
|
|||
val bg by animateColorAsState(if(focused)Color.White.copy(alpha=.14f) else Color.Transparent,tween(150),label="navigationBackground")
|
||||
val scale by animateFloatAsState(if(focused)1.035f else 1f,tween(160),label="navigationFocus")
|
||||
LaunchedEffect(initialFocus){if(initialFocus){delay(140);runCatching{requester.requestFocus()}}}
|
||||
Column(modifier.height(34.dp).graphicsLayer{scaleX=scale;scaleY=scale}.focusRequester(requester).onFocusChanged{focused=it.isFocused;if(it.isFocused)onFocused()}.clip(RoundedCornerShape(5.dp)).background(bg).clickable(onClick=onClick).padding(horizontal=13.dp),horizontalAlignment=Alignment.CenterHorizontally,verticalArrangement=Arrangement.Center) {
|
||||
Column(modifier.height(34.dp).graphicsLayer{scaleX=scale;scaleY=scale}.focusRequester(requester).navigationSound().onFocusChanged{focused=it.isFocused;if(it.isFocused)onFocused()}.clip(RoundedCornerShape(5.dp)).background(bg).clickable(onClick=onClick).padding(horizontal=13.dp),horizontalAlignment=Alignment.CenterHorizontally,verticalArrangement=Arrangement.Center) {
|
||||
Text(label,color=if(focused||selected)Accent else Muted,fontSize=13.sp,lineHeight=18.sp,fontWeight=if(selected||focused)FontWeight.SemiBold else FontWeight.Medium)
|
||||
if(selected||focused)Box(Modifier.padding(top=3.dp).width(16.dp).height(1.5.dp).background(Accent.copy(alpha=if(focused)1f else .6f),RoundedCornerShape(1.dp)))
|
||||
}
|
||||
|
|
|
|||
29
app/src/test/java/tv/kaleido/app/NavigationSoundsTest.kt
Normal file
29
app/src/test/java/tv/kaleido/app/NavigationSoundsTest.kt
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
package tv.kaleido.app
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
class NavigationSoundsTest {
|
||||
@Test fun initialAndUnchangedFocusAreSilent() {
|
||||
var taps=0
|
||||
val sounds=NavigationSoundController{taps++}.apply{enabled=true}
|
||||
val card=Any()
|
||||
sounds.focused(card);sounds.focused(card)
|
||||
assertEquals(0,taps)
|
||||
sounds.focused(Any())
|
||||
assertEquals(1,taps)
|
||||
}
|
||||
@Test fun mutingKeepsFocusHistoryAndEnablingOnlyAffectsFutureMoves() {
|
||||
var taps=0
|
||||
val sounds=NavigationSoundController{taps++}.apply{enabled=true}
|
||||
sounds.focused(Any());sounds.focused(Any())
|
||||
sounds.enabled=false
|
||||
val mutedCard=Any()
|
||||
sounds.focused(mutedCard);sounds.focused(Any())
|
||||
assertEquals(1,taps)
|
||||
sounds.enabled=true
|
||||
assertEquals(1,taps)
|
||||
sounds.focused(mutedCard)
|
||||
assertEquals(2,taps)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue