NewPipeExtractor icon indicating copy to clipboard operation
NewPipeExtractor copied to clipboard

Use Locale.forLanguageTag().

Open Isira-Seneviratne opened this issue 2 years ago • 5 comments


Use Locale.forLanguageTag() as NewPipe now requires API level 21.

Isira-Seneviratne avatar Aug 24 '22 00:08 Isira-Seneviratne

NewPipe now requires API level 21.

Does the extractor also require API level 21 too?

triallax avatar Aug 24 '22 12:08 triallax

NewPipe now requires API level 21.

Does the extractor also require API level 21 too?

At the moment it requires API level 19 (due to using the StandardCharsets class).

Isira-Seneviratne avatar Aug 24 '22 12:08 Isira-Seneviratne

Then this PR would raise that requirement to 21, right? Do we want that?

triallax avatar Aug 24 '22 12:08 triallax

I don't think so, as some apps use the extractor on lower APIs, such as SkyTube.

The question is: does this method would be available with the desugar library based on Java 11?

AudricV avatar Aug 24 '22 12:08 AudricV

I don't think so, as some apps use the extractor on lower APIs, such as SkyTube.

Oh, right. In that case, changes will need to be made as StandardCharsets requires API level 19 (though it seems like it'll be supported in desugar: https://github.com/google/desugar_jdk_libs)

The question is: does this method would be available with the desugar library based on Java 11?

Probably? I checked using the Android Studio preview and it didn't seem to be available. I created an issue for it a while ago: https://issuetracker.google.com/issues/171182330

Isira-Seneviratne avatar Aug 24 '22 12:08 Isira-Seneviratne

Then this PR would raise that requirement to 21, right? Do we want that?

If I understand correctly, the purpose of this PR is actually to prevent raising the requirement to 21, while being able to use LocaleCompat.forLanguageTag()

Stypox avatar Nov 28 '22 13:11 Stypox

Then this PR would raise that requirement to 21, right? Do we want that?

If I understand correctly, the purpose of this PR is actually to prevent raising the requirement to 21, while being able to use LocaleCompat.forLanguageTag()

The idea was to eventually switch to Locale.forLanguageTag() if/when it becomes available via desugaring.

Isira-Seneviratne avatar Nov 29 '22 03:11 Isira-Seneviratne

I think it's better if you avoid reflection. We can use our own implementation until the real one becomes available

Stypox avatar Nov 29 '22 09:11 Stypox