Fix redundant syntax after kotlin 1.4

This commit is contained in:
Lucas Lima 2020-08-25 23:46:20 -03:00
parent 331785f6e2
commit f3dce6a259
No known key found for this signature in database
GPG key ID: C5EEF4C30BFBF8D7
3 changed files with 16 additions and 19 deletions

View file

@ -18,7 +18,6 @@ import androidx.core.view.doOnLayout
import androidx.drawerlayout.widget.DrawerLayout
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.FragmentTransaction
import androidx.lifecycle.Observer
import androidx.lifecycle.lifecycleScope
import androidx.preference.PreferenceManager
import dev.lucasnlm.antimine.about.AboutActivity
@ -104,7 +103,7 @@ class GameActivity : ThematicActivity(R.layout.activity_game), DialogInterface.O
eventObserver.observe(
this@GameActivity,
Observer {
{
if (lastEvent != it) {
onGameEvent(it)
lastEvent = it
@ -114,7 +113,7 @@ class GameActivity : ThematicActivity(R.layout.activity_game), DialogInterface.O
retryObserver.observe(
this@GameActivity,
Observer {
{
lifecycleScope.launch {
gameViewModel.retryGame(currentSaveId.toInt())
}
@ -123,14 +122,14 @@ class GameActivity : ThematicActivity(R.layout.activity_game), DialogInterface.O
shareObserver.observe(
this@GameActivity,
Observer {
{
shareCurrentGame()
}
)
elapsedTimeSeconds.observe(
this@GameActivity,
Observer {
{
timer.apply {
visibility = if (it == 0L) View.GONE else View.VISIBLE
text = DateUtils.formatElapsedTime(it)
@ -141,7 +140,7 @@ class GameActivity : ThematicActivity(R.layout.activity_game), DialogInterface.O
mineCount.observe(
this@GameActivity,
Observer {
{
minesCount.apply {
visibility = View.VISIBLE
text = it.toString()
@ -151,14 +150,14 @@ class GameActivity : ThematicActivity(R.layout.activity_game), DialogInterface.O
difficulty.observe(
this@GameActivity,
Observer {
{
onChangeDifficulty(it)
}
)
field.observe(
this@GameActivity,
Observer { area ->
{ area ->
val mines = area.filter { it.hasMine }
totalArea = area.count()
totalMines = mines.count()
@ -168,7 +167,7 @@ class GameActivity : ThematicActivity(R.layout.activity_game), DialogInterface.O
saveId.observe(
this@GameActivity,
Observer {
{
currentSaveId = it
}
)

View file

@ -9,7 +9,6 @@ import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import androidx.core.os.HandlerCompat
import androidx.fragment.app.FragmentTransaction
import androidx.lifecycle.Observer
import androidx.preference.PreferenceManager
import dev.lucasnlm.antimine.about.AboutActivity
import dev.lucasnlm.antimine.common.level.models.Difficulty
@ -50,14 +49,14 @@ class TvGameActivity : AppCompatActivity() {
private fun bindViewModel() = gameViewModel.apply {
eventObserver.observe(
this@TvGameActivity,
Observer {
{
onGameEvent(it)
}
)
elapsedTimeSeconds.observe(
this@TvGameActivity,
Observer {
{
timer.apply {
visibility = if (it == 0L) View.GONE else View.VISIBLE
text = DateUtils.formatElapsedTime(it)
@ -68,7 +67,7 @@ class TvGameActivity : AppCompatActivity() {
mineCount.observe(
this@TvGameActivity,
Observer {
{
minesCount.apply {
visibility = View.VISIBLE
text = it.toString()
@ -78,14 +77,14 @@ class TvGameActivity : AppCompatActivity() {
difficulty.observe(
this@TvGameActivity,
Observer {
{
// onChangeDifficulty(it)
}
)
field.observe(
this@TvGameActivity,
Observer { area ->
{ area ->
val mines = area.filter { it.hasMine }
totalArea = area.count()
totalMines = mines.count()

View file

@ -3,7 +3,6 @@ package dev.lucasnlm.antimine.wear
import android.os.Bundle
import android.view.View
import androidx.core.view.doOnLayout
import androidx.lifecycle.Observer
import androidx.lifecycle.lifecycleScope
import dev.lucasnlm.antimine.common.R
import dev.lucasnlm.antimine.common.level.models.AmbientSettings
@ -39,14 +38,14 @@ class WatchLevelFragment : CommonLevelFragment(R.layout.fragment_level) {
gameViewModel.run {
field.observe(
viewLifecycleOwner,
Observer {
{
areaAdapter.bindField(it)
}
)
levelSetup.observe(
viewLifecycleOwner,
Observer {
{
getView()?.let { view ->
setupRecyclerViewSize(view, it)
}
@ -55,7 +54,7 @@ class WatchLevelFragment : CommonLevelFragment(R.layout.fragment_level) {
eventObserver.observe(
viewLifecycleOwner,
Observer {
{
if (it == Event.StartNewGame) {
recyclerGrid.scrollToPosition(areaAdapter.itemCount / 2)
}