Skip to content

Commit 7416963

Browse files
committed
Add popup for NewPipe dropping support for Android 5
1 parent 9360d2f commit 7416963

3 files changed

Lines changed: 34 additions & 0 deletions

File tree

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import android.content.IntentFilter;
2828
import android.content.SharedPreferences;
2929
import android.content.pm.PackageManager;
30+
import android.os.Build;
3031
import android.os.Bundle;
3132
import android.os.Handler;
3233
import android.os.Looper;
@@ -203,6 +204,7 @@ protected void onCreate(final Bundle savedInstanceState) {
203204
// We want every release build (nightly, nightly-refactor) to show the popup
204205
if (!DEBUG) {
205206
showKeepAndroidDialog();
207+
showApi23RequirementDialog();
206208
}
207209

208210
MigrationManager.showUserInfoIfPresent(this);
@@ -1028,4 +1030,32 @@ private static String getKeepAndroidOpenDetailsUrl() {
10281030
return kaoBaseUrl;
10291031
}
10301032
}
1033+
1034+
private void showApi23RequirementDialog() {
1035+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
1036+
return; // only show dialog on the devices that will stop being supported
1037+
}
1038+
1039+
final var prefs = PreferenceManager.getDefaultSharedPreferences(this);
1040+
final var shownKey = getString(R.string.api23_requirement_dialog_shown_key);
1041+
if (prefs.getBoolean(shownKey, false)) {
1042+
return; // dialog was already shown in the past, no need to show it again
1043+
}
1044+
1045+
final var dialog = new AlertDialog.Builder(this)
1046+
.setTitle(R.string.api23_requirement_dialog_title)
1047+
.setCancelable(false)
1048+
.setMessage(R.string.api23_requirement_dialog_message)
1049+
.setPositiveButton(android.R.string.ok, (d, w) -> prefs.edit()
1050+
.putBoolean(shownKey, true)
1051+
.apply())
1052+
.setNegativeButton(R.string.api23_requirement_dialog_blogpost, null)
1053+
.show();
1054+
1055+
// If we use setNegativeButton, dialog will close after pressing the button,
1056+
// but we want it to close only when positive button is pressed
1057+
final var blogpostUrl = "https://newpipe.net/blog/pinned/announcement/drop-android-5/";
1058+
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
1059+
.setOnClickListener(v -> ShareUtils.openUrlInBrowser(this, blogpostUrl));
1060+
}
10311061
}

app/src/main/res/values/settings_keys.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
<!-- Key values -->
1313
<string name="kao_last_checked_key">kao_last_checked</string>
14+
<string name="api23_requirement_dialog_shown_key">api23_requirement_dialog_shown</string>
1415

1516
<string name="download_path_video_key">download_path</string>
1617
<string name="download_path_audio_key">download_path_audio</string>

app/src/main/res/values/strings.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,4 +900,7 @@
900900
<string name="kao_dialog_warning">In August 2025, Google announced that as of September 2026, installing apps will require developer verification for all Android apps on certified devices, including those installed outside of the Play Store. Since the developers of NewPipe do not agree to this requirement, NewPipe will no longer work on certified Android devices after that time.</string>
901901
<string name="kao_dialog_more_info">Details</string>
902902
<string name="kao_solution">Solution</string>
903+
<string name="api23_requirement_dialog_title">NewPipe is dropping support for Android 5</string>
904+
<string name="api23_requirement_dialog_message">Unfortunately NewPipe depends on a few libraries that recently dropped support for Android 5.0 and 5.1. The next NewPipe release will therefore only work on devices with Android 6 or higher, sadly. Read more in the blogpost.</string>
905+
<string name="api23_requirement_dialog_blogpost">Blogpost</string>
903906
</resources>

0 commit comments

Comments
 (0)