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

Use ContextCompat methods. #4276

Merged
merged 3 commits into from
Oct 10, 2020

Conversation

Isira-Seneviratne
Copy link
Member

@Isira-Seneviratne Isira-Seneviratne commented Sep 13, 2020

What is it?

  • Bug fix (user facing)
  • Feature (user facing)
  • Code base improvement (dev facing)
  • Meta improvement to the project (dev facing)

Description of the changes in your PR

  • Use ContextCompat's getSystemService and startForegroundService methods.

Testing apk

debug.zip

Agreement

@Isira-Seneviratne Isira-Seneviratne force-pushed the Use_ContextCompat_methods branch 2 times, most recently from 14d89f9 to f092503 Compare September 13, 2020 14:13
@Redirion
Copy link
Member

in App.java the method initNotificationChannel can be made private and the method setUpUpdateNotificationChannel could be merged into it. You could rename initNotificationChannel to initNotificationChannels and use the method createNotificationChannels. This way we can skip one call to getSystemService

The variables id, name and description can have their final modifier removed to be reused for the appUpdateChannel

can you add these changes to your PR?

@Isira-Seneviratne
Copy link
Member Author

in App.java the method initNotificationChannel can be made private and the method setUpUpdateNotificationChannel could be merged into it. You could rename initNotificationChannel to initNotificationChannels and use the method createNotificationChannels. This way we can skip one call to getSystemService

The variables id, name and description can have their final modifier removed to be reused for the appUpdateChannel

can you add these changes to your PR?

Sure.

@Redirion
Copy link
Member

Redirion commented Sep 16, 2020

Thank you for the fast changes, but please use createNotificationChannels to provide both Channels at once.

See here why it is useful: https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/app/NotificationManager.java#819

Redirion
Redirion previously approved these changes Sep 16, 2020
@Isira-Seneviratne Isira-Seneviratne force-pushed the Use_ContextCompat_methods branch 3 times, most recently from 4ea6aa6 to 05ef697 Compare October 4, 2020 02:53
@Isira-Seneviratne Isira-Seneviratne force-pushed the Use_ContextCompat_methods branch 2 times, most recently from e3d1f75 to 61ae65a Compare October 7, 2020 00:18
@Isira-Seneviratne
Copy link
Member Author

I fixed a merge conflict.

Copy link
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

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

Almost there, thank you!

app/src/main/java/org/schabi/newpipe/App.java Outdated Show resolved Hide resolved
checkstyle-suppressions.xml Outdated Show resolved Hide resolved
@Stypox
Copy link
Member

Stypox commented Oct 7, 2020

Code looks good, thank you! Could you provide a test apk? After some testing I'll merge

@Isira-Seneviratne
Copy link
Member Author

Code looks good, thank you! Could you provide a test apk? After some testing I'll merge

Sure.

@Isira-Seneviratne
Copy link
Member Author

I uploaded a test APK in debug.zip.

Copy link
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

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

I tested every activity you changed on API 19 and everything works correctly. Thank you!

@Stypox Stypox merged commit 3c67df2 into TeamNewPipe:dev Oct 10, 2020
@Isira-Seneviratne Isira-Seneviratne deleted the Use_ContextCompat_methods branch October 11, 2020 02:32
This was referenced Nov 10, 2020
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.

3 participants