Add popup for NewPipe dropping support for Android 5
This commit is contained in:
parent
9360d2f61c
commit
6d52522523
3 changed files with 34 additions and 0 deletions
|
|
@ -27,6 +27,7 @@ import android.content.Intent;
|
|||
import android.content.IntentFilter;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
|
@ -203,6 +204,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
// We want every release build (nightly, nightly-refactor) to show the popup
|
||||
if (!DEBUG) {
|
||||
showKeepAndroidDialog();
|
||||
showApi23RequirementDialog();
|
||||
}
|
||||
|
||||
MigrationManager.showUserInfoIfPresent(this);
|
||||
|
|
@ -1028,4 +1030,32 @@ public class MainActivity extends AppCompatActivity {
|
|||
return kaoBaseUrl;
|
||||
}
|
||||
}
|
||||
|
||||
private void showApi23RequirementDialog() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
return; // only show dialog on the devices that will stop being supported
|
||||
}
|
||||
|
||||
final var prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
final var shownKey = getString(R.string.api23_requirement_dialog_shown_key);
|
||||
if (prefs.getBoolean(shownKey, false)) {
|
||||
return; // dialog was already shown in the past, no need to show it again
|
||||
}
|
||||
|
||||
final var dialog = new AlertDialog.Builder(this)
|
||||
.setTitle(R.string.api23_requirement_dialog_title)
|
||||
.setCancelable(false)
|
||||
.setMessage(R.string.api23_requirement_dialog_message)
|
||||
.setPositiveButton(android.R.string.ok, (d, w) -> prefs.edit()
|
||||
.putBoolean(shownKey, true)
|
||||
.apply())
|
||||
.setNegativeButton(R.string.api23_requirement_dialog_blogpost, null)
|
||||
.show();
|
||||
|
||||
// If we use setNegativeButton, dialog will close after pressing the button,
|
||||
// but we want it to close only when positive button is pressed
|
||||
final var blogpostUrl = "https://newpipe.net/blog/pinned/announcement/drop-android-5/";
|
||||
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
|
||||
.setOnClickListener(v -> ShareUtils.openUrlInBrowser(this, blogpostUrl));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue