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

Deprecations and cleanup #3909

Merged
merged 9 commits into from
Sep 7, 2020
Merged

Deprecations and cleanup #3909

merged 9 commits into from
Sep 7, 2020

Conversation

TacoTheDank
Copy link
Member

@TacoTheDank TacoTheDank commented Jul 19, 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

  • Fixes a bunch of deprecations
  • A little bit of code cleanup

Fixes the following issue(s)

  • Fixes some deprecations in code

Testing apk

newpipe-deprecationsandcleanup.zip

Agreement

@wb9688
Copy link
Contributor

wb9688 commented Jul 19, 2020

Code looks OK, though have you tested your changes on at least Android 4.4 and Android 10?

We also prefer marking variables as final whenever possible, e.g. in those enhanced for loops.

@TacoTheDank
Copy link
Member Author

TacoTheDank commented Jul 20, 2020

@wb9688

I have no 4.4 device to test, and can't really do an AS emulator. I have an Android 10 one though, and will test on that.

There was a crash caused by one of the changes, so I reverted that (and better grouped the commits). I'm testing an APK, and everything now works fine as far as I can tell.

@MD77MD
Copy link

MD77MD commented Jul 20, 2020

I have a 4.4 device.. what should I look for to test... could you put the link to the APK.

@MD77MD
Copy link

MD77MD commented Jul 21, 2020

I really think this will be more useful and needed after the big merge (expendable players with unified ui). with the release of newPipe 0.20.

@TacoTheDank
Copy link
Member Author

TacoTheDank commented Jul 23, 2020

@MD77MD Didn't see this. I've added the APK. (I think it's the right one). I think you should try playing and downloading videos, going through the tabs on the left toolbar, the local feed, and play around with the subscriptions.

@Stypox
Copy link
Member

Stypox commented Jul 23, 2020

@MD77MD since you own a 4.4 device, are you willing to add yourself to the testers page on the wiki?

@ghost
Copy link

ghost commented Jul 24, 2020

I have test the last apk on my phone android 4.4 and all work well. I continue with test if i have issues i post here, thanks for work :)

@TobiGr
Copy link
Member

TobiGr commented Jul 31, 2020

Code looks good, but will be merged after #2907 as it changes player code.

@TacoTheDank
Copy link
Member Author

Ok. I'll probably have to fix conflicts but that's fine.

@TacoTheDank
Copy link
Member Author

Fixed. Some changes have been made as well, so re-review the commits.

@Redirion
Copy link
Member

@TacoTheDank please update the ExoPlayer-Dependency to 2.11.8 as 2.11.8 contains only "trivial changes" it should be safe to do so

Copy link
Contributor

@wb9688 wb9688 left a comment

Choose a reason for hiding this comment

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

In general I like these changes. Could you rebase on dev and fix the Checkstyles errors though?

@wb9688
Copy link
Contributor

wb9688 commented Aug 27, 2020

You still haven't fixed all Checkstyle errors. Did you even try compiling the code before pushing it?

@TacoTheDank
Copy link
Member Author

TacoTheDank commented Aug 27, 2020

@wb9688

You still haven't fixed all Checkstyle errors. Did you even try compiling the code before pushing it?

Yeah, I did. I just had to undo the commits and re-push them. It's much easier to find where the errors are via travis than trying to play find-the-error with the runCheckstyle after building:
image

Please watch the tone...

@wb9688
Copy link
Contributor

wb9688 commented Aug 27, 2020

@TacoTheDank: Ah, if it looks like that, it makes sense indeed, sorry. It shouldn't look like that though, are you using something other than Android Studio?

@TacoTheDank
Copy link
Member Author

@wb9688 Nope, it's just plain ol' Android Studio. The runCheckstyle just tells me the number of errors/warnings in the files, but doesn't give me anything else to work with :/

@TacoTheDank
Copy link
Member Author

TacoTheDank commented Aug 27, 2020

