mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 05:35:39 +03:00
Provide a banal 'paste' postmessage implementation. (#4189)
Provide a banal 'paste' postmessage implementation.
This commit is contained in:
commit
5373660f90
1 changed files with 10 additions and 0 deletions
|
@ -35,6 +35,7 @@ import android.net.Uri;
|
|||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.webkit.ValueCallback;
|
||||
|
@ -418,6 +419,15 @@ public class RichDocumentsWebView extends ExternalSiteWebView {
|
|||
Log_OC.e(this, "Failed to parse rename json message: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void paste() {
|
||||
// Javascript cannot do this by itself, so help out.
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
webview.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_PASTE));
|
||||
webview.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_PASTE));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue