Skip to content

Commit 4c82e8b

Browse files
authored
Merge pull request #13278 from theimpulson/merge
Merge dev into refactor
2 parents 8b28bd1 + 064e532 commit 4c82e8b

215 files changed

Lines changed: 2106 additions & 2418 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/build.gradle.kts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ configure<ApplicationExtension> {
8484
resValue("string", "app_name", "NewPipe $suffix")
8585
}
8686
isMinifyEnabled = true
87-
isShrinkResources = false // disabled to fix F-Droid"s reproducible build
87+
isShrinkResources = true
8888
proguardFiles(
8989
getDefaultProguardFile("proguard-android-optimize.txt"),
9090
"proguard-rules.pro"
@@ -93,13 +93,9 @@ configure<ApplicationExtension> {
9393
}
9494

9595
lint {
96-
checkReleaseBuilds = false
97-
// Or, if you prefer, you can continue to check for errors in release builds,
98-
// but continue the build even when errors are found:
96+
lintConfig = file("lint.xml")
97+
// Continue the debug build even when errors are found
9998
abortOnError = false
100-
// suppress false warning ("Resource IDs will be non-final in Android Gradle Plugin version
101-
// 5.0, avoid using them in switch case statements"), which affects only library projects
102-
disable += "NonConstantResourceId"
10399
}
104100

105101
compileOptions {

app/lint.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ SPDX-FileCopyrightText: 2026 NewPipe e.V. <https://newpipe-ev.de>
4+
~ SPDX-License-Identifier: GPL-3.0-or-later
5+
-->
6+
<lint>
7+
<issue id="MissingTranslation" severity="ignore" />
8+
<issue id="MissingQuantity" severity="ignore" />
9+
<issue id="ImpliedQuantity" severity="ignore" />
10+
</lint>

app/src/main/java/org/schabi/newpipe/ExitActivity.java

Lines changed: 0 additions & 50 deletions
This file was deleted.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2016-2026 NewPipe contributors <https://newpipe.net>
3+
* SPDX-License-Identifier: GPL-3.0-or-later
4+
*/
5+
6+
package org.schabi.newpipe
7+
8+
import android.annotation.SuppressLint
9+
import android.app.Activity
10+
import android.content.Intent
11+
import android.os.Bundle
12+
import org.schabi.newpipe.util.NavigationHelper
13+
14+
class ExitActivity : Activity() {
15+
@SuppressLint("NewApi")
16+
override fun onCreate(savedInstanceState: Bundle?) {
17+
super.onCreate(savedInstanceState)
18+
finishAndRemoveTask()
19+
NavigationHelper.restartApp(this)
20+
}
21+
22+
companion object {
23+
@JvmStatic
24+
fun exitAndRemoveFromRecentApps(activity: Activity) {
25+
val intent = Intent(activity, ExitActivity::class.java)
26+
intent.addFlags(
27+
Intent.FLAG_ACTIVITY_NEW_TASK
28+
or Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
29+
or Intent.FLAG_ACTIVITY_CLEAR_TASK
30+
or Intent.FLAG_ACTIVITY_NO_ANIMATION
31+
)
32+
33+
activity.startActivity(intent)
34+
}
35+
}
36+
}

app/src/main/java/org/schabi/newpipe/MainActivity.java

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -305,25 +305,21 @@ private void addDrawerMenuForCurrentService() throws ExtractionException {
305305
}
306306

307307
private boolean drawerItemSelected(final MenuItem item) {
308-
switch (item.getGroupId()) {
309-
case R.id.menu_services_group:
310-
changeService(item);
311-
break;
312-
case R.id.menu_tabs_group:
313-
tabSelected(item);
314-
break;
315-
case R.id.menu_kiosks_group:
316-
try {
317-
kioskSelected(item);
318-
} catch (final Exception e) {
319-
ErrorUtil.showUiErrorSnackbar(this, "Selecting drawer kiosk", e);
320-
}
321-
break;
322-
case R.id.menu_options_about_group:
323-
optionsAboutSelected(item);
324-
break;
325-
default:
326-
return false;
308+
final int groupId = item.getGroupId();
309+
if (groupId == R.id.menu_services_group) {
310+
changeService(item);
311+
} else if (groupId == R.id.menu_tabs_group) {
312+
tabSelected(item);
313+
} else if (groupId == R.id.menu_kiosks_group) {
314+
try {
315+
kioskSelected(item);
316+
} catch (final Exception e) {
317+
ErrorUtil.showUiErrorSnackbar(this, "Selecting drawer kiosk", e);
318+
}
319+
} else if (groupId == R.id.menu_options_about_group) {
320+
optionsAboutSelected(item);
321+
} else {
322+
return false;
327323
}
328324

329325
mainBinding.getRoot().closeDrawers();

app/src/main/java/org/schabi/newpipe/NewVersionWorker.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ class NewVersionWorker(
8282
)
8383

8484
val notificationManager = NotificationManagerCompat.from(applicationContext)
85-
notificationManager.notify(2000, notificationBuilder.build())
85+
if (notificationManager.areNotificationsEnabled()) {
86+
notificationManager.notify(2000, notificationBuilder.build())
87+
}
8688
}
8789

8890
@Throws(IOException::class, ReCaptchaException::class)

app/src/main/java/org/schabi/newpipe/QueueItemMenuUtil.java

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -41,50 +41,50 @@ public static void openPopupMenu(final PlayQueue playQueue,
4141
}
4242

4343
popupMenu.setOnMenuItemClickListener(menuItem -> {
44-
switch (menuItem.getItemId()) {
45-
case R.id.menu_item_remove:
46-
final int index = playQueue.indexOf(item);
47-
playQueue.remove(index);
48-
return true;
49-
case R.id.menu_item_details:
50-
// playQueue is null since we don't want any queue change
51-
NavigationHelper.openVideoDetail(context, item.getServiceId(),
52-
item.getUrl(), item.getTitle(), null,
53-
false);
54-
return true;
55-
case R.id.menu_item_append_playlist:
56-
PlaylistDialog.createCorrespondingDialog(
57-
context,
58-
List.of(new StreamEntity(item)),
59-
dialog -> dialog.show(
60-
fragmentManager,
61-
"QueueItemMenuUtil@append_playlist"
62-
)
63-
);
44+
final int itemId = menuItem.getItemId();
45+
if (itemId == R.id.menu_item_remove) {
46+
final int index = playQueue.indexOf(item);
47+
playQueue.remove(index);
48+
return true;
49+
} else if (itemId == R.id.menu_item_details) {
50+
// playQueue is null since we don't want any queue change
51+
NavigationHelper.openVideoDetail(context, item.getServiceId(),
52+
item.getUrl(), item.getTitle(), null,
53+
false);
54+
return true;
55+
} else if (itemId == R.id.menu_item_append_playlist) {
56+
PlaylistDialog.createCorrespondingDialog(
57+
context,
58+
List.of(new StreamEntity(item)),
59+
dialog -> dialog.show(
60+
fragmentManager,
61+
"QueueItemMenuUtil@append_playlist"
62+
)
63+
);
6464

65-
return true;
66-
case R.id.menu_item_channel_details:
67-
SparseItemUtil.fetchUploaderUrlIfSparse(context, item.getServiceId(),
68-
item.getUrl(), item.getUploaderUrl(),
69-
// An intent must be used here.
70-
// Opening with FragmentManager transactions is not working,
71-
// as PlayQueueActivity doesn't use fragments.
72-
uploaderUrl -> NavigationHelper.openChannelFragmentUsingIntent(
73-
context, item.getServiceId(), uploaderUrl, item.getUploader()
74-
));
75-
return true;
76-
case R.id.menu_item_share:
77-
shareText(context, item.getTitle(), item.getUrl(),
78-
item.getThumbnails());
79-
return true;
80-
case R.id.menu_item_download:
81-
fetchStreamInfoAndSaveToDatabase(context, item.getServiceId(), item.getUrl(),
82-
info -> {
83-
final DownloadDialog downloadDialog = new DownloadDialog(context,
84-
info);
85-
downloadDialog.show(fragmentManager, "downloadDialog");
86-
});
87-
return true;
65+
return true;
66+
} else if (itemId == R.id.menu_item_channel_details) {
67+
SparseItemUtil.fetchUploaderUrlIfSparse(context, item.getServiceId(),
68+
item.getUrl(), item.getUploaderUrl(),
69+
// An intent must be used here.
70+
// Opening with FragmentManager transactions is not working,
71+
// as PlayQueueActivity doesn't use fragments.
72+
uploaderUrl -> NavigationHelper.openChannelFragmentUsingIntent(
73+
context, item.getServiceId(), uploaderUrl, item.getUploader()
74+
));
75+
return true;
76+
} else if (itemId == R.id.menu_item_share) {
77+
shareText(context, item.getTitle(), item.getUrl(),
78+
item.getThumbnails());
79+
return true;
80+
} else if (itemId == R.id.menu_item_download) {
81+
fetchStreamInfoAndSaveToDatabase(context, item.getServiceId(), item.getUrl(),
82+
info -> {
83+
final DownloadDialog downloadDialog = new DownloadDialog(context,
84+
info);
85+
downloadDialog.show(fragmentManager, "downloadDialog");
86+
});
87+
return true;
8888
}
8989
return false;
9090
});

app/src/main/java/org/schabi/newpipe/RouterActivity.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,7 @@ protected void onSuccess() {
343343
return;
344344
}
345345

346-
final List<StreamingService.ServiceInfo.MediaCapability> capabilities =
347-
currentService.getServiceInfo().getMediaCapabilities();
346+
final var capabilities = currentService.getServiceInfo().getMediaCapabilities();
348347

349348
// Check if the service supports the choice
350349
if ((isVideoPlayerSelected && capabilities.contains(VIDEO))
@@ -522,8 +521,7 @@ private List<AdapterChoiceItem> getChoicesForService(final StreamingService serv
522521
final List<AdapterChoiceItem> returnedItems = new ArrayList<>();
523522
returnedItems.add(showInfo); // Always present
524523

525-
final List<StreamingService.ServiceInfo.MediaCapability> capabilities =
526-
service.getServiceInfo().getMediaCapabilities();
524+
final var capabilities = service.getServiceInfo().getMediaCapabilities();
527525

528526
if (linkType == LinkType.STREAM || linkType == LinkType.PLAYLIST) {
529527
if (capabilities.contains(VIDEO)) {

app/src/main/java/org/schabi/newpipe/database/playlist/model/PlaylistRemoteEntity.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,7 @@ data class PlaylistRemoteEntity(
6262
orderingName = playlistInfo.name,
6363
url = playlistInfo.url,
6464
thumbnailUrl = ImageStrategy.imageListToDbUrl(
65-
if (playlistInfo.thumbnails.isEmpty()) {
66-
playlistInfo.uploaderAvatars
67-
} else {
68-
playlistInfo.thumbnails
69-
}
65+
playlistInfo.thumbnails.ifEmpty { playlistInfo.uploaderAvatars }
7066
),
7167
uploader = playlistInfo.uploaderName,
7268
streamCount = playlistInfo.streamCount

app/src/main/java/org/schabi/newpipe/database/stream/dao/StreamDAO.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ abstract class StreamDAO : BasicDAO<StreamEntity> {
8888

8989
private fun compareAndUpdateStream(newerStream: StreamEntity) {
9090
val existentMinimalStream = getMinimalStreamForCompare(newerStream.serviceId, newerStream.url)
91-
?: throw IllegalStateException("Stream cannot be null just after insertion.")
91+
?: error("Stream cannot be null just after insertion.")
9292
newerStream.uid = existentMinimalStream.uid
9393

9494
if (!StreamTypeUtil.isLiveStream(newerStream.streamType)) {

0 commit comments

Comments
 (0)