Refactor: Disable Script Fonts
Signed-off-by: HeCodes2Much <wayne6324@gmail.com>
This commit is contained in:
@@ -81,10 +81,15 @@ class Application : Application() {
|
||||
|
||||
// Apply the custom font to different font families
|
||||
if (customFont != null) {
|
||||
TypefaceUtil.setDefaultFont("DEFAULT", customFont)
|
||||
TypefaceUtil.setDefaultFont("MONOSPACE", customFont)
|
||||
TypefaceUtil.setDefaultFont("SERIF", customFont)
|
||||
TypefaceUtil.setDefaultFont("SANS_SERIF", customFont)
|
||||
// Ensure the custom font is applied correctly
|
||||
try {
|
||||
TypefaceUtil.setDefaultFont("DEFAULT", customFont)
|
||||
TypefaceUtil.setDefaultFont("MONOSPACE", customFont)
|
||||
TypefaceUtil.setDefaultFont("SERIF", customFont)
|
||||
TypefaceUtil.setDefaultFont("SANS_SERIF", customFont)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,13 +35,13 @@ class FontAdapter(
|
||||
Constants.Fonts.Bitter -> ResourcesCompat.getFont(context, R.font.bitter)
|
||||
Constants.Fonts.Dotness -> ResourcesCompat.getFont(context, R.font.dotness)
|
||||
Constants.Fonts.DroidSans -> ResourcesCompat.getFont(context, R.font.open_sans)
|
||||
Constants.Fonts.GreatVibes -> ResourcesCompat.getFont(context, R.font.great_vibes)
|
||||
// Constants.Fonts.GreatVibes -> ResourcesCompat.getFont(context, R.font.great_vibes)
|
||||
Constants.Fonts.Lato -> ResourcesCompat.getFont(context, R.font.lato)
|
||||
Constants.Fonts.Lobster -> ResourcesCompat.getFont(context, R.font.lobster)
|
||||
// Constants.Fonts.Lobster -> ResourcesCompat.getFont(context, R.font.lobster)
|
||||
Constants.Fonts.Merriweather -> ResourcesCompat.getFont(context, R.font.merriweather)
|
||||
Constants.Fonts.Montserrat -> ResourcesCompat.getFont(context, R.font.montserrat)
|
||||
Constants.Fonts.OpenSans -> ResourcesCompat.getFont(context, R.font.open_sans)
|
||||
Constants.Fonts.Pacifico -> ResourcesCompat.getFont(context, R.font.pacifico)
|
||||
// Constants.Fonts.Pacifico -> ResourcesCompat.getFont(context, R.font.pacifico)
|
||||
Constants.Fonts.Quicksand -> ResourcesCompat.getFont(context, R.font.quicksand)
|
||||
Constants.Fonts.Raleway -> ResourcesCompat.getFont(context, R.font.raleway)
|
||||
Constants.Fonts.Roboto -> ResourcesCompat.getFont(context, R.font.roboto)
|
||||
|
||||
@@ -153,8 +153,10 @@ class DrawFragment : Fragment(),
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
private fun observeSwipeTouchListener() {
|
||||
binding.mainView.setOnTouchListener(getSwipeGestureListener(context))
|
||||
binding.drawAdapter.setOnTouchListener(getSwipeGestureListener(context))
|
||||
binding.apply {
|
||||
mainView.setOnTouchListener(getSwipeGestureListener(context))
|
||||
drawAdapter.setOnTouchListener(getSwipeGestureListener(context))
|
||||
}
|
||||
}
|
||||
|
||||
private fun getSwipeGestureListener(context: Context): View.OnTouchListener {
|
||||
|
||||
@@ -182,8 +182,10 @@ class FavoriteFragment : Fragment(),
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
private fun observeSwipeTouchListener() {
|
||||
binding.fragmentContainer.setOnTouchListener(getSwipeGestureListener(context))
|
||||
binding.favoriteAdapter.setOnTouchListener(getSwipeGestureListener(context))
|
||||
binding.apply {
|
||||
fragmentContainer.setOnTouchListener(getSwipeGestureListener(context))
|
||||
favoriteAdapter.setOnTouchListener(getSwipeGestureListener(context))
|
||||
}
|
||||
}
|
||||
|
||||
private fun getSwipeGestureListener(context: Context): View.OnTouchListener {
|
||||
|
||||
@@ -99,8 +99,10 @@ class HiddenFragment : Fragment(),
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
private fun observeSwipeTouchListener() {
|
||||
binding.fragmentContainer.setOnTouchListener(getSwipeGestureListener(context))
|
||||
binding.hiddenAdapter.setOnTouchListener(getSwipeGestureListener(context))
|
||||
binding.apply {
|
||||
fragmentContainer.setOnTouchListener(getSwipeGestureListener(context))
|
||||
hiddenAdapter.setOnTouchListener(getSwipeGestureListener(context))
|
||||
}
|
||||
}
|
||||
|
||||
private fun getSwipeGestureListener(context: Context): View.OnTouchListener {
|
||||
|
||||
@@ -214,17 +214,17 @@ class HomeFragment : Fragment(),
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
private fun observeSwipeTouchListener() {
|
||||
binding.touchArea.setOnTouchListener(getSwipeGestureListener(context))
|
||||
binding.nestScrollView.setOnTouchListener(getSwipeGestureListener(context))
|
||||
binding.apply {
|
||||
touchArea.setOnTouchListener(getSwipeGestureListener(context))
|
||||
nestScrollView.setOnTouchListener(getSwipeGestureListener(context))
|
||||
|
||||
binding.clock.setOnClickListener { context.launchClock() }
|
||||
binding.date.setOnClickListener { context.launchCalendar() }
|
||||
binding.battery.setOnClickListener { context.openBatteryManager() }
|
||||
clock.setOnClickListener { context.launchClock() }
|
||||
date.setOnClickListener { context.launchCalendar() }
|
||||
battery.setOnClickListener { context.openBatteryManager() }
|
||||
}
|
||||
}
|
||||
|
||||
private fun observeUserInterfaceSettings() {
|
||||
binding.nestScrollView.hideKeyboard()
|
||||
|
||||
preferenceViewModel.setShowTime(preferenceHelper.showTime)
|
||||
preferenceViewModel.setShowDate(preferenceHelper.showDate)
|
||||
preferenceViewModel.setShowDailyWord(preferenceHelper.showDailyWord)
|
||||
@@ -269,19 +269,23 @@ class HomeFragment : Fragment(),
|
||||
preferenceHelper.showDailyWord
|
||||
)
|
||||
}
|
||||
val is24HourFormat = DateFormat.is24HourFormat(requireContext())
|
||||
val localLocale = Locale.getDefault()
|
||||
val best12 = DateFormat.getBestDateTimePattern(localLocale, "hmma")
|
||||
val best24 = DateFormat.getBestDateTimePattern(localLocale, "HHmm")
|
||||
binding.apply {
|
||||
nestScrollView.hideKeyboard()
|
||||
|
||||
val timePattern = if (is24HourFormat) best24 else best12
|
||||
binding.clock.format12Hour = timePattern
|
||||
binding.clock.format24Hour = timePattern
|
||||
val datePattern = DateFormat.getBestDateTimePattern(localLocale, "eeeddMMM")
|
||||
binding.date.format12Hour = datePattern
|
||||
binding.date.format24Hour = datePattern
|
||||
val is24HourFormat = DateFormat.is24HourFormat(requireContext())
|
||||
val localLocale = Locale.getDefault()
|
||||
val best12 = DateFormat.getBestDateTimePattern(localLocale, "hmma")
|
||||
val best24 = DateFormat.getBestDateTimePattern(localLocale, "HHmm")
|
||||
|
||||
binding.word.text = appHelper.wordOfTheDay(resources)
|
||||
val timePattern = if (is24HourFormat) best24 else best12
|
||||
clock.format12Hour = timePattern
|
||||
clock.format24Hour = timePattern
|
||||
val datePattern = DateFormat.getBestDateTimePattern(localLocale, "eeeddMMM")
|
||||
date.format12Hour = datePattern
|
||||
date.format24Hour = datePattern
|
||||
|
||||
word.text = appHelper.wordOfTheDay(resources)
|
||||
}
|
||||
}
|
||||
|
||||
private fun observeBioAuthCheck(appInfo: AppInfo) {
|
||||
|
||||
@@ -239,34 +239,36 @@ class SettingsFragment : Fragment(),
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
private fun observeSwipeTouchListener() {
|
||||
binding.touchArea.setOnTouchListener(getSwipeGestureListener(context))
|
||||
binding.apply {
|
||||
touchArea.setOnTouchListener(getSwipeGestureListener(context))
|
||||
|
||||
binding.miscellaneousSearchEngineControl.setOnClickListener {
|
||||
showSearchEngineDialog()
|
||||
}
|
||||
miscellaneousSearchEngineControl.setOnClickListener {
|
||||
showSearchEngineDialog()
|
||||
}
|
||||
|
||||
binding.miscellaneousLauncherFontsControl.setOnClickListener {
|
||||
showLauncherFontDialog()
|
||||
}
|
||||
miscellaneousLauncherFontsControl.setOnClickListener {
|
||||
showLauncherFontDialog()
|
||||
}
|
||||
|
||||
binding.gesturesDoubleTapControl.setOnClickListener {
|
||||
swipeActionClickEvent(Constants.Swipe.DoubleTap)
|
||||
}
|
||||
gesturesDoubleTapControl.setOnClickListener {
|
||||
swipeActionClickEvent(Constants.Swipe.DoubleTap)
|
||||
}
|
||||
|
||||
binding.gesturesSwipeUpControl.setOnClickListener {
|
||||
swipeActionClickEvent(Constants.Swipe.Up)
|
||||
}
|
||||
gesturesSwipeUpControl.setOnClickListener {
|
||||
swipeActionClickEvent(Constants.Swipe.Up)
|
||||
}
|
||||
|
||||
binding.gesturesSwipeDownControl.setOnClickListener {
|
||||
swipeActionClickEvent(Constants.Swipe.Down)
|
||||
}
|
||||
gesturesSwipeDownControl.setOnClickListener {
|
||||
swipeActionClickEvent(Constants.Swipe.Down)
|
||||
}
|
||||
|
||||
binding.gesturesSwipeLeftControl.setOnClickListener {
|
||||
swipeActionClickEvent(Constants.Swipe.Left)
|
||||
}
|
||||
gesturesSwipeLeftControl.setOnClickListener {
|
||||
swipeActionClickEvent(Constants.Swipe.Left)
|
||||
}
|
||||
|
||||
binding.gesturesSwipeRightControl.setOnClickListener {
|
||||
swipeActionClickEvent(Constants.Swipe.Right)
|
||||
gesturesSwipeRightControl.setOnClickListener {
|
||||
swipeActionClickEvent(Constants.Swipe.Right)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -93,7 +93,6 @@ class WidgetFragment : Fragment(),
|
||||
private fun initializeInjectedDependencies() {
|
||||
context = requireContext()
|
||||
binding.nestScrollView.hideKeyboard()
|
||||
|
||||
binding.nestScrollView.scrollEventListener = this
|
||||
}
|
||||
|
||||
|
||||
@@ -104,47 +104,50 @@ class SettingsFragment : Fragment(),
|
||||
|
||||
private fun observeClickListener() {
|
||||
setupSwitchListeners()
|
||||
binding.apply {
|
||||
weatherOrderControl.setOnClickListener {
|
||||
showOrderChangeDialog(binding.weatherOrderControl)
|
||||
}
|
||||
|
||||
binding.weatherOrderControl.setOnClickListener {
|
||||
showOrderChangeDialog(binding.weatherOrderControl)
|
||||
}
|
||||
batteryOrderControl.setOnClickListener {
|
||||
showOrderChangeDialog(binding.batteryOrderControl)
|
||||
}
|
||||
|
||||
binding.batteryOrderControl.setOnClickListener {
|
||||
showOrderChangeDialog(binding.batteryOrderControl)
|
||||
}
|
||||
selectBatteryWidgetColor.setOnClickListener {
|
||||
val bottomSheetFragment = ColorBottomSheetDialogFragment()
|
||||
bottomSheetFragment.show(parentFragmentManager, "BottomSheetDialog")
|
||||
}
|
||||
|
||||
binding.selectBatteryWidgetColor.setOnClickListener {
|
||||
val bottomSheetFragment = ColorBottomSheetDialogFragment()
|
||||
bottomSheetFragment.show(parentFragmentManager, "BottomSheetDialog")
|
||||
}
|
||||
|
||||
binding.selectBatteryWidgetColor.setOnClickListener {
|
||||
val bottomSheetFragment = ColorBottomSheetDialogFragment()
|
||||
bottomSheetFragment.show(parentFragmentManager, "BottomSheetDialog")
|
||||
selectBatteryWidgetColor.setOnClickListener {
|
||||
val bottomSheetFragment = ColorBottomSheetDialogFragment()
|
||||
bottomSheetFragment.show(parentFragmentManager, "BottomSheetDialog")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupSwitchListeners() {
|
||||
binding.weatherSwitchCompat.setOnCheckedChangeListener { _, isChecked ->
|
||||
preferenceViewModel.setShowWeatherWidget(isChecked)
|
||||
binding.apply {
|
||||
val weatherVisibility = if (isChecked) View.VISIBLE else View.GONE
|
||||
weatherOrderMenu.visibility = weatherVisibility
|
||||
weatherSunsetSunriseMenu.visibility = weatherVisibility
|
||||
selectWeatherWidgetColor.visibility = View.GONE
|
||||
binding.apply {
|
||||
weatherSwitchCompat.setOnCheckedChangeListener { _, isChecked ->
|
||||
preferenceViewModel.setShowWeatherWidget(isChecked)
|
||||
binding.apply {
|
||||
val weatherVisibility = if (isChecked) View.VISIBLE else View.GONE
|
||||
weatherOrderMenu.visibility = weatherVisibility
|
||||
weatherSunsetSunriseMenu.visibility = weatherVisibility
|
||||
selectWeatherWidgetColor.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
binding.weatherSunsetSunriseSwitchCompat.setOnCheckedChangeListener { _, isChecked ->
|
||||
preferenceViewModel.setShowWeatherWidgetSunSetRise(isChecked)
|
||||
}
|
||||
weatherSunsetSunriseSwitchCompat.setOnCheckedChangeListener { _, isChecked ->
|
||||
preferenceViewModel.setShowWeatherWidgetSunSetRise(isChecked)
|
||||
}
|
||||
|
||||
binding.batterySwitchCompat.setOnCheckedChangeListener { _, isChecked ->
|
||||
preferenceViewModel.setShowBatteryWidget(isChecked)
|
||||
binding.apply {
|
||||
val batteryVisibility = if (isChecked) View.VISIBLE else View.GONE
|
||||
batteryOrderMenu.visibility = batteryVisibility
|
||||
selectBatteryWidgetColor.visibility = View.GONE
|
||||
batterySwitchCompat.setOnCheckedChangeListener { _, isChecked ->
|
||||
preferenceViewModel.setShowBatteryWidget(isChecked)
|
||||
binding.apply {
|
||||
val batteryVisibility = if (isChecked) View.VISIBLE else View.GONE
|
||||
batteryOrderMenu.visibility = batteryVisibility
|
||||
selectBatteryWidgetColor.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,13 +175,16 @@ object Constants {
|
||||
Bitter,
|
||||
Dotness,
|
||||
DroidSans,
|
||||
GreatVibes,
|
||||
|
||||
// GreatVibes,
|
||||
Lato,
|
||||
Lobster,
|
||||
|
||||
// Lobster,
|
||||
Merriweather,
|
||||
Montserrat,
|
||||
OpenSans,
|
||||
Pacifico,
|
||||
|
||||
// Pacifico,
|
||||
Quicksand,
|
||||
Raleway,
|
||||
Roboto,
|
||||
@@ -193,13 +196,13 @@ object Constants {
|
||||
Bitter -> ResourcesCompat.getFont(context, R.font.bitter)
|
||||
Dotness -> ResourcesCompat.getFont(context, R.font.dotness)
|
||||
DroidSans -> ResourcesCompat.getFont(context, R.font.open_sans)
|
||||
GreatVibes -> ResourcesCompat.getFont(context, R.font.great_vibes)
|
||||
// GreatVibes -> ResourcesCompat.getFont(context, R.font.great_vibes)
|
||||
Lato -> ResourcesCompat.getFont(context, R.font.lato)
|
||||
Lobster -> ResourcesCompat.getFont(context, R.font.lobster)
|
||||
// Lobster -> ResourcesCompat.getFont(context, R.font.lobster)
|
||||
Merriweather -> ResourcesCompat.getFont(context, R.font.merriweather)
|
||||
Montserrat -> ResourcesCompat.getFont(context, R.font.montserrat)
|
||||
OpenSans -> ResourcesCompat.getFont(context, R.font.open_sans)
|
||||
Pacifico -> ResourcesCompat.getFont(context, R.font.pacifico)
|
||||
// Pacifico -> ResourcesCompat.getFont(context, R.font.pacifico)
|
||||
Quicksand -> ResourcesCompat.getFont(context, R.font.quicksand)
|
||||
Raleway -> ResourcesCompat.getFont(context, R.font.raleway)
|
||||
Roboto -> ResourcesCompat.getFont(context, R.font.roboto)
|
||||
@@ -213,13 +216,13 @@ object Constants {
|
||||
Bitter -> context.getString(R.string.settings_font_bitter)
|
||||
Dotness -> context.getString(R.string.settings_font_dotness)
|
||||
DroidSans -> context.getString(R.string.settings_font_droidsans)
|
||||
GreatVibes -> context.getString(R.string.settings_font_greatvibes)
|
||||
// GreatVibes -> context.getString(R.string.settings_font_greatvibes)
|
||||
Lato -> context.getString(R.string.settings_font_lato)
|
||||
Lobster -> context.getString(R.string.settings_font_lobster)
|
||||
// Lobster -> context.getString(R.string.settings_font_lobster)
|
||||
Merriweather -> context.getString(R.string.settings_font_merriweather)
|
||||
Montserrat -> context.getString(R.string.settings_font_montserrat)
|
||||
OpenSans -> context.getString(R.string.settings_font_opensans)
|
||||
Pacifico -> context.getString(R.string.settings_font_pacifico)
|
||||
// Pacifico -> context.getString(R.string.settings_font_pacifico)
|
||||
Quicksand -> context.getString(R.string.settings_font_quicksand)
|
||||
Raleway -> context.getString(R.string.settings_font_raleway)
|
||||
Roboto -> context.getString(R.string.settings_font_roboto)
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start"
|
||||
android:layout_marginVertical="8dp"
|
||||
android:layout_marginVertical="2dp"
|
||||
android:format12Hour="h:mm"
|
||||
android:format24Hour="hhmm"
|
||||
android:textSize="48sp"
|
||||
@@ -73,7 +73,6 @@
|
||||
android:format12Hour="EEE, dd MMM"
|
||||
android:format24Hour="EEE, dd MMM"
|
||||
android:gravity="start"
|
||||
android:paddingHorizontal="2dp"
|
||||
android:textSize="32sp"
|
||||
tools:text="Thu, 30 Dec"
|
||||
style="@style/TextDefaultStyle" />
|
||||
|
||||
Reference in New Issue
Block a user