themes and various bugs

This commit is contained in:
Finnley Somdahl 2023-10-24 23:38:46 -05:00
parent dc165fa6bc
commit 63526c6ed3
114 changed files with 1719 additions and 558 deletions

View 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
}
}
}
}
}