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
api-impl: misc stubs/additions
This commit is contained in:
@@ -159,7 +159,6 @@ void activity_start(JNIEnv *env, jobject activity_object)
|
|||||||
activity_backlog = g_list_prepend(activity_backlog, _REF(activity_object));
|
activity_backlog = g_list_prepend(activity_backlog, _REF(activity_object));
|
||||||
|
|
||||||
activity_update_current(env);
|
activity_update_current(env);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_android_app_Activity_nativeFinish(JNIEnv *env, jobject this, jlong window)
|
JNIEXPORT void JNICALL Java_android_app_Activity_nativeFinish(JNIEnv *env, jobject this, jlong window)
|
||||||
|
|||||||
@@ -9,6 +9,10 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
#undef android_app_Activity_MODE_PRIVATE
|
#undef android_app_Activity_MODE_PRIVATE
|
||||||
#define android_app_Activity_MODE_PRIVATE 0L
|
#define android_app_Activity_MODE_PRIVATE 0L
|
||||||
|
#undef android_app_Activity_RESULT_CANCELED
|
||||||
|
#define android_app_Activity_RESULT_CANCELED 0L
|
||||||
|
#undef android_app_Activity_RESULT_OK
|
||||||
|
#define android_app_Activity_RESULT_OK -1L
|
||||||
/*
|
/*
|
||||||
* Class: android_app_Activity
|
* Class: android_app_Activity
|
||||||
* Method: nativeFinish
|
* Method: nativeFinish
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import android.net.Uri;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
|
import android.util.Slog;
|
||||||
import android.view.ContextThemeWrapper;
|
import android.view.ContextThemeWrapper;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
@@ -34,6 +35,11 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class Activity extends ContextThemeWrapper implements Window.Callback {
|
public class Activity extends ContextThemeWrapper implements Window.Callback {
|
||||||
|
private final static String TAG = "Activity";
|
||||||
|
|
||||||
|
public static final int RESULT_CANCELED = 0;
|
||||||
|
public static final int RESULT_OK = -1;
|
||||||
|
|
||||||
LayoutInflater layout_inflater;
|
LayoutInflater layout_inflater;
|
||||||
Window window = new Window(this, this);
|
Window window = new Window(this, this);
|
||||||
int requested_orientation = -1 /*ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED*/; // dummy
|
int requested_orientation = -1 /*ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED*/; // dummy
|
||||||
@@ -57,6 +63,7 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
|
|||||||
if (className == null) {
|
if (className == null) {
|
||||||
for (PackageParser.Activity activity: pkg.activities) {
|
for (PackageParser.Activity activity: pkg.activities) {
|
||||||
for (PackageParser.IntentInfo intent: activity.intents) {
|
for (PackageParser.IntentInfo intent: activity.intents) {
|
||||||
|
Slog.i(TAG, intent.toString());
|
||||||
if ((uri == null && intent.hasCategory("android.intent.category.LAUNCHER")) ||
|
if ((uri == null && intent.hasCategory("android.intent.category.LAUNCHER")) ||
|
||||||
(uri != null && intent.hasDataScheme(uri.getScheme()))) {
|
(uri != null && intent.hasDataScheme(uri.getScheme()))) {
|
||||||
className = activity.className;
|
className = activity.className;
|
||||||
@@ -149,7 +156,7 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
|
|||||||
public final void setVolumeControlStream(int streamType) {}
|
public final void setVolumeControlStream(int streamType) {}
|
||||||
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
System.out.println("- onCreate - yay!");
|
Slog.i(TAG, "- onCreate - yay!");
|
||||||
new ViewGroup(this).setId(R.id.content);
|
new ViewGroup(this).setId(R.id.content);
|
||||||
|
|
||||||
for (Fragment fragment : fragments) {
|
for (Fragment fragment : fragments) {
|
||||||
@@ -160,12 +167,12 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void onPostCreate(Bundle savedInstanceState) {
|
protected void onPostCreate(Bundle savedInstanceState) {
|
||||||
System.out.println("- onPostCreate - yay!");
|
Slog.i(TAG, "- onPostCreate - yay!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onStart() {
|
protected void onStart() {
|
||||||
System.out.println("- onStart - yay!");
|
Slog.i(TAG, "- onStart - yay!");
|
||||||
if (window.contentView != null)
|
if (window.contentView != null)
|
||||||
window.setContentView(window.contentView);
|
window.setContentView(window.contentView);
|
||||||
window.setTitle(title);
|
window.setTitle(title);
|
||||||
@@ -184,13 +191,13 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void onRestart() {
|
protected void onRestart() {
|
||||||
System.out.println("- onRestart - yay!");
|
Slog.i(TAG, "- onRestart - yay!");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
System.out.println("- onResume - yay!");
|
Slog.i(TAG, "- onResume - yay!");
|
||||||
|
|
||||||
for (Fragment fragment : fragments) {
|
for (Fragment fragment : fragments) {
|
||||||
fragment.onResume();
|
fragment.onResume();
|
||||||
@@ -201,12 +208,12 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void onPostResume() {
|
protected void onPostResume() {
|
||||||
System.out.println("- onPostResume - yay!");
|
Slog.i(TAG, "- onPostResume - yay!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
System.out.println("- onPause - yay!");
|
Slog.i(TAG, "- onPause - yay!");
|
||||||
|
|
||||||
for (Fragment fragment : fragments) {
|
for (Fragment fragment : fragments) {
|
||||||
fragment.onPause();
|
fragment.onPause();
|
||||||
@@ -217,7 +224,7 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void onStop() {
|
protected void onStop() {
|
||||||
System.out.println("- onStop - yay!");
|
Slog.i(TAG, "- onStop - yay!");
|
||||||
|
|
||||||
for (Fragment fragment : fragments) {
|
for (Fragment fragment : fragments) {
|
||||||
fragment.onStop();
|
fragment.onStop();
|
||||||
@@ -227,7 +234,7 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
System.out.println("- onDestroy - yay!");
|
Slog.i(TAG, "- onDestroy - yay!");
|
||||||
|
|
||||||
for (Fragment fragment : fragments) {
|
for (Fragment fragment : fragments) {
|
||||||
fragment.onDestroy();
|
fragment.onDestroy();
|
||||||
@@ -238,7 +245,7 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onWindowFocusChanged(boolean hasFocus) {
|
public void onWindowFocusChanged(boolean hasFocus) {
|
||||||
System.out.println("- onWindowFocusChanged - yay! (hasFocus: " + hasFocus + ")");
|
Slog.i(TAG, "- onWindowFocusChanged - yay! (hasFocus: " + hasFocus + ")");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -255,12 +262,12 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
|
|||||||
/* --- */
|
/* --- */
|
||||||
|
|
||||||
public void setContentView(int layoutResID) throws Exception {
|
public void setContentView(int layoutResID) throws Exception {
|
||||||
System.out.println("- setContentView - yay!");
|
Slog.i(TAG, "- setContentView - yay!");
|
||||||
|
|
||||||
root_view = layout_inflater.inflate(layoutResID, null, false);
|
root_view = layout_inflater.inflate(layoutResID, null, false);
|
||||||
|
|
||||||
System.out.println("~~~~~~~~~~~");
|
System.out.println("~~~~~~~~~~~");
|
||||||
System.out.println(root_view);
|
System.out.println(root_view.toString());
|
||||||
System.out.printf("%x\n", root_view.id);
|
System.out.printf("%x\n", root_view.id);
|
||||||
System.out.println("~~~~~~~~~~~");
|
System.out.println("~~~~~~~~~~~");
|
||||||
|
|
||||||
@@ -277,17 +284,17 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public <T extends android.view.View> T findViewById(int id) {
|
public <T extends android.view.View> T findViewById(int id) {
|
||||||
System.out.printf("- findViewById - asked for view with id: %x\n", id);
|
System.out.printf(TAG, "- findViewById - asked for view with id: %x\n", id);
|
||||||
View view = null;
|
View view = null;
|
||||||
if (window.contentView != null)
|
if (window.contentView != null)
|
||||||
view = window.contentView.findViewById(id);
|
view = window.contentView.findViewById(id);
|
||||||
System.out.println("- findViewById - found this: " + view);
|
Slog.i(TAG, "- findViewById - found this: " + view);
|
||||||
|
|
||||||
return (T)view;
|
return (T)view;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void invalidateOptionsMenu() {
|
public void invalidateOptionsMenu() {
|
||||||
System.out.println("invalidateOptionsMenu() called, should we do something?");
|
Slog.i(TAG, "invalidateOptionsMenu() called, should we do something?");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Window getWindow() {
|
public Window getWindow() {
|
||||||
@@ -317,7 +324,7 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void startActivityForResult(Intent intent, int requestCode, Bundle options) {
|
public void startActivityForResult(Intent intent, int requestCode, Bundle options) {
|
||||||
System.out.println("startActivityForResult(" + intent + ", " + requestCode + ") called");
|
Slog.i(TAG, "startActivityForResult(" + intent + ", " + requestCode + "," + options + ") called");
|
||||||
if (intent.getComponent() != null) {
|
if (intent.getComponent() != null) {
|
||||||
try {
|
try {
|
||||||
Class<? extends Activity> cls = Class.forName(intent.getComponent().getClassName()).asSubclass(Activity.class);
|
Class<? extends Activity> cls = Class.forName(intent.getComponent().getClassName()).asSubclass(Activity.class);
|
||||||
@@ -338,9 +345,8 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
|
|||||||
}
|
}
|
||||||
} else if (FILE_CHOOSER_ACTIONS.contains(intent.getAction())) {
|
} else if (FILE_CHOOSER_ACTIONS.contains(intent.getAction())) {
|
||||||
nativeFileChooser(FILE_CHOOSER_ACTIONS.indexOf(intent.getAction()), intent.getType(), intent.getStringExtra("android.intent.extra.TITLE"), requestCode);
|
nativeFileChooser(FILE_CHOOSER_ACTIONS.indexOf(intent.getAction()), intent.getType(), intent.getStringExtra("android.intent.extra.TITLE"), requestCode);
|
||||||
}
|
} else {
|
||||||
else {
|
Slog.i(TAG, "startActivityForResult: intent was not handled. Calling onActivityResult(RESULT_CANCELED).");
|
||||||
System.out.println("startActivityForResult: intent was not handled. Calling onActivityResult(RESULT_CANCELED).");
|
|
||||||
onActivityResult(requestCode, 0 /*RESULT_CANCELED*/, new Intent());
|
onActivityResult(requestCode, 0 /*RESULT_CANCELED*/, new Intent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -359,18 +365,18 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected Dialog onCreateDialog(int id) {
|
protected Dialog onCreateDialog(int id) {
|
||||||
System.out.println("Activity.onCreateDialog(" + id + ") called");
|
Slog.i(TAG, "Activity.onCreateDialog(" + id + ") called");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onPrepareDialog(int id, Dialog dialog) {
|
protected void onPrepareDialog(int id, Dialog dialog) {
|
||||||
System.out.println("Activity.onPrepareDialog(" + id + ") called");
|
Slog.i(TAG, "Activity.onPrepareDialog(" + id + ") called");
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<Integer, Dialog> dialogs = new HashMap<Integer, Dialog>();
|
private Map<Integer, Dialog> dialogs = new HashMap<Integer, Dialog>();
|
||||||
|
|
||||||
public final void showDialog(int id) {
|
public final void showDialog(int id) {
|
||||||
System.out.println("Activity.showDialog(" + id + ") called");
|
Slog.i(TAG, "Activity.showDialog(" + id + ") called");
|
||||||
Dialog dialog = dialogs.get(id);
|
Dialog dialog = dialogs.get(id);
|
||||||
if (dialog == null)
|
if (dialog == null)
|
||||||
dialogs.put(id, dialog = onCreateDialog(id));
|
dialogs.put(id, dialog = onCreateDialog(id));
|
||||||
@@ -416,7 +422,7 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onContentChanged() {
|
public void onContentChanged() {
|
||||||
System.out.println("- onContentChanged - yay!");
|
Slog.i(TAG, "- onContentChanged - yay!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
@@ -502,7 +508,7 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuOpened(int featureId, Menu menu) {
|
public boolean onMenuOpened(int featureId, Menu menu) {
|
||||||
System.out.println("onMenuOpened(" + featureId + ", " + menu + ") called");
|
Slog.i(TAG, "onMenuOpened(" + featureId + ", " + menu + ") called");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -513,11 +519,11 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
|
|||||||
Constructor<? extends Activity> constructor = cls.getConstructor();
|
Constructor<? extends Activity> constructor = cls.getConstructor();
|
||||||
Activity activity = constructor.newInstance();
|
Activity activity = constructor.newInstance();
|
||||||
activity.getWindow().native_window = getWindow().native_window;
|
activity.getWindow().native_window = getWindow().native_window;
|
||||||
System.out.println("activity.getWindow().native_window >"+activity.getWindow().native_window+"<");
|
Slog.i(TAG, "activity.getWindow().native_window >"+activity.getWindow().native_window+"<");
|
||||||
nativeFinish(0);
|
nativeFinish(0);
|
||||||
nativeStartActivity(activity);
|
nativeStartActivity(activity);
|
||||||
} catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
|
} catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
|
||||||
System.out.println("exception in Activity.recreate, this is kinda sus");
|
Slog.i(TAG, "exception in Activity.recreate, this is kinda sus");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
package android.app;
|
package android.app;
|
||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.content.pm.ConfigurationInfo;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.pm.ConfigurationInfo;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ActivityThread {
|
public class ActivityThread {
|
||||||
@@ -18,4 +20,8 @@ public class ActivityThread {
|
|||||||
public Application getApplication() {
|
public Application getApplication() {
|
||||||
return Context.this_application;
|
return Context.this_application;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Configuration getConfiguration() {
|
||||||
|
return Context.this_application.getResources().getConfiguration();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ public class FragmentManager {
|
|||||||
public FragmentManager(Activity activity) {
|
public FragmentManager(Activity activity) {
|
||||||
this.activity = activity;
|
this.activity = activity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Fragment findFragmentByTag(String tag) {
|
public Fragment findFragmentByTag(String tag) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ public class FragmentTransaction {
|
|||||||
public FragmentTransaction(Activity activity) {
|
public FragmentTransaction(Activity activity) {
|
||||||
this.activity = activity;
|
this.activity = activity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FragmentTransaction add(Fragment fragment, String string) {
|
public FragmentTransaction add(Fragment fragment, String string) {
|
||||||
fragment.activity = activity;
|
fragment.activity = activity;
|
||||||
activity.fragments.add(fragment);
|
activity.fragments.add(fragment);
|
||||||
|
|||||||
@@ -14,6 +14,18 @@ public class ProgressDialog extends AlertDialog {
|
|||||||
|
|
||||||
public void setIndeterminate(boolean indeterminate) {}
|
public void setIndeterminate(boolean indeterminate) {}
|
||||||
|
|
||||||
|
public static ProgressDialog show(Context context, CharSequence title, CharSequence message) {
|
||||||
|
return show(context, title, message, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ProgressDialog show(Context context, CharSequence title, CharSequence message, boolean indeterminate) {
|
||||||
|
return show(context, title, message, indeterminate, false, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ProgressDialog show(Context context, CharSequence title, CharSequence message, boolean indeterminate, boolean cancelable) {
|
||||||
|
return show(context, title, message, indeterminate, cancelable, null);
|
||||||
|
}
|
||||||
|
|
||||||
public static ProgressDialog show(Context context, CharSequence title, CharSequence message, boolean indeterminate, boolean cancelable, OnCancelListener cancelListener) {
|
public static ProgressDialog show(Context context, CharSequence title, CharSequence message, boolean indeterminate, boolean cancelable, OnCancelListener cancelListener) {
|
||||||
return new ProgressDialog(context);
|
return new ProgressDialog(context);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,13 +3,17 @@ package android.content;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
|
|
||||||
|
import android.accounts.Account;
|
||||||
import android.database.ContentObserver;
|
import android.database.ContentObserver;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
import android.os.CancellationSignal;
|
import android.os.CancellationSignal;
|
||||||
import android.os.ParcelFileDescriptor;
|
import android.os.ParcelFileDescriptor;
|
||||||
|
|
||||||
public class ContentResolver {
|
public class ContentResolver {
|
||||||
|
public static final String SYNC_EXTRAS_IGNORE_SETTINGS = "ignore_settings";
|
||||||
|
|
||||||
public final void registerContentObserver(Uri uri, boolean notifyForDescendants, ContentObserver observer) {
|
public final void registerContentObserver(Uri uri, boolean notifyForDescendants, ContentObserver observer) {
|
||||||
}
|
}
|
||||||
public final void unregisterContentObserver(ContentObserver observer) {
|
public final void unregisterContentObserver(ContentObserver observer) {
|
||||||
@@ -77,4 +81,17 @@ public class ContentResolver {
|
|||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void requestSync(Account account, String authority, Bundle extras) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void cancelSync(Account account, String authority) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setMasterSyncAutomatically(boolean sync) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isSyncActive(Account account, String authority) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -358,6 +358,10 @@ public class Context extends Object {
|
|||||||
return getCacheDir();
|
return getCacheDir();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public File[] getExternalCacheDirs() {
|
||||||
|
return new File[] {getCacheDir()};
|
||||||
|
}
|
||||||
|
|
||||||
public File getNoBackupFilesDir() {
|
public File getNoBackupFilesDir() {
|
||||||
if (nobackup_dir == null) {
|
if (nobackup_dir == null) {
|
||||||
nobackup_dir = new File(getDataDirFile(), "no_backup/" + getPackageName());
|
nobackup_dir = new File(getDataDirFile(), "no_backup/" + getPackageName());
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ import java.io.Serializable;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class Intent implements Parcelable {
|
public class Intent implements Parcelable {
|
||||||
|
public static final String ACTION_MAIN = "android.intent.action.MAIN";
|
||||||
|
public static final int FLAG_ACTIVITY_NEW_TASK = 0x10000000;
|
||||||
|
|
||||||
private ComponentName component;
|
private ComponentName component;
|
||||||
private Bundle extras = new Bundle();
|
private Bundle extras = new Bundle();
|
||||||
private String action;
|
private String action;
|
||||||
|
|||||||
@@ -2,11 +2,10 @@ package android.os;
|
|||||||
public final class Debug {
|
public final class Debug {
|
||||||
public static class MemoryInfo {
|
public static class MemoryInfo {
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Wait until a debugger attaches. As soon as the debugger attaches,
|
public static void waitForDebugger() {
|
||||||
* this returns, so you will need to place a breakpoint after the
|
}
|
||||||
* waitForDebugger() call if you want to start tracing immediately.
|
|
||||||
*/
|
|
||||||
public static class InstructionCount {
|
public static class InstructionCount {
|
||||||
public InstructionCount() {
|
public InstructionCount() {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,10 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class TelephonyManager {
|
public class TelephonyManager {
|
||||||
|
public static TelephonyManager getDefault() {
|
||||||
|
return new TelephonyManager();
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME: can we return null instead of ""?
|
// FIXME: can we return null instead of ""?
|
||||||
public String getNetworkOperator() {
|
public String getNetworkOperator() {
|
||||||
return "";
|
return "";
|
||||||
@@ -17,6 +21,10 @@ public class TelephonyManager {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSubscriberId() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
public int getPhoneType() {
|
public int getPhoneType() {
|
||||||
return 0; // PHONE_TYPE_NONE
|
return 0; // PHONE_TYPE_NONE
|
||||||
}
|
}
|
||||||
|
|||||||
40
src/api-impl/android/util/FloatProperty.java
Normal file
40
src/api-impl/android/util/FloatProperty.java
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2011 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package android.util;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An implementation of {@link android.util.Property} to be used specifically with fields of type
|
||||||
|
* <code>float</code>. This type-specific subclass enables performance benefit by allowing
|
||||||
|
* calls to a {@link #setValue(Object, float) setValue()} function that takes the primitive
|
||||||
|
* <code>float</code> type and avoids autoboxing and other overhead associated with the
|
||||||
|
* <code>Float</code> class.
|
||||||
|
*
|
||||||
|
* @param <T> The class on which the Property is declared.
|
||||||
|
*/
|
||||||
|
public abstract class FloatProperty<T> extends Property<T, Float> {
|
||||||
|
public FloatProperty(String name) {
|
||||||
|
super(Float.class, name);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* A type-specific variant of {@link #set(Object, Float)} that is faster when dealing
|
||||||
|
* with fields of type <code>float</code>.
|
||||||
|
*/
|
||||||
|
public abstract void setValue(T object, float value);
|
||||||
|
@Override
|
||||||
|
final public void set(T object, Float value) {
|
||||||
|
setValue(object, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -21,6 +21,7 @@ import android.os.Parcelable;
|
|||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.os.Vibrator;
|
import android.os.Vibrator;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
import android.util.FloatProperty;
|
||||||
import android.util.LayoutDirection;
|
import android.util.LayoutDirection;
|
||||||
import android.util.Property;
|
import android.util.Property;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
@@ -580,6 +581,28 @@ public class View implements Drawable.Callback {
|
|||||||
|
|
||||||
public static final int TEXT_DIRECTION_RTL = 4; // 0x4
|
public static final int TEXT_DIRECTION_RTL = 4; // 0x4
|
||||||
|
|
||||||
|
public static final Property<View, Float> SCALE_X = new FloatProperty<View>("scaleX") {
|
||||||
|
@Override
|
||||||
|
public void setValue(View object, float value) {
|
||||||
|
object.setScaleX(value);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Float get(View object) {
|
||||||
|
return object.getScaleX();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public static final Property<View, Float> SCALE_Y = new FloatProperty<View>("scaleY") {
|
||||||
|
@Override
|
||||||
|
public void setValue(View object, float value) {
|
||||||
|
object.setScaleY(value);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Float get(View object) {
|
||||||
|
return object.getScaleY();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// --- end of constants from android source
|
// --- end of constants from android source
|
||||||
|
|
||||||
// --- interfaces from android source
|
// --- interfaces from android source
|
||||||
@@ -613,8 +636,7 @@ public class View implements Drawable.Callback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static interface OnKeyListener {
|
public static interface OnKeyListener {
|
||||||
// TODO
|
boolean onKey(View v, int keyCode, KeyEvent event);
|
||||||
// boolean onKey(View v, int keyCode, KeyEvent event);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface OnLongClickListener {
|
public interface OnLongClickListener {
|
||||||
@@ -1580,6 +1602,16 @@ public class View implements Drawable.Callback {
|
|||||||
native_queueAllocate(widget);
|
native_queueAllocate(widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setX(float x) {
|
||||||
|
setTranslationX(x - left);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setY(float y) {
|
||||||
|
setTranslationY(y - top);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setAlpha(float alpha) {
|
public void setAlpha(float alpha) {
|
||||||
native_setVisibility(widget, visibility, alpha);
|
native_setVisibility(widget, visibility, alpha);
|
||||||
this.alpha = alpha;
|
this.alpha = alpha;
|
||||||
@@ -1721,6 +1753,9 @@ public class View implements Drawable.Callback {
|
|||||||
|
|
||||||
public void setHorizontalScrollBarEnabled(boolean enabled) {}
|
public void setHorizontalScrollBarEnabled(boolean enabled) {}
|
||||||
|
|
||||||
|
public void setVerticalScrollBarEnabled(boolean enabled) {}
|
||||||
|
|
||||||
|
|
||||||
public void postInvalidateOnAnimation() {
|
public void postInvalidateOnAnimation() {
|
||||||
postInvalidate();
|
postInvalidate();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ package android.view;
|
|||||||
|
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.graphics.Region;
|
import android.graphics.Region;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
|
|
||||||
@@ -494,9 +496,16 @@ public final class ViewTreeObserver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mOnGlobalLayoutListeners.add(listener);
|
mOnGlobalLayoutListeners.add(listener);
|
||||||
|
|
||||||
// hack: many Applications wait for the global layout before doing anything
|
// hack: many Applications wait for the global layout before doing anything
|
||||||
// so we dispatch the event immediately
|
// so we dispatch the event immediately
|
||||||
listener.onGlobalLayout();
|
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
listener.onGlobalLayout();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
package android.widget;
|
package android.widget;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
public class GridView extends AbsListView {
|
public class GridView extends AbsListView {
|
||||||
public GridView(Context context) {
|
public GridView(Context context) {
|
||||||
@@ -11,4 +14,19 @@ public class GridView extends AbsListView {
|
|||||||
public GridView(Context context, AttributeSet attributeSet) {
|
public GridView(Context context, AttributeSet attributeSet) {
|
||||||
super(context, attributeSet);
|
super(context, attributeSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GridView(Context context, AttributeSet attributeSet, int defStyleAttr) {
|
||||||
|
super(context, attributeSet, defStyleAttr);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getSelectedView() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
throw new UnsupportedOperationException("Unimplemented method 'getSelectedView'");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSelection(int position) {
|
||||||
|
setSelection(position, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ public class TextView extends View {
|
|||||||
public void setAllCaps(boolean allCaps) {
|
public void setAllCaps(boolean allCaps) {
|
||||||
String[] classesToRemove = {"ATL-text-uppercase"};
|
String[] classesToRemove = {"ATL-text-uppercase"};
|
||||||
native_removeClasses(widget, classesToRemove);
|
native_removeClasses(widget, classesToRemove);
|
||||||
|
|
||||||
if(allCaps){
|
if(allCaps){
|
||||||
native_addClass(widget, "ATL-text-uppercase");
|
native_addClass(widget, "ATL-text-uppercase");
|
||||||
}
|
}
|
||||||
@@ -351,4 +351,8 @@ public class TextView extends View {
|
|||||||
public int getPaintFlags() {return 0;}
|
public int getPaintFlags() {return 0;}
|
||||||
|
|
||||||
public void setPaintFlags(int flags) {}
|
public void setPaintFlags(int flags) {}
|
||||||
|
|
||||||
|
public int getLineHeight() {
|
||||||
|
return 10; // FIXME
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -400,6 +400,7 @@ hax_jar = jar('hax', [
|
|||||||
'android/util/DecompiledXmlResourceParser.java',
|
'android/util/DecompiledXmlResourceParser.java',
|
||||||
'android/util/DisplayMetrics.java',
|
'android/util/DisplayMetrics.java',
|
||||||
'android/util/FloatMath.java',
|
'android/util/FloatMath.java',
|
||||||
|
'android/util/FloatProperty.java',
|
||||||
'android/util/JsonReader.java',
|
'android/util/JsonReader.java',
|
||||||
'android/util/JsonScope.java',
|
'android/util/JsonScope.java',
|
||||||
'android/util/JsonToken.java',
|
'android/util/JsonToken.java',
|
||||||
@@ -516,6 +517,7 @@ hax_jar = jar('hax', [
|
|||||||
'android/widget/FilterQueryProvider.java',
|
'android/widget/FilterQueryProvider.java',
|
||||||
'android/widget/FrameLayout.java',
|
'android/widget/FrameLayout.java',
|
||||||
'android/widget/Gallery.java',
|
'android/widget/Gallery.java',
|
||||||
|
'android/widget/GridView.java',
|
||||||
'android/widget/HeaderViewListAdapter.java',
|
'android/widget/HeaderViewListAdapter.java',
|
||||||
'android/widget/HorizontalScrollView.java',
|
'android/widget/HorizontalScrollView.java',
|
||||||
'android/widget/ImageButton.java',
|
'android/widget/ImageButton.java',
|
||||||
@@ -588,5 +590,6 @@ hax_jar = jar('hax', [
|
|||||||
'-bootclasspath', bootclasspath,
|
'-bootclasspath', bootclasspath,
|
||||||
'-source', '1.8', '-target', '1.8',
|
'-source', '1.8', '-target', '1.8',
|
||||||
'-encoding', 'UTF-8',
|
'-encoding', 'UTF-8',
|
||||||
|
'-Xlint:-deprecation', # we implement deprecated APIs
|
||||||
'-h', join_paths(dir_base, 'src/api-impl-jni/generated_headers')
|
'-h', join_paths(dir_base, 'src/api-impl-jni/generated_headers')
|
||||||
])
|
])
|
||||||
|
|||||||
Reference in New Issue
Block a user