Skip to content

Commit f715043

Browse files
author
Yevhen Babiichuk (DustDFG)
committed
fixup! Add warning banner about ongoing google certification for android apps
1 parent fa1aa4a commit f715043

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

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

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -993,8 +993,7 @@ private void showKeepAndroidDialog() {
993993
"https://github.com/woheller69/FreeDroidWarn?tab=readme-ov-file#solutions");
994994

995995
if (kaoLastCheck.plus(30, ChronoUnit.DAYS).isBefore(now)) {
996-
997-
new AlertDialog.Builder(this)
996+
final var dialog = new AlertDialog.Builder(this)
998997
.setTitle("Keep Android Open")
999998
.setMessage(this.getString(R.string.kao_dialog_warning))
1000999
.setPositiveButton(this.getString(android.R.string.ok), (d, w) -> {
@@ -1005,16 +1004,18 @@ private void showKeepAndroidDialog() {
10051004
)
10061005
.apply();
10071006
})
1008-
.setNeutralButton(
1009-
this.getString(R.string.kao_solution),
1010-
(d, w) ->
1011-
this.startActivity(new Intent(Intent.ACTION_VIEW, solutionURI)))
1012-
1013-
.setNegativeButton(
1014-
this.getString(R.string.kao_dialog_more_info),
1015-
(d, w) ->
1016-
this.startActivity(new Intent(Intent.ACTION_VIEW, kaoURI)))
1007+
.setNeutralButton(this.getString(R.string.kao_solution), null)
1008+
.setNegativeButton(this.getString(R.string.kao_dialog_more_info), null)
10171009
.show();
1010+
1011+
// If we use setNeutralButton and etc. dialog will close after pressing the buttons
1012+
// but we want it to close only when positive button is pressed
1013+
dialog.getButton(AlertDialog.BUTTON_NEGATIVE).setOnClickListener(v ->
1014+
this.startActivity(new Intent(Intent.ACTION_VIEW, kaoURI))
1015+
);
1016+
dialog.getButton(AlertDialog.BUTTON_NEUTRAL).setOnClickListener(v ->
1017+
this.startActivity(new Intent(Intent.ACTION_VIEW, solutionURI))
1018+
);
10181019
}
10191020
}
10201021
}

0 commit comments

Comments
 (0)