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