Make text shadows more visible.
This commit is contained in:
parent
da9fc362af
commit
a306d92282
@ -18,8 +18,8 @@ class FixedFocusScrollView @JvmOverloads constructor(
|
||||
var isScrollable = true
|
||||
|
||||
override fun scrollTo(x: Int, y: Int) {
|
||||
if (isScrollable) {
|
||||
if (isScrollable || !isLaidOut) {
|
||||
super.scrollTo(x, y)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ object Preferences : KotprefModel() {
|
||||
var textSecondSize by floatPref(key = "PREF_TEXT_SECOND_SIZE", default = 16f)
|
||||
var clockTextSize by floatPref(key = "PREF_TEXT_CLOCK_SIZE", default = 72f)
|
||||
var clockBottomMargin by intPref(default = Constants.ClockBottomMargin.MEDIUM.rawValue)
|
||||
var secondRowTopMargin by intPref(default = Constants.SecondRowTopMargin.NONE.rawValue)
|
||||
var secondRowTopMargin by intPref(default = Constants.SecondRowTopMargin.SMALL.rawValue)
|
||||
var showClock by booleanPref(key = "PREF_SHOW_CLOCK", default = false)
|
||||
var clockAppName by stringPref(key = "PREF_CLOCK_APP_NAME", default = "")
|
||||
var clockAppPackage by stringPref(key = "PREF_CLOCK_APP_PACKAGE", default = "")
|
||||
|
@ -17,7 +17,7 @@ object ImageHelper {
|
||||
0 -> 0f * factor
|
||||
1 -> 8f * factor
|
||||
2 -> 16f * factor
|
||||
else -> 0f * factor
|
||||
else -> 8f * factor
|
||||
}, resources.displayMetrics)
|
||||
|
||||
if (originalView.drawable != null && originalView.drawable.intrinsicWidth > 0 && originalView.drawable.intrinsicHeight > 0) {
|
||||
@ -58,7 +58,7 @@ object ImageHelper {
|
||||
0 -> 0f * factor
|
||||
1 -> 0.8f * factor
|
||||
2 -> 1f * factor
|
||||
else -> 0f
|
||||
else -> 0.8f * factor
|
||||
}))
|
||||
|
||||
colorMatrixScript.setColorMatrix(matrix)
|
||||
|
@ -86,6 +86,7 @@ class MainFragment : Fragment() {
|
||||
binding.actionSettings.isClickable = !show
|
||||
binding.actionSettings.isFocusable = !show
|
||||
binding.fragmentTitle.text = if (show) destination.label.toString() else getString(R.string.app_name)
|
||||
binding.toolbar.cardElevation = 0f
|
||||
}
|
||||
|
||||
binding.actionSettings.setOnSingleClickListener {
|
||||
@ -98,6 +99,10 @@ class MainFragment : Fragment() {
|
||||
}
|
||||
|
||||
private fun subscribeUi(viewModel: MainViewModel) {
|
||||
viewModel.showPreview.observe(viewLifecycleOwner) {
|
||||
binding.preview.visibility = if (it) View.VISIBLE else View.GONE
|
||||
}
|
||||
|
||||
viewModel.showWallpaper.observe(viewLifecycleOwner) {
|
||||
if (it) {
|
||||
val wallpaper = requireActivity().getCurrentWallpaper()
|
||||
@ -138,7 +143,7 @@ class MainFragment : Fragment() {
|
||||
}
|
||||
|
||||
viewModel.fragmentScrollY.observe(viewLifecycleOwner) {
|
||||
binding.toolbar.cardElevation = if (it > 0) 24f else 0f
|
||||
binding.toolbar.cardElevation = if (it > 0) 32f else 0f
|
||||
}
|
||||
|
||||
viewModel.widgetPreferencesUpdate.observe(viewLifecycleOwner) {
|
||||
|
@ -32,6 +32,7 @@ import com.tommasoberlose.anotherwidget.receivers.WidgetClickListenerReceiver
|
||||
import com.tommasoberlose.anotherwidget.utils.checkGrantedPermission
|
||||
import com.tommasoberlose.anotherwidget.utils.convertDpToPixel
|
||||
import com.tommasoberlose.anotherwidget.utils.isDarkTheme
|
||||
import com.tommasoberlose.anotherwidget.utils.toPixel
|
||||
import java.text.DateFormat
|
||||
import java.util.*
|
||||
import java.util.concurrent.TimeUnit
|
||||
@ -875,24 +876,24 @@ class AlignedWidget(val context: Context, val rightAligned: Boolean = false) {
|
||||
val shadowRadius =
|
||||
when (if (context.isDarkTheme()) Preferences.textShadowDark else Preferences.textShadow) {
|
||||
0 -> 0f
|
||||
1 -> 5f
|
||||
2 -> 5f
|
||||
else -> 5f
|
||||
}
|
||||
1 -> 2f
|
||||
2 -> 3f
|
||||
else -> 2f
|
||||
}.toPixel(context)
|
||||
val shadowColor =
|
||||
when (if (context.isDarkTheme()) Preferences.textShadowDark else Preferences.textShadow) {
|
||||
0 -> Color.TRANSPARENT
|
||||
1 -> R.color.black_50
|
||||
1 -> Color.DKGRAY
|
||||
2 -> Color.BLACK
|
||||
else -> R.color.black_50
|
||||
else -> Color.DKGRAY
|
||||
}
|
||||
val shadowDy =
|
||||
val shadowOffset =
|
||||
when (if (context.isDarkTheme()) Preferences.textShadowDark else Preferences.textShadow) {
|
||||
0 -> 0f
|
||||
1 -> 0f
|
||||
2 -> 1f
|
||||
2 -> 0.5f
|
||||
else -> 0f
|
||||
}
|
||||
}.toPixel(context)
|
||||
|
||||
listOf<TextView>(
|
||||
bindingView.date,
|
||||
@ -903,7 +904,7 @@ class AlignedWidget(val context: Context, val rightAligned: Boolean = false) {
|
||||
bindingView.weatherSubLineDivider,
|
||||
bindingView.weatherSubLineTemperature,
|
||||
).forEach {
|
||||
it.setShadowLayer(shadowRadius, 0f, shadowDy, shadowColor)
|
||||
it.setShadowLayer(shadowRadius, shadowOffset, shadowOffset, shadowColor)
|
||||
}
|
||||
|
||||
// Icons shadow
|
||||
@ -917,7 +918,7 @@ class AlignedWidget(val context: Context, val rightAligned: Boolean = false) {
|
||||
it.second.isVisible = it.first.isVisible
|
||||
it.second.scaleX = it.first.scaleX
|
||||
it.second.scaleY = it.first.scaleY
|
||||
it.second.applyShadow(it.first, 0.7f)
|
||||
it.second.applyShadow(it.first, 0.8f)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -912,24 +912,24 @@ class StandardWidget(val context: Context) {
|
||||
val shadowRadius =
|
||||
when (if (context.isDarkTheme()) Preferences.textShadowDark else Preferences.textShadow) {
|
||||
0 -> 0f
|
||||
1 -> 5f
|
||||
2 -> 5f
|
||||
else -> 5f
|
||||
}
|
||||
1 -> 2f
|
||||
2 -> 3f
|
||||
else -> 2f
|
||||
}.toPixel(context)
|
||||
val shadowColor =
|
||||
when (if (context.isDarkTheme()) Preferences.textShadowDark else Preferences.textShadow) {
|
||||
0 -> Color.TRANSPARENT
|
||||
1 -> R.color.black_50
|
||||
1 -> Color.DKGRAY
|
||||
2 -> Color.BLACK
|
||||
else -> R.color.black_50
|
||||
else -> Color.DKGRAY
|
||||
}
|
||||
val shadowDy =
|
||||
val shadowOffset =
|
||||
when (if (context.isDarkTheme()) Preferences.textShadowDark else Preferences.textShadow) {
|
||||
0 -> 0f
|
||||
1 -> 0f
|
||||
2 -> 1f
|
||||
2 -> 0.5f
|
||||
else -> 0f
|
||||
}
|
||||
}.toPixel(context)
|
||||
|
||||
listOf<TextView>(
|
||||
bindingView.date,
|
||||
@ -941,7 +941,7 @@ class StandardWidget(val context: Context) {
|
||||
bindingView.weatherSubLineDivider,
|
||||
bindingView.weatherSubLineTemperature,
|
||||
).forEach {
|
||||
it.setShadowLayer(shadowRadius, 0f, shadowDy, shadowColor)
|
||||
it.setShadowLayer(shadowRadius, shadowOffset, shadowOffset, shadowColor)
|
||||
}
|
||||
|
||||
// Icons shadow
|
||||
@ -955,7 +955,7 @@ class StandardWidget(val context: Context) {
|
||||
it.second.isVisible = it.first.isVisible
|
||||
it.second.scaleX = it.first.scaleX
|
||||
it.second.scaleY = it.first.scaleY
|
||||
it.second.applyShadow(it.first, 0.7f)
|
||||
it.second.applyShadow(it.first, 0.8f)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -511,7 +511,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="24dp"
|
||||
android:paddingRight="24dp"
|
||||
android:paddingBottom="32dp"
|
||||
android:paddingBottom="12dp"
|
||||
android:duplicateParentState="true"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/colorSecondaryText"
|
||||
|
@ -16,7 +16,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="32dp"
|
||||
android:paddingBottom="48dp"
|
||||
android:orientation="vertical">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
|
@ -76,7 +76,6 @@
|
||||
android:id="@+id/footer"
|
||||
android:padding="8dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
android:layout_width="48dp"
|
||||
|
@ -138,6 +138,8 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipToPadding="false"
|
||||
android:clipChildren="false"
|
||||
android:gravity="center_vertical"
|
||||
android:id="@+id/sub_line"
|
||||
android:visibility="gone"
|
||||
@ -145,12 +147,12 @@
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:cropToPadding="false"
|
||||
android:clipToPadding="false"
|
||||
android:clipChildren="false">
|
||||
<ImageView
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:cropToPadding="false"
|
||||
android:clipToPadding="false"
|
||||
android:clipChildren="false"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:id="@+id/sub_line_icon_shadow"
|
||||
@ -158,7 +160,7 @@
|
||||
<ImageView
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:cropToPadding="false"
|
||||
android:clipToPadding="false"
|
||||
android:clipChildren="false"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:id="@+id/sub_line_icon"
|
||||
@ -179,6 +181,8 @@
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipToPadding="false"
|
||||
android:clipChildren="false"
|
||||
android:gravity="center"
|
||||
android:visibility="gone"
|
||||
android:layout_marginStart="2dp"
|
||||
|
@ -157,12 +157,16 @@
|
||||
android:layout_gravity="center"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:paddingStart="4dp"
|
||||
android:paddingEnd="4dp"
|
||||
android:layoutDirection="locale"
|
||||
android:gravity="center">
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipToPadding="false"
|
||||
android:clipChildren="false"
|
||||
android:gravity="center_vertical"
|
||||
android:id="@+id/sub_line"
|
||||
android:visibility="gone"
|
||||
@ -170,12 +174,12 @@
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:cropToPadding="false"
|
||||
android:clipToPadding="false"
|
||||
android:clipChildren="false">
|
||||
<ImageView
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:cropToPadding="false"
|
||||
android:clipToPadding="false"
|
||||
android:clipChildren="false"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:id="@+id/sub_line_icon_shadow"
|
||||
@ -183,7 +187,7 @@
|
||||
<ImageView
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:cropToPadding="false"
|
||||
android:clipToPadding="false"
|
||||
android:clipChildren="false"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:id="@+id/sub_line_icon"
|
||||
@ -203,6 +207,8 @@
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipToPadding="false"
|
||||
android:clipChildren="false"
|
||||
android:gravity="center"
|
||||
android:visibility="gone"
|
||||
android:layout_marginStart="2dp"
|
||||
|
Loading…
x
Reference in New Issue
Block a user