You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
add Java APIs needed for WhatsApp MainActivity and ConversationActivity
This commit is contained in:
@@ -33,7 +33,7 @@ import java.util.Map;
|
||||
|
||||
public class Activity extends ContextThemeWrapper implements Window.Callback {
|
||||
LayoutInflater layout_inflater;
|
||||
Window window = new Window(this);
|
||||
Window window = new Window(this, this);
|
||||
int requested_orientation = -1 /*ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED*/; // dummy
|
||||
public Intent intent;
|
||||
private Activity resultActivity;
|
||||
@@ -369,9 +369,10 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
nativeFinish(getWindow().native_window);
|
||||
getWindow().setContentView(null);
|
||||
window = null;
|
||||
if (window != null) {
|
||||
nativeFinish(getWindow().native_window);
|
||||
window = null;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -529,6 +530,14 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
|
||||
|
||||
public void overridePendingTransition(int enterAnim, int exitAnim) {}
|
||||
|
||||
public boolean isTaskRoot() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void postponeEnterTransition() {}
|
||||
|
||||
public void startPostponedEnterTransition() {}
|
||||
|
||||
private native void nativeFinish(long native_window);
|
||||
public static native void nativeRecreateActivity(Activity activity);
|
||||
public static native void nativeStartActivity(Activity activity);
|
||||
|
||||
@@ -20,6 +20,10 @@ public class ActivityManager {
|
||||
public long availMem = 10000;
|
||||
|
||||
public long totalMem = 10000;
|
||||
|
||||
public long threshold = 200;
|
||||
|
||||
public boolean lowMemory = false;
|
||||
}
|
||||
|
||||
public void getMemoryInfo(MemoryInfo outInfo)
|
||||
|
||||
6
src/api-impl/android/app/DatePickerDialog.java
Normal file
6
src/api-impl/android/app/DatePickerDialog.java
Normal file
@@ -0,0 +1,6 @@
|
||||
package android.app;
|
||||
|
||||
public class DatePickerDialog {
|
||||
|
||||
public interface OnDateSetListener {}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ public class Dialog implements Window.Callback, DialogInterface {
|
||||
public Dialog(Context context, int themeResId) {
|
||||
this.context = context;
|
||||
nativePtr = nativeInit();
|
||||
window = new Window(this);
|
||||
window = new Window(context, this);
|
||||
window.native_window = nativePtr;
|
||||
}
|
||||
|
||||
|
||||
@@ -188,6 +188,8 @@ public class Notification implements Parcelable {
|
||||
|
||||
public Builder addExtras(Bundle extras) {return this;}
|
||||
|
||||
public Builder addRemoteInput(RemoteInput remoteInput) {return this;}
|
||||
|
||||
public Action build() {
|
||||
return action;
|
||||
}
|
||||
@@ -210,5 +212,19 @@ public class Notification implements Parcelable {
|
||||
public BigTextStyle setBigContentTitle(CharSequence title) {return this;}
|
||||
|
||||
public BigTextStyle bigText(CharSequence text) {return this;}
|
||||
|
||||
public BigTextStyle setSummaryText(CharSequence summaryText) {return this;}
|
||||
}
|
||||
|
||||
public static class InboxStyle extends Style {
|
||||
|
||||
public InboxStyle(Notification.Builder builder) {}
|
||||
|
||||
public InboxStyle setBigContentTitle(CharSequence title) {return this;}
|
||||
|
||||
public InboxStyle setSummaryText(CharSequence summaryText) {return this;}
|
||||
|
||||
public InboxStyle addLine(CharSequence line) {return this;}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
23
src/api-impl/android/app/RemoteInput.java
Normal file
23
src/api-impl/android/app/RemoteInput.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package android.app;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
public class RemoteInput {
|
||||
|
||||
public static class Builder {
|
||||
|
||||
public Builder(String resultKey) {}
|
||||
|
||||
public Builder setLabel(CharSequence label) {return this;}
|
||||
|
||||
public Builder setChoices(CharSequence[] choices) {return this;}
|
||||
|
||||
public Builder setAllowFreeFormInput(boolean allowFreeFormInput) {return this;}
|
||||
|
||||
public Builder addExtras(Bundle extras) {return this;}
|
||||
|
||||
public RemoteInput build() {
|
||||
return new RemoteInput();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,4 +40,8 @@ public abstract class Service extends Context {
|
||||
public void stopSelf() {
|
||||
System.out.println("Service.stopSelf() called");
|
||||
}
|
||||
|
||||
public void attachBaseContext(Context newBase) {
|
||||
System.out.println("Service.attachBaseContext(" + newBase + ") called");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user