Skip to content

Commit

Permalink
feat(health-sdk): Code optimalization
Browse files Browse the repository at this point in the history
  • Loading branch information
llevente committed Jul 18, 2024
1 parent a1cebef commit fcbc4ae
Showing 1 changed file with 2 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,7 @@ internal suspend fun <T> Flow<T>.withPrev() = flow {
}

internal fun View.getLayoutInflaterWithGiniHealthThemeAndLocale(locale: Locale? = null): LayoutInflater =
if (locale == null) {
LayoutInflater.from(context.wrappedWithGiniHealthTheme())
} else {
LayoutInflater.from(context.wrappedWithGiniHealthTheme().wrappedWithCustomLocale(locale))
}
LayoutInflater.from(context.wrappedWithGiniHealthThemeAndLocale(locale))

private fun Context.wrappedWithCustomLocale(locale: Locale): Context = CustomLocaleContextThemeWrapper.wrap(this, locale, R.style.GiniHealthTheme)
private fun Context.wrappedWithGiniHealthTheme(): Context = ContextThemeWrapper(this, R.style.GiniHealthTheme)
Expand All @@ -196,13 +192,7 @@ internal fun Context.wrappedWithGiniHealthThemeAndLocale(locale: Locale? = null)
}

internal fun Fragment.getLayoutInflaterWithGiniHealthThemeAndLocale(inflater: LayoutInflater, locale: Locale? = null): LayoutInflater {
val inflater =
if (locale == null) {
inflater.cloneInContext(requireContext().wrappedWithGiniHealthTheme())
} else {
inflater.cloneInContext(requireContext().wrappedWithGiniHealthTheme().wrappedWithCustomLocale(locale))
}
return inflater
return inflater.cloneInContext(requireContext().wrappedWithGiniHealthThemeAndLocale(locale))
}

internal fun View.setIntervalClickListener(click: View.OnClickListener?) {
Expand Down

0 comments on commit fcbc4ae

Please sign in to comment.