-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Android 14] Update compileSdkVersion to 34 #740
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
package com.wordpress.stories.compose.text | ||
|
||
import android.content.res.Resources | ||
import android.os.Build | ||
import android.util.TypedValue | ||
import android.widget.SeekBar | ||
import android.widget.SeekBar.OnSeekBarChangeListener | ||
|
@@ -29,9 +30,19 @@ class TextSizeSlider( | |
}) | ||
} | ||
|
||
@Suppress("DEPRECATION") | ||
fun update() { | ||
val fontSizeSp = (textView.textSize / resources.displayMetrics.scaledDensity).toInt() | ||
seekBar.progress = (fontSizeSp - TEXT_SIZE_SLIDER_MIN_VALUE) / TEXT_SIZE_SLIDER_STEP | ||
val fontSizeSp = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { | ||
// this takes into account text specifics (such as font size multipliers in system settings) | ||
TypedValue.deriveDimension( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That is a good point, I will rewrite the commit history to add this change in a separate commit. I will likely keep the comment though.
Well, adding the |
||
TypedValue.COMPLEX_UNIT_SP, | ||
textView.textSize, | ||
resources.displayMetrics | ||
) | ||
} else { | ||
(textView.textSize / resources.displayMetrics.scaledDensity) | ||
} | ||
seekBar.progress = (fontSizeSp.toInt() - TEXT_SIZE_SLIDER_MIN_VALUE) / TEXT_SIZE_SLIDER_STEP | ||
} | ||
|
||
companion object { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question (❓): This still ends-up in a valid application flow, right? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the logic here, we don't really know what to do if
e1
is null, and the fallback is to just call thesuper
anyway, so I kept calling thesuper
implementation anyway.I just realized though that when this fling is properly captured, the code is currently crashing because of a bug in a different part of the code (not related to this
compileSdkVersion
update). I will open a different PR to fix it.