Simplify PreferencesActivity
This commit is contained in:
parent
b5e78e543f
commit
cd73a834d2
3 changed files with 5 additions and 9 deletions
|
@ -150,6 +150,7 @@
|
|||
|
||||
<activity
|
||||
android:name="dev.lucasnlm.antimine.stats.StatsActivity"
|
||||
android:label="@string/events"
|
||||
android:theme="@style/AppTheme">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
|
|
|
@ -7,10 +7,9 @@ import androidx.preference.PreferenceManager
|
|||
|
||||
import dev.lucasnlm.antimine.R
|
||||
|
||||
class PreferencesActivity : AppCompatActivity() {
|
||||
class PreferencesActivity : AppCompatActivity(R.layout.activity_empty) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_empty)
|
||||
PreferenceManager.setDefaultValues(this, R.xml.preferences, false)
|
||||
|
||||
// Load the preferences from an XML resource
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package dev.lucasnlm.antimine.stats
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.activity.viewModels
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.lifecycle.ViewModelProviders
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import dev.lucasnlm.antimine.R
|
||||
import dev.lucasnlm.antimine.common.level.repository.IStatsRepository
|
||||
|
@ -14,18 +14,14 @@ import kotlinx.coroutines.launch
|
|||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class StatsActivity : AppCompatActivity() {
|
||||
class StatsActivity : AppCompatActivity(R.layout.activity_stats) {
|
||||
@Inject
|
||||
lateinit var statsRepository: IStatsRepository
|
||||
|
||||
private lateinit var viewModel: StatsViewModel
|
||||
private val viewModel: StatsViewModel by viewModels()
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_stats)
|
||||
setTitle(R.string.events)
|
||||
|
||||
viewModel = ViewModelProviders.of(this).get(StatsViewModel::class.java)
|
||||
viewModel.statsObserver.observe(
|
||||
this,
|
||||
Observer {
|
||||
|
|
Loading…
Reference in a new issue