themes and various bugs
This commit is contained in:
parent
dc165fa6bc
commit
63526c6ed3
114 changed files with 1719 additions and 558 deletions
48
app/src/main/java/ani/dantotsu/themes/ThemeManager.kt
Normal file
48
app/src/main/java/ani/dantotsu/themes/ThemeManager.kt
Normal file
|
@ -0,0 +1,48 @@
|
|||
package ani.dantotsu.themes
|
||||
|
||||
import android.content.Context
|
||||
import ani.dantotsu.R
|
||||
|
||||
class ThemeManager(private val context: Context) {
|
||||
fun applyTheme() {
|
||||
if(context.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE).getBoolean("use_material_you", false)){
|
||||
return
|
||||
}
|
||||
when (context.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE).getString("theme", "PURPLE")!!) {
|
||||
"PURPLE" -> {
|
||||
context.setTheme(R.style.Theme_Dantotsu_Purple)
|
||||
}
|
||||
//"MONOCHROME" -> {
|
||||
// context.setTheme(R.style.Theme_Dantotsu_Monochrome)
|
||||
//}
|
||||
"BLUE" -> {
|
||||
context.setTheme(R.style.Theme_Dantotsu_Blue)
|
||||
}
|
||||
"GREEN" -> {
|
||||
context.setTheme(R.style.Theme_Dantotsu_Green)
|
||||
}
|
||||
"PINK" -> {
|
||||
context.setTheme(R.style.Theme_Dantotsu_Pink)
|
||||
}
|
||||
else -> {
|
||||
context.setTheme(R.style.Theme_Dantotsu_Purple)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object{
|
||||
enum class Theme(val theme: String) {
|
||||
PURPLE("PURPLE"),
|
||||
BLUE("BLUE"),
|
||||
GREEN("GREEN"),
|
||||
PINK("PINK");
|
||||
//MONOCHROME("MONOCHROME");
|
||||
|
||||
companion object {
|
||||
fun fromString(value: String): Theme {
|
||||
return values().find { it.theme == value } ?: PURPLE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue