the license dialog will now follow the theme too
This commit is contained in:
@ -24,6 +24,7 @@ package org.mosad.seil0.projectlaogai.fragments
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.renderscript.Sampler
|
||||
import android.util.TypedValue
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
@ -143,12 +144,27 @@ class SettingsFragment : Fragment() {
|
||||
}
|
||||
|
||||
linLayoutLicence.setOnClickListener {
|
||||
// do the theme magic, as the lib's theme support is broken
|
||||
val outValue = TypedValue()
|
||||
context!!.theme.resolveAttribute(R.attr.themeName, outValue, true)
|
||||
|
||||
val dialogCss = when (outValue.string) {
|
||||
"light" -> R.string.license_dialog_style_light
|
||||
else -> R.string.license_dialog_style_dark
|
||||
}
|
||||
|
||||
val themeId = when (outValue.string) {
|
||||
"light" -> R.style.AppTheme_Light
|
||||
else -> R.style.LicensesDialogTheme_Dark
|
||||
}
|
||||
|
||||
// open a new license dialog
|
||||
LicensesDialog.Builder(context!!)
|
||||
.setNotices(R.raw.notices)
|
||||
.setTitle(R.string.licenses)
|
||||
.setIncludeOwnLicense(true)
|
||||
.setThemeResourceId(R.style.AppTheme_Light)
|
||||
.setThemeResourceId(themeId)
|
||||
.setNoticesCssStyle(dialogCss)
|
||||
.build()
|
||||
.show()
|
||||
}
|
||||
|
Reference in New Issue
Block a user