Fix ktlint
This commit is contained in:
parent
cbd58e9ddc
commit
574f88b96d
22 changed files with 54 additions and 64 deletions
5
.editorconfig
Normal file
5
.editorconfig
Normal file
|
@ -0,0 +1,5 @@
|
|||
[*.{kt,kts}]
|
||||
indent_size=4
|
||||
insert_final_newline=true
|
||||
max_line_length=120
|
||||
disabled_rules=import-ordering,no-wildcard-imports
|
|
@ -25,14 +25,12 @@ import androidx.preference.PreferenceManager
|
|||
import com.google.android.play.core.appupdate.AppUpdateManagerFactory
|
||||
import com.google.android.play.core.install.model.AppUpdateType
|
||||
import com.google.android.play.core.install.model.UpdateAvailability
|
||||
import dev.lucasnlm.antimine.about.AboutActivity
|
||||
import dev.lucasnlm.antimine.preferences.PreferencesActivity
|
||||
import dagger.android.support.DaggerAppCompatActivity
|
||||
import dev.lucasnlm.antimine.about.AboutActivity
|
||||
import dev.lucasnlm.antimine.common.level.data.DifficultyPreset
|
||||
import dev.lucasnlm.antimine.common.level.data.GameEvent
|
||||
import dev.lucasnlm.antimine.common.level.data.GameStatus
|
||||
import dev.lucasnlm.antimine.common.level.data.Mark
|
||||
|
||||
import dev.lucasnlm.antimine.common.level.viewmodel.GameViewModel
|
||||
import dev.lucasnlm.antimine.common.level.viewmodel.GameViewModelFactory
|
||||
import dev.lucasnlm.antimine.core.analytics.AnalyticsManager
|
||||
|
@ -42,6 +40,7 @@ import dev.lucasnlm.antimine.core.utils.isDarkModeEnabled
|
|||
import dev.lucasnlm.antimine.level.view.CustomLevelDialogFragment
|
||||
import dev.lucasnlm.antimine.level.view.EndGameDialogFragment
|
||||
import dev.lucasnlm.antimine.level.view.LevelFragment
|
||||
import dev.lucasnlm.antimine.preferences.PreferencesActivity
|
||||
import dev.lucasnlm.antimine.share.viewmodel.ShareViewModel
|
||||
import kotlinx.android.synthetic.main.activity_game.*
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
|
@ -441,9 +440,7 @@ class GameActivity : DaggerAppCompatActivity() {
|
|||
|
||||
waitAndShowEndGameDialog(false)
|
||||
}
|
||||
else -> {
|
||||
|
||||
}
|
||||
else -> { }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -455,8 +452,8 @@ class GameActivity : DaggerAppCompatActivity() {
|
|||
val appUpdateInfoTask = appUpdateManager.appUpdateInfo
|
||||
|
||||
appUpdateInfoTask.addOnSuccessListener { info ->
|
||||
if (info.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE
|
||||
&& info.isUpdateTypeAllowed(AppUpdateType.FLEXIBLE)
|
||||
if (info.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE &&
|
||||
info.isUpdateTypeAllowed(AppUpdateType.FLEXIBLE)
|
||||
) {
|
||||
try {
|
||||
appUpdateManager.startUpdateFlowForResult(
|
||||
|
@ -467,7 +464,6 @@ class GameActivity : DaggerAppCompatActivity() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -81,7 +81,7 @@ class TvGameActivity : DaggerAppCompatActivity() {
|
|||
}
|
||||
})
|
||||
difficulty.observe(this@TvGameActivity, Observer {
|
||||
//onChangeDifficulty(it)
|
||||
// onChangeDifficulty(it)
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -287,9 +287,7 @@ class TvGameActivity : DaggerAppCompatActivity() {
|
|||
|
||||
waitAndShowConfirmNewGame()
|
||||
}
|
||||
else -> {
|
||||
|
||||
}
|
||||
else -> { }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -298,8 +296,8 @@ class TvGameActivity : DaggerAppCompatActivity() {
|
|||
val appUpdateInfoTask = appUpdateManager.appUpdateInfo
|
||||
|
||||
appUpdateInfoTask.addOnSuccessListener { info ->
|
||||
if (info.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE
|
||||
&& info.isUpdateTypeAllowed(AppUpdateType.FLEXIBLE)) {
|
||||
if (info.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE &&
|
||||
info.isUpdateTypeAllowed(AppUpdateType.FLEXIBLE)) {
|
||||
try {
|
||||
appUpdateManager.startUpdateFlowForResult(
|
||||
info, AppUpdateType.FLEXIBLE, this, 1)
|
||||
|
@ -308,11 +306,9 @@ class TvGameActivity : DaggerAppCompatActivity() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val TAG = "GameActivity"
|
||||
const val PREFERENCE_FIRST_USE = "preference_first_use"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ class AboutActivity : AppCompatActivity() {
|
|||
)
|
||||
|
||||
thirdsParties.setOnClickListener { openThirdParties() }
|
||||
sourceCode.setOnClickListener{ openSourceCode() }
|
||||
sourceCode.setOnClickListener { openSourceCode() }
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean =
|
||||
|
|
|
@ -17,8 +17,9 @@ internal class ThirdPartyAdapter(
|
|||
override fun getItemCount(): Int = thirdParties.size
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ThirdPartyItemHolder {
|
||||
val view = LayoutInflater.from(parent.context)
|
||||
.inflate(R.layout.view_third_party, parent, false)
|
||||
val view = LayoutInflater
|
||||
.from(parent.context)
|
||||
.inflate(R.layout.view_third_party, parent, false)
|
||||
return ThirdPartyItemHolder(view)
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ import org.junit.Test
|
|||
import java.io.File
|
||||
import java.io.FileOutputStream
|
||||
|
||||
|
||||
class AreaScreenshot {
|
||||
|
||||
private lateinit var context: Context
|
||||
|
@ -99,7 +98,6 @@ class AreaScreenshot {
|
|||
screenshotTest(area, "covered_ambient.png", true)
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
fun testUncoveredArea() {
|
||||
val area = Area(0, 0, 0, isCovered = false)
|
||||
|
@ -159,7 +157,6 @@ class AreaScreenshot {
|
|||
screenshotTest(area, "covered_question_ambient.png", true)
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
fun testCoveredAreaHighlighted() {
|
||||
val area = Area(0, 0, 0, isCovered = true, highlighted = true)
|
||||
|
|
|
@ -172,7 +172,7 @@ class LevelFacade {
|
|||
.filter {
|
||||
it.mark == Mark.None
|
||||
}
|
||||
.map{
|
||||
.map {
|
||||
openField(it)
|
||||
it.id
|
||||
}
|
||||
|
|
|
@ -5,8 +5,9 @@ sealed class GameStatus {
|
|||
|
||||
object Running : GameStatus()
|
||||
|
||||
class Over(val rightMines: Int = 0,
|
||||
val totalMines: Int = 0,
|
||||
val time: Long = 0
|
||||
class Over(
|
||||
val rightMines: Int = 0,
|
||||
val totalMines: Int = 0,
|
||||
val time: Long = 0
|
||||
) : GameStatus()
|
||||
}
|
||||
|
|
|
@ -31,6 +31,3 @@ data class Save(
|
|||
@ColumnInfo(name = "field")
|
||||
val field: List<Area>
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -35,4 +35,4 @@ class DimensionRepository(
|
|||
styledAttributes.recycle()
|
||||
return actionBarSize
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,11 @@ class AreaAdapter(
|
|||
override fun getItemCount() = field.size
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): FieldViewHolder {
|
||||
val layout = if (viewModel.useAccessibilityMode()) { R.layout.view_accessibility_field } else { R.layout.view_field }
|
||||
val layout = if (viewModel.useAccessibilityMode()) {
|
||||
R.layout.view_accessibility_field
|
||||
} else {
|
||||
R.layout.view_field
|
||||
}
|
||||
val view = LayoutInflater.from(parent.context).inflate(layout, parent, false)
|
||||
val holder = FieldViewHolder(view)
|
||||
|
||||
|
|
|
@ -8,4 +8,3 @@ data class AreaPaintSettings(
|
|||
val rectF: RectF,
|
||||
val radius: Float
|
||||
)
|
||||
|
||||
|
|
|
@ -10,16 +10,17 @@ import dev.lucasnlm.antimine.common.level.data.Mark
|
|||
import dev.lucasnlm.antimine.common.level.model.AreaPalette
|
||||
import dev.lucasnlm.antimine.common.level.repository.DrawableRepository
|
||||
|
||||
fun Area.paintOnCanvas(context: Context,
|
||||
canvas: Canvas,
|
||||
isAmbientMode: Boolean,
|
||||
isLowBitAmbient: Boolean,
|
||||
isFocused: Boolean,
|
||||
drawableRepository: DrawableRepository,
|
||||
paintSettings: AreaPaintSettings,
|
||||
areaPalette: AreaPalette,
|
||||
markPadding: Int? = null,
|
||||
minePadding: Int? = null
|
||||
fun Area.paintOnCanvas(
|
||||
context: Context,
|
||||
canvas: Canvas,
|
||||
isAmbientMode: Boolean,
|
||||
isLowBitAmbient: Boolean,
|
||||
isFocused: Boolean,
|
||||
drawableRepository: DrawableRepository,
|
||||
paintSettings: AreaPaintSettings,
|
||||
areaPalette: AreaPalette,
|
||||
markPadding: Int? = null,
|
||||
minePadding: Int? = null
|
||||
) {
|
||||
paintSettings.run {
|
||||
if (isCovered) {
|
||||
|
@ -35,7 +36,7 @@ fun Area.paintOnCanvas(context: Context,
|
|||
style = Paint.Style.FILL
|
||||
isAntiAlias = !isLowBitAmbient
|
||||
color = areaPalette.covered
|
||||
alpha = if(highlighted) 155 else 255
|
||||
alpha = if (highlighted) 155 else 255
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,14 +26,11 @@ class AreaView : View {
|
|||
private lateinit var palette: AreaPalette
|
||||
private val drawableRepository = DrawableRepository()
|
||||
|
||||
constructor(context: Context)
|
||||
: super(context)
|
||||
constructor(context: Context) : super(context)
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet?)
|
||||
: super(context, attrs)
|
||||
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int)
|
||||
: super(context, attrs, defStyleAttr)
|
||||
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
|
||||
|
||||
fun bindField(area: Area, isAmbientMode: Boolean, isLowBitAmbient: Boolean, paintSettings: AreaPaintSettings) {
|
||||
this.paintSettings = paintSettings
|
||||
|
@ -124,6 +121,4 @@ class AreaView : View {
|
|||
)
|
||||
return ContextCompat.getDrawable(context, outValue.resourceId)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -12,11 +12,9 @@ class UnlockedHorizontalScrollView : HorizontalScrollView {
|
|||
|
||||
constructor(context: Context) : super(context)
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet)
|
||||
: super(context, attrs)
|
||||
constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int)
|
||||
: super(context, attrs, defStyleAttr)
|
||||
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
|
||||
|
||||
fun setTarget(recyclerView: RecyclerView) {
|
||||
this.recyclerView = recyclerView
|
||||
|
|
|
@ -176,7 +176,7 @@ class GameViewModel(
|
|||
field.postValue(levelFacade.field.toList())
|
||||
}
|
||||
|
||||
if (preferencesRepository.useFlagAssistant() && !levelFacade.hasAnyMineExploded()){
|
||||
if (preferencesRepository.useFlagAssistant() && !levelFacade.hasAnyMineExploded()) {
|
||||
levelFacade.runFlagAssistant()
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,8 @@ import dev.lucasnlm.antimine.common.level.data.GameStats
|
|||
import dev.lucasnlm.antimine.common.level.data.LevelSetup
|
||||
|
||||
sealed class Event(
|
||||
val title: String, val extra: Map<String, String> = mapOf()
|
||||
val title: String,
|
||||
val extra: Map<String, String> = mapOf()
|
||||
) {
|
||||
class Open : Event("Open game")
|
||||
|
||||
|
|
|
@ -45,5 +45,4 @@ class PreferencesRepository(
|
|||
|
||||
override fun useLargeAreas(): Boolean =
|
||||
getBoolean("preference_large_area", false)
|
||||
|
||||
}
|
||||
|
|
|
@ -417,4 +417,4 @@ class LevelFacadeTest {
|
|||
assertFalse(checkVictory())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,9 +49,9 @@ class ClockTest {
|
|||
val mockTimer = mock<Timer>()
|
||||
val clock = MockClock(mockTimer)
|
||||
|
||||
clock.start { }
|
||||
clock.start { }
|
||||
assertFalse(clock.isStopped)
|
||||
clock.stop()
|
||||
assertTrue(clock.isStopped)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import kotlinx.coroutines.launch
|
|||
import kotlinx.coroutines.withContext
|
||||
import javax.inject.Inject
|
||||
|
||||
class WatchLevelFragment: DaggerFragment() {
|
||||
class WatchLevelFragment : DaggerFragment() {
|
||||
@Inject
|
||||
lateinit var viewModelFactory: GameViewModelFactory
|
||||
|
||||
|
|
Loading…
Reference in a new issue