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
misc stubbing
This commit is contained in:
@@ -3,5 +3,9 @@ package android.app;
|
||||
import android.content.Context;
|
||||
|
||||
public class Application extends Context {
|
||||
public interface ActivityLifecycleCallbacks {}
|
||||
|
||||
public void registerActivityLifecycleCallbacks(Application.ActivityLifecycleCallbacks callback) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
package android.content;
|
||||
|
||||
public class ContentResolver {
|
||||
import android.net.Uri;
|
||||
import android.database.ContentObserver;
|
||||
|
||||
public class ContentResolver {
|
||||
public final void registerContentObserver(Uri uri, boolean notifyForDescendants, ContentObserver observer) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ public class Context extends Object {
|
||||
static DisplayMetrics dm;
|
||||
static Configuration config;
|
||||
static Resources r;
|
||||
static ApplicationInfo application_info;
|
||||
|
||||
static String apk_path = "/tmp/APK_PATH_SHOULD_HAVE_BEEN_FILLED_IN_BY_CODE_IN_main.c/";
|
||||
|
||||
@@ -59,14 +60,21 @@ public class Context extends Object {
|
||||
config = new Configuration();
|
||||
r = new Resources(assets, dm, config);
|
||||
this_application = new Application(); // TODO: the application context is presumably not identical to the Activity context, what is the difference for us though?
|
||||
application_info = new ApplicationInfo();
|
||||
}
|
||||
|
||||
public Context() {
|
||||
System.out.println("new Context! this one is: " + this);
|
||||
}
|
||||
|
||||
public Resources.Theme getTheme() {
|
||||
return r.newTheme();
|
||||
}
|
||||
|
||||
public ApplicationInfo getApplicationInfo () {
|
||||
return new ApplicationInfo();
|
||||
// TODO: do this somewhere saner?
|
||||
application_info.nativeLibraryDir = (new File(getDataDirFile(), "lib")).getAbsolutePath();
|
||||
return application_info;
|
||||
}
|
||||
|
||||
public Context getApplicationContext() {
|
||||
|
||||
@@ -118,4 +118,15 @@ public class Intent {
|
||||
return this; //??
|
||||
}
|
||||
|
||||
public String getStringExtra(String name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Uri getData() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean getBooleanExtra(String name, boolean defaultValue) {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1258,8 +1258,8 @@ public class Resources {
|
||||
int len = attrs.length;
|
||||
TypedArray array = getCachedStyledAttributes(len);
|
||||
array.mRsrcs = attrs;
|
||||
AssetManager.applyStyle(mTheme, 0, 0, 0, attrs,
|
||||
array.mData, array.mIndices);
|
||||
/* AssetManager.applyStyle(mTheme, 0, 0, 0, attrs,
|
||||
array.mData, array.mIndices);*/
|
||||
return array;
|
||||
}
|
||||
|
||||
@@ -1288,7 +1288,7 @@ public class Resources {
|
||||
int len = attrs.length;
|
||||
TypedArray array = getCachedStyledAttributes(len);
|
||||
array.mRsrcs = attrs;
|
||||
|
||||
/*
|
||||
AssetManager.applyStyle(mTheme, 0, resid, 0, attrs,
|
||||
array.mData, array.mIndices);
|
||||
if (false) {
|
||||
@@ -1316,7 +1316,7 @@ public class Resources {
|
||||
+ "=" + value;
|
||||
}
|
||||
System.out.println(s);
|
||||
}
|
||||
}*/
|
||||
return array;
|
||||
}
|
||||
|
||||
@@ -1372,7 +1372,7 @@ public class Resources {
|
||||
int[] attrs, int defStyleAttr, int defStyleRes) {
|
||||
int len = attrs.length;
|
||||
TypedArray array = getCachedStyledAttributes(len);
|
||||
|
||||
/*
|
||||
// XXX note that for now we only work with compiled XML files.
|
||||
// To support generic XML files we will need to manually parse
|
||||
// out the attributes from the XML file (applying type information
|
||||
@@ -1414,7 +1414,7 @@ public class Resources {
|
||||
}
|
||||
System.out.println(s);
|
||||
}
|
||||
|
||||
*/
|
||||
return array;
|
||||
}
|
||||
|
||||
@@ -1465,7 +1465,7 @@ public class Resources {
|
||||
|
||||
/*package*/ Theme() {
|
||||
mAssets = Resources.this.mAssets;
|
||||
mTheme = mAssets.createTheme();
|
||||
mTheme = 0/*mAssets.createTheme()*/;
|
||||
}
|
||||
|
||||
private final AssetManager mAssets;
|
||||
|
||||
11
src/api-impl/android/database/ContentObserver.java
Normal file
11
src/api-impl/android/database/ContentObserver.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package android.database;
|
||||
|
||||
import android.os.Handler;
|
||||
|
||||
public class ContentObserver {
|
||||
public ContentObserver() {
|
||||
}
|
||||
|
||||
public ContentObserver(Handler handler) {
|
||||
}
|
||||
}
|
||||
@@ -16,17 +16,14 @@
|
||||
|
||||
package android.database;
|
||||
|
||||
//import android.content.ContentResolver;
|
||||
//import android.net.Uri;
|
||||
import android.database.ContentObserver;
|
||||
import android.content.ContentResolver;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
||||
import java.io.Closeable;
|
||||
|
||||
class Uri {}
|
||||
class ContentResolver {}
|
||||
|
||||
class CharArrayBuffer {}
|
||||
class ContentObserver {}
|
||||
class DataSetObserver {}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package android.hardware.display;
|
||||
|
||||
public final class DisplayManager {
|
||||
public static interface DisplayListener {}
|
||||
}
|
||||
@@ -7,4 +7,8 @@ public class AudioManager {
|
||||
public int getRingerMode() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getStreamVolume (int streamType) {
|
||||
return 0; // arbitrary, shouldn't matter too much?
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ public class Handler {
|
||||
*/
|
||||
public Handler(Looper looper, Callback callback, boolean async) {
|
||||
mLooper = looper;
|
||||
mQueue = looper.mQueue;
|
||||
mQueue = null/*looper.mQueue*/;
|
||||
mCallback = callback;
|
||||
mAsynchronous = async;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package android.provider;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.net.Uri;
|
||||
import android.util.AndroidException;
|
||||
|
||||
public class Settings {
|
||||
@@ -25,14 +26,29 @@ public class Settings {
|
||||
}
|
||||
}
|
||||
public static final class System {
|
||||
public static final Uri CONTENT_URI = null;//Uri.parse("content://settings/system");
|
||||
|
||||
public static int getInt(ContentResolver cr, String key, int def) {
|
||||
java.lang.System.out.println("!!!! Settings$System.getInt(def: "+def+"): unknown key: >"+key+"<");
|
||||
int ret = getInt(cr, key);
|
||||
if(ret != -1) {
|
||||
return ret;
|
||||
} else {
|
||||
return def; // FIXME
|
||||
}
|
||||
}
|
||||
|
||||
public static int getInt(ContentResolver cr, String key) {
|
||||
switch(key) {
|
||||
case "accelerometer_rotation":
|
||||
return 0; // degrees? no clue
|
||||
default:
|
||||
java.lang.System.out.println("!!!! Settings$System.getInt: unknown key: >"+key+"<");
|
||||
return 0;
|
||||
return 0; // TODO: should be -1 probably?
|
||||
}
|
||||
}
|
||||
|
||||
public static Uri getUriFor(String name) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
5
src/api-impl/android/telephony/PhoneStateListener.java
Normal file
5
src/api-impl/android/telephony/PhoneStateListener.java
Normal file
@@ -0,0 +1,5 @@
|
||||
package android.telephony;
|
||||
|
||||
public class PhoneStateListener {
|
||||
|
||||
}
|
||||
5
src/api-impl/android/view/Choreographer.java
Normal file
5
src/api-impl/android/view/Choreographer.java
Normal file
@@ -0,0 +1,5 @@
|
||||
package android.view;
|
||||
|
||||
public final class Choreographer {
|
||||
public static interface FrameCallback {}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package android.view;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.LayoutDirection;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Canvas;
|
||||
|
||||
@@ -746,6 +747,10 @@ public class View extends Object {
|
||||
native_set_size_request(MeasureSpec.getSize(measuredWidth), MeasureSpec.getSize(measuredHeight));
|
||||
}
|
||||
|
||||
public Resources getResources() {
|
||||
return Context.this_application.getResources();
|
||||
}
|
||||
|
||||
public native void setGravity(int gravity);
|
||||
public native void setOnTouchListener(OnTouchListener l);
|
||||
public native void setOnClickListener(OnClickListener l);
|
||||
@@ -758,6 +763,12 @@ public class View extends Object {
|
||||
|
||||
// --- stubs
|
||||
|
||||
public void setContentDescription(CharSequence contentDescription) {
|
||||
System.out.println("setContentDescription called with: >"+contentDescription+"<");
|
||||
}
|
||||
|
||||
public void setId(int id) {}
|
||||
|
||||
public void setOnKeyListener(OnKeyListener l) {}
|
||||
|
||||
public void setFocusable(boolean focusable) {}
|
||||
|
||||
@@ -49,13 +49,8 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
|
||||
|
||||
public native void addView(View child, int index, LayoutParams params);
|
||||
|
||||
public native void removeView(View view);/* {
|
||||
System.out.println("NOT_IMPLEMENTED: ViewGroup.removeView: Gtk4 doesn't have a generic function for removing a child of GtkView, so you must override this function in the actual widget's class");
|
||||
}*/
|
||||
public native void removeAllViews();/* {
|
||||
System.out.println("NOT_IMPLEMENTED: ViewGroup.removeAllViews: Gtk4 doesn't have a generic function for removing a child of GtkView, so you must override this function in the actual widget's class");
|
||||
new Exception().printStackTrace();
|
||||
}*/
|
||||
public native void removeView(View view);
|
||||
public native void removeAllViews();
|
||||
|
||||
public View getChildAt(int index) {
|
||||
return children.get(index);
|
||||
@@ -67,6 +62,10 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
|
||||
return new LayoutParams(/*getContext(), attrs*/);
|
||||
}
|
||||
|
||||
public void bringChildToFront(View child) {
|
||||
// TODO: actually implement this (might make sense to implement it in the subclasses instead), when applicable
|
||||
}
|
||||
|
||||
public static class LayoutParams {
|
||||
public static final int FILL_PARENT = -1;
|
||||
public static final int MATCH_PARENT = -1;
|
||||
|
||||
@@ -62,6 +62,7 @@ hax_jar = jar('hax', [
|
||||
'android/content/ServiceConnection.java',
|
||||
'android/content/SharedPreferences.java',
|
||||
'android/database/Cursor.java',
|
||||
'android/database/ContentObserver.java',
|
||||
'android/database/sqlite/DatabaseErrorHandler.java',
|
||||
'android/database/sqlite/SQLiteCursorDriver.java',
|
||||
'android/database/sqlite/SQLiteCursor.java',
|
||||
@@ -81,6 +82,7 @@ hax_jar = jar('hax', [
|
||||
'android/graphics/Rect.java',
|
||||
'android/graphics/Region.java',
|
||||
'android/graphics/Typeface.java',
|
||||
'android/hardware/display/DisplayManager.java',
|
||||
'android/hardware/SensorEventListener.java',
|
||||
'android/hardware/Sensor.java',
|
||||
'android/hardware/SensorManager.java',
|
||||
@@ -127,6 +129,7 @@ hax_jar = jar('hax', [
|
||||
'android/provider/Settings.java',
|
||||
'android/R.java',
|
||||
'android/support/v4/app/FragmentActivity.java',
|
||||
'android/telephony/PhoneStateListener.java',
|
||||
'android/telephony/TelephonyManager.java',
|
||||
'android/text/ClipboardManager.java',
|
||||
'android/text/GetChars.java',
|
||||
@@ -167,6 +170,7 @@ hax_jar = jar('hax', [
|
||||
'android/util/TypedValue.java',
|
||||
'android/util/Xml.java',
|
||||
'android/util/XmlPullAttributes.java',
|
||||
'android/view/Choreographer.java',
|
||||
'android/view/Display.java',
|
||||
'android/view/Gravity.java',
|
||||
'android/view/InputDevice.java',
|
||||
|
||||
Reference in New Issue
Block a user