Fix ktlint
This commit is contained in:
parent
9dec3f6266
commit
8d0e12a2ba
16 changed files with 120 additions and 67 deletions
|
@ -227,7 +227,10 @@ class GameActivity : ThematicActivity(R.layout.activity_game), DialogInterface.O
|
|||
}
|
||||
|
||||
minesCount.setCompoundDrawablesWithIntrinsicBounds(
|
||||
ContextCompat.getDrawable(this, usingTheme.assets.toolbarMine), null, null, null
|
||||
ContextCompat.getDrawable(this, usingTheme.assets.toolbarMine),
|
||||
null,
|
||||
null,
|
||||
null
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -279,28 +282,30 @@ class GameActivity : ThematicActivity(R.layout.activity_game), DialogInterface.O
|
|||
}
|
||||
)
|
||||
|
||||
addDrawerListener(object : DrawerLayout.DrawerListener {
|
||||
override fun onDrawerSlide(drawerView: View, slideOffset: Float) {
|
||||
// Empty
|
||||
}
|
||||
|
||||
override fun onDrawerOpened(drawerView: View) {
|
||||
gameViewModel.pauseGame()
|
||||
analyticsManager.sentEvent(Analytics.OpenDrawer)
|
||||
}
|
||||
|
||||
override fun onDrawerClosed(drawerView: View) {
|
||||
if (hasNoOtherFocusedDialog()) {
|
||||
gameViewModel.resumeGame()
|
||||
addDrawerListener(
|
||||
object : DrawerLayout.DrawerListener {
|
||||
override fun onDrawerSlide(drawerView: View, slideOffset: Float) {
|
||||
// Empty
|
||||
}
|
||||
|
||||
analyticsManager.sentEvent(Analytics.CloseDrawer)
|
||||
}
|
||||
override fun onDrawerOpened(drawerView: View) {
|
||||
gameViewModel.pauseGame()
|
||||
analyticsManager.sentEvent(Analytics.OpenDrawer)
|
||||
}
|
||||
|
||||
override fun onDrawerStateChanged(newState: Int) {
|
||||
// Empty
|
||||
override fun onDrawerClosed(drawerView: View) {
|
||||
if (hasNoOtherFocusedDialog()) {
|
||||
gameViewModel.resumeGame()
|
||||
}
|
||||
|
||||
analyticsManager.sentEvent(Analytics.CloseDrawer)
|
||||
}
|
||||
|
||||
override fun onDrawerStateChanged(newState: Int) {
|
||||
// Empty
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
if (preferencesRepository.isFirstUse()) {
|
||||
openDrawer(GravityCompat.START)
|
||||
|
@ -495,7 +500,8 @@ class GameActivity : ThematicActivity(R.layout.activity_game), DialogInterface.O
|
|||
val currentGameStatus = status
|
||||
if (currentGameStatus is Status.Over && !isFinishing && !drawer.isDrawerOpen(GravityCompat.START)) {
|
||||
if (supportFragmentManager.findFragmentByTag(SupportAppDialogFragment.TAG) == null &&
|
||||
supportFragmentManager.findFragmentByTag(EndGameDialogFragment.TAG) == null) {
|
||||
supportFragmentManager.findFragmentByTag(EndGameDialogFragment.TAG) == null
|
||||
) {
|
||||
val score = currentGameStatus.score
|
||||
EndGameDialogFragment.newInstance(
|
||||
victory,
|
||||
|
|
|
@ -200,7 +200,8 @@ class TvGameActivity : AppCompatActivity() {
|
|||
keepConfirmingNewGame = false
|
||||
}
|
||||
},
|
||||
null, DateUtils.SECOND_IN_MILLIS
|
||||
null,
|
||||
DateUtils.SECOND_IN_MILLIS
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -222,7 +223,8 @@ class TvGameActivity : AppCompatActivity() {
|
|||
}.show()
|
||||
}
|
||||
},
|
||||
null, DateUtils.SECOND_IN_MILLIS
|
||||
null,
|
||||
DateUtils.SECOND_IN_MILLIS
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,8 @@ import dev.lucasnlm.antimine.ThematicActivity
|
|||
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository
|
||||
import org.koin.android.ext.android.inject
|
||||
|
||||
class PreferencesActivity : ThematicActivity(R.layout.activity_empty),
|
||||
class PreferencesActivity :
|
||||
ThematicActivity(R.layout.activity_empty),
|
||||
SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
|
||||
private val preferenceRepository: IPreferencesRepository by inject()
|
||||
|
|
|
@ -60,7 +60,10 @@ class ShareManager(
|
|||
val canvas = Canvas(bitmap)
|
||||
|
||||
canvas.drawRect(
|
||||
0.0f, 0.0f, imageWidth.toFloat(), imageHeight.toFloat(),
|
||||
0.0f,
|
||||
0.0f,
|
||||
imageWidth.toFloat(),
|
||||
imageHeight.toFloat(),
|
||||
Paint().apply {
|
||||
color = Color.WHITE
|
||||
alpha = 0xff
|
||||
|
|
|
@ -31,7 +31,8 @@ class ThemeViewModel(
|
|||
}.map {
|
||||
if (it is ThemeEvent.ChangeTheme &&
|
||||
billingManager.isEnabled() &&
|
||||
!preferencesRepository.areExtrasUnlocked()) {
|
||||
!preferencesRepository.areExtrasUnlocked()
|
||||
) {
|
||||
ThemeEvent.Unlock
|
||||
} else {
|
||||
it
|
||||
|
|
|
@ -119,7 +119,9 @@ class ThemeViewModelTest : IntentViewModelTest() {
|
|||
)
|
||||
|
||||
private val allThemes = listOf(
|
||||
lightTheme, darkTheme, gardenTheme
|
||||
lightTheme,
|
||||
darkTheme,
|
||||
gardenTheme
|
||||
)
|
||||
|
||||
@Test
|
||||
|
|
|
@ -18,7 +18,8 @@ import dev.lucasnlm.antimine.common.level.database.models.Stats
|
|||
Save::class,
|
||||
Stats::class
|
||||
],
|
||||
version = 6, exportSchema = false
|
||||
version = 6,
|
||||
exportSchema = false
|
||||
)
|
||||
@TypeConverters(
|
||||
AreaConverter::class,
|
||||
|
|
|
@ -37,7 +37,8 @@ open class Clock {
|
|||
onTick(elapsedTimeSeconds)
|
||||
}
|
||||
},
|
||||
1000L, 1000L
|
||||
1000L,
|
||||
1000L
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,23 +80,25 @@ class AreaAdapter(
|
|||
val style = preferencesRepository.controlStyle()
|
||||
if (style == ControlStyle.DoubleClick || style == ControlStyle.DoubleClickInverted) {
|
||||
view.isClickable = true
|
||||
view.setOnDoubleClickListener(object : GestureDetector.OnDoubleTapListener {
|
||||
override fun onDoubleTap(e: MotionEvent?): Boolean {
|
||||
return view.onClickablePosition(adapterPosition) {
|
||||
viewModel.onDoubleClick(it)
|
||||
view.setOnDoubleClickListener(
|
||||
object : GestureDetector.OnDoubleTapListener {
|
||||
override fun onDoubleTap(e: MotionEvent?): Boolean {
|
||||
return view.onClickablePosition(adapterPosition) {
|
||||
viewModel.onDoubleClick(it)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDoubleTapEvent(e: MotionEvent?): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
override fun onSingleTapConfirmed(e: MotionEvent?): Boolean {
|
||||
return view.onClickablePosition(adapterPosition) {
|
||||
viewModel.onSingleClick(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDoubleTapEvent(e: MotionEvent?): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
override fun onSingleTapConfirmed(e: MotionEvent?): Boolean {
|
||||
return view.onClickablePosition(adapterPosition) {
|
||||
viewModel.onSingleClick(it)
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
} else {
|
||||
view.setOnTouchListener { _, motionEvent ->
|
||||
when (motionEvent.action) {
|
||||
|
|
|
@ -140,7 +140,9 @@ class AreaView : View {
|
|||
private fun getRippleEffect(context: Context): Drawable? {
|
||||
val outValue = TypedValue()
|
||||
context.theme.resolveAttribute(
|
||||
android.R.attr.selectableItemBackground, outValue, true
|
||||
android.R.attr.selectableItemBackground,
|
||||
outValue,
|
||||
true
|
||||
)
|
||||
return ContextCompat.getDrawable(context, outValue.resourceId)
|
||||
}
|
||||
|
|
|
@ -69,7 +69,9 @@ class GameViewModel(
|
|||
currentDifficulty = newDifficulty
|
||||
|
||||
val minefield = minefieldRepository.fromDifficulty(
|
||||
newDifficulty, dimensionRepository, preferencesRepository
|
||||
newDifficulty,
|
||||
dimensionRepository,
|
||||
preferencesRepository
|
||||
)
|
||||
|
||||
gameController = GameController(minefield, minefieldRepository.randomSeed())
|
||||
|
@ -85,7 +87,8 @@ class GameViewModel(
|
|||
|
||||
analyticsManager.sentEvent(
|
||||
Analytics.NewGame(
|
||||
minefield, newDifficulty,
|
||||
minefield,
|
||||
newDifficulty,
|
||||
gameController.seed,
|
||||
getAreaSizeMultiplier()
|
||||
)
|
||||
|
|
|
@ -57,8 +57,8 @@ class PreferencesRepository(
|
|||
|
||||
override fun hasCustomizations(): Boolean {
|
||||
return preferencesManager.getInt(PREFERENCE_AREA_SIZE, 50) != 50 ||
|
||||
preferencesManager.getInt(PREFERENCE_LONG_PRESS_TIMEOUT,
|
||||
ViewConfiguration.getLongPressTimeout()) != ViewConfiguration.getLongPressTimeout()
|
||||
preferencesManager.getInt(PREFERENCE_LONG_PRESS_TIMEOUT, ViewConfiguration.getLongPressTimeout()) !=
|
||||
ViewConfiguration.getLongPressTimeout()
|
||||
}
|
||||
|
||||
override fun reset() {
|
||||
|
|
|
@ -55,7 +55,10 @@ class AreaConverterTest {
|
|||
"highlighted":true
|
||||
}
|
||||
]
|
||||
""".trimIndent().replace(" ", "").replace("\n", "")
|
||||
""".trimIndent().replace(
|
||||
" ",
|
||||
""
|
||||
).replace("\n", "")
|
||||
|
||||
private val areaList =
|
||||
listOf(
|
||||
|
@ -98,7 +101,8 @@ class AreaConverterTest {
|
|||
val fieldConverter = AreaConverter()
|
||||
val list = fieldConverter.toAreaList(expectedJson)
|
||||
assertEquals(
|
||||
areaList, list
|
||||
areaList,
|
||||
list
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,9 @@ class MinefieldFactoryTest {
|
|||
@Test
|
||||
fun testFromDifficultyPresetBeginner() {
|
||||
MinefieldRepository().fromDifficulty(
|
||||
Difficulty.Beginner, dimensionRepository, preferencesRepository
|
||||
Difficulty.Beginner,
|
||||
dimensionRepository,
|
||||
preferencesRepository
|
||||
).run {
|
||||
assertEquals(9, width)
|
||||
assertEquals(9, height)
|
||||
|
@ -29,7 +31,9 @@ class MinefieldFactoryTest {
|
|||
@Test
|
||||
fun testFromDifficultyPresetIntermediate() {
|
||||
MinefieldRepository().fromDifficulty(
|
||||
Difficulty.Intermediate, dimensionRepository, preferencesRepository
|
||||
Difficulty.Intermediate,
|
||||
dimensionRepository,
|
||||
preferencesRepository
|
||||
).run {
|
||||
assertEquals(16, width)
|
||||
assertEquals(16, height)
|
||||
|
@ -40,7 +44,9 @@ class MinefieldFactoryTest {
|
|||
@Test
|
||||
fun testFromDifficultyPresetExpert() {
|
||||
MinefieldRepository().fromDifficulty(
|
||||
Difficulty.Expert, dimensionRepository, preferencesRepository
|
||||
Difficulty.Expert,
|
||||
dimensionRepository,
|
||||
preferencesRepository
|
||||
).run {
|
||||
assertEquals(24, width)
|
||||
assertEquals(24, height)
|
||||
|
|
|
@ -27,7 +27,9 @@ class MinefieldRepositoryTest {
|
|||
}
|
||||
|
||||
val minefield = minefieldRepository.fromDifficulty(
|
||||
Difficulty.Standard, dimensionRepository, preferencesRepository
|
||||
Difficulty.Standard,
|
||||
dimensionRepository,
|
||||
preferencesRepository
|
||||
)
|
||||
|
||||
assertEquals(Minefield(99, 96, 1900), minefield)
|
||||
|
@ -47,7 +49,9 @@ class MinefieldRepositoryTest {
|
|||
}
|
||||
|
||||
val minefield = minefieldRepository.fromDifficulty(
|
||||
Difficulty.Standard, dimensionRepository, preferencesRepository
|
||||
Difficulty.Standard,
|
||||
dimensionRepository,
|
||||
preferencesRepository
|
||||
)
|
||||
|
||||
assertEquals(Minefield(99, 97, 1920), minefield)
|
||||
|
@ -67,7 +71,9 @@ class MinefieldRepositoryTest {
|
|||
}
|
||||
|
||||
val minefield = minefieldRepository.fromDifficulty(
|
||||
Difficulty.Standard, dimensionRepository, preferencesRepository
|
||||
Difficulty.Standard,
|
||||
dimensionRepository,
|
||||
preferencesRepository
|
||||
)
|
||||
|
||||
assertEquals(Minefield(99, 97, 1920 + 50), minefield)
|
||||
|
@ -87,7 +93,9 @@ class MinefieldRepositoryTest {
|
|||
}
|
||||
|
||||
val minefield = minefieldRepository.fromDifficulty(
|
||||
Difficulty.Standard, dimensionRepository, preferencesRepository
|
||||
Difficulty.Standard,
|
||||
dimensionRepository,
|
||||
preferencesRepository
|
||||
)
|
||||
|
||||
assertEquals(Minefield(99, 97, 4321), minefield)
|
||||
|
@ -100,7 +108,9 @@ class MinefieldRepositoryTest {
|
|||
val dimensionRepository = mockk<IDimensionRepository>(relaxed = true)
|
||||
|
||||
val minefield = minefieldRepository.fromDifficulty(
|
||||
Difficulty.Beginner, dimensionRepository, preferencesRepository
|
||||
Difficulty.Beginner,
|
||||
dimensionRepository,
|
||||
preferencesRepository
|
||||
)
|
||||
assertEquals(beginnerMinefield, minefield)
|
||||
}
|
||||
|
@ -112,7 +122,9 @@ class MinefieldRepositoryTest {
|
|||
val dimensionRepository = mockk<IDimensionRepository>(relaxed = true)
|
||||
|
||||
val minefield = minefieldRepository.fromDifficulty(
|
||||
Difficulty.Intermediate, dimensionRepository, preferencesRepository
|
||||
Difficulty.Intermediate,
|
||||
dimensionRepository,
|
||||
preferencesRepository
|
||||
)
|
||||
assertEquals(intermediateMinefield, minefield)
|
||||
}
|
||||
|
@ -124,7 +136,9 @@ class MinefieldRepositoryTest {
|
|||
val dimensionRepository = mockk<IDimensionRepository>(relaxed = true)
|
||||
|
||||
val minefield = minefieldRepository.fromDifficulty(
|
||||
Difficulty.Expert, dimensionRepository, preferencesRepository
|
||||
Difficulty.Expert,
|
||||
dimensionRepository,
|
||||
preferencesRepository
|
||||
)
|
||||
assertEquals(expertMinefield, minefield)
|
||||
}
|
||||
|
@ -138,7 +152,9 @@ class MinefieldRepositoryTest {
|
|||
val dimensionRepository = mockk<IDimensionRepository>(relaxed = true)
|
||||
|
||||
val minefield = minefieldRepository.fromDifficulty(
|
||||
Difficulty.Custom, dimensionRepository, preferencesRepository
|
||||
Difficulty.Custom,
|
||||
dimensionRepository,
|
||||
preferencesRepository
|
||||
)
|
||||
assertEquals(Minefield(25, 20, 12), minefield)
|
||||
}
|
||||
|
|
|
@ -70,12 +70,14 @@ class WatchGameActivity : AppCompatActivity(), AmbientModeSupport.AmbientCallbac
|
|||
bindViewModel()
|
||||
loadGameFragment()
|
||||
|
||||
swipe.addCallback(object : SwipeDismissFrameLayout.Callback() {
|
||||
override fun onDismissed(layout: SwipeDismissFrameLayout) {
|
||||
swipe.visibility = View.GONE
|
||||
finish()
|
||||
swipe.addCallback(
|
||||
object : SwipeDismissFrameLayout.Callback() {
|
||||
override fun onDismissed(layout: SwipeDismissFrameLayout) {
|
||||
swipe.visibility = View.GONE
|
||||
finish()
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
|
@ -197,7 +199,8 @@ class WatchGameActivity : AppCompatActivity(), AmbientModeSupport.AmbientCallbac
|
|||
}
|
||||
}
|
||||
},
|
||||
null, wait
|
||||
null,
|
||||
wait
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue