Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Background Webview #1154

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions AndroidCompat/src/main/java/android/os/Handler.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package android.os;

import android.annotation.NonNull;
import xyz.nulldev.androidcompat.os.CoroutineHandler;

public class Handler {
Looper looper;
CoroutineHandler mCoroutineHandler;
public Handler(@NonNull Looper looper) {
mCoroutineHandler = new CoroutineHandler(looper);
}

public final boolean post(@NonNull Runnable r) {
mCoroutineHandler.post(r);
return true;
}

@NonNull
public final Looper getLooper() {
return looper;
}

public interface Callback {
boolean handleMessage(@NonNull Message var1);
}
}
35 changes: 35 additions & 0 deletions AndroidCompat/src/main/java/android/os/Looper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package android.os;

import android.annotation.NonNull;
import android.annotation.Nullable;

import java.util.concurrent.Executor;
import java.util.concurrent.Executors;

public final class Looper {
public Executor excecutor = Executors.newSingleThreadExecutor();
private Looper() {
// throw new RuntimeException("Stub!");
}

private static Looper mainLooper = null;

public static Looper getMainLooper() {
synchronized (Looper.class) {
if (mainLooper == null) {
mainLooper = new Looper();
}
}
return mainLooper;
}

@Nullable
public static Looper myLooper() {
return new Looper();
}

@NonNull
public Thread getThread() {
return Thread.currentThread();
}
}
137 changes: 137 additions & 0 deletions AndroidCompat/src/main/java/android/webkit/WebChromeClient.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
package android.webkit;

import android.annotation.Nullable;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Message;
import android.view.View;

public class WebChromeClient {
public WebChromeClient() {
throw new RuntimeException("Stub!");
}

public void onProgressChanged(WebView view, int newProgress) {
throw new RuntimeException("Stub!");
}

public void onReceivedTitle(WebView view, String title) {
throw new RuntimeException("Stub!");
}

public void onReceivedIcon(WebView view, Bitmap icon) {
throw new RuntimeException("Stub!");
}

public void onReceivedTouchIconUrl(WebView view, String url, boolean precomposed) {
throw new RuntimeException("Stub!");
}

public void onShowCustomView(View view, CustomViewCallback callback) {
throw new RuntimeException("Stub!");
}

public void onHideCustomView() {
throw new RuntimeException("Stub!");
}

public boolean onCreateWindow(WebView view, boolean isDialog, boolean isUserGesture, Message resultMsg) {
throw new RuntimeException("Stub!");
}

public void onRequestFocus(WebView view) {
throw new RuntimeException("Stub!");
}

public void onCloseWindow(WebView window) {
throw new RuntimeException("Stub!");
}

public boolean onJsAlert(WebView view, String url, String message, JsResult result) {
throw new RuntimeException("Stub!");
}

public boolean onJsConfirm(WebView view, String url, String message, JsResult result) {
throw new RuntimeException("Stub!");
}

public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, JsPromptResult result) {
throw new RuntimeException("Stub!");
}

public boolean onJsBeforeUnload(WebView view, String url, String message, JsResult result) {
throw new RuntimeException("Stub!");
}

public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
throw new RuntimeException("Stub!");
}

public void onGeolocationPermissionsHidePrompt() {
throw new RuntimeException("Stub!");
}

public void onPermissionRequest(PermissionRequest request) {
throw new RuntimeException("Stub!");
}

public void onPermissionRequestCanceled(PermissionRequest request) {
throw new RuntimeException("Stub!");
}

public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
throw new RuntimeException("Stub!");
}

@Nullable
public Bitmap getDefaultVideoPoster() {
throw new RuntimeException("Stub!");
}

@Nullable
public View getVideoLoadingProgressView() {
throw new RuntimeException("Stub!");
}

public void getVisitedHistory(ValueCallback<String[]> callback) {
throw new RuntimeException("Stub!");
}

public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, FileChooserParams fileChooserParams) {
throw new RuntimeException("Stub!");
}

public abstract static class FileChooserParams {
public static final int MODE_OPEN = 0;
public static final int MODE_OPEN_MULTIPLE = 1;
public static final int MODE_SAVE = 3;

public FileChooserParams() {
throw new RuntimeException("Stub!");
}

@Nullable
public static Uri[] parseResult(int resultCode, Intent data) {
throw new RuntimeException("Stub!");
}

public abstract int getMode();

public abstract String[] getAcceptTypes();

public abstract boolean isCaptureEnabled();

@Nullable
public abstract CharSequence getTitle();

@Nullable
public abstract String getFilenameHint();

public abstract Intent createIntent();
}

public interface CustomViewCallback {
void onCustomViewHidden();
}
}
Loading
Loading