@ -38,6 +38,7 @@ import com.afollestad.materialdialogs.list.listItems
import kotlinx.android.synthetic.main.fragment_settings.*
import org.jetbrains.anko.doAsync
import org.jetbrains.anko.uiThread
import org.mosad.seil0.projectlaogai.BuildConfig
import org.mosad.seil0.projectlaogai.controller.PreferencesController
import org.mosad.seil0.projectlaogai.controller.PreferencesController.Companion.cColorAccent
import org.mosad.seil0.projectlaogai.controller.PreferencesController.Companion.cColorPrimary
@ -58,7 +59,7 @@ class SettingsFragment : Fragment() {
private lateinit var linLayoutUser : LinearLayout
private lateinit var linLayoutCourse : LinearLayout
private lateinit var linLayoutInfo : LinearLayout
private lateinit var linLayoutAbout : LinearLayout
private lateinit var linLayoutPrimaryColor : LinearLayout
private lateinit var linLayoutAccentColor : LinearLayout
private lateinit var switchBuffet : Switch
@ -69,7 +70,7 @@ class SettingsFragment : Fragment() {
linLayoutUser = view . findViewById ( R . id . linLayout _User )
linLayoutCourse = view . findViewById ( R . id . linLayout _Course )
linLayoutInfo = view . findViewById ( R . id . linLayout _Info )
linLayoutAbout = view . findViewById ( R . id . linLayout _About )
linLayoutPrimaryColor = view . findViewById ( R . id . linLayout _PrimaryColor )
linLayoutAccentColor = view . findViewById ( R . id . linLayout _AccentColor )
switchBuffet = view . findViewById ( R . id . switch _buffet )
@ -84,6 +85,7 @@ class SettingsFragment : Fragment() {
super . onViewCreated ( view , savedInstanceState )
txtView _Course . text = cCourse . courseName
txtView _AboutDesc . text = resources . getString ( R . string . about _version , BuildConfig . VERSION _NAME , getString ( R . string . build _time ) )
switch _buffet . isChecked = cShowBuffet // init switch
}
@ -100,11 +102,11 @@ class SettingsFragment : Fragment() {
txtView _Course . text = cCourse . courseName // update txtView
}
linLayoutInfo . setOnClickListener {
linLayoutAbout . setOnClickListener {
// open a new info dialog
MaterialDialog ( context !! )
. title ( R . string . about )
. message ( R . string . about _text )
. title ( R . string . about _dialog _heading )
. message ( R . string . about _dialog _ text )
. show ( )
}
@ -162,7 +164,7 @@ class SettingsFragment : Fragment() {
// open a new dialog
MaterialDialog ( context )
. title ( R . string . select _course )
. listItems ( items = courseNameList ) { _ , index , text ->
. listItems ( items = courseNameList ) { _ , index , _ ->
val dialog = MaterialDialog ( context ) . cancelable ( false )
. cancelOnTouchOutside ( false )