Mercurial > cgi-bin > hgweb.cgi > SimpleResizer
comparison app/src/main/java/com/bartsent/simpleresizer/SettingsActivity.kt @ 15:20da616dcda0
Add preferences.
author | David Barts <n5jrn@me.com> |
---|---|
date | Thu, 18 Feb 2021 22:12:19 -0800 |
parents | |
children | 9231f1a41a59 |
comparison
equal
deleted
inserted
replaced
14:73beb7c973ae | 15:20da616dcda0 |
---|---|
1 package com.bartsent.simpleresizer | |
2 | |
3 import android.os.Bundle | |
4 import androidx.appcompat.app.AppCompatActivity | |
5 import androidx.preference.PreferenceFragmentCompat | |
6 import androidx.preference.PreferenceManager | |
7 | |
8 class SettingsActivity : AppCompatActivity() { | |
9 | |
10 override fun onCreate(savedInstanceState: Bundle?) { | |
11 super.onCreate(savedInstanceState) | |
12 setContentView(R.layout.settings_activity) | |
13 if (savedInstanceState == null) { | |
14 supportFragmentManager | |
15 .beginTransaction() | |
16 .replace(R.id.settings, SettingsFragment()) | |
17 .commit() | |
18 } | |
19 supportActionBar?.setDisplayHomeAsUpEnabled(true) | |
20 PreferenceManager.setDefaultValues(applicationContext, R.xml.root_preferences, false) | |
21 } | |
22 | |
23 class SettingsFragment : PreferenceFragmentCompat() { | |
24 override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { | |
25 setPreferencesFromResource(R.xml.root_preferences, rootKey) | |
26 } | |
27 } | |
28 } |