Skip to content
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

Remove unnecessary compat method calls. #8382

Merged
merged 2 commits into from
May 22, 2022

Conversation

Isira-Seneviratne
Copy link
Member

What is it?

  • Bugfix (user facing)
  • Feature (user facing)
  • Codebase improvement (dev facing)
  • Meta improvement to the project (dev facing)

Description of the changes in your PR

  • Remove compatibility method calls that aren't needed due to the minSdk being 19 (KitKat).

Fixes the following issue(s)

  • Fixes #

APK testing

The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR.

Due diligence

Copy link
Member

@litetex litetex left a comment

Choose a reason for hiding this comment

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

Thank you for the PR.

LGTM however someone with more Android experience might have a look at this before merging :)

Worked well while doing a quick test.

@Redirion
Copy link
Member

even though these methods might not be of use currently, I see no advantage in removing them. androidx is updateable, the core Android OS on most devices is not due to lacking manufacturer support. So sticking to an updatable API seems advantageous to me.

@Stypox
Copy link
Member

Stypox commented May 12, 2022

I agree with @Redirion, I see no advantage

@Isira-Seneviratne
Copy link
Member Author

Isira-Seneviratne commented May 12, 2022

even though these methods might not be of use currently, I see no advantage in removing them. androidx is updateable, the core Android OS on most devices is not due to lacking manufacturer support. So sticking to an updatable API seems advantageous to me.

I was under the impression that NewPipe Legacy is no longer being maintained (there's a pretty significant gap in the latest versions of NewPipe and NewPipe Legacy), so I removed those method calls (two of them call older methods on older API levels and don't make use of backport implementations).

  • ViewCompat.setBackground() isn't needed on API levels >= 16.
  • GestureDetectorCompat isn't needed on API levels >= 17.
  • TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds() isn't needed on API levels >= 18.

@Stypox
Copy link
Member

Stypox commented May 12, 2022

Mmmh ok. This is a micro-optimization, since using wrapped functions is slower and uses less apk size than using non-wrapped ones, but it is really a minuscole difference. But it actually makes sense to use non-compat methods to reduce code complexity.

even though these methods might not be of use currently, I see no advantage in removing them. androidx is updateable, the core Android OS on most devices is not due to lacking manufacturer support. So sticking to an updatable API seems advantageous to me.

Actually, that does not hold well, since otherwise we should use androidx methods for every place possible, but that would be a nightmare. Let's remove them if possible.

@triallax triallax added the codequality Improvements to the codebase to improve the code quality label May 13, 2022
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@Stypox Stypox merged commit 1daece3 into TeamNewPipe:dev May 22, 2022
@Stypox Stypox mentioned this pull request Jun 24, 2022
3 tasks
@Isira-Seneviratne Isira-Seneviratne deleted the Remove_compat_methods branch July 15, 2022 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codequality Improvements to the codebase to improve the code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants