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
refactor source tree organization, switch to meson
This commit is contained in:
172
src/api-impl/android/app/Activity.java
Normal file
172
src/api-impl/android/app/Activity.java
Normal file
@@ -0,0 +1,172 @@
|
||||
package android.app;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import android.widget.TextView;
|
||||
import android.view.View;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.WindowManagerImpl;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserFactory;
|
||||
|
||||
import java.io.FileReader;
|
||||
import java.io.StringReader;
|
||||
|
||||
public class Activity extends Context {
|
||||
LayoutInflater layout_inflater;
|
||||
Window window = new Window();
|
||||
|
||||
protected void set_window(long native_window) {
|
||||
window.native_window = native_window;
|
||||
}
|
||||
|
||||
public Activity() {
|
||||
layout_inflater = new LayoutInflater();
|
||||
}
|
||||
|
||||
public View root_view;
|
||||
|
||||
public final Application getApplication () {
|
||||
return (Application)getApplicationContext();
|
||||
}
|
||||
|
||||
public WindowManager getWindowManager() {
|
||||
return new WindowManagerImpl();
|
||||
}
|
||||
|
||||
public ComponentName getComponentName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Intent getIntent() {
|
||||
return null; // this is the main activity, and it wasn't opened as a result of someone calling "open with"
|
||||
// return new Intent();
|
||||
}
|
||||
|
||||
public boolean isFinishing() {
|
||||
return false; // FIXME
|
||||
}
|
||||
|
||||
public final boolean requestWindowFeature(int featureId) {
|
||||
return false; // whatever feature it is, it's probably not supported
|
||||
}
|
||||
|
||||
public final void setVolumeControlStream(int streamType) {}
|
||||
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
System.out.println("- onCreate - yay!");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
protected void onStart() {
|
||||
System.out.println("- onStart - yay!");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
protected void onRestart() {
|
||||
System.out.println("- onRestart - yay!");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
protected void onResume() {
|
||||
System.out.println("- onResume - yay!");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
protected void onPause() {
|
||||
System.out.println("- onPause - yay!");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
protected void onStop() {
|
||||
System.out.println("- onStop - yay!");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
protected void onDestroy() {
|
||||
System.out.println("- onDestroy - yay!");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
public void onWindowFocusChanged(boolean hasFocus) {
|
||||
System.out.println("- onWindowFocusChanged - yay! (hasFocus: "+hasFocus+")");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* --- */
|
||||
|
||||
public void setContentView(int layoutResID) throws Exception {
|
||||
System.out.println("- setContentView - yay!");
|
||||
|
||||
String layout_xml_file = "data/" + getString(layoutResID);
|
||||
|
||||
System.out.println("loading layout from: " + layout_xml_file);
|
||||
|
||||
XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
|
||||
factory.setNamespaceAware(true);
|
||||
XmlPullParser xpp = factory.newPullParser();
|
||||
|
||||
xpp.setInput( new FileReader(layout_xml_file) );
|
||||
|
||||
root_view = layout_inflater.inflate(xpp, null, false);
|
||||
|
||||
System.out.println("~~~~~~~~~~~");
|
||||
System.out.println(root_view);
|
||||
System.out.println(root_view.widget);
|
||||
System.out.println("~~~~~~~~~~~");
|
||||
|
||||
setContentView(root_view);
|
||||
|
||||
/* Window w = new Window();
|
||||
w.setTitle(this.toString());
|
||||
w.setDefaultSize(540, 960);
|
||||
w.add(root_view.widget);
|
||||
w.showAll();
|
||||
|
||||
|
||||
w.connect(new Window.DeleteEvent() {
|
||||
public boolean onDeleteEvent(Widget source, Event event) {
|
||||
Gtk.mainQuit();
|
||||
return false;
|
||||
}
|
||||
});*/
|
||||
}
|
||||
|
||||
public void setContentView(View view) {
|
||||
window.setContentView(view);
|
||||
}
|
||||
|
||||
public <T extends android.view.View> T findViewById(int id) {
|
||||
System.out.println("- findViewById - asked for view with id: " + id);
|
||||
View view = View.view_by_id.get(id);
|
||||
System.out.println("- findViewById - found this: " + view);
|
||||
|
||||
return (T) view;
|
||||
}
|
||||
|
||||
public void invalidateOptionsMenu() {
|
||||
System.out.println("invalidateOptionsMenu() called, should we do something?");
|
||||
}
|
||||
|
||||
public Window getWindow() {
|
||||
return this.window;
|
||||
}
|
||||
|
||||
public final void runOnUiThread(Runnable action) {
|
||||
action.run(); // FIXME: running synchronously for now
|
||||
}
|
||||
}
|
||||
5
src/api-impl/android/app/ActivityManager.java
Normal file
5
src/api-impl/android/app/ActivityManager.java
Normal file
@@ -0,0 +1,5 @@
|
||||
package android.app;
|
||||
|
||||
public class ActivityManager {
|
||||
|
||||
}
|
||||
45
src/api-impl/android/app/AlertDialog.java
Normal file
45
src/api-impl/android/app/AlertDialog.java
Normal file
@@ -0,0 +1,45 @@
|
||||
package android.app;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.view.View;
|
||||
|
||||
public class AlertDialog extends Dialog {
|
||||
public static class Builder {
|
||||
public Builder(Context context){
|
||||
System.out.println("making an AlertDialog$Builder as we speak, my word!");
|
||||
}
|
||||
|
||||
public AlertDialog.Builder setPositiveButton (int textId, DialogInterface.OnClickListener listener) {
|
||||
return this;
|
||||
}
|
||||
|
||||
public AlertDialog.Builder setPositiveButton (CharSequence text, DialogInterface.OnClickListener listener) {
|
||||
return this;
|
||||
}
|
||||
|
||||
public AlertDialog.Builder setCancelable (boolean cancelable) {
|
||||
return this;
|
||||
}
|
||||
|
||||
public AlertDialog.Builder setIcon (int iconId) {
|
||||
return this;
|
||||
}
|
||||
|
||||
public AlertDialog.Builder setTitle (CharSequence title) {
|
||||
return this;
|
||||
}
|
||||
|
||||
public AlertDialog.Builder setMessage (CharSequence message) {
|
||||
return this;
|
||||
}
|
||||
|
||||
public AlertDialog.Builder setView (View view) {
|
||||
return this;
|
||||
}
|
||||
|
||||
public AlertDialog create() {
|
||||
return new AlertDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
7
src/api-impl/android/app/Application.java
Normal file
7
src/api-impl/android/app/Application.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package android.app;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
public class Application extends Context {
|
||||
|
||||
}
|
||||
19
src/api-impl/android/app/Dialog.java
Normal file
19
src/api-impl/android/app/Dialog.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package android.app;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
public class Dialog {
|
||||
public void show() {
|
||||
System.out.println("totally showing the Dialog "+this+" right now, most definitely doing that");
|
||||
}
|
||||
|
||||
public void dismiss() {
|
||||
System.out.println("totally dismissing the Dialog "+this+" right now, which was most definitely being shown just a moment ago");
|
||||
}
|
||||
|
||||
public class Builder {
|
||||
public Builder(Context context){
|
||||
System.out.println("making a Dialog$Builder as we speak, my word!");
|
||||
}
|
||||
}
|
||||
}
|
||||
5
src/api-impl/android/app/IntentService.java
Normal file
5
src/api-impl/android/app/IntentService.java
Normal file
@@ -0,0 +1,5 @@
|
||||
package android.app;
|
||||
|
||||
public abstract class IntentService {
|
||||
|
||||
}
|
||||
7
src/api-impl/android/app/KeyguardManager.java
Normal file
7
src/api-impl/android/app/KeyguardManager.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package android.app;
|
||||
|
||||
public class KeyguardManager {
|
||||
public boolean inKeyguardRestrictedInputMode() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
21
src/api-impl/android/app/PendingIntent.java
Normal file
21
src/api-impl/android/app/PendingIntent.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package android.app;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentSender;
|
||||
|
||||
public class PendingIntent {
|
||||
public static PendingIntent getBroadcast(Context context, int requestCode, Intent intent, int flags) {
|
||||
return new PendingIntent();
|
||||
}
|
||||
|
||||
public IntentSender getIntentSender() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void send (Context context, int code, Intent intent) {}
|
||||
|
||||
public class CanceledException extends Exception {
|
||||
|
||||
}
|
||||
}
|
||||
4
src/api-impl/android/app/ProgressDialog.java
Normal file
4
src/api-impl/android/app/ProgressDialog.java
Normal file
@@ -0,0 +1,4 @@
|
||||
package android.app;
|
||||
|
||||
public class ProgressDialog extends Dialog {
|
||||
}
|
||||
5
src/api-impl/android/app/Service.java
Normal file
5
src/api-impl/android/app/Service.java
Normal file
@@ -0,0 +1,5 @@
|
||||
package android.app;
|
||||
|
||||
public class Service {
|
||||
|
||||
}
|
||||
624
src/api-impl/android/app/SharedPreferencesImpl.java
Normal file
624
src/api-impl/android/app/SharedPreferencesImpl.java
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user