I don't like how checkstyle operates. I've fixed all the actual changes causing the errors, but it still errors because of the hashCode warnings that I have nothing to do with. I'll now have to fix that PR-unrelated thing for it to actually succeed :/

@wb9688
Copy link
Contributor

wb9688 commented Aug 27, 2020

@TacoTheDank: Oh, that's very strange. It should say e.g. the line number and that should be clickable to jump to the error. If you run ./gradlew runCheckstyle in a terminal, does it show the errors and warnings with the line numbers (like on Travis)? Btw there are also some Ktlint errors now, but they could be automatically resolved by running ./gradlew formatKtlint.

@TacoTheDank
Copy link
Member Author

I'll try it.

@wb9688
Copy link
Contributor

wb9688 commented Aug 27, 2020

@TacoTheDank: No, you don't have to fix the warnings. Notice how it fails at :runKtlint now ;)

@TacoTheDank
Copy link
Member Author

Ok, everything should NOW be good 😅

@TacoTheDank
Copy link
Member Author

Also, running ./gradlew runCheckstyle now just builds successfully without giving me any warnings at all. Very strange lol

@TacoTheDank
Copy link
Member Author

I like my PRs being very clean, with no unnecessary after-changes. Sorry for all the force-pushing lol

@opusforlife2
Copy link
Collaborator

It's fine. I don't mind. You can force-push all you want. 🤭

@MD77MD
Copy link

MD77MD commented Aug 27, 2020

It's fine. I don't mind. You can force-push all you want. 

that sounds naughty 😁...great job though 👍

@opusforlife2
Copy link
Collaborator

Oh no no no. All force-pushing is 100% consensual in this repo, no matter how scary the term sounds. 🤣

@Redirion
Copy link
Member

Code looks good, but will be merged after #2907 as it changes player code.

@TobiGr In my opinion this is good to merge now.

Stypox
Stypox previously approved these changes Sep 3, 2020
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.

Code looks good to me. Have you tested that everything works correctly on Android 4.4 with SwitchPreferenceCompat? (it should, but I remember strange shenanigans a while ago)

Copy link
Member

@TobiGr TobiGr left a comment

Choose a reason for hiding this comment

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

Looks good to me. @Stypox @wb9688 Please merge once 4.4 compatibility is assured.
At the reviewers: please tell @friendlyanon whenever there are changes which might cause problems with the legacy version to not introduce preventable regressions. @friendlyanon You basically need to take a look at 1da2063 and StandardCharset changes.

if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) {
builder.setPriority(NotificationCompat.PRIORITY_MAX);
}
builder.setPriority(NotificationCompat.PRIORITY_MAX);
Copy link
Member

Choose a reason for hiding this comment

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

Heads up @friendlyanon

@@ -303,10 +302,6 @@ public static int getTossFlingVelocity(@NonNull final Context context) {

@NonNull
public static CaptionStyleCompat getCaptionStyle(@NonNull final Context context) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return CaptionStyleCompat.DEFAULT;
}
Copy link
Member

Choose a reason for hiding this comment

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

Heads up @friendlyanon

@@ -331,10 +326,6 @@ public static CaptionStyleCompat getCaptionStyle(@NonNull final Context context)
* @return caption scaling
*/
public static float getCaptionScale(@NonNull final Context context) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return 1f;
}
Copy link
Member

Choose a reason for hiding this comment

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

Heads up @friendlyanon

return false;
}
if (!checkReadStoragePermissions(activity, requestCode)) {
return false;
Copy link
Member

Choose a reason for hiding this comment

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

@@ -1105,7 +1105,7 @@ private void openBackgroundPlayer(final boolean append) {
player.toggleFullscreen();
}

if (!useExternalAudioPlayer && android.os.Build.VERSION.SDK_INT >= 16) {
if (!useExternalAudioPlayer) {
Copy link
Member

Choose a reason for hiding this comment

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

Heads up @friendlyanon

Comment on lines 1305 to 1308
.map((@NonNull String descriptionText) ->
HtmlCompat.fromHtml(descriptionText,
HtmlCompat.FROM_HTML_MODE_LEGACY))
Copy link
Member

Choose a reason for hiding this comment

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

Comment on lines +477 to +478
playbackSeekBar.getThumb()
.setColorFilter(new PorterDuffColorFilter(Color.RED, PorterDuff.Mode.SRC_IN));
Copy link
Member

Choose a reason for hiding this comment

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

Comment on lines +460 to +461
playbackSeekBar.getThumb()
.setColorFilter(new PorterDuffColorFilter(Color.RED, PorterDuff.Mode.SRC_IN));
Copy link
Member

Choose a reason for hiding this comment

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

Comment on lines +214 to +215
playbackSeekBar.getThumb()
.setColorFilter(new PorterDuffColorFilter(Color.RED, PorterDuff.Mode.SRC_IN));
Copy link
Member

Choose a reason for hiding this comment

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

} catch (final UnsupportedEncodingException e) {
return "0x" + Integer.toHexString(type);
}
return new String(ByteBuffer.allocate(4).putInt(type).array(), StandardCharsets.UTF_8);
Copy link
Member

Choose a reason for hiding this comment

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

@friendlyanon StandardCharsets was added with API 19

@TacoTheDank
Copy link
Member Author

@Stypox Unfortunately I do not have a KitKat device on which to test. :(

@Stypox
Copy link
Member

Stypox commented Sep 4, 2020

Ok, I will test myself on an emulator then 😉

@Stypox
Copy link
Member

Stypox commented Sep 6, 2020

I fixed a problem with the TabAdapter of VideoDetailFragment: for some reason the BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT had this issue: crash if enqueueing stream in the background and then clicking on it to open VideoDetailFragment: "Cannot setMaxLifecycle for Fragment not attached to FragmentManager". This can be solved by updating everything to ViewPager2 and removing TabAdapter altogether, but this is not relevant to this PR, so I just reverted to the deprecated BEHAVIOR_SET_USER_VISIBLE_HINT.
Everything else I checked worked fine, even on Android 4.4.

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.

Ready for merge in my opinion @wb9688. Thank you @TacoTheDank :-D

@TacoTheDank
Copy link
Member Author

I agree with migrating to ViewPager2.

@Stypox Stypox requested a review from wb9688 September 7, 2020 18:03
@Stypox Stypox merged commit 1448678 into TeamNewPipe:dev Sep 7, 2020
@Stypox
Copy link
Member

Stypox commented Sep 7, 2020

@TacoTheDank thank you for your effort!

This was referenced Sep 27, 2020
@TacoTheDank TacoTheDank deleted the deprecations-and-cleanup branch September 27, 2020 23:58
ShareASmile added a commit to ShareASmile/FoxPipe that referenced this pull request Jun 14, 2024
…s of 15-01-2024 into pre-unified-legacy

This is a fork of TeamNewPipe/NewPipe-legacy that I have been patching for a few months now. There is no commit history as this has been a personal project up until today.

Pulled in a major chunk of related commits for NewPipe Preunified from upstream TeamNewPipe/NewPipe repository:
1. Update NewPipe extractor to fetch likes count Fix TeamNewPipe/NewPipe#10624
2. Access Background Player Queue from Main menu by HybridAU
TeamNewPipe/NewPipe#8419
3. Added Bandcamp Music Support Into NewPipeLegacy, Improve Bandcamp intent filters
TeamNewPipe/NewPipe#3741
TeamNewPipe/NewPipe#6373
TeamNewPipe/NewPipe#6456
4. Disable sending metrics to Google when using Android System WebView
TeamNewPipe/NewPipe#5337
5. Add basic resize functionality
TeamNewPipe/NewPipe#3948
6. [media.ccc.de] Add recent & live stream kiosk
TeamNewPipe/NewPipe#5251
TeamNewPipe/NewPipe#5286
[media.ccc.de] Fix service color
TeamNewPipe/NewPipe#5258
7. Ability to see Pinned Comment added by dkramer95
TeamNewPipe/NewPipe#7577
8. Clicking on Title In Background Player Should Open Video Details
TeamNewPipe/NewPipe#3808 by https://github.com/budde25
9. Added Swipe to Refresh for Channels New Videos in Subscription Feed
TeamNewPipe/NewPipe#4893
10. [peertube] implement sepia search
TeamNewPipe/NewPipe#5257
11. Allow installation on external storage by triallax in
TeamNewPipe/NewPipe#6037
12. Change UA to privacy.resistFingerprinting
TeamNewPipe/NewPipe#5649 by FireMasterK
13. Add formatting removal on paste for search TeamNewPipe/NewPipe#5912 by imericxu
14. Remember Last Selected Media Type For Downloads
TeamNewPipe/NewPipe#4038 by vmazoyer
15. Improve search suggestion experience when remote ones can't be fetched
TeamNewPipe/NewPipe#4029 by StyPox
16. Fix Download Button Not Visible After Playing Live Stream, Fix video detail controls visibility set inconsistently
Add this commit by StyPox
TeamNewPipe/NewPipe@dbb86d2 from
TeamNewPipe/NewPipe#4362
17. [Background Player] Fix very small thumbnails in Video Detail Page by TobiGR in
TeamNewPipe/NewPipe#5818
18. Add Always Expand Description In Appearance Settings
TeamNewPipe/NewPipe#2998 by B0pol
(Related) entries from search history Increased from 25 to 80 and Search Suggestions Entries from 3 to 60 commit copied from
TeamNewPipe/NewPipe#2666 thanks to ergor
20. Fixes snackbar error on disabled likes count
Fixes TeamNewPipe/NewPipe#7405 by TeamNewPipe/NewPipeExtractor#753
21. Fixed player controls not hiding after replay & Bluetooth headset button by Alexander--
TeamNewPipe/NewPipe#3547
22. update user agent in Downloader to firefox latest ESR 115 by Nickoriginal
TeamNewPipe/NewPipe#8269
23. Changed Dark Theme Colors To Darker Variant by sauravrao637
TeamNewPipe/NewPipe#6244
24. Support for PeerTube Short Links
TeamNewPipe/NewPipe#7353
25. Handle URLs for YouTube Shorts
TeamNewPipe/NewPipe#7181
26. Fix playback speed not being updated in Background Player & Fix TeamNewPipe/NewPipe#8058
Fixed Combinedly by TeamNewPipe/NewPipe#6421 by Tobius
and by seanzzy in
TeamNewPipe/NewPipe#8244
27. Added comments disabled functionallity by litetex in
TeamNewPipe/NewPipe#6483
28. [media.ccc.de] Fix service color
TeamNewPipe/NewPipe#5258
29. Ignore ContentNotSupportedException caused by Bandcamp fan pages
TeamNewPipe/NewPipeExtractor#1033
30. Crash when rotating device on unsupported channels
TeamNewPipe/NewPipe#6696
31. Correct Gigaget's license from GPLv2 to GPLv3
TeamNewPipe/NewPipe#4892
32. Add basic resize functionality [Samsung Dex Now Supported]
TeamNewPipe/NewPipe#3948
33. [Security] Update ktlint to 0.40.0
34. Fix security vulnerability update checkstyle / guava
35. Update ExoPlayer from 2.11.6 to 2.11.8
36. Update checkstyle, OkHttp, use Kotlin JDK8 by TacoTheDank added this commit
TeamNewPipe/NewPipe@79e2bb3
from TeamNewPipe/NewPipe#3909
37. Use user agent of DownloaderImpl also in ReCapthaActivity
TeamNewPipe/NewPipe#5215
38. Fix ACRA bug reports not containing stack trace, Do not init ACRA if inside its own process
TeamNewPipe/NewPipe#3982
39. Remove deprecated calls to set Sender class to ACRA
TeamNewPipe/NewPipe#3982
40.Use SubtitlesStream#getUrl instead of getURL
TeamNewPipe/NewPipe#4120
41. Remove pbj=1 parameter from YouYube urls in recaptcha activity
TeamNewPipe/NewPipe#5208
42. Set notification style in Android 11 to MediaStyle Thanks to XiangRongLin for Limted Support for preunified refer to this commit
XiangRongLin@aa55a09
43. Click on title in background player opens video details
TeamNewPipe/NewPipe#3808
44. Add 2K and 4K to the options list for default resolution
 TeamNewPipe/NewPipe#2968
45. Fix crash when opening video in local playlist tab
Fixes TeamNewPipe/NewPipe#3887
by TeamNewPipe/NewPipe#3892 by wb9688
46.  Handle ContentNotSupportedException
TeamNewPipe/NewPipe#3300
47. [YouTube] Improve download speed by Theta-dev
TeamNewPipe/NewPipe#9948
48. Disable commenter image when disabling thumbnails loading by 4D17Y4
Fixes TeamNewPipe/NewPipe#4205
TeamNewPipe/NewPipe#4350
49. Adapt opacity of popup close button to allow touches in other apps on Android >=11
Fixes TeamNewPipe/NewPipe#6770
TeamNewPipe/NewPipe#8279
50. Better error messages for SoundCloud and YouTube unavailable contents
TeamNewPipe/NewPipe#5385
51. Mitigating long buffering on initial video playback by using custom progress-load-interval in exoplayer,
Use 16 KiB as the default progressive load interval by karyogamy
TeamNewPipe/NewPipe#7919
52. Support for opening YouTube Live URLs
TeamNewPipe/NewPipe#9725

Co-Authored-By: Tobi <17365767+tobigr@users.noreply.github.com>
Co-Authored-By: Stypox <stypox@pm.me>
Co-Authored-By: Audric V. <74829229+audricv@users.noreply.github.com>
Co-Authored-By: bopol <58657617+b0pol@users.noreply.github.com>
Co-Authored-By: Isira Seneviratne <31027858+isira-seneviratne@users.noreply.github.com>
Co-Authored-By: opusforlife2 <53176348+opusforlife2@users.noreply.github.com>
Co-Authored-By: fynngodau <fynngodau@mailbox.org>
Co-Authored-By: David Kramer <6166095+dkramer95@users.noreply.github.com>
Co-Authored-By: Ethan Budd <budde25@protonmail.com>
Co-Authored-By: triallax <triallax@tutanota.com>
Co-Authored-By: Kavin <20838718+firemasterk@users.noreply.github.com>
Co-Authored-By: Eric Xu <xeric.2002@gmail.com>
Co-Authored-By: Vincent Mazoyer <17800856+vmazoyer@users.noreply.github.com>
Co-Authored-By: Erol Gorancic <erol@gorancic.no>
Co-Authored-By: Alexander-- <1107390+alexander--@users.noreply.github.com>
Co-Authored-By: Saurav Rao <56369484+sauravrao637@users.noreply.github.com>
Co-Authored-By: Nickoriginal <85299944+nickoriginal@users.noreply.github.com>
Co-Authored-By: Ziyan Zhang <71145592+seanzzy@users.noreply.github.com>
Co-Authored-By: litetex <40789489+litetex@users.noreply.github.com>
Co-Authored-By: XiangRongLin <41164160+xiangronglin@users.noreply.github.com>
Co-Authored-By: wb9688 <46277131+wb9688@users.noreply.github.com>
Co-Authored-By: Okan25 <92695587+okan25@users.noreply.github.com>
Co-Authored-By: Michael Van Delft <1610265+hybridau@users.noreply.github.com>
Co-Authored-By: Taco <32376686+tacothedank@users.noreply.github.com>
Co-Authored-By: ThetaDev <thetadev@magenta.de>
Co-Authored-By: Aditya-Srivastav <54016427+4d17y4@users.noreply.github.com>
Co-Authored-By: John Zhen Mo <zhenmogukl@gmail.com>
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.

7 participants