Fix webview-js dialog not dismissing correctly

This commit is contained in:
Gregor Santner 2018-03-30 01:41:43 +02:00
parent 08242760bb
commit 618f3eaaba
No known key found for this signature in database
GPG Key ID: 7E83A7834AECB009
3 changed files with 8 additions and 17 deletions

View File

@ -100,6 +100,7 @@ public class ContextMenuWebView extends NestedWebView {
MainActivity.REQUEST_CODE__ACCESS_EXTERNAL_STORAGE);
}
})
.setCancelable(false)
.setNegativeButton(context.getText(android.R.string.no), null)
.show();
}

View File

@ -18,7 +18,6 @@
*/
package com.github.dfa.diaspora_android.web;
import android.content.DialogInterface;
import android.webkit.JsResult;
import android.webkit.WebView;
import android.widget.ProgressBar;
@ -65,20 +64,13 @@ public class DiasporaStreamWebChromeClient extends FileUploadWebChromeClient {
ThemedAlertDialogBuilder builder = new ThemedAlertDialogBuilder(view.getContext(), AppSettings.get());
builder.setTitle(view.getContext().getString(R.string.confirmation))
.setMessage(message)
.setPositiveButton(android.R.string.ok,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
result.confirm();
}
})
.setNegativeButton(android.R.string.cancel,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
result.cancel();
}
})
.create()
.show();
.setPositiveButton(android.R.string.ok, (dialog, which) -> result.confirm())
.setNegativeButton(android.R.string.cancel, (dialog, which) -> result.cancel())
.setOnCancelListener(dialog -> {
result.cancel();
dialog.dismiss();
})
.create().show();
return true;
}

View File

@ -12,8 +12,6 @@ buildscript {
ext.version_library_appcompat = "27.1.0"
// https://github.com/JakeWharton/butterknife/releases
ext.version_library_butterknife = "8.8.1"
// https://github.com/atlassian/commonmark-java/releases
ext.version_library_commonmark = "0.10.0"
// https://github.com/guardianproject/NetCipher/releases
ext.version_library_netcipher = "2.0.0-alpha1"
// https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-gradle-plugin#LookAtCentral