Add trailing comma
This commit is contained in:
parent
d518a60e58
commit
9dec3f6266
73 changed files with 124 additions and 123 deletions
|
@ -7,7 +7,7 @@ import dev.lucasnlm.external.UnlockAppListener
|
|||
|
||||
class IapHandler(
|
||||
private val context: Context,
|
||||
private val preferencesManager: IPreferencesRepository
|
||||
private val preferencesManager: IPreferencesRepository,
|
||||
) : UnlockAppListener {
|
||||
override fun onLockStatusChanged(isFreeUnlock: Boolean, status: Boolean) {
|
||||
preferencesManager.setLockExtras(status, isFreeUnlock)
|
||||
|
|
|
@ -4,5 +4,5 @@ enum class AboutEvent {
|
|||
SupportUs,
|
||||
ThirdPartyLicenses,
|
||||
SourceCode,
|
||||
Translators
|
||||
Translators,
|
||||
}
|
||||
|
|
|
@ -4,15 +4,15 @@ import androidx.annotation.RawRes
|
|||
|
||||
data class License(
|
||||
val name: String,
|
||||
@RawRes val licenseFileRes: Int
|
||||
@RawRes val licenseFileRes: Int,
|
||||
)
|
||||
|
||||
data class TranslationInfo(
|
||||
val language: String,
|
||||
val translators: Sequence<String>
|
||||
val translators: Sequence<String>,
|
||||
)
|
||||
|
||||
data class AboutState(
|
||||
val translators: List<TranslationInfo>,
|
||||
val licenses: List<License>
|
||||
val licenses: List<License>,
|
||||
)
|
||||
|
|
|
@ -7,7 +7,7 @@ import dev.lucasnlm.antimine.R
|
|||
import dev.lucasnlm.antimine.core.viewmodel.IntentViewModel
|
||||
|
||||
class AboutViewModel(
|
||||
private val context: Context
|
||||
private val context: Context,
|
||||
) : IntentViewModel<AboutEvent, AboutState>() {
|
||||
|
||||
override fun onEvent(event: AboutEvent) {
|
||||
|
@ -38,7 +38,7 @@ class AboutViewModel(
|
|||
"Spanish" to sequenceOf("Alfredo Jara", "Aldo Rodriguez", "Inail"),
|
||||
"Turkish" to sequenceOf("creuzwagen", "Fatih Fırıncı"),
|
||||
"Ukrainian" to sequenceOf("Dmitry Shuba"),
|
||||
"Vietnamese" to sequenceOf("pnhpnh")
|
||||
"Vietnamese" to sequenceOf("pnhpnh"),
|
||||
).map {
|
||||
TranslationInfo(it.key, it.value)
|
||||
}.toList()
|
||||
|
@ -50,7 +50,7 @@ class AboutViewModel(
|
|||
"Moshi" to R.raw.apache2,
|
||||
"Mockito" to R.raw.mockito,
|
||||
"Noto Emoji" to R.raw.apache2,
|
||||
"Sounds" to R.raw.sounds
|
||||
"Sounds" to R.raw.sounds,
|
||||
).map {
|
||||
License(it.key, it.value)
|
||||
}.toList()
|
||||
|
|
|
@ -12,7 +12,7 @@ import dev.lucasnlm.antimine.about.viewmodel.License
|
|||
import kotlinx.android.synthetic.main.view_third_party.view.*
|
||||
|
||||
internal class LicensesAdapter(
|
||||
private val licenses: List<License>
|
||||
private val licenses: List<License>,
|
||||
) : RecyclerView.Adapter<ThirdPartyViewHolder>() {
|
||||
|
||||
override fun getItemCount(): Int = licenses.size
|
||||
|
|
|
@ -7,7 +7,7 @@ import dev.lucasnlm.antimine.R
|
|||
import dev.lucasnlm.antimine.about.viewmodel.TranslationInfo
|
||||
|
||||
class TranslatorsAdapter(
|
||||
private val translators: List<TranslationInfo>
|
||||
private val translators: List<TranslationInfo>,
|
||||
) : RecyclerView.Adapter<TranslatorsViewHolder>() {
|
||||
|
||||
override fun getItemCount(): Int = translators.size
|
||||
|
|
|
@ -9,5 +9,5 @@ data class ControlDetails(
|
|||
@StringRes val firstActionId: Int,
|
||||
@StringRes val firstActionResponseId: Int,
|
||||
@StringRes val secondActionId: Int,
|
||||
@StringRes val secondActionResponseId: Int
|
||||
@StringRes val secondActionResponseId: Int,
|
||||
)
|
||||
|
|
|
@ -4,6 +4,6 @@ import dev.lucasnlm.antimine.core.control.ControlStyle
|
|||
|
||||
sealed class ControlEvent {
|
||||
data class SelectControlStyle(
|
||||
val controlStyle: ControlStyle
|
||||
val controlStyle: ControlStyle,
|
||||
) : ControlEvent()
|
||||
}
|
||||
|
|
|
@ -6,5 +6,5 @@ import dev.lucasnlm.antimine.core.control.ControlStyle
|
|||
data class ControlState(
|
||||
val selectedIndex: Int,
|
||||
val selected: ControlStyle,
|
||||
val gameControls: List<ControlDetails>
|
||||
val gameControls: List<ControlDetails>,
|
||||
)
|
||||
|
|
|
@ -8,7 +8,7 @@ import dev.lucasnlm.antimine.core.viewmodel.IntentViewModel
|
|||
import kotlinx.coroutines.flow.flow
|
||||
|
||||
class ControlViewModel(
|
||||
private val preferencesRepository: IPreferencesRepository
|
||||
private val preferencesRepository: IPreferencesRepository,
|
||||
) : IntentViewModel<ControlEvent, ControlState>() {
|
||||
|
||||
private val gameControlOptions = listOf(
|
||||
|
|
|
@ -5,7 +5,7 @@ import dev.lucasnlm.antimine.core.viewmodel.IntentViewModel
|
|||
import kotlinx.coroutines.flow.flow
|
||||
|
||||
class CreateGameViewModel(
|
||||
private val preferencesRepository: IPreferencesRepository
|
||||
private val preferencesRepository: IPreferencesRepository,
|
||||
) : IntentViewModel<CustomEvent, CustomState>() {
|
||||
|
||||
override suspend fun mapEventToState(event: CustomEvent) = flow {
|
||||
|
|
|
@ -4,6 +4,6 @@ import dev.lucasnlm.antimine.common.level.models.Minefield
|
|||
|
||||
sealed class CustomEvent {
|
||||
data class UpdateCustomGameEvent(
|
||||
val minefield: Minefield
|
||||
val minefield: Minefield,
|
||||
) : CustomEvent()
|
||||
}
|
||||
|
|
|
@ -3,5 +3,5 @@ package dev.lucasnlm.antimine.custom.viewmodel
|
|||
data class CustomState(
|
||||
val width: Int,
|
||||
val height: Int,
|
||||
val mines: Int
|
||||
val mines: Int,
|
||||
)
|
||||
|
|
|
@ -10,7 +10,7 @@ import kotlinx.coroutines.flow.flow
|
|||
|
||||
class HistoryViewModel(
|
||||
private val context: Context,
|
||||
private val savesRepository: ISavesRepository
|
||||
private val savesRepository: ISavesRepository,
|
||||
) : IntentViewModel<HistoryEvent, HistoryState>() {
|
||||
|
||||
override fun initialState() = HistoryState(
|
||||
|
|
|
@ -16,7 +16,7 @@ import kotlinx.android.synthetic.main.view_history_item.view.*
|
|||
|
||||
class HistoryAdapter(
|
||||
private val saveHistory: List<Save>,
|
||||
private val statelessViewModel: StatelessViewModel<HistoryEvent>
|
||||
private val statelessViewModel: StatelessViewModel<HistoryEvent>,
|
||||
) : RecyclerView.Adapter<HistoryViewHolder>() {
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): HistoryViewHolder {
|
||||
val view = LayoutInflater
|
||||
|
|
|
@ -7,11 +7,11 @@ sealed class EndGameDialogEvent {
|
|||
val isVictory: Boolean?,
|
||||
val time: Long,
|
||||
val rightMines: Int,
|
||||
val totalMines: Int
|
||||
val totalMines: Int,
|
||||
) : EndGameDialogEvent()
|
||||
|
||||
data class ChangeEmoji(
|
||||
val isVictory: Boolean?,
|
||||
@DrawableRes val titleEmoji: Int
|
||||
@DrawableRes val titleEmoji: Int,
|
||||
) : EndGameDialogEvent()
|
||||
}
|
||||
|
|
|
@ -6,5 +6,5 @@ data class EndGameDialogState(
|
|||
@DrawableRes val titleEmoji: Int,
|
||||
val title: String,
|
||||
val message: String,
|
||||
val isVictory: Boolean?
|
||||
val isVictory: Boolean?,
|
||||
)
|
||||
|
|
|
@ -6,7 +6,7 @@ import dev.lucasnlm.antimine.core.viewmodel.IntentViewModel
|
|||
import kotlinx.coroutines.flow.flow
|
||||
|
||||
class EndGameDialogViewModel(
|
||||
private val context: Context
|
||||
private val context: Context,
|
||||
) : IntentViewModel<EndGameDialogEvent, EndGameDialogState>() {
|
||||
|
||||
private fun List<Int>.safeRandomEmoji(
|
||||
|
@ -29,13 +29,13 @@ class EndGameDialogViewModel(
|
|||
R.drawable.emoji_hugging_face,
|
||||
R.drawable.emoji_partying_face,
|
||||
R.drawable.emoji_clapping_hands,
|
||||
R.drawable.emoji_triangular_flag
|
||||
R.drawable.emoji_triangular_flag,
|
||||
).safeRandomEmoji(except)
|
||||
|
||||
private fun randomNeutralEmoji(except: Int? = null) = listOf(
|
||||
R.drawable.emoji_grimacing_face,
|
||||
R.drawable.emoji_smiling_face_with_sunglasses,
|
||||
R.drawable.emoji_triangular_flag
|
||||
R.drawable.emoji_triangular_flag,
|
||||
).safeRandomEmoji(except)
|
||||
|
||||
private fun randomGameOverEmoji(except: Int? = null) = listOf(
|
||||
|
@ -52,7 +52,7 @@ class EndGameDialogViewModel(
|
|||
R.drawable.emoji_face_with_head_bandage,
|
||||
R.drawable.emoji_face_with_symbols_on_mouth,
|
||||
R.drawable.emoji_collision,
|
||||
R.drawable.emoji_sad_but_relieved_face
|
||||
R.drawable.emoji_sad_but_relieved_face,
|
||||
|
||||
).safeRandomEmoji(except)
|
||||
|
||||
|
@ -70,7 +70,7 @@ class EndGameDialogViewModel(
|
|||
R.drawable.emoji_triangular_flag,
|
||||
"",
|
||||
"",
|
||||
false
|
||||
false,
|
||||
)
|
||||
|
||||
override suspend fun mapEventToState(event: EndGameDialogEvent) = flow {
|
||||
|
|
|
@ -8,5 +8,5 @@ data class PlayGamesItem(
|
|||
val id: Int,
|
||||
@DrawableRes val iconRes: Int,
|
||||
@StringRes val stringRes: Int,
|
||||
val triggerEvent: PlayGamesEvent
|
||||
val triggerEvent: PlayGamesEvent,
|
||||
)
|
||||
|
|
|
@ -10,12 +10,12 @@ import dev.lucasnlm.external.IPlayGamesManager
|
|||
|
||||
class PlayGamesViewModel(
|
||||
private val playGamesManager: IPlayGamesManager,
|
||||
private val analyticsManager: IAnalyticsManager
|
||||
private val analyticsManager: IAnalyticsManager,
|
||||
) : StatelessViewModel<PlayGamesEvent>() {
|
||||
|
||||
val playGamesItems = listOf(
|
||||
PlayGamesItem(0, R.drawable.games_achievements, R.string.achievements, PlayGamesEvent.OpenAchievements),
|
||||
PlayGamesItem(1, R.drawable.games_leaderboards, R.string.leaderboards, PlayGamesEvent.OpenLeaderboards)
|
||||
PlayGamesItem(1, R.drawable.games_leaderboards, R.string.leaderboards, PlayGamesEvent.OpenLeaderboards),
|
||||
)
|
||||
|
||||
fun openAchievements(activity: Activity) {
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.io.File
|
|||
import java.io.FileOutputStream
|
||||
|
||||
class ShareManager(
|
||||
private val context: Context
|
||||
private val context: Context,
|
||||
) {
|
||||
private suspend fun share(minefield: Minefield, field: List<Area>): Boolean {
|
||||
val file = createImage(minefield, field)
|
||||
|
|
|
@ -6,5 +6,5 @@ data class StatsModel(
|
|||
val averageDuration: Long,
|
||||
val mines: Int,
|
||||
val victory: Int,
|
||||
val openArea: Int
|
||||
val openArea: Int,
|
||||
)
|
||||
|
|
|
@ -8,7 +8,7 @@ import kotlinx.coroutines.flow.flow
|
|||
|
||||
class StatsViewModel(
|
||||
private val statsRepository: IStatsRepository,
|
||||
private val preferenceRepository: IPreferencesRepository
|
||||
private val preferenceRepository: IPreferencesRepository,
|
||||
) : IntentViewModel<StatsEvent, StatsModel>() {
|
||||
private suspend fun loadStatsModel(): StatsModel {
|
||||
val minId = preferenceRepository.getStatsBase()
|
||||
|
|
|
@ -2,5 +2,5 @@ package dev.lucasnlm.antimine.text.models
|
|||
|
||||
data class TextState(
|
||||
val title: String,
|
||||
val body: String
|
||||
val body: String,
|
||||
)
|
||||
|
|
|
@ -5,6 +5,6 @@ import androidx.annotation.RawRes
|
|||
sealed class TextEvent {
|
||||
data class LoadText(
|
||||
val title: String,
|
||||
@RawRes val rawFileRes: Int
|
||||
@RawRes val rawFileRes: Int,
|
||||
) : TextEvent()
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import kotlinx.coroutines.flow.flow
|
|||
import kotlinx.coroutines.withContext
|
||||
|
||||
class TextViewModel(
|
||||
private val context: Context
|
||||
private val context: Context,
|
||||
) : IntentViewModel<TextEvent, TextState>() {
|
||||
|
||||
private suspend fun loadText(@RawRes rawFile: Int): String {
|
||||
|
|
|
@ -21,7 +21,7 @@ import kotlinx.android.synthetic.main.view_theme.view.*
|
|||
|
||||
class ThemeAdapter(
|
||||
private val themeViewModel: ThemeViewModel,
|
||||
private val areaSize: Float
|
||||
private val areaSize: Float,
|
||||
) : RecyclerView.Adapter<ThemeViewHolder>() {
|
||||
|
||||
private val themes: List<AppTheme> = themeViewModel.singleState().themes
|
||||
|
@ -35,7 +35,7 @@ class ThemeAdapter(
|
|||
Area(5, 2, 1, 3, hasMine = true, mistake = false, mark = Mark.Flag, isCovered = true),
|
||||
Area(6, 0, 2, 0, hasMine = true, mistake = false, mark = Mark.Question, isCovered = true),
|
||||
Area(7, 1, 2, 4, hasMine = false, mistake = false, mark = Mark.None, isCovered = false),
|
||||
Area(8, 2, 2, 0, hasMine = false, mistake = false, mark = Mark.None, isCovered = true)
|
||||
Area(8, 2, 2, 0, hasMine = false, mistake = false, mark = Mark.None, isCovered = true),
|
||||
)
|
||||
|
||||
init {
|
||||
|
|
|
@ -6,7 +6,7 @@ sealed class ThemeEvent {
|
|||
object Unlock : ThemeEvent()
|
||||
|
||||
data class ChangeTheme(
|
||||
val newTheme: AppTheme
|
||||
val newTheme: AppTheme,
|
||||
) : ThemeEvent()
|
||||
|
||||
object ResetTheme : ThemeEvent()
|
||||
|
|
|
@ -4,5 +4,5 @@ import dev.lucasnlm.antimine.core.themes.model.AppTheme
|
|||
|
||||
data class ThemeState(
|
||||
val current: AppTheme,
|
||||
val themes: List<AppTheme>
|
||||
val themes: List<AppTheme>,
|
||||
)
|
||||
|
|
|
@ -16,7 +16,7 @@ class ThemeViewModel(
|
|||
private val themeRepository: IThemeRepository,
|
||||
private val billingManager: IBillingManager,
|
||||
private val preferencesRepository: IPreferencesRepository,
|
||||
private val analyticsManager: IAnalyticsManager
|
||||
private val analyticsManager: IAnalyticsManager,
|
||||
) : IntentViewModel<ThemeEvent, ThemeState>() {
|
||||
private fun setTheme(theme: AppTheme) {
|
||||
themeRepository.setTheme(theme)
|
||||
|
|
|
@ -13,7 +13,7 @@ sealed class FirstOpen {
|
|||
* Describes the [value] of the first step.
|
||||
*/
|
||||
class Position(
|
||||
val value: Int
|
||||
val value: Int,
|
||||
) : FirstOpen()
|
||||
|
||||
override fun toString(): String = when (this) {
|
||||
|
|
|
@ -44,5 +44,5 @@ data class Save(
|
|||
val field: List<Area>,
|
||||
|
||||
@ColumnInfo(name = "actions")
|
||||
val actions: Int
|
||||
val actions: Int,
|
||||
)
|
||||
|
|
|
@ -14,5 +14,5 @@ enum class SaveStatus(
|
|||
VICTORY(1),
|
||||
|
||||
// Finished game with game over.
|
||||
DEFEAT(2)
|
||||
DEFEAT(2),
|
||||
}
|
||||
|
|
|
@ -25,5 +25,5 @@ data class Stats(
|
|||
val height: Int,
|
||||
|
||||
@ColumnInfo(name = "openArea")
|
||||
val openArea: Int
|
||||
val openArea: Int,
|
||||
)
|
||||
|
|
|
@ -4,7 +4,7 @@ import dev.lucasnlm.antimine.common.level.models.Area
|
|||
import dev.lucasnlm.antimine.common.level.models.Mark
|
||||
|
||||
class FlagAssistant(
|
||||
private val field: MutableList<Area>
|
||||
private val field: MutableList<Area>,
|
||||
) {
|
||||
fun runFlagAssistant() {
|
||||
// Must not select Mark.PurposefulNone, only Mark.None. Otherwise, it will flag
|
||||
|
|
|
@ -7,7 +7,7 @@ import kotlin.random.Random
|
|||
|
||||
class MinefieldCreator(
|
||||
private val minefield: Minefield,
|
||||
private val randomGenerator: Random
|
||||
private val randomGenerator: Random,
|
||||
) {
|
||||
private fun createMutableEmpty(): List<Area> {
|
||||
val width = minefield.width
|
||||
|
|
|
@ -5,7 +5,7 @@ import dev.lucasnlm.antimine.common.level.models.Mark
|
|||
|
||||
class MinefieldHandler(
|
||||
private val field: MutableList<Area>,
|
||||
private val useQuestionMark: Boolean
|
||||
private val useQuestionMark: Boolean,
|
||||
) {
|
||||
fun showAllMines() {
|
||||
field.filter { it.hasMine && it.mark != Mark.Flag }
|
||||
|
|
|
@ -2,5 +2,5 @@ package dev.lucasnlm.antimine.common.level.models
|
|||
|
||||
data class AmbientSettings(
|
||||
val isAmbientMode: Boolean = false,
|
||||
val isLowBitAmbient: Boolean = false
|
||||
val isLowBitAmbient: Boolean = false,
|
||||
)
|
||||
|
|
|
@ -9,5 +9,5 @@ data class Area(
|
|||
val mistake: Boolean = false,
|
||||
val isCovered: Boolean = true,
|
||||
val mark: Mark = Mark.None,
|
||||
val highlighted: Boolean = false
|
||||
val highlighted: Boolean = false,
|
||||
)
|
||||
|
|
|
@ -6,5 +6,5 @@ import android.graphics.RectF
|
|||
data class AreaPaintSettings(
|
||||
val painter: Paint,
|
||||
val rectF: RectF,
|
||||
val radius: Float
|
||||
val radius: Float,
|
||||
)
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package dev.lucasnlm.antimine.common.level.models
|
||||
|
||||
enum class Difficulty(
|
||||
val text: String
|
||||
val text: String,
|
||||
) {
|
||||
Standard("STANDARD"),
|
||||
Beginner("BEGINNER"),
|
||||
Intermediate("INTERMEDIATE"),
|
||||
Expert("EXPERT"),
|
||||
Custom("CUSTOM")
|
||||
Custom("CUSTOM"),
|
||||
}
|
||||
|
|
|
@ -7,5 +7,5 @@ enum class Event {
|
|||
Resume,
|
||||
Running,
|
||||
Victory,
|
||||
GameOver
|
||||
GameOver,
|
||||
}
|
||||
|
|
|
@ -4,7 +4,8 @@ enum class Mark {
|
|||
None,
|
||||
Flag,
|
||||
Question,
|
||||
PurposefulNone;
|
||||
PurposefulNone,
|
||||
;
|
||||
|
||||
fun isFlag(): Boolean = this == Flag
|
||||
|
||||
|
|
|
@ -3,5 +3,5 @@ package dev.lucasnlm.antimine.common.level.models
|
|||
data class Minefield(
|
||||
val width: Int,
|
||||
val height: Int,
|
||||
val mines: Int
|
||||
val mines: Int,
|
||||
)
|
||||
|
|
|
@ -3,5 +3,5 @@ package dev.lucasnlm.antimine.common.level.models
|
|||
data class Score(
|
||||
val rightMines: Int,
|
||||
val totalMines: Int,
|
||||
val totalArea: Int
|
||||
val totalArea: Int,
|
||||
)
|
||||
|
|
|
@ -7,6 +7,6 @@ sealed class Status {
|
|||
|
||||
class Over(
|
||||
val time: Long = 0L,
|
||||
val score: Score? = null
|
||||
val score: Score? = null,
|
||||
) : Status()
|
||||
}
|
||||
|
|
|
@ -18,12 +18,12 @@ interface IDimensionRepository {
|
|||
|
||||
data class Size(
|
||||
val width: Int,
|
||||
val height: Int
|
||||
val height: Int,
|
||||
)
|
||||
|
||||
class DimensionRepository(
|
||||
private val context: Context,
|
||||
private val preferencesRepository: IPreferencesRepository
|
||||
private val preferencesRepository: IPreferencesRepository,
|
||||
) : IDimensionRepository {
|
||||
|
||||
override fun areaSize(): Float {
|
||||
|
|
|
@ -9,7 +9,7 @@ interface IMinefieldRepository {
|
|||
fun fromDifficulty(
|
||||
difficulty: Difficulty,
|
||||
dimensionRepository: IDimensionRepository,
|
||||
preferencesRepository: IPreferencesRepository
|
||||
preferencesRepository: IPreferencesRepository,
|
||||
): Minefield
|
||||
|
||||
fun randomSeed(): Long
|
||||
|
@ -19,7 +19,7 @@ class MinefieldRepository : IMinefieldRepository {
|
|||
override fun fromDifficulty(
|
||||
difficulty: Difficulty,
|
||||
dimensionRepository: IDimensionRepository,
|
||||
preferencesRepository: IPreferencesRepository
|
||||
preferencesRepository: IPreferencesRepository,
|
||||
): Minefield =
|
||||
when (difficulty) {
|
||||
Difficulty.Standard -> calculateStandardMode(
|
||||
|
@ -34,7 +34,7 @@ class MinefieldRepository : IMinefieldRepository {
|
|||
|
||||
private fun calculateStandardMode(
|
||||
dimensionRepository: IDimensionRepository,
|
||||
preferencesRepository: IPreferencesRepository
|
||||
preferencesRepository: IPreferencesRepository,
|
||||
): Minefield {
|
||||
val fieldSize = dimensionRepository.defaultAreaSize()
|
||||
val verticalGap = if (dimensionRepository.navigationBarHeight() > 0)
|
||||
|
|
|
@ -13,7 +13,7 @@ interface ISavesRepository {
|
|||
|
||||
class SavesRepository(
|
||||
private val savesDao: SaveDao,
|
||||
private var maxSavesStorage: Int = MAX_STORAGE
|
||||
private var maxSavesStorage: Int = MAX_STORAGE,
|
||||
) : ISavesRepository {
|
||||
override suspend fun getAllSaves(): List<Save> = savesDao.getAll()
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ interface IStatsRepository {
|
|||
}
|
||||
|
||||
class StatsRepository(
|
||||
private val statsDao: StatsDao
|
||||
private val statsDao: StatsDao,
|
||||
) : IStatsRepository {
|
||||
override suspend fun getAllStats(minId: Int): List<Stats> {
|
||||
return statsDao.getAll(minId)
|
||||
|
@ -21,7 +21,7 @@ class StatsRepository(
|
|||
}
|
||||
|
||||
class MemoryStatsRepository(
|
||||
private val memoryStats: MutableList<Stats> = mutableListOf()
|
||||
private val memoryStats: MutableList<Stats> = mutableListOf(),
|
||||
) : IStatsRepository {
|
||||
override suspend fun getAllStats(minId: Int): List<Stats> = memoryStats.filter { it.uid >= minId }
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package dev.lucasnlm.antimine.common.level.solver
|
||||
|
||||
class LimitedBruteForceSolver(
|
||||
private val maxAttemptTime: Long = DEFAULT_BRUTE_FORCE_TIMEOUT
|
||||
private val maxAttemptTime: Long = DEFAULT_BRUTE_FORCE_TIMEOUT,
|
||||
) : BruteForceSolver() {
|
||||
|
||||
private val initialTime = System.currentTimeMillis()
|
||||
|
|
|
@ -12,7 +12,7 @@ interface IHapticFeedbackManager {
|
|||
}
|
||||
|
||||
class HapticFeedbackManager(
|
||||
context: Context
|
||||
context: Context,
|
||||
) : IHapticFeedbackManager {
|
||||
|
||||
private val vibrator by lazy { context.getSystemService(VIBRATOR_SERVICE) as Vibrator }
|
||||
|
|
|
@ -25,7 +25,7 @@ class AreaAdapter(
|
|||
context: Context,
|
||||
private val viewModel: GameViewModel,
|
||||
private val preferencesRepository: IPreferencesRepository,
|
||||
dimensionRepository: IDimensionRepository
|
||||
dimensionRepository: IDimensionRepository,
|
||||
) : RecyclerView.Adapter<AreaViewHolder>() {
|
||||
|
||||
private var field = listOf<Area>()
|
||||
|
|
|
@ -21,7 +21,7 @@ fun Area.paintOnCanvas(
|
|||
paintSettings: AreaPaintSettings,
|
||||
theme: AppTheme,
|
||||
markPadding: Int? = null,
|
||||
minePadding: Int? = null
|
||||
minePadding: Int? = null,
|
||||
) {
|
||||
paintSettings.run {
|
||||
if (isCovered) {
|
||||
|
|
|
@ -46,7 +46,7 @@ class GameViewModel(
|
|||
private val minefieldRepository: IMinefieldRepository,
|
||||
private val analyticsManager: IAnalyticsManager,
|
||||
private val playGamesManager: IPlayGamesManager,
|
||||
private val clock: Clock
|
||||
private val clock: Clock,
|
||||
) : ViewModel() {
|
||||
val eventObserver = MutableLiveData<Event>()
|
||||
val retryObserver = MutableLiveData<Unit>()
|
||||
|
|
|
@ -5,7 +5,7 @@ import dev.lucasnlm.antimine.core.analytics.models.Analytics
|
|||
import dev.lucasnlm.external.IExternalAnalyticsWrapper
|
||||
|
||||
class ProdAnalyticsManager(
|
||||
private val analyticsWrapper: IExternalAnalyticsWrapper
|
||||
private val analyticsWrapper: IExternalAnalyticsWrapper,
|
||||
) : IAnalyticsManager {
|
||||
override fun setup(context: Context, properties: Map<String, String>) {
|
||||
analyticsWrapper.setup(context, properties)
|
||||
|
|
|
@ -6,7 +6,7 @@ import dev.lucasnlm.antimine.common.level.models.Minefield
|
|||
|
||||
sealed class Analytics(
|
||||
val name: String,
|
||||
val extra: Map<String, String> = mapOf()
|
||||
val extra: Map<String, String> = mapOf(),
|
||||
) {
|
||||
object Open : Analytics("Open game")
|
||||
|
||||
|
@ -14,7 +14,7 @@ sealed class Analytics(
|
|||
minefield: Minefield,
|
||||
difficulty: Difficulty,
|
||||
seed: Long,
|
||||
areaSizeMultiplier: Int
|
||||
areaSizeMultiplier: Int,
|
||||
) : Analytics(
|
||||
"New Game",
|
||||
mapOf(
|
||||
|
@ -32,7 +32,7 @@ sealed class Analytics(
|
|||
difficulty: Difficulty,
|
||||
seed: Long,
|
||||
areaSizeMultiplier: Int,
|
||||
firstOpen: Int
|
||||
firstOpen: Int,
|
||||
) : Analytics(
|
||||
"Retry Game",
|
||||
mapOf(
|
||||
|
@ -96,7 +96,7 @@ sealed class Analytics(
|
|||
object OpenLeaderboards : Analytics("Open Leaderboards")
|
||||
|
||||
data class ClickTheme(
|
||||
private val themeId: Long
|
||||
private val themeId: Long,
|
||||
) : Analytics("Click Theme", mapOf("id" to themeId.toString()))
|
||||
|
||||
object OpenSettings : Analytics("Open Settings")
|
||||
|
|
|
@ -16,7 +16,7 @@ enum class ActionResponse {
|
|||
data class Actions(
|
||||
val singleClick: ActionResponse?,
|
||||
val doubleClick: ActionResponse?,
|
||||
val longPress: ActionResponse?
|
||||
val longPress: ActionResponse?,
|
||||
)
|
||||
|
||||
/**
|
||||
|
@ -37,7 +37,7 @@ enum class ControlStyle {
|
|||
sealed class GameControl(
|
||||
val id: ControlStyle,
|
||||
val onCovered: Actions,
|
||||
val onOpen: Actions
|
||||
val onOpen: Actions,
|
||||
) {
|
||||
object Standard : GameControl(
|
||||
id = ControlStyle.Standard,
|
||||
|
|
|
@ -13,7 +13,7 @@ interface IPreferencesManager {
|
|||
}
|
||||
|
||||
class PreferencesManager(
|
||||
private val context: Context
|
||||
private val context: Context,
|
||||
) : IPreferencesManager {
|
||||
private val preferences by lazy {
|
||||
PreferenceManager.getDefaultSharedPreferences(context)
|
||||
|
|
|
@ -49,7 +49,7 @@ interface IPreferencesRepository {
|
|||
|
||||
class PreferencesRepository(
|
||||
private val preferencesManager: IPreferencesManager,
|
||||
private val defaultLongPressTimeout: Int
|
||||
private val defaultLongPressTimeout: Int,
|
||||
) : IPreferencesRepository {
|
||||
init {
|
||||
migrateOldPreferences()
|
||||
|
|
|
@ -9,7 +9,7 @@ interface ISoundManager {
|
|||
}
|
||||
|
||||
class SoundManager(
|
||||
private val context: Context
|
||||
private val context: Context,
|
||||
) : ISoundManager {
|
||||
|
||||
override fun play(@RawRes soundId: Int) {
|
||||
|
|
|
@ -7,5 +7,5 @@ data class AppTheme(
|
|||
@StyleRes val theme: Int,
|
||||
@StyleRes val themeNoActionBar: Int,
|
||||
val assets: Assets,
|
||||
val palette: AreaPalette
|
||||
val palette: AreaPalette,
|
||||
)
|
||||
|
|
|
@ -18,5 +18,5 @@ data class AreaPalette(
|
|||
@ColorInt val minesAround7: Int,
|
||||
@ColorInt val minesAround8: Int,
|
||||
@ColorInt val highlight: Int,
|
||||
@ColorInt val focus: Int
|
||||
@ColorInt val focus: Int,
|
||||
)
|
||||
|
|
|
@ -9,5 +9,5 @@ data class Assets(
|
|||
@DrawableRes val toolbarMine: Int,
|
||||
@DrawableRes val mine: Int,
|
||||
@DrawableRes val mineExploded: Int,
|
||||
@DrawableRes val mineLow: Int
|
||||
@DrawableRes val mineLow: Int,
|
||||
)
|
||||
|
|
|
@ -18,7 +18,7 @@ interface IThemeRepository {
|
|||
|
||||
class ThemeRepository(
|
||||
private val context: Context,
|
||||
private val preferenceRepository: IPreferencesRepository
|
||||
private val preferenceRepository: IPreferencesRepository,
|
||||
) : IThemeRepository {
|
||||
override fun getCustomTheme(): AppTheme? {
|
||||
return getAllThemes().firstOrNull { it.id == preferenceRepository.themeId() }
|
||||
|
|
|
@ -26,7 +26,7 @@ object Themes {
|
|||
minesAround7 = 0x66126B,
|
||||
minesAround8 = 0x000000,
|
||||
highlight = 0x212121,
|
||||
focus = 0xD32F2F
|
||||
focus = 0xD32F2F,
|
||||
),
|
||||
assets = Assets(
|
||||
wrongFlag = R.drawable.red_flag,
|
||||
|
@ -35,7 +35,7 @@ object Themes {
|
|||
toolbarMine = R.drawable.mine,
|
||||
mine = R.drawable.mine,
|
||||
mineExploded = R.drawable.mine_exploded_red,
|
||||
mineLow = R.drawable.mine_low
|
||||
mineLow = R.drawable.mine_low,
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -60,7 +60,7 @@ object Themes {
|
|||
minesAround7 = 0xCCCCCC,
|
||||
minesAround8 = 0xCCCCCC,
|
||||
highlight = 0x212121,
|
||||
focus = 0xD32F2F
|
||||
focus = 0xD32F2F,
|
||||
),
|
||||
assets = Assets(
|
||||
wrongFlag = R.drawable.flag,
|
||||
|
@ -69,7 +69,7 @@ object Themes {
|
|||
toolbarMine = R.drawable.mine_low,
|
||||
mine = R.drawable.mine_low,
|
||||
mineExploded = R.drawable.mine_low,
|
||||
mineLow = R.drawable.mine_low
|
||||
mineLow = R.drawable.mine_low,
|
||||
)
|
||||
),
|
||||
LightTheme,
|
||||
|
@ -93,7 +93,7 @@ object Themes {
|
|||
minesAround7 = 0xd5d2cc,
|
||||
minesAround8 = 0xd5d2cc,
|
||||
highlight = 0xFFFFFF,
|
||||
focus = 0xFFFFFF
|
||||
focus = 0xFFFFFF,
|
||||
),
|
||||
assets = Assets(
|
||||
wrongFlag = R.drawable.flag,
|
||||
|
@ -102,7 +102,7 @@ object Themes {
|
|||
toolbarMine = R.drawable.mine_low,
|
||||
mine = R.drawable.mine,
|
||||
mineExploded = R.drawable.mine_exploded_white,
|
||||
mineLow = R.drawable.mine_low
|
||||
mineLow = R.drawable.mine_low,
|
||||
)
|
||||
),
|
||||
AppTheme(
|
||||
|
@ -125,7 +125,7 @@ object Themes {
|
|||
minesAround7 = 0x66126B,
|
||||
minesAround8 = 0x000000,
|
||||
highlight = 0xFFFFFF,
|
||||
focus = 0xFFFFFF
|
||||
focus = 0xFFFFFF,
|
||||
),
|
||||
assets = Assets(
|
||||
wrongFlag = R.drawable.flag,
|
||||
|
@ -134,7 +134,7 @@ object Themes {
|
|||
toolbarMine = R.drawable.mine_low,
|
||||
mine = R.drawable.mine,
|
||||
mineExploded = R.drawable.mine_exploded_white,
|
||||
mineLow = R.drawable.mine_low
|
||||
mineLow = R.drawable.mine_low,
|
||||
)
|
||||
),
|
||||
AppTheme(
|
||||
|
@ -157,7 +157,7 @@ object Themes {
|
|||
minesAround7 = 0x66126B,
|
||||
minesAround8 = 0x000000,
|
||||
highlight = 0x212121,
|
||||
focus = 0xD32F2F
|
||||
focus = 0xD32F2F,
|
||||
),
|
||||
assets = Assets(
|
||||
wrongFlag = R.drawable.red_flag,
|
||||
|
@ -166,7 +166,7 @@ object Themes {
|
|||
toolbarMine = R.drawable.mine,
|
||||
mine = R.drawable.mine,
|
||||
mineExploded = R.drawable.mine_exploded_red,
|
||||
mineLow = R.drawable.mine_low
|
||||
mineLow = R.drawable.mine_low,
|
||||
)
|
||||
),
|
||||
AppTheme(
|
||||
|
@ -189,7 +189,7 @@ object Themes {
|
|||
minesAround7 = 0x66126B,
|
||||
minesAround8 = 0x000000,
|
||||
highlight = 0x212121,
|
||||
focus = 0xD32F2F
|
||||
focus = 0xD32F2F,
|
||||
),
|
||||
assets = Assets(
|
||||
wrongFlag = R.drawable.red_flag,
|
||||
|
@ -198,7 +198,7 @@ object Themes {
|
|||
toolbarMine = R.drawable.mine,
|
||||
mine = R.drawable.mine,
|
||||
mineExploded = R.drawable.mine_exploded_red,
|
||||
mineLow = R.drawable.mine_low
|
||||
mineLow = R.drawable.mine_low,
|
||||
)
|
||||
),
|
||||
AppTheme(
|
||||
|
@ -221,7 +221,7 @@ object Themes {
|
|||
minesAround7 = 0x66126B,
|
||||
minesAround8 = 0x000000,
|
||||
highlight = 0x212121,
|
||||
focus = 0xD32F2F
|
||||
focus = 0xD32F2F,
|
||||
),
|
||||
assets = Assets(
|
||||
wrongFlag = R.drawable.red_flag,
|
||||
|
@ -230,7 +230,7 @@ object Themes {
|
|||
toolbarMine = R.drawable.mine,
|
||||
mine = R.drawable.mine,
|
||||
mineExploded = R.drawable.mine_exploded_red,
|
||||
mineLow = R.drawable.mine_low
|
||||
mineLow = R.drawable.mine_low,
|
||||
)
|
||||
),
|
||||
AppTheme(
|
||||
|
@ -253,7 +253,7 @@ object Themes {
|
|||
minesAround7 = 0xBBBBBB,
|
||||
minesAround8 = 0xEEEEEE,
|
||||
highlight = 0x212121,
|
||||
focus = 0xD32F2F
|
||||
focus = 0xD32F2F,
|
||||
),
|
||||
assets = Assets(
|
||||
wrongFlag = R.drawable.flag_black,
|
||||
|
@ -262,7 +262,7 @@ object Themes {
|
|||
toolbarMine = R.drawable.mine_low,
|
||||
mine = R.drawable.mine_white,
|
||||
mineExploded = R.drawable.mine_white,
|
||||
mineLow = R.drawable.mine_low
|
||||
mineLow = R.drawable.mine_low,
|
||||
)
|
||||
),
|
||||
AppTheme(
|
||||
|
@ -285,7 +285,7 @@ object Themes {
|
|||
minesAround7 = 0x616161,
|
||||
minesAround8 = 0x000000,
|
||||
highlight = 0x212121,
|
||||
focus = 0xD32F2F
|
||||
focus = 0xD32F2F,
|
||||
),
|
||||
assets = Assets(
|
||||
wrongFlag = R.drawable.flag,
|
||||
|
@ -294,7 +294,7 @@ object Themes {
|
|||
toolbarMine = R.drawable.mine_low,
|
||||
mine = R.drawable.mine_pink,
|
||||
mineExploded = R.drawable.mine_pink_exploded,
|
||||
mineLow = R.drawable.mine_low
|
||||
mineLow = R.drawable.mine_low,
|
||||
)
|
||||
),
|
||||
AppTheme(
|
||||
|
@ -317,7 +317,7 @@ object Themes {
|
|||
minesAround7 = 0x616161,
|
||||
minesAround8 = 0x000000,
|
||||
highlight = 0xd1c4e9,
|
||||
focus = 0xD32F2F
|
||||
focus = 0xD32F2F,
|
||||
),
|
||||
assets = Assets(
|
||||
wrongFlag = R.drawable.flag,
|
||||
|
@ -326,7 +326,7 @@ object Themes {
|
|||
toolbarMine = R.drawable.mine_low,
|
||||
mine = R.drawable.mine_pink,
|
||||
mineExploded = R.drawable.mine_pink_exploded,
|
||||
mineLow = R.drawable.mine_low
|
||||
mineLow = R.drawable.mine_low,
|
||||
)
|
||||
),
|
||||
AppTheme(
|
||||
|
@ -349,7 +349,7 @@ object Themes {
|
|||
minesAround7 = 0x616161,
|
||||
minesAround8 = 0x000000,
|
||||
highlight = 0xd1c4e9,
|
||||
focus = 0xD32F2F
|
||||
focus = 0xD32F2F,
|
||||
),
|
||||
assets = Assets(
|
||||
wrongFlag = R.drawable.flag,
|
||||
|
@ -381,7 +381,7 @@ object Themes {
|
|||
minesAround7 = 0x616161,
|
||||
minesAround8 = 0x000000,
|
||||
highlight = 0xd1c4e9,
|
||||
focus = 0xD32F2F
|
||||
focus = 0xD32F2F,
|
||||
),
|
||||
assets = Assets(
|
||||
wrongFlag = R.drawable.flag,
|
||||
|
@ -413,7 +413,7 @@ object Themes {
|
|||
minesAround7 = 0x616161,
|
||||
minesAround8 = 0x000000,
|
||||
highlight = 0xd1c4e9,
|
||||
focus = 0xD32F2F
|
||||
focus = 0xD32F2F,
|
||||
),
|
||||
assets = Assets(
|
||||
wrongFlag = R.drawable.flag,
|
||||
|
@ -422,7 +422,7 @@ object Themes {
|
|||
toolbarMine = R.drawable.mine_low,
|
||||
mine = R.drawable.mine,
|
||||
mineExploded = R.drawable.mine_pink_exploded,
|
||||
mineLow = R.drawable.mine_low
|
||||
mineLow = R.drawable.mine_low,
|
||||
)
|
||||
),
|
||||
AppTheme(
|
||||
|
@ -445,7 +445,7 @@ object Themes {
|
|||
minesAround7 = 0x616161,
|
||||
minesAround8 = 0x000000,
|
||||
highlight = 0xd1c4e9,
|
||||
focus = 0xD32F2F
|
||||
focus = 0xD32F2F,
|
||||
),
|
||||
assets = Assets(
|
||||
wrongFlag = R.drawable.flag,
|
||||
|
@ -477,7 +477,7 @@ object Themes {
|
|||
minesAround7 = 0xFF0000,
|
||||
minesAround8 = 0xFF0000,
|
||||
highlight = 0xd1c4e9,
|
||||
focus = 0xD32F2F
|
||||
focus = 0xD32F2F,
|
||||
),
|
||||
assets = Assets(
|
||||
wrongFlag = R.drawable.flag_black,
|
||||
|
@ -486,7 +486,7 @@ object Themes {
|
|||
toolbarMine = R.drawable.mine_low,
|
||||
mine = R.drawable.mine_white,
|
||||
mineExploded = R.drawable.mine_white,
|
||||
mineLow = R.drawable.mine_low
|
||||
mineLow = R.drawable.mine_low,
|
||||
)
|
||||
),
|
||||
AppTheme(
|
||||
|
@ -509,7 +509,7 @@ object Themes {
|
|||
minesAround7 = 0xFF0000,
|
||||
minesAround8 = 0xFF0000,
|
||||
highlight = 0xd1c4e9,
|
||||
focus = 0xD32F2F
|
||||
focus = 0xD32F2F,
|
||||
),
|
||||
assets = Assets(
|
||||
wrongFlag = R.drawable.flag_black,
|
||||
|
@ -541,7 +541,7 @@ object Themes {
|
|||
minesAround7 = 0xFF0000,
|
||||
minesAround8 = 0xFF0000,
|
||||
highlight = 0xd1c4e9,
|
||||
focus = 0xD32F2F
|
||||
focus = 0xD32F2F,
|
||||
),
|
||||
assets = Assets(
|
||||
wrongFlag = R.drawable.flag_black,
|
||||
|
@ -550,7 +550,7 @@ object Themes {
|
|||
toolbarMine = R.drawable.mine_low,
|
||||
mine = R.drawable.mine_white,
|
||||
mineExploded = R.drawable.mine_white,
|
||||
mineLow = R.drawable.mine_low
|
||||
mineLow = R.drawable.mine_low,
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -13,7 +13,7 @@ enum class Achievement(
|
|||
Expert(""),
|
||||
ThirtySeconds(""),
|
||||
Flags(""),
|
||||
Boom("")
|
||||
Boom(""),
|
||||
}
|
||||
|
||||
enum class Leaderboard(
|
||||
|
@ -21,7 +21,7 @@ enum class Leaderboard(
|
|||
) {
|
||||
BestTimeBeginner(""),
|
||||
BestTimeIntermediate(""),
|
||||
BestTimeExpert("")
|
||||
BestTimeExpert(""),
|
||||
}
|
||||
|
||||
interface IPlayGamesManager {
|
||||
|
|
|
@ -6,7 +6,7 @@ import android.content.Intent
|
|||
import android.net.Uri
|
||||
|
||||
class BillingManager(
|
||||
private val context: Context
|
||||
private val context: Context,
|
||||
) : IBillingManager {
|
||||
|
||||
override fun start(unlockAppListener: UnlockAppListener) {
|
||||
|
|
|
@ -3,7 +3,7 @@ package dev.lucasnlm.external
|
|||
import android.content.Context
|
||||
|
||||
class ExternalAnalyticsWrapper(
|
||||
context: Context
|
||||
context: Context,
|
||||
) : IExternalAnalyticsWrapper {
|
||||
override fun setup(context: Context, properties: Map<String, String>) {
|
||||
// F-droid build doesn't have analytics.
|
||||
|
|
|
@ -5,7 +5,7 @@ import android.content.Context
|
|||
import android.content.Intent
|
||||
|
||||
class PlayGamesManager(
|
||||
context: Context
|
||||
context: Context,
|
||||
) : IPlayGamesManager {
|
||||
override fun hasGooglePlayGames(): Boolean = false
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import com.android.billingclient.api.SkuDetailsParams
|
|||
import com.android.billingclient.api.querySkuDetails
|
||||
|
||||
class BillingManager(
|
||||
private val context: Context
|
||||
private val context: Context,
|
||||
) : IBillingManager, BillingClientStateListener, PurchasesUpdatedListener {
|
||||
private var unlockAppListener: UnlockAppListener? = null
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import android.os.Bundle
|
|||
import com.google.firebase.analytics.FirebaseAnalytics
|
||||
|
||||
class ExternalAnalyticsWrapper(
|
||||
private val context: Context
|
||||
private val context: Context,
|
||||
) : IExternalAnalyticsWrapper {
|
||||
private val firebaseAnalytics by lazy {
|
||||
FirebaseAnalytics.getInstance(context)
|
||||
|
|
|
@ -12,7 +12,7 @@ import com.google.android.gms.auth.api.signin.GoogleSignInOptions
|
|||
import com.google.android.gms.games.Games
|
||||
|
||||
class PlayGamesManager(
|
||||
private val context: Context
|
||||
private val context: Context,
|
||||
) : IPlayGamesManager {
|
||||
private var account: GoogleSignInAccount? = null
|
||||
|
||||
|
|
Loading…
Reference in a new issue