Skip to content

Fix/sample app#155

Merged
adimiz1 merged 14 commits intomasterfrom
fix/sample_app
Aug 27, 2023
Merged

Fix/sample app#155
adimiz1 merged 14 commits intomasterfrom
fix/sample_app

Conversation

@adimiz1
Copy link
Contributor

@adimiz1 adimiz1 commented Aug 21, 2023

Brief Summary of Changes

Fix deprecations around the SDK

What does this PR address?

  • GitHub issue (Add reference - #XX)
  • Refactoring
  • New feature
  • Bug fix
  • Adds more tests

Are tests included?

  • Yes
  • No

Reviewer, please note:

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I ran the full test suite before pushing the changes and all the tests pass.

Copy link

@const-cloudinary const-cloudinary left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good PR. Please fix a few very minor issues.

SpannableString spannableString = new SpannableString(text);
spannableString.setSpan(new ForegroundColorSpan(holder.statusText.getContext().getResources().getColor(R.color.buttonColor)), text.indexOf(progressStr), text.length(), 0);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
spannableString.setSpan(new ForegroundColorSpan(holder.statusText.getContext().getColor(R.color.buttonColor)), text.indexOf(progressStr), text.length(), 0);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why don't you just extract holder.statusText.getContext().getColor(R.color.buttonColor)) to a variable ? and reuse the rest of the code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Becase getColor from getResources is deprecated, and from getContext is supported in Android M+

return Bitmap.CompressFormat.WEBP;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
return Bitmap.CompressFormat.WEBP_LOSSY;
} else {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't need else here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The else is for older versions of Android that do not support WEBP

return point.x;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
return window.getCurrentWindowMetrics().getBounds().width();
} else {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for else

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The else is for Old android version < Android R

@adimiz1 adimiz1 merged commit 67861b3 into master Aug 27, 2023
@adimiz1 adimiz1 deleted the fix/sample_app branch August 27, 2023 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants