1
0
Fork 0
fenix/app/src/main/java/org/mozilla/fenix/settings/SettingsActivity.kt

37 lines
1.1 KiB
Kotlin

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.fenix.settings
import android.R.id.content
import android.os.Bundle
import android.view.MenuItem
import androidx.appcompat.app.AppCompatActivity
class SettingsActivity : AppCompatActivity(), SettingsFragment.ActionBarUpdater {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (savedInstanceState == null) {
with(supportFragmentManager.beginTransaction()) {
replace(content, SettingsFragment())
commit()
}
}
}
override fun onOptionsItemSelected(item: MenuItem): Boolean = when (item.itemId) {
android.R.id.home -> {
onBackPressed()
true
}
else -> super.onOptionsItemSelected(item)
}
override fun updateTitle(titleResId: Int) {
setTitle(titleResId)
}
}