mirror of
https://github.com/gezimos/inkOS.git
synced 2025-12-23 22:17:55 -05:00
Removed Battery Font/size Prefs since it's tied to Date Widget.
This commit is contained in:
@@ -59,7 +59,6 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
|
||||
val audioWidgetColor = MutableLiveData<Int>(prefs.audioWidgetColor)
|
||||
val appsFont = MutableLiveData(prefs.appsFont)
|
||||
val clockFont = MutableLiveData(prefs.clockFont)
|
||||
val batteryFont = MutableLiveData(prefs.batteryFont)
|
||||
val quoteFont = MutableLiveData(prefs.quoteFont)
|
||||
val notificationsFont = MutableLiveData(prefs.notificationsFont)
|
||||
val notificationFont = MutableLiveData(prefs.labelnotificationsFont)
|
||||
@@ -69,7 +68,6 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
|
||||
val textPaddingSize = MutableLiveData(prefs.textPaddingSize)
|
||||
val appSize = MutableLiveData(prefs.appSize)
|
||||
val clockSize = MutableLiveData(prefs.clockSize)
|
||||
val batterySize = MutableLiveData(prefs.batterySize)
|
||||
val quoteSize = MutableLiveData(prefs.quoteSize)
|
||||
val quoteText = MutableLiveData(prefs.quoteText)
|
||||
val showQuote = MutableLiveData(prefs.showQuote)
|
||||
@@ -98,7 +96,6 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
|
||||
"AUDIO_WIDGET_COLOR" -> audioWidgetColor.postValue(prefs.audioWidgetColor)
|
||||
"APPS_FONT" -> appsFont.postValue(prefs.appsFont)
|
||||
"CLOCK_FONT" -> clockFont.postValue(prefs.clockFont)
|
||||
"BATTERY_FONT" -> batteryFont.postValue(prefs.batteryFont)
|
||||
"QUOTE_FONT" -> quoteFont.postValue(prefs.quoteFont)
|
||||
"NOTIFICATIONS_FONT" -> notificationsFont.postValue(prefs.notificationsFont)
|
||||
"NOTIFICATION_FONT" -> notificationFont.postValue(prefs.labelnotificationsFont)
|
||||
@@ -108,7 +105,6 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
|
||||
"TEXT_PADDING_SIZE" -> textPaddingSize.postValue(prefs.textPaddingSize)
|
||||
"APP_SIZE_TEXT" -> appSize.postValue(prefs.appSize)
|
||||
"CLOCK_SIZE_TEXT" -> clockSize.postValue(prefs.clockSize)
|
||||
"BATTERY_SIZE_TEXT" -> batterySize.postValue(prefs.batterySize)
|
||||
"QUOTE_TEXT_SIZE" -> quoteSize.postValue(prefs.quoteSize)
|
||||
"QUOTE_TEXT" -> quoteText.postValue(prefs.quoteText)
|
||||
"SHOW_QUOTE" -> showQuote.postValue(prefs.showQuote)
|
||||
|
||||
@@ -48,8 +48,6 @@ object Constants {
|
||||
const val THEME_BACKUP_WRITE = 11
|
||||
const val THEME_BACKUP_READ = 12
|
||||
|
||||
const val MIN_BATTERY_SIZE = 10
|
||||
const val MAX_BATTERY_SIZE = 40
|
||||
|
||||
const val MIN_TEXT_PADDING = 0
|
||||
const val MAX_TEXT_PADDING = 80
|
||||
|
||||
@@ -53,7 +53,7 @@ private const val CLICK_CLOCK = "CLICK_CLOCK"
|
||||
private const val DOUBLE_TAP = "DOUBLE_TAP"
|
||||
private const val APP_SIZE_TEXT = "APP_SIZE_TEXT"
|
||||
private const val CLOCK_SIZE_TEXT = "CLOCK_SIZE_TEXT"
|
||||
private const val BATTERY_SIZE_TEXT = "BATTERY_SIZE_TEXT"
|
||||
|
||||
private const val TEXT_SIZE_SETTINGS = "TEXT_SIZE_SETTINGS"
|
||||
private const val TEXT_PADDING_SIZE = "TEXT_PADDING_SIZE"
|
||||
private const val SHOW_NOTIFICATION_BADGE = "show_notification_badge"
|
||||
@@ -217,7 +217,7 @@ class Prefs(val context: Context) {
|
||||
clockFont = font
|
||||
statusFont = font
|
||||
labelnotificationsFont = font
|
||||
batteryFont = font
|
||||
|
||||
fontFamily = font
|
||||
lettersFont = font
|
||||
lettersTitleFont = font
|
||||
@@ -246,7 +246,7 @@ class Prefs(val context: Context) {
|
||||
clockFont = value
|
||||
statusFont = value
|
||||
labelnotificationsFont = value
|
||||
batteryFont = value
|
||||
|
||||
fontFamily = value
|
||||
lettersFont = value
|
||||
lettersTitleFont = value
|
||||
@@ -762,15 +762,7 @@ class Prefs(val context: Context) {
|
||||
}
|
||||
set(value) = prefs.edit { putString(NOTIFICATION_FONT, value.name) }
|
||||
|
||||
var batteryFont: Constants.FontFamily
|
||||
get() = try {
|
||||
Constants.FontFamily.valueOf(
|
||||
prefs.getString(BATTERY_FONT, Constants.FontFamily.System.name)!!
|
||||
)
|
||||
} catch (_: Exception) {
|
||||
Constants.FontFamily.System
|
||||
}
|
||||
set(value) = prefs.edit { putString(BATTERY_FONT, value.name) }
|
||||
|
||||
|
||||
var lettersFont: Constants.FontFamily
|
||||
get() = try {
|
||||
@@ -902,15 +894,7 @@ class Prefs(val context: Context) {
|
||||
}
|
||||
set(value) = prefs.edit { putInt(CLOCK_SIZE_TEXT, value) }
|
||||
|
||||
var batterySize: Int
|
||||
get() {
|
||||
return try {
|
||||
prefs.getInt(BATTERY_SIZE_TEXT, 18)
|
||||
} catch (_: Exception) {
|
||||
18
|
||||
}
|
||||
}
|
||||
set(value) = prefs.edit { putInt(BATTERY_SIZE_TEXT, value) }
|
||||
|
||||
|
||||
var settingsSize: Int
|
||||
get() {
|
||||
@@ -1011,7 +995,7 @@ class Prefs(val context: Context) {
|
||||
"clock" -> clockFont
|
||||
"status" -> statusFont
|
||||
"notification" -> labelnotificationsFont
|
||||
"battery" -> batteryFont
|
||||
|
||||
"quote" -> quoteFont
|
||||
"letters" -> lettersFont
|
||||
"lettersTitle" -> lettersTitleFont
|
||||
@@ -1080,7 +1064,7 @@ class Prefs(val context: Context) {
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val BATTERY_FONT = "battery_font"
|
||||
|
||||
private const val LETTERS_FONT = "letters_font"
|
||||
private const val LETTERS_TEXT_SIZE = "letters_text_size"
|
||||
private const val LETTERS_TITLE = "letters_title"
|
||||
|
||||
@@ -110,10 +110,6 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener
|
||||
// Add a BroadcastReceiver for user present (unlock)
|
||||
private var userPresentReceiver: android.content.BroadcastReceiver? = null
|
||||
|
||||
// Lazy-loaded font cache to reduce font loading overhead
|
||||
private val cachedAppFont by lazy {
|
||||
prefs.getFontForContext("apps").getFont(requireContext(), prefs.getCustomFontPathForContext("apps"))
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
@@ -680,7 +676,8 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener
|
||||
homeAppsLayout.children.forEach { view ->
|
||||
if (view is TextView) {
|
||||
view.setTextColor(prefs.appColor)
|
||||
view.typeface = cachedAppFont
|
||||
val appTypeface = prefs.getFontForContext("apps").getFont(requireContext(), prefs.getCustomFontPathForContext("apps"))
|
||||
view.typeface = appTypeface
|
||||
}
|
||||
}
|
||||
val clockTypeface = prefs.getFontForContext("clock").getFont(requireContext(), prefs.getCustomFontPathForContext("clock"))
|
||||
@@ -701,7 +698,8 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener
|
||||
prefs.smallCapsApps -> displayText.lowercase()
|
||||
else -> displayText
|
||||
}
|
||||
view.typeface = cachedAppFont
|
||||
val appTypeface = prefs.getFontForContext("apps").getFont(requireContext(), prefs.getCustomFontPathForContext("apps"))
|
||||
view.typeface = appTypeface
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -966,7 +964,8 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener
|
||||
binding.quote.text = text
|
||||
}
|
||||
appsFont.observe(viewLifecycleOwner) { font ->
|
||||
updateAllAppProperties(font = cachedAppFont)
|
||||
val typeface = prefs.getFontForContext("apps").getFont(requireContext(), prefs.getCustomFontPathForContext("apps"))
|
||||
updateAllAppProperties(font = typeface)
|
||||
}
|
||||
clockFont.observe(viewLifecycleOwner) { font ->
|
||||
val typeface = prefs.getFontForContext("clock").getFont(requireContext(), prefs.getCustomFontPathForContext("clock"))
|
||||
@@ -1338,7 +1337,8 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener
|
||||
setTextColor(prefs.appColor)
|
||||
|
||||
// Apply apps font
|
||||
typeface = cachedAppFont
|
||||
val appTypeface = prefs.getFontForContext("apps").getFont(requireContext(), prefs.getCustomFontPathForContext("apps"))
|
||||
typeface = appTypeface
|
||||
|
||||
tag = appModel.activityPackage // Assign unique tag
|
||||
}
|
||||
|
||||
@@ -223,8 +223,6 @@ class FontsFragment : Fragment() {
|
||||
var appSize by remember { mutableStateOf(prefs.appSize) }
|
||||
var clockFontState by remember { mutableStateOf(prefs.clockFont) }
|
||||
var clockSize by remember { mutableStateOf(prefs.clockSize) }
|
||||
var batteryFontState by remember { mutableStateOf(prefs.batteryFont) }
|
||||
var batterySize by remember { mutableStateOf(prefs.batterySize) }
|
||||
// Home App Type State
|
||||
var appNameMode by remember {
|
||||
mutableStateOf(
|
||||
@@ -257,7 +255,6 @@ class FontsFragment : Fragment() {
|
||||
val font = universalFontState
|
||||
appsFontState = font
|
||||
clockFontState = font
|
||||
batteryFontState = font
|
||||
labelnotificationsFontState = font
|
||||
notificationsFontState = font
|
||||
notificationsTitleFontState = font
|
||||
@@ -303,8 +300,6 @@ class FontsFragment : Fragment() {
|
||||
prefs.removeCustomFontPath("date")
|
||||
prefs.quoteFont = Constants.FontFamily.System
|
||||
prefs.removeCustomFontPath("quote")
|
||||
prefs.batteryFont = Constants.FontFamily.System
|
||||
prefs.removeCustomFontPath("battery")
|
||||
prefs.lettersFont = Constants.FontFamily.System
|
||||
prefs.removeCustomFontPath("letters")
|
||||
prefs.lettersTitleFont = Constants.FontFamily.System
|
||||
@@ -315,7 +310,6 @@ class FontsFragment : Fragment() {
|
||||
prefs.appSize = 32
|
||||
prefs.clockSize = 64
|
||||
prefs.labelnotificationsTextSize = 16
|
||||
prefs.batterySize = 18
|
||||
prefs.dateSize = 18
|
||||
prefs.quoteSize = 18
|
||||
prefs.lettersTextSize = 18
|
||||
@@ -329,8 +323,6 @@ class FontsFragment : Fragment() {
|
||||
appSize = 32
|
||||
clockFontState = Constants.FontFamily.System
|
||||
clockSize = 64
|
||||
batteryFontState = Constants.FontFamily.System
|
||||
batterySize = 18
|
||||
dateFontState = Constants.FontFamily.System
|
||||
dateSize = 18
|
||||
quoteFontState = Constants.FontFamily.System
|
||||
@@ -366,7 +358,7 @@ class FontsFragment : Fragment() {
|
||||
prefs.lettersTitleFont = font
|
||||
prefs.dateFont = font
|
||||
prefs.quoteFont = font
|
||||
prefs.batteryFont = font
|
||||
|
||||
prefs.lettersFont = font
|
||||
if (font == Constants.FontFamily.Custom && fontPath != null) {
|
||||
val keys = listOf(
|
||||
@@ -380,7 +372,6 @@ class FontsFragment : Fragment() {
|
||||
"lettersTitle",
|
||||
"date",
|
||||
"quote",
|
||||
"battery",
|
||||
"letters"
|
||||
)
|
||||
for (key in keys) prefs.setCustomFontPath(key, fontPath)
|
||||
@@ -413,7 +404,6 @@ class FontsFragment : Fragment() {
|
||||
prefs.lettersTitleFont = newFont
|
||||
prefs.dateFont = newFont
|
||||
prefs.quoteFont = newFont
|
||||
prefs.batteryFont = newFont
|
||||
prefs.lettersFont = newFont
|
||||
if (newFont == Constants.FontFamily.Custom && fontPath != null) {
|
||||
val keys = listOf(
|
||||
@@ -427,7 +417,6 @@ class FontsFragment : Fragment() {
|
||||
"lettersTitle",
|
||||
"date",
|
||||
"quote",
|
||||
"battery",
|
||||
"letters"
|
||||
)
|
||||
for (key in keys) prefs.setCustomFontPath(key, fontPath)
|
||||
@@ -634,48 +623,8 @@ class FontsFragment : Fragment() {
|
||||
)
|
||||
DashedSeparator()
|
||||
|
||||
// Battery Font
|
||||
SettingsSelect(
|
||||
title = stringResource(R.string.battery_font),
|
||||
option = getFontDisplayName(batteryFontState, "battery"),
|
||||
fontSize = titleFontSize,
|
||||
onClick = {
|
||||
if (!universalFontEnabledState) {
|
||||
showFontSelectionDialogWithCustoms(
|
||||
R.string.battery_font,
|
||||
"battery"
|
||||
) { newFont, customPath ->
|
||||
prefs.batteryFont = newFont
|
||||
batteryFontState = newFont
|
||||
customPath?.let { prefs.setCustomFontPath("battery", it) }
|
||||
}
|
||||
}
|
||||
},
|
||||
fontColor = if (!universalFontEnabledState)
|
||||
SettingsTheme.typography.title.color
|
||||
else Color.Gray,
|
||||
enabled = !universalFontEnabledState
|
||||
)
|
||||
DashedSeparator()
|
||||
SettingsSelect(
|
||||
title = stringResource(R.string.battery_text_size),
|
||||
option = batterySize.toString(),
|
||||
fontSize = titleFontSize,
|
||||
onClick = {
|
||||
dialogBuilder.showSliderDialog(
|
||||
context = requireContext(),
|
||||
title = requireContext().getString(R.string.battery_text_size),
|
||||
minValue = Constants.MIN_BATTERY_SIZE,
|
||||
maxValue = Constants.MAX_BATTERY_SIZE,
|
||||
currentValue = prefs.batterySize,
|
||||
onValueSelected = { newBatterySize ->
|
||||
prefs.batterySize = newBatterySize
|
||||
batterySize = newBatterySize
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
DashedSeparator()
|
||||
|
||||
|
||||
|
||||
// Quote Font Section
|
||||
SettingsSelect(
|
||||
@@ -1017,7 +966,6 @@ class FontsFragment : Fragment() {
|
||||
"settings" -> prefs.fontFamily = Constants.FontFamily.System
|
||||
"apps" -> prefs.appsFont = Constants.FontFamily.System
|
||||
"clock" -> prefs.clockFont = Constants.FontFamily.System
|
||||
"battery" -> prefs.batteryFont = Constants.FontFamily.System
|
||||
"date" -> prefs.dateFont = Constants.FontFamily.System
|
||||
"quote" -> prefs.quoteFont = Constants.FontFamily.System
|
||||
"notification" -> prefs.labelnotificationsFont =
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
|
||||
<string name="app_text_size">App Text Size</string>
|
||||
<string name="clock_text_size">Clock Text Size</string>
|
||||
<string name="battery_text_size">Battery Text Size</string>
|
||||
|
||||
|
||||
<string name="layout_positioning">Layout & Positioning</string>
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
|
||||
<string name="app_notification_font">Badge Noti. Font</string>
|
||||
|
||||
<string name="battery_font">Battery Font</string>
|
||||
|
||||
<string name="universal_custom_font">Universal Font</string>
|
||||
<string name="universal_custom_font_selector">Universal Font</string>
|
||||
<string name="notifications_font">Notifications Font</string>
|
||||
|
||||
Reference in New Issue
Block a user