release 0.5.0 #35
@ -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()
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										33
									
								
								app/src/main/res/layouts/activities/values/css_styles.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								app/src/main/res/layouts/activities/values/css_styles.xml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,33 @@
 | 
			
		||||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<resources>
 | 
			
		||||
     <string name="license_dialog_style_light" translatable="false">
 | 
			
		||||
        body {
 | 
			
		||||
            background-color: #ffffff;
 | 
			
		||||
            color: #000000;
 | 
			
		||||
            font-family: sans-serif;
 | 
			
		||||
            overflow-wrap: break-word;
 | 
			
		||||
        }
 | 
			
		||||
        pre {
 | 
			
		||||
            background-color: #eeeeee;
 | 
			
		||||
            padding: 1em;
 | 
			
		||||
            white-space: pre-wrap;
 | 
			
		||||
        }
 | 
			
		||||
    </string>
 | 
			
		||||
 | 
			
		||||
    <string name="license_dialog_style_dark" translatable="false">
 | 
			
		||||
        body {
 | 
			
		||||
            background-color: #303030;
 | 
			
		||||
            color: #ffffff;
 | 
			
		||||
            font-family: sans-serif;
 | 
			
		||||
            overflow-wrap: break-word;
 | 
			
		||||
        }
 | 
			
		||||
        pre {
 | 
			
		||||
            background-color: #424242;
 | 
			
		||||
            padding: 1em;
 | 
			
		||||
            white-space: pre-wrap;
 | 
			
		||||
        }
 | 
			
		||||
        li a {
 | 
			
		||||
            color: #21a3df;
 | 
			
		||||
        }
 | 
			
		||||
    </string>
 | 
			
		||||
</resources>
 | 
			
		||||
@ -58,4 +58,8 @@
 | 
			
		||||
        <item name="android:windowBackground">@drawable/background_splash</item>
 | 
			
		||||
    </style>
 | 
			
		||||
 | 
			
		||||
    <style name="LicensesDialogTheme.Dark" parent="Theme.AppCompat.Dialog">
 | 
			
		||||
        <item name="android:windowBackground">@color/themeSecondaryDark</item>
 | 
			
		||||
    </style>
 | 
			
		||||
 | 
			
		||||
</resources>
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user