Skip to content

Commit 35b70c5

Browse files
authored
Merge pull request #13194 from TeamNewPipe/r8fixes
Enable lint checks and resource shrinking
2 parents feb4424 + 653b33b commit 35b70c5

28 files changed

+489
-449
lines changed

app/build.gradle.kts

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

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

10096
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/MainActivity.java

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

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

333329
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
});

0 commit comments

Comments
 (0)