kopia lustrzana https://github.com/rt-bishop/Look4Sat
Add preference library and settings fragment placeholder
rodzic
bff8e44d28
commit
42b7914482
|
@ -44,4 +44,6 @@ dependencies {
|
|||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
|
||||
implementation 'androidx.preference:preference:1.1.0'
|
||||
}
|
||||
|
|
|
@ -1,24 +1,11 @@
|
|||
package com.rtbishop.lookingsat.ui
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.ViewModelProviders
|
||||
import com.rtbishop.lookingsat.MainViewModel
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
import com.rtbishop.lookingsat.R
|
||||
|
||||
class SettingsFragment : Fragment() {
|
||||
|
||||
private lateinit var viewModel: MainViewModel
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
viewModel = ViewModelProviders.of(this).get(MainViewModel::class.java)
|
||||
return inflater.inflate(R.layout.fragment_sky, container, false)
|
||||
class SettingsFragment : PreferenceFragmentCompat() {
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
setPreferencesFromResource(R.xml.preference, rootKey)
|
||||
}
|
||||
}
|
|
@ -10,4 +10,6 @@
|
|||
<string name="menu_about">About</string>
|
||||
<string name="menu_github">GitHub</string>
|
||||
<string name="menu_credits">Credits</string>
|
||||
|
||||
<string name="placeholder">Placeholder</string>
|
||||
</resources>
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<PreferenceCategory android:title="@string/placeholder">
|
||||
<EditTextPreference
|
||||
android:key="username"
|
||||
android:summary="@string/placeholder"
|
||||
android:title="@string/placeholder" />
|
||||
<EditTextPreference
|
||||
android:key="password"
|
||||
android:summary="@string/placeholder"
|
||||
android:title="@string/placeholder" />
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
Ładowanie…
Reference in New Issue