Lint fixes
This commit is contained in:
parent
931632afc9
commit
dc8cd08ab7
15 changed files with 22 additions and 48 deletions
|
@ -31,7 +31,7 @@ class HistoryViewModel @ViewModelInject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
override suspend fun mapEventToState(event: HistoryEvent) = flow<HistoryState> {
|
||||
override suspend fun mapEventToState(event: HistoryEvent) = flow {
|
||||
when (event) {
|
||||
is HistoryEvent.LoadAllSaves -> {
|
||||
val newSaveList = savesRepository.getAllSaves().sortedByDescending { it.uid }
|
||||
|
|
|
@ -68,13 +68,6 @@ open class LevelFragment : CommonLevelFragment(R.layout.fragment_level) {
|
|||
}
|
||||
)
|
||||
|
||||
fieldRefresh.observe(
|
||||
viewLifecycleOwner,
|
||||
Observer {
|
||||
areaAdapter.notifyItemChanged(it)
|
||||
}
|
||||
)
|
||||
|
||||
eventObserver.observe(
|
||||
viewLifecycleOwner,
|
||||
Observer {
|
||||
|
|
|
@ -75,7 +75,7 @@ class EndGameDialogViewModel @ViewModelInject constructor(
|
|||
false
|
||||
)
|
||||
|
||||
override suspend fun mapEventToState(event: EndGameDialogEvent) = flow<EndGameDialogState> {
|
||||
override suspend fun mapEventToState(event: EndGameDialogEvent) = flow {
|
||||
if (event is EndGameDialogEvent.BuildCustomEndGame) {
|
||||
val state = when (event.isVictory) {
|
||||
true -> {
|
||||
|
|
|
@ -13,7 +13,7 @@ class ThemeViewModel @ViewModelInject constructor(
|
|||
themeRepository.setTheme(theme)
|
||||
}
|
||||
|
||||
override suspend fun mapEventToState(event: ThemeEvent) = flow<ThemeState> {
|
||||
override suspend fun mapEventToState(event: ThemeEvent) = flow {
|
||||
if (event is ThemeEvent.ChangeTheme) {
|
||||
setTheme(event.newTheme)
|
||||
emit(state.copy(current = event.newTheme))
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:drawablePadding="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:includeFontPadding="false"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
@ -29,9 +30,6 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:drawableStart="@drawable/timer"
|
||||
android:drawableLeft="@drawable/timer"
|
||||
android:drawablePadding="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:includeFontPadding="false"
|
||||
|
@ -41,6 +39,8 @@
|
|||
android:textSize="@dimen/text_size"
|
||||
android:textStyle="bold"
|
||||
android:visibility="gone"
|
||||
app:drawableLeftCompat="@drawable/timer"
|
||||
app:drawableStartCompat="@drawable/timer"
|
||||
tools:text="10:00"
|
||||
tools:visibility="visible" />
|
||||
|
||||
|
@ -49,8 +49,6 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:drawableStart="@drawable/mine"
|
||||
android:drawableLeft="@drawable/mine"
|
||||
android:drawablePadding="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:includeFontPadding="false"
|
||||
|
@ -59,6 +57,7 @@
|
|||
android:textSize="@dimen/text_size"
|
||||
android:textStyle="bold"
|
||||
android:visibility="gone"
|
||||
app:drawableStartCompat="@drawable/mine"
|
||||
tools:text="99"
|
||||
tools:visibility="visible" />
|
||||
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
android:background="?android:attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:paddingLeft="32dp"
|
||||
android:paddingRight="48dp"
|
||||
android:paddingStart="32dp"
|
||||
android:paddingEnd="48dp"
|
||||
android:paddingVertical="12dp">
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
app:layout_constraintStart_toEndOf="@id/badge"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
|
@ -35,7 +34,6 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
app:layout_constraintStart_toEndOf="@id/badge"
|
||||
app:layout_constraintTop_toBottomOf="@id/difficulty"
|
||||
|
@ -46,7 +44,6 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text="-"
|
||||
app:layout_constraintStart_toEndOf="@id/minefieldSize"
|
||||
|
@ -58,7 +55,6 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginTop="4dp"
|
||||
app:layout_constraintStart_toEndOf="@id/dash"
|
||||
app:layout_constraintTop_toBottomOf="@id/difficulty"
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
android:layout_weight="1"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
tools:text="Text" />
|
||||
|
||||
|
|
|
@ -167,7 +167,7 @@ class GameController {
|
|||
}
|
||||
}
|
||||
|
||||
fun findExplodedMine() = mines().filter { it.mistake }.firstOrNull()
|
||||
fun findExplodedMine() = mines().firstOrNull { it.mistake }
|
||||
|
||||
fun takeExplosionRadius(target: Area): List<Area> =
|
||||
mines().filter { it.isCovered && it.mark.isNone() }.sortedBy {
|
||||
|
|
|
@ -61,7 +61,6 @@ class DimensionRepository(
|
|||
}
|
||||
|
||||
override fun navigationBarHeight(): Int {
|
||||
// TODO use official mode if available
|
||||
val resources = context.resources
|
||||
val resourceId: Int = resources.getIdentifier(NAVIGATION_BAR_HEIGHT, DEF_TYPE_DIMEN, DEF_PACKAGE)
|
||||
return if (resourceId > 0) { resources.getDimensionPixelSize(resourceId) } else 0
|
||||
|
|
|
@ -57,17 +57,19 @@ class AreaAdapter(
|
|||
override fun getItemCount(): Int = field.size
|
||||
|
||||
private fun AreaView.onClickablePosition(position: Int, action: suspend (Int) -> Unit): Boolean {
|
||||
return if (position == RecyclerView.NO_POSITION) {
|
||||
Log.d(TAG, "Item no longer exists.")
|
||||
false
|
||||
} else if (clickEnabled) {
|
||||
requestFocus()
|
||||
GlobalScope.launch {
|
||||
action(position)
|
||||
return when {
|
||||
position == RecyclerView.NO_POSITION -> {
|
||||
Log.d(TAG, "Item no longer exists.")
|
||||
false
|
||||
}
|
||||
true
|
||||
} else {
|
||||
false
|
||||
clickEnabled -> {
|
||||
requestFocus()
|
||||
GlobalScope.launch {
|
||||
action(position)
|
||||
}
|
||||
true
|
||||
}
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -106,12 +106,7 @@ class AreaView : View {
|
|||
area.hasMine -> IMPORTANT_FOR_ACCESSIBILITY_YES
|
||||
area.mistake -> IMPORTANT_FOR_ACCESSIBILITY_YES
|
||||
area.mark.isNotNone() -> IMPORTANT_FOR_ACCESSIBILITY_YES
|
||||
!area.isCovered ->
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
|
||||
} else {
|
||||
IMPORTANT_FOR_ACCESSIBILITY_NO
|
||||
}
|
||||
!area.isCovered -> IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
|
||||
else -> IMPORTANT_FOR_ACCESSIBILITY_YES
|
||||
}
|
||||
)
|
||||
|
|
|
@ -54,7 +54,6 @@ class GameViewModel @ViewModelInject constructor(
|
|||
private var currentDifficulty: Difficulty = Difficulty.Standard
|
||||
|
||||
val field = MutableLiveData<List<Area>>()
|
||||
val fieldRefresh = MutableLiveData<Int>()
|
||||
val elapsedTimeSeconds = MutableLiveData<Long>()
|
||||
val mineCount = MutableLiveData<Int>()
|
||||
val difficulty = MutableLiveData<Difficulty>()
|
||||
|
|
|
@ -63,12 +63,7 @@ class WatchLevelFragment : CommonLevelFragment(R.layout.fragment_level) {
|
|||
}
|
||||
}
|
||||
)
|
||||
fieldRefresh.observe(
|
||||
viewLifecycleOwner,
|
||||
Observer {
|
||||
areaAdapter.notifyItemChanged(it)
|
||||
}
|
||||
)
|
||||
|
||||
eventObserver.observe(
|
||||
viewLifecycleOwner,
|
||||
Observer {
|
||||
|
|
Loading…
Reference in a new issue