From 82744e9e5eeb775330dc28adaf8e4f4c8c83e5c7 Mon Sep 17 00:00:00 2001 From: Julian Winkler Date: Thu, 17 Aug 2023 10:46:24 +0200 Subject: [PATCH] add bunch of new java APIs: mostly stubs or copied from AOSP Many of these classes are only needed to be subclassed by androidx support library, which is used in many android apps --- .../android_graphics_Matrix.h | 8 - .../android_graphics_PorterDuffColorFilter.h | 21 + .../android_graphics_Region.h | 8 - .../android_widget_FrameLayout.h | 50 +++ .../android_widget_ImageView.h | 50 +++ .../android_widget_LinearLayout.h | 50 +++ src/api-impl-jni/util.c | 3 + src/api-impl-jni/widgets/WrapperWidget.c | 4 +- .../android/accounts/AccountManager.java | 5 + src/api-impl/android/animation/Animator.java | 9 + .../android/animation/AnimatorInflater.java | 11 + .../animation/AnimatorListenerAdapter.java | 56 +++ .../android/animation/LayoutTransition.java | 5 + .../android/animation/ValueAnimator.java | 33 ++ src/api-impl/android/app/Activity.java | 18 + src/api-impl/android/app/DownloadManager.java | 5 + src/api-impl/android/app/Fragment.java | 5 + src/api-impl/android/app/FragmentManager.java | 16 + .../android/app/FragmentTransaction.java | 12 + src/api-impl/android/app/SearchManager.java | 5 + src/api-impl/android/app/UiModeManager.java | 10 + .../android/app/WallpaperManager.java | 5 + .../app/admin/DevicePolicyManager.java | 5 + src/api-impl/android/content/Context.java | 7 + .../android/content/ContextWrapper.java | 14 + src/api-impl/android/content/Intent.java | 8 + .../android/content/pm/PackageManager.java | 30 +- src/api-impl/android/database/Cursor.java | 1 - .../android/database/DataSetObservable.java | 54 +++ .../android/database/DataSetObserver.java | 41 ++ src/api-impl/android/database/Observable.java | 83 ++++ src/api-impl/android/graphics/Color.java | 8 + src/api-impl/android/graphics/Matrix.java | 8 +- src/api-impl/android/graphics/Paint.java | 12 + src/api-impl/android/graphics/Path.java | 2 +- src/api-impl/android/graphics/PointF.java | 118 ++++++ .../graphics/PorterDuffColorFilter.java | 127 +++++++ src/api-impl/android/graphics/Region.java | 4 +- .../android/graphics/drawable/Animatable.java | 5 + .../graphics/drawable/ColorDrawable.java | 13 + .../android/graphics/drawable/Drawable.java | 45 ++- .../graphics/drawable/GradientDrawable.java | 17 + .../graphics/drawable/LayerDrawable.java | 14 + .../android/net/wifi/WifiManager.java | 5 + .../android/net/wifi/p2p/WifiP2pManager.java | 5 + src/api-impl/android/nfc/NfcManager.java | 5 + src/api-impl/android/os/DropBoxManager.java | 5 + .../android/os/storage/StorageManager.java | 5 + src/api-impl/android/text/TextUtils.java | 8 + .../method/PasswordTransformationMethod.java | 176 +++++++++ .../text/method/TransformationMethod.java | 47 +++ .../android/util/SparseBooleanArray.java | 355 +++++++++++++++++ src/api-impl/android/view/AbsSavedState.java | 5 + src/api-impl/android/view/ActionMode.java | 358 ++++++++++++++++++ .../android/view/ContextThemeWrapper.java | 12 + .../android/view/InflateException.java | 5 + src/api-impl/android/view/LayoutInflater.java | 56 ++- src/api-impl/android/view/Menu.java | 8 + src/api-impl/android/view/MenuInflater.java | 11 + src/api-impl/android/view/MenuItem.java | 11 + src/api-impl/android/view/SubMenu.java | 5 + src/api-impl/android/view/View.java | 114 ++++++ .../android/view/ViewConfiguration.java | 34 ++ src/api-impl/android/view/ViewGroup.java | 79 +++- src/api-impl/android/view/Window.java | 26 +- .../accessibility/AccessibilityManager.java | 5 + .../animation/DecelerateInterpolator.java | 5 + .../view/inputmethod/BaseInputConnection.java | 1 - .../view/inputmethod/InputMethodManager.java | 5 + .../view/textservice/TextServicesManager.java | 5 + src/api-impl/android/widget/AdapterView.java | 12 + src/api-impl/android/widget/Button.java | 17 + .../android/widget/CompoundButton.java | 17 + src/api-impl/android/widget/EdgeEffect.java | 17 + src/api-impl/android/widget/FrameLayout.java | 15 + .../android/widget/HorizontalScrollView.java | 18 + src/api-impl/android/widget/ImageButton.java | 20 + src/api-impl/android/widget/ImageView.java | 10 +- src/api-impl/android/widget/LinearLayout.java | 1 - src/api-impl/android/widget/ListView.java | 17 + src/api-impl/android/widget/OverScroller.java | 14 + src/api-impl/android/widget/PopupMenu.java | 146 +++++++ src/api-impl/android/widget/Scroller.java | 22 ++ src/api-impl/android/widget/SeekBar.java | 20 + src/api-impl/android/widget/TextView.java | 24 ++ src/api-impl/meson.build | 56 +++ .../xnet/provider/jsse/SSLParametersImpl.java | 5 + 87 files changed, 2746 insertions(+), 46 deletions(-) create mode 100644 src/api-impl-jni/generated_headers/android_graphics_PorterDuffColorFilter.h create mode 100644 src/api-impl/android/accounts/AccountManager.java create mode 100644 src/api-impl/android/animation/Animator.java create mode 100644 src/api-impl/android/animation/AnimatorInflater.java create mode 100644 src/api-impl/android/animation/AnimatorListenerAdapter.java create mode 100644 src/api-impl/android/animation/LayoutTransition.java create mode 100644 src/api-impl/android/animation/ValueAnimator.java create mode 100644 src/api-impl/android/app/DownloadManager.java create mode 100644 src/api-impl/android/app/Fragment.java create mode 100644 src/api-impl/android/app/FragmentManager.java create mode 100644 src/api-impl/android/app/FragmentTransaction.java create mode 100644 src/api-impl/android/app/SearchManager.java create mode 100644 src/api-impl/android/app/UiModeManager.java create mode 100644 src/api-impl/android/app/WallpaperManager.java create mode 100644 src/api-impl/android/app/admin/DevicePolicyManager.java create mode 100644 src/api-impl/android/content/ContextWrapper.java create mode 100644 src/api-impl/android/database/DataSetObservable.java create mode 100644 src/api-impl/android/database/DataSetObserver.java create mode 100644 src/api-impl/android/database/Observable.java create mode 100644 src/api-impl/android/graphics/PointF.java create mode 100644 src/api-impl/android/graphics/PorterDuffColorFilter.java create mode 100644 src/api-impl/android/graphics/drawable/Animatable.java create mode 100644 src/api-impl/android/graphics/drawable/ColorDrawable.java create mode 100644 src/api-impl/android/graphics/drawable/GradientDrawable.java create mode 100644 src/api-impl/android/graphics/drawable/LayerDrawable.java create mode 100644 src/api-impl/android/net/wifi/WifiManager.java create mode 100644 src/api-impl/android/net/wifi/p2p/WifiP2pManager.java create mode 100644 src/api-impl/android/nfc/NfcManager.java create mode 100644 src/api-impl/android/os/DropBoxManager.java create mode 100644 src/api-impl/android/os/storage/StorageManager.java create mode 100644 src/api-impl/android/text/method/PasswordTransformationMethod.java create mode 100644 src/api-impl/android/text/method/TransformationMethod.java create mode 100644 src/api-impl/android/util/SparseBooleanArray.java create mode 100644 src/api-impl/android/view/AbsSavedState.java create mode 100644 src/api-impl/android/view/ActionMode.java create mode 100644 src/api-impl/android/view/ContextThemeWrapper.java create mode 100644 src/api-impl/android/view/InflateException.java create mode 100644 src/api-impl/android/view/MenuInflater.java create mode 100644 src/api-impl/android/view/MenuItem.java create mode 100644 src/api-impl/android/view/SubMenu.java create mode 100644 src/api-impl/android/view/ViewConfiguration.java create mode 100644 src/api-impl/android/view/accessibility/AccessibilityManager.java create mode 100644 src/api-impl/android/view/animation/DecelerateInterpolator.java create mode 100644 src/api-impl/android/view/inputmethod/InputMethodManager.java create mode 100644 src/api-impl/android/view/textservice/TextServicesManager.java create mode 100644 src/api-impl/android/widget/AdapterView.java create mode 100644 src/api-impl/android/widget/Button.java create mode 100644 src/api-impl/android/widget/CompoundButton.java create mode 100644 src/api-impl/android/widget/EdgeEffect.java create mode 100644 src/api-impl/android/widget/HorizontalScrollView.java create mode 100644 src/api-impl/android/widget/ImageButton.java create mode 100644 src/api-impl/android/widget/ListView.java create mode 100644 src/api-impl/android/widget/OverScroller.java create mode 100644 src/api-impl/android/widget/PopupMenu.java create mode 100644 src/api-impl/android/widget/Scroller.java create mode 100644 src/api-impl/android/widget/SeekBar.java create mode 100644 src/api-impl/org/apache/harmony/xnet/provider/jsse/SSLParametersImpl.java diff --git a/src/api-impl-jni/generated_headers/android_graphics_Matrix.h b/src/api-impl-jni/generated_headers/android_graphics_Matrix.h index eeadbff0..0c3e594b 100644 --- a/src/api-impl-jni/generated_headers/android_graphics_Matrix.h +++ b/src/api-impl-jni/generated_headers/android_graphics_Matrix.h @@ -25,14 +25,6 @@ extern "C" { #define android_graphics_Matrix_MPERSP_1 7L #undef android_graphics_Matrix_MPERSP_2 #define android_graphics_Matrix_MPERSP_2 8L -/* - * Class: android_graphics_Matrix - * Method: native_create - * Signature: (I)I - */ -JNIEXPORT jint JNICALL Java_android_graphics_Matrix_native_1create - (JNIEnv *, jclass, jint); - /* * Class: android_graphics_Matrix * Method: native_isIdentity diff --git a/src/api-impl-jni/generated_headers/android_graphics_PorterDuffColorFilter.h b/src/api-impl-jni/generated_headers/android_graphics_PorterDuffColorFilter.h new file mode 100644 index 00000000..03f31aea --- /dev/null +++ b/src/api-impl-jni/generated_headers/android_graphics_PorterDuffColorFilter.h @@ -0,0 +1,21 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class android_graphics_PorterDuffColorFilter */ + +#ifndef _Included_android_graphics_PorterDuffColorFilter +#define _Included_android_graphics_PorterDuffColorFilter +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: android_graphics_PorterDuffColorFilter + * Method: native_CreatePorterDuffFilter + * Signature: (II)J + */ +JNIEXPORT jlong JNICALL Java_android_graphics_PorterDuffColorFilter_native_1CreatePorterDuffFilter + (JNIEnv *, jclass, jint, jint); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/api-impl-jni/generated_headers/android_graphics_Region.h b/src/api-impl-jni/generated_headers/android_graphics_Region.h index c30c6063..c590801d 100644 --- a/src/api-impl-jni/generated_headers/android_graphics_Region.h +++ b/src/api-impl-jni/generated_headers/android_graphics_Region.h @@ -89,14 +89,6 @@ JNIEXPORT void JNICALL Java_android_graphics_Region_scale JNIEXPORT jboolean JNICALL Java_android_graphics_Region_nativeEquals (JNIEnv *, jclass, jint, jint); -/* - * Class: android_graphics_Region - * Method: nativeConstructor - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_android_graphics_Region_nativeConstructor - (JNIEnv *, jclass); - /* * Class: android_graphics_Region * Method: nativeDestructor diff --git a/src/api-impl-jni/generated_headers/android_widget_FrameLayout.h b/src/api-impl-jni/generated_headers/android_widget_FrameLayout.h index 99745de1..2ab79984 100644 --- a/src/api-impl-jni/generated_headers/android_widget_FrameLayout.h +++ b/src/api-impl-jni/generated_headers/android_widget_FrameLayout.h @@ -149,6 +149,56 @@ extern "C" { #define android_widget_FrameLayout_PFLAG2_LAYOUT_DIRECTION_RESOLVED 32L #undef android_widget_FrameLayout_PFLAG2_LAYOUT_DIRECTION_RESOLVED_MASK #define android_widget_FrameLayout_PFLAG2_LAYOUT_DIRECTION_RESOLVED_MASK 48L +#undef android_widget_FrameLayout_STATUS_BAR_HIDDEN +#define android_widget_FrameLayout_STATUS_BAR_HIDDEN 1L +#undef android_widget_FrameLayout_STATUS_BAR_VISIBLE +#define android_widget_FrameLayout_STATUS_BAR_VISIBLE 0L +#undef android_widget_FrameLayout_SYSTEM_UI_FLAG_FULLSCREEN +#define android_widget_FrameLayout_SYSTEM_UI_FLAG_FULLSCREEN 4L +#undef android_widget_FrameLayout_SYSTEM_UI_FLAG_HIDE_NAVIGATION +#define android_widget_FrameLayout_SYSTEM_UI_FLAG_HIDE_NAVIGATION 2L +#undef android_widget_FrameLayout_SYSTEM_UI_FLAG_IMMERSIVE +#define android_widget_FrameLayout_SYSTEM_UI_FLAG_IMMERSIVE 2048L +#undef android_widget_FrameLayout_SYSTEM_UI_FLAG_IMMERSIVE_STICKY +#define android_widget_FrameLayout_SYSTEM_UI_FLAG_IMMERSIVE_STICKY 4096L +#undef android_widget_FrameLayout_SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN +#define android_widget_FrameLayout_SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN 1024L +#undef android_widget_FrameLayout_SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION +#define android_widget_FrameLayout_SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION 512L +#undef android_widget_FrameLayout_SYSTEM_UI_FLAG_LAYOUT_STABLE +#define android_widget_FrameLayout_SYSTEM_UI_FLAG_LAYOUT_STABLE 256L +#undef android_widget_FrameLayout_SYSTEM_UI_FLAG_LOW_PROFILE +#define android_widget_FrameLayout_SYSTEM_UI_FLAG_LOW_PROFILE 1L +#undef android_widget_FrameLayout_SYSTEM_UI_FLAG_VISIBLE +#define android_widget_FrameLayout_SYSTEM_UI_FLAG_VISIBLE 0L +#undef android_widget_FrameLayout_SYSTEM_UI_LAYOUT_FLAGS +#define android_widget_FrameLayout_SYSTEM_UI_LAYOUT_FLAGS 1536L +#undef android_widget_FrameLayout_TEXT_ALIGNMENT_CENTER +#define android_widget_FrameLayout_TEXT_ALIGNMENT_CENTER 4L +#undef android_widget_FrameLayout_TEXT_ALIGNMENT_GRAVITY +#define android_widget_FrameLayout_TEXT_ALIGNMENT_GRAVITY 1L +#undef android_widget_FrameLayout_TEXT_ALIGNMENT_INHERIT +#define android_widget_FrameLayout_TEXT_ALIGNMENT_INHERIT 0L +#undef android_widget_FrameLayout_TEXT_ALIGNMENT_TEXT_END +#define android_widget_FrameLayout_TEXT_ALIGNMENT_TEXT_END 3L +#undef android_widget_FrameLayout_TEXT_ALIGNMENT_TEXT_START +#define android_widget_FrameLayout_TEXT_ALIGNMENT_TEXT_START 2L +#undef android_widget_FrameLayout_TEXT_ALIGNMENT_VIEW_END +#define android_widget_FrameLayout_TEXT_ALIGNMENT_VIEW_END 6L +#undef android_widget_FrameLayout_TEXT_ALIGNMENT_VIEW_START +#define android_widget_FrameLayout_TEXT_ALIGNMENT_VIEW_START 5L +#undef android_widget_FrameLayout_TEXT_DIRECTION_ANY_RTL +#define android_widget_FrameLayout_TEXT_DIRECTION_ANY_RTL 2L +#undef android_widget_FrameLayout_TEXT_DIRECTION_FIRST_STRONG +#define android_widget_FrameLayout_TEXT_DIRECTION_FIRST_STRONG 1L +#undef android_widget_FrameLayout_TEXT_DIRECTION_INHERIT +#define android_widget_FrameLayout_TEXT_DIRECTION_INHERIT 0L +#undef android_widget_FrameLayout_TEXT_DIRECTION_LOCALE +#define android_widget_FrameLayout_TEXT_DIRECTION_LOCALE 5L +#undef android_widget_FrameLayout_TEXT_DIRECTION_LTR +#define android_widget_FrameLayout_TEXT_DIRECTION_LTR 3L +#undef android_widget_FrameLayout_TEXT_DIRECTION_RTL +#define android_widget_FrameLayout_TEXT_DIRECTION_RTL 4L /* * Class: android_widget_FrameLayout * Method: native_constructor diff --git a/src/api-impl-jni/generated_headers/android_widget_ImageView.h b/src/api-impl-jni/generated_headers/android_widget_ImageView.h index 021e0ed9..ef7845d0 100644 --- a/src/api-impl-jni/generated_headers/android_widget_ImageView.h +++ b/src/api-impl-jni/generated_headers/android_widget_ImageView.h @@ -149,6 +149,56 @@ extern "C" { #define android_widget_ImageView_PFLAG2_LAYOUT_DIRECTION_RESOLVED 32L #undef android_widget_ImageView_PFLAG2_LAYOUT_DIRECTION_RESOLVED_MASK #define android_widget_ImageView_PFLAG2_LAYOUT_DIRECTION_RESOLVED_MASK 48L +#undef android_widget_ImageView_STATUS_BAR_HIDDEN +#define android_widget_ImageView_STATUS_BAR_HIDDEN 1L +#undef android_widget_ImageView_STATUS_BAR_VISIBLE +#define android_widget_ImageView_STATUS_BAR_VISIBLE 0L +#undef android_widget_ImageView_SYSTEM_UI_FLAG_FULLSCREEN +#define android_widget_ImageView_SYSTEM_UI_FLAG_FULLSCREEN 4L +#undef android_widget_ImageView_SYSTEM_UI_FLAG_HIDE_NAVIGATION +#define android_widget_ImageView_SYSTEM_UI_FLAG_HIDE_NAVIGATION 2L +#undef android_widget_ImageView_SYSTEM_UI_FLAG_IMMERSIVE +#define android_widget_ImageView_SYSTEM_UI_FLAG_IMMERSIVE 2048L +#undef android_widget_ImageView_SYSTEM_UI_FLAG_IMMERSIVE_STICKY +#define android_widget_ImageView_SYSTEM_UI_FLAG_IMMERSIVE_STICKY 4096L +#undef android_widget_ImageView_SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN +#define android_widget_ImageView_SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN 1024L +#undef android_widget_ImageView_SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION +#define android_widget_ImageView_SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION 512L +#undef android_widget_ImageView_SYSTEM_UI_FLAG_LAYOUT_STABLE +#define android_widget_ImageView_SYSTEM_UI_FLAG_LAYOUT_STABLE 256L +#undef android_widget_ImageView_SYSTEM_UI_FLAG_LOW_PROFILE +#define android_widget_ImageView_SYSTEM_UI_FLAG_LOW_PROFILE 1L +#undef android_widget_ImageView_SYSTEM_UI_FLAG_VISIBLE +#define android_widget_ImageView_SYSTEM_UI_FLAG_VISIBLE 0L +#undef android_widget_ImageView_SYSTEM_UI_LAYOUT_FLAGS +#define android_widget_ImageView_SYSTEM_UI_LAYOUT_FLAGS 1536L +#undef android_widget_ImageView_TEXT_ALIGNMENT_CENTER +#define android_widget_ImageView_TEXT_ALIGNMENT_CENTER 4L +#undef android_widget_ImageView_TEXT_ALIGNMENT_GRAVITY +#define android_widget_ImageView_TEXT_ALIGNMENT_GRAVITY 1L +#undef android_widget_ImageView_TEXT_ALIGNMENT_INHERIT +#define android_widget_ImageView_TEXT_ALIGNMENT_INHERIT 0L +#undef android_widget_ImageView_TEXT_ALIGNMENT_TEXT_END +#define android_widget_ImageView_TEXT_ALIGNMENT_TEXT_END 3L +#undef android_widget_ImageView_TEXT_ALIGNMENT_TEXT_START +#define android_widget_ImageView_TEXT_ALIGNMENT_TEXT_START 2L +#undef android_widget_ImageView_TEXT_ALIGNMENT_VIEW_END +#define android_widget_ImageView_TEXT_ALIGNMENT_VIEW_END 6L +#undef android_widget_ImageView_TEXT_ALIGNMENT_VIEW_START +#define android_widget_ImageView_TEXT_ALIGNMENT_VIEW_START 5L +#undef android_widget_ImageView_TEXT_DIRECTION_ANY_RTL +#define android_widget_ImageView_TEXT_DIRECTION_ANY_RTL 2L +#undef android_widget_ImageView_TEXT_DIRECTION_FIRST_STRONG +#define android_widget_ImageView_TEXT_DIRECTION_FIRST_STRONG 1L +#undef android_widget_ImageView_TEXT_DIRECTION_INHERIT +#define android_widget_ImageView_TEXT_DIRECTION_INHERIT 0L +#undef android_widget_ImageView_TEXT_DIRECTION_LOCALE +#define android_widget_ImageView_TEXT_DIRECTION_LOCALE 5L +#undef android_widget_ImageView_TEXT_DIRECTION_LTR +#define android_widget_ImageView_TEXT_DIRECTION_LTR 3L +#undef android_widget_ImageView_TEXT_DIRECTION_RTL +#define android_widget_ImageView_TEXT_DIRECTION_RTL 4L /* * Class: android_widget_ImageView * Method: native_constructor diff --git a/src/api-impl-jni/generated_headers/android_widget_LinearLayout.h b/src/api-impl-jni/generated_headers/android_widget_LinearLayout.h index f6594b13..cc3731bd 100644 --- a/src/api-impl-jni/generated_headers/android_widget_LinearLayout.h +++ b/src/api-impl-jni/generated_headers/android_widget_LinearLayout.h @@ -149,6 +149,56 @@ extern "C" { #define android_widget_LinearLayout_PFLAG2_LAYOUT_DIRECTION_RESOLVED 32L #undef android_widget_LinearLayout_PFLAG2_LAYOUT_DIRECTION_RESOLVED_MASK #define android_widget_LinearLayout_PFLAG2_LAYOUT_DIRECTION_RESOLVED_MASK 48L +#undef android_widget_LinearLayout_STATUS_BAR_HIDDEN +#define android_widget_LinearLayout_STATUS_BAR_HIDDEN 1L +#undef android_widget_LinearLayout_STATUS_BAR_VISIBLE +#define android_widget_LinearLayout_STATUS_BAR_VISIBLE 0L +#undef android_widget_LinearLayout_SYSTEM_UI_FLAG_FULLSCREEN +#define android_widget_LinearLayout_SYSTEM_UI_FLAG_FULLSCREEN 4L +#undef android_widget_LinearLayout_SYSTEM_UI_FLAG_HIDE_NAVIGATION +#define android_widget_LinearLayout_SYSTEM_UI_FLAG_HIDE_NAVIGATION 2L +#undef android_widget_LinearLayout_SYSTEM_UI_FLAG_IMMERSIVE +#define android_widget_LinearLayout_SYSTEM_UI_FLAG_IMMERSIVE 2048L +#undef android_widget_LinearLayout_SYSTEM_UI_FLAG_IMMERSIVE_STICKY +#define android_widget_LinearLayout_SYSTEM_UI_FLAG_IMMERSIVE_STICKY 4096L +#undef android_widget_LinearLayout_SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN +#define android_widget_LinearLayout_SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN 1024L +#undef android_widget_LinearLayout_SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION +#define android_widget_LinearLayout_SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION 512L +#undef android_widget_LinearLayout_SYSTEM_UI_FLAG_LAYOUT_STABLE +#define android_widget_LinearLayout_SYSTEM_UI_FLAG_LAYOUT_STABLE 256L +#undef android_widget_LinearLayout_SYSTEM_UI_FLAG_LOW_PROFILE +#define android_widget_LinearLayout_SYSTEM_UI_FLAG_LOW_PROFILE 1L +#undef android_widget_LinearLayout_SYSTEM_UI_FLAG_VISIBLE +#define android_widget_LinearLayout_SYSTEM_UI_FLAG_VISIBLE 0L +#undef android_widget_LinearLayout_SYSTEM_UI_LAYOUT_FLAGS +#define android_widget_LinearLayout_SYSTEM_UI_LAYOUT_FLAGS 1536L +#undef android_widget_LinearLayout_TEXT_ALIGNMENT_CENTER +#define android_widget_LinearLayout_TEXT_ALIGNMENT_CENTER 4L +#undef android_widget_LinearLayout_TEXT_ALIGNMENT_GRAVITY +#define android_widget_LinearLayout_TEXT_ALIGNMENT_GRAVITY 1L +#undef android_widget_LinearLayout_TEXT_ALIGNMENT_INHERIT +#define android_widget_LinearLayout_TEXT_ALIGNMENT_INHERIT 0L +#undef android_widget_LinearLayout_TEXT_ALIGNMENT_TEXT_END +#define android_widget_LinearLayout_TEXT_ALIGNMENT_TEXT_END 3L +#undef android_widget_LinearLayout_TEXT_ALIGNMENT_TEXT_START +#define android_widget_LinearLayout_TEXT_ALIGNMENT_TEXT_START 2L +#undef android_widget_LinearLayout_TEXT_ALIGNMENT_VIEW_END +#define android_widget_LinearLayout_TEXT_ALIGNMENT_VIEW_END 6L +#undef android_widget_LinearLayout_TEXT_ALIGNMENT_VIEW_START +#define android_widget_LinearLayout_TEXT_ALIGNMENT_VIEW_START 5L +#undef android_widget_LinearLayout_TEXT_DIRECTION_ANY_RTL +#define android_widget_LinearLayout_TEXT_DIRECTION_ANY_RTL 2L +#undef android_widget_LinearLayout_TEXT_DIRECTION_FIRST_STRONG +#define android_widget_LinearLayout_TEXT_DIRECTION_FIRST_STRONG 1L +#undef android_widget_LinearLayout_TEXT_DIRECTION_INHERIT +#define android_widget_LinearLayout_TEXT_DIRECTION_INHERIT 0L +#undef android_widget_LinearLayout_TEXT_DIRECTION_LOCALE +#define android_widget_LinearLayout_TEXT_DIRECTION_LOCALE 5L +#undef android_widget_LinearLayout_TEXT_DIRECTION_LTR +#define android_widget_LinearLayout_TEXT_DIRECTION_LTR 3L +#undef android_widget_LinearLayout_TEXT_DIRECTION_RTL +#define android_widget_LinearLayout_TEXT_DIRECTION_RTL 4L /* * Class: android_widget_LinearLayout * Method: native_constructor diff --git a/src/api-impl-jni/util.c b/src/api-impl-jni/util.c index f0494f73..0e77a37b 100644 --- a/src/api-impl-jni/util.c +++ b/src/api-impl-jni/util.c @@ -4,6 +4,9 @@ struct handle_cache handle_cache = {0}; const char * attribute_set_get_string(JNIEnv *env, jobject attrs, char *attribute, char *schema) { + if (!attrs) + return NULL; + if(!schema) schema = "http://schemas.android.com/apk/res/android"; diff --git a/src/api-impl-jni/widgets/WrapperWidget.c b/src/api-impl-jni/widgets/WrapperWidget.c index 1e7617f4..d47bedca 100644 --- a/src/api-impl-jni/widgets/WrapperWidget.c +++ b/src/api-impl-jni/widgets/WrapperWidget.c @@ -137,6 +137,8 @@ void wrapper_widget_set_child(WrapperWidget *parent, GtkWidget *child) // TODO: gtk_widget_insert_before(child, GTK_WIDGET(parent), NULL); } +#define MEASURE_SPEC_EXACTLY (1 << 30) + static void on_mapped(GtkWidget* self, gpointer data) { WrapperWidget *wrapper = WRAPPER_WIDGET(self); @@ -144,7 +146,7 @@ static void on_mapped(GtkWidget* self, gpointer data) JNIEnv *env; (*wrapper->jvm)->GetEnv(wrapper->jvm, (void**)&env, JNI_VERSION_1_6); - (*env)->CallVoidMethod(env, wrapper->jobj, wrapper->measure_method, gtk_widget_get_width(self), gtk_widget_get_height(self)); + (*env)->CallVoidMethod(env, wrapper->jobj, wrapper->measure_method, MEASURE_SPEC_EXACTLY, MEASURE_SPEC_EXACTLY); } } diff --git a/src/api-impl/android/accounts/AccountManager.java b/src/api-impl/android/accounts/AccountManager.java new file mode 100644 index 00000000..bdea7432 --- /dev/null +++ b/src/api-impl/android/accounts/AccountManager.java @@ -0,0 +1,5 @@ +package android.accounts; + +public class AccountManager { + +} diff --git a/src/api-impl/android/animation/Animator.java b/src/api-impl/android/animation/Animator.java new file mode 100644 index 00000000..26245b90 --- /dev/null +++ b/src/api-impl/android/animation/Animator.java @@ -0,0 +1,9 @@ +package android.animation; + +public class Animator { + + public void setTarget(Object target) {} + + public void start() {} + +} diff --git a/src/api-impl/android/animation/AnimatorInflater.java b/src/api-impl/android/animation/AnimatorInflater.java new file mode 100644 index 00000000..c878bbdf --- /dev/null +++ b/src/api-impl/android/animation/AnimatorInflater.java @@ -0,0 +1,11 @@ +package android.animation; + +import android.content.Context; + +public class AnimatorInflater { + + public static Animator loadAnimator(Context context, int resId) { + return new Animator(); + } + +} diff --git a/src/api-impl/android/animation/AnimatorListenerAdapter.java b/src/api-impl/android/animation/AnimatorListenerAdapter.java new file mode 100644 index 00000000..4d86df97 --- /dev/null +++ b/src/api-impl/android/animation/AnimatorListenerAdapter.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2010 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.animation; + +/** + * This adapter class provides empty implementations of the methods from {@link android.animation.Animator.AnimatorListener}. + * Any custom listener that cares only about a subset of the methods of this listener can + * simply subclass this adapter class instead of implementing the interface directly. + */ +public abstract class AnimatorListenerAdapter /*implements Animator.AnimatorListener, + Animator.AnimatorPauseListener*/ { + /** + * {@inheritDoc} + */ + public void onAnimationCancel(Animator animation) { + } + /** + * {@inheritDoc} + */ + public void onAnimationEnd(Animator animation) { + } + /** + * {@inheritDoc} + */ + public void onAnimationRepeat(Animator animation) { + } + /** + * {@inheritDoc} + */ + public void onAnimationStart(Animator animation) { + } + /** + * {@inheritDoc} + */ + public void onAnimationPause(Animator animation) { + } + /** + * {@inheritDoc} + */ + public void onAnimationResume(Animator animation) { + } +} diff --git a/src/api-impl/android/animation/LayoutTransition.java b/src/api-impl/android/animation/LayoutTransition.java new file mode 100644 index 00000000..ada9d3b5 --- /dev/null +++ b/src/api-impl/android/animation/LayoutTransition.java @@ -0,0 +1,5 @@ +package android.animation; + +public class LayoutTransition { + +} diff --git a/src/api-impl/android/animation/ValueAnimator.java b/src/api-impl/android/animation/ValueAnimator.java new file mode 100644 index 00000000..f8eca733 --- /dev/null +++ b/src/api-impl/android/animation/ValueAnimator.java @@ -0,0 +1,33 @@ +package android.animation; + +public class ValueAnimator { + + public static ValueAnimator ofFloat(float... values) { + return new ValueAnimator(); + } + + public ValueAnimator setDuration(long duration) { + return this; + } + + public void addUpdateListener(AnimatorUpdateListener listener) {} + + public static long getFrameDelay() { + return 20; // 20ms frame interval + } + + /** + * Implementors of this interface can add themselves as update listeners + * to an ValueAnimator instance to receive callbacks on every animation + * frame, after the current frame's values have been calculated for that + * ValueAnimator. + */ + public static interface AnimatorUpdateListener { + /** + *

Notifies the occurrence of another frame of the animation.

+ * + * @param animation The animation which was repeated. + */ + void onAnimationUpdate(ValueAnimator animation); + } +} diff --git a/src/api-impl/android/app/Activity.java b/src/api-impl/android/app/Activity.java index 40014773..9ea23bd5 100644 --- a/src/api-impl/android/app/Activity.java +++ b/src/api-impl/android/app/Activity.java @@ -1,5 +1,6 @@ package android.app; +import android.R; import android.content.ComponentName; import android.content.Context; import android.content.Intent; @@ -102,6 +103,7 @@ public class Activity extends Context { protected void onCreate(Bundle savedInstanceState) { System.out.println("- onCreate - yay!"); + new ViewGroup(this).setId(R.id.content); return; } @@ -263,6 +265,22 @@ public class Activity extends Context { nativeFinish(getWindow().native_window); } + public Object getLastNonConfigurationInstance() { + return null; + } + + public FragmentManager getFragmentManager() { + return new FragmentManager(); + } + + public LayoutInflater getLayoutInflater() { + return layout_inflater; + } + + public CharSequence getTitle() { + return "Title"; + } + private native void nativeFinish(long native_window); private static native void nativeStartActivity(Activity activity); } diff --git a/src/api-impl/android/app/DownloadManager.java b/src/api-impl/android/app/DownloadManager.java new file mode 100644 index 00000000..473deee2 --- /dev/null +++ b/src/api-impl/android/app/DownloadManager.java @@ -0,0 +1,5 @@ +package android.app; + +public class DownloadManager { + +} diff --git a/src/api-impl/android/app/Fragment.java b/src/api-impl/android/app/Fragment.java new file mode 100644 index 00000000..178a6d32 --- /dev/null +++ b/src/api-impl/android/app/Fragment.java @@ -0,0 +1,5 @@ +package android.app; + +public class Fragment { + +} diff --git a/src/api-impl/android/app/FragmentManager.java b/src/api-impl/android/app/FragmentManager.java new file mode 100644 index 00000000..865ea0a4 --- /dev/null +++ b/src/api-impl/android/app/FragmentManager.java @@ -0,0 +1,16 @@ +package android.app; + +public class FragmentManager { + + public Fragment findFragmentByTag(String tag) { + return null; + } + + public FragmentTransaction beginTransaction() { + return new FragmentTransaction(); + } + + public boolean executePendingTransactions() { + return false; + } +} diff --git a/src/api-impl/android/app/FragmentTransaction.java b/src/api-impl/android/app/FragmentTransaction.java new file mode 100644 index 00000000..8900e6e1 --- /dev/null +++ b/src/api-impl/android/app/FragmentTransaction.java @@ -0,0 +1,12 @@ +package android.app; + +public class FragmentTransaction { + + public FragmentTransaction add(Fragment fragment, String string) { + return this; + } + + public int commit() { + return 0; + } +} diff --git a/src/api-impl/android/app/SearchManager.java b/src/api-impl/android/app/SearchManager.java new file mode 100644 index 00000000..69b7e627 --- /dev/null +++ b/src/api-impl/android/app/SearchManager.java @@ -0,0 +1,5 @@ +package android.app; + +public class SearchManager { + +} diff --git a/src/api-impl/android/app/UiModeManager.java b/src/api-impl/android/app/UiModeManager.java new file mode 100644 index 00000000..0cd11875 --- /dev/null +++ b/src/api-impl/android/app/UiModeManager.java @@ -0,0 +1,10 @@ +package android.app; + +import android.content.res.Configuration; + +public class UiModeManager { + + public int getCurrentModeType() { + return Configuration.UI_MODE_TYPE_NORMAL; + } +} diff --git a/src/api-impl/android/app/WallpaperManager.java b/src/api-impl/android/app/WallpaperManager.java new file mode 100644 index 00000000..b0443967 --- /dev/null +++ b/src/api-impl/android/app/WallpaperManager.java @@ -0,0 +1,5 @@ +package android.app; + +public class WallpaperManager { + +} diff --git a/src/api-impl/android/app/admin/DevicePolicyManager.java b/src/api-impl/android/app/admin/DevicePolicyManager.java new file mode 100644 index 00000000..fa64c941 --- /dev/null +++ b/src/api-impl/android/app/admin/DevicePolicyManager.java @@ -0,0 +1,5 @@ +package android.app.admin; + +public class DevicePolicyManager { + +} diff --git a/src/api-impl/android/content/Context.java b/src/api-impl/android/content/Context.java index 5227ecc1..52191ccd 100644 --- a/src/api-impl/android/content/Context.java +++ b/src/api-impl/android/content/Context.java @@ -6,6 +6,7 @@ import android.app.Application; import android.app.KeyguardManager; import android.app.NotificationManager; import android.app.SharedPreferencesImpl; +import android.app.UiModeManager; import android.content.BroadcastReceiver; import android.content.ClipboardManager; import android.content.Intent; @@ -165,6 +166,8 @@ public class Context extends Object { return new InputManager(); case "location": return new LocationManager(); + case "uimode": + return new UiModeManager(); default: System.out.println("!!!!!!! getSystemService: case >" + name + "< is not implemented yet"); return null; @@ -348,4 +351,8 @@ public class Context extends Object { public void setTheme(int resId) { theme.applyStyle(resId, true); } + + public final CharSequence getText(int resId) { + return getResources().getText(resId); + } } diff --git a/src/api-impl/android/content/ContextWrapper.java b/src/api-impl/android/content/ContextWrapper.java new file mode 100644 index 00000000..47a38415 --- /dev/null +++ b/src/api-impl/android/content/ContextWrapper.java @@ -0,0 +1,14 @@ +package android.content; + +public class ContextWrapper extends Context { + private Context baseContext; + + public ContextWrapper(Context baseContext) { + this.baseContext = baseContext; + } + + public Context getBaseContext() { + return baseContext; + } + +} diff --git a/src/api-impl/android/content/Intent.java b/src/api-impl/android/content/Intent.java index 53870410..1ed3067b 100644 --- a/src/api-impl/android/content/Intent.java +++ b/src/api-impl/android/content/Intent.java @@ -185,6 +185,14 @@ public class Intent { return component; } + public boolean hasExtra(String name) { + return extras.containsKey(name); + } + + public Serializable getSerializableExtra(String name) { + return (Serializable)extras.get(name); + } + @Override public String toString() { return "Intent [component=" + component + ", extras=" + extras + "]"; diff --git a/src/api-impl/android/content/pm/PackageManager.java b/src/api-impl/android/content/pm/PackageManager.java index cfeed6a0..470899e5 100644 --- a/src/api-impl/android/content/pm/PackageManager.java +++ b/src/api-impl/android/content/pm/PackageManager.java @@ -1337,6 +1337,34 @@ public class PackageManager { */ public static final String EXTRA_REQUEST_PERMISSION_PERMISSION_LIST = "android.content.pm.extra.PERMISSION_LIST"; + // dummy certificate + public final static byte[] X509_DUMMY = ( + "-----BEGIN CERTIFICATE-----\n" + + "MIIERjCCAy6gAwIBAgIJAIz+EYMBU6aQMA0GCSqGSIb3DQEBBQUAMIGiMQswCQYD\n" + + "VQQGEwJDQTELMAkGA1UECBMCQkMxEjAQBgNVBAcTCVZhbmNvdXZlcjEWMBQGA1UE\n" + + "ChMNd3d3LmN1Y2JjLmNvbTEUMBIGA1UECxQLY29tbW9uc19zc2wxHTAbBgNVBAMU\n" + + "FGRlbW9faW50ZXJtZWRpYXRlX2NhMSUwIwYJKoZIhvcNAQkBFhZqdWxpdXNkYXZp\n" + + "ZXNAZ21haWwuY29tMB4XDTA2MTIxMTE1MzE0MVoXDTI4MTEwNTE1MzE0MVowgaQx\n" + + "CzAJBgNVBAYTAlVTMREwDwYDVQQIEwhNYXJ5bGFuZDEUMBIGA1UEBxMLRm9yZXN0\n" + + "IEhpbGwxFzAVBgNVBAoTDmh0dHBjb21wb25lbnRzMRowGAYDVQQLExF0ZXN0IGNl\n" + + "cnRpZmljYXRlczEQMA4GA1UEAxMHZm9vLmNvbTElMCMGCSqGSIb3DQEJARYWanVs\n" + + "aXVzZGF2aWVzQGdtYWlsLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC\n" + + "ggEBAMhjr5aCPoyp0R1iroWAfnEyBMGYWoCidH96yGPFjYLowez5aYKY1IOKTY2B\n" + + "lYho4O84X244QrZTRl8kQbYtxnGh4gSCD+Z8gjZ/gMvLUlhqOb+WXPAUHMB39GRy\n" + + "zerA/ZtrlUqf+lKo0uWcocxeRc771KN8cPH3nHZ0rV0Hx4ZAZy6U4xxObe4rtSVY\n" + + "07hNKXAb2odnVqgzcYiDkLV8ilvEmoNWMWrp8UBqkTcpEhYhCYp3cTkgJwMSuqv8\n" + + "BqnGd87xQU3FVZI4tbtkB+KzjD9zz8QCDJAfDjZHR03KNQ5mxOgXwxwKw6lGMaiV\n" + + "JTxpTKqym93whYk93l3ocEe55c0CAwEAAaN7MHkwCQYDVR0TBAIwADAsBglghkgB\n" + + "hvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYE\n" + + "FJ8Ud78/OrbKOIJCSBYs2tDLXofYMB8GA1UdIwQYMBaAFHua2o+QmU5S0qzbswNS\n" + + "yoemDT4NMA0GCSqGSIb3DQEBBQUAA4IBAQC3jRmEya6sQCkmieULcvx8zz1euCk9\n" + + "fSez7BEtki8+dmfMXe3K7sH0lI8f4jJR0rbSCjpmCQLYmzC3NxBKeJOW0RcjNBpO\n" + + "c2JlGO9auXv2GDP4IYiXElLJ6VSqc8WvDikv0JmCCWm0Zga+bZbR/EWN5DeEtFdF\n" + + "815CLpJZNcYwiYwGy/CVQ7w2TnXlG+mraZOz+owr+cL6J/ZesbdEWfjoS1+cUEhE\n" + + "HwlNrAu8jlZ2UqSgskSWlhYdMTAP9CPHiUv9N7FcT58Itv/I4fKREINQYjDpvQcx\n" + + "SaTYb9dr5sB4WLNglk7zxDtM80H518VvihTcP7FHL+Gn6g4j5fkI98+S\n" + + "-----END CERTIFICATE-----\n").getBytes(); + /** * Retrieve overall information about an application package that is * installed on the system. @@ -1374,7 +1402,7 @@ public class PackageManager { public PackageInfo getPackageInfo(String packageName, int flags) throws NameNotFoundException { PackageInfo packageInfo = new PackageInfo(); if ((flags & GET_SIGNATURES) == GET_SIGNATURES) { - packageInfo.signatures = new Signature[0]; + packageInfo.signatures = new Signature[]{new Signature(X509_DUMMY)}; } return packageInfo; } diff --git a/src/api-impl/android/database/Cursor.java b/src/api-impl/android/database/Cursor.java index e32ae1bc..0a370d28 100644 --- a/src/api-impl/android/database/Cursor.java +++ b/src/api-impl/android/database/Cursor.java @@ -23,7 +23,6 @@ import android.os.Bundle; import java.io.Closeable; class CharArrayBuffer {} -class DataSetObserver {} /** * This interface provides random read-write access to the result set returned diff --git a/src/api-impl/android/database/DataSetObservable.java b/src/api-impl/android/database/DataSetObservable.java new file mode 100644 index 00000000..3075b8b0 --- /dev/null +++ b/src/api-impl/android/database/DataSetObservable.java @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2007 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.database; + +/** + * A specialization of {@link Observable} for {@link DataSetObserver} + * that provides methods for sending notifications to a list of + * {@link DataSetObserver} objects. + */ +public class DataSetObservable extends Observable { + /** + * Invokes {@link DataSetObserver#onChanged} on each observer. + * Called when the contents of the data set have changed. The recipient + * will obtain the new contents the next time it queries the data set. + */ + public void notifyChanged() { + synchronized(mObservers) { + // since onChanged() is implemented by the app, it could do anything, including + // removing itself from {@link mObservers} - and that could cause problems if + // an iterator is used on the ArrayList {@link mObservers}. + // to avoid such problems, just march thru the list in the reverse order. + for (int i = mObservers.size() - 1; i >= 0; i--) { + mObservers.get(i).onChanged(); + } + } + } + + /** + * Invokes {@link DataSetObserver#onInvalidated} on each observer. + * Called when the data set is no longer valid and cannot be queried again, + * such as when the data set has been closed. + */ + public void notifyInvalidated() { + synchronized (mObservers) { + for (int i = mObservers.size() - 1; i >= 0; i--) { + mObservers.get(i).onInvalidated(); + } + } + } +} diff --git a/src/api-impl/android/database/DataSetObserver.java b/src/api-impl/android/database/DataSetObserver.java new file mode 100644 index 00000000..e9c67c4c --- /dev/null +++ b/src/api-impl/android/database/DataSetObserver.java @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2007 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.database; + +/** + * Receives call backs when a data set has been changed, or made invalid. The typically data sets + * that are observed are {@link Cursor}s or {@link android.widget.Adapter}s. + * DataSetObserver must be implemented by objects which are added to a DataSetObservable. + */ +public abstract class DataSetObserver { + /** + * This method is called when the entire data set has changed, + * most likely through a call to {@link Cursor#requery()} on a {@link Cursor}. + */ + public void onChanged() { + // Do nothing + } + + /** + * This method is called when the entire data becomes invalid, + * most likely through a call to {@link Cursor#deactivate()} or {@link Cursor#close()} on a + * {@link Cursor}. + */ + public void onInvalidated() { + // Do nothing + } +} diff --git a/src/api-impl/android/database/Observable.java b/src/api-impl/android/database/Observable.java new file mode 100644 index 00000000..3ae15777 --- /dev/null +++ b/src/api-impl/android/database/Observable.java @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2007 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.database; + +import java.util.ArrayList; + +/** + * Provides methods for registering or unregistering arbitrary observers in an {@link ArrayList}. + * + * This abstract class is intended to be subclassed and specialized to maintain + * a registry of observers of specific types and dispatch notifications to them. + * + * @param T The observer type. + */ +public abstract class Observable { + /** + * The list of observers. An observer can be in the list at most + * once and will never be null. + */ + protected final ArrayList mObservers = new ArrayList(); + + /** + * Adds an observer to the list. The observer cannot be null and it must not already + * be registered. + * @param observer the observer to register + * @throws IllegalArgumentException the observer is null + * @throws IllegalStateException the observer is already registered + */ + public void registerObserver(T observer) { + if (observer == null) { + throw new IllegalArgumentException("The observer is null."); + } + synchronized(mObservers) { + if (mObservers.contains(observer)) { + throw new IllegalStateException("Observer " + observer + " is already registered."); + } + mObservers.add(observer); + } + } + + /** + * Removes a previously registered observer. The observer must not be null and it + * must already have been registered. + * @param observer the observer to unregister + * @throws IllegalArgumentException the observer is null + * @throws IllegalStateException the observer is not yet registered + */ + public void unregisterObserver(T observer) { + if (observer == null) { + throw new IllegalArgumentException("The observer is null."); + } + synchronized(mObservers) { + int index = mObservers.indexOf(observer); + if (index == -1) { + throw new IllegalStateException("Observer " + observer + " was not registered."); + } + mObservers.remove(index); + } + } + + /** + * Remove all registered observers. + */ + public void unregisterAll() { + synchronized(mObservers) { + mObservers.clear(); + } + } + +} diff --git a/src/api-impl/android/graphics/Color.java b/src/api-impl/android/graphics/Color.java index 2d7a3312..59ced1b9 100644 --- a/src/api-impl/android/graphics/Color.java +++ b/src/api-impl/android/graphics/Color.java @@ -4,4 +4,12 @@ public class Color { public static int argb(int alpha, int red, int green, int blue) { return (alpha << 24) | (red << 16) | (green << 8) | (blue << 0); } + + /** + * Return the alpha component of a color int. This is the same as saying + * color >>> 24 + */ + public static int alpha(int color) { + return color >>> 24; + } } diff --git a/src/api-impl/android/graphics/Matrix.java b/src/api-impl/android/graphics/Matrix.java index 838cec49..2e9c3187 100644 --- a/src/api-impl/android/graphics/Matrix.java +++ b/src/api-impl/android/graphics/Matrix.java @@ -220,7 +220,7 @@ public class Matrix { if (src == null) { reset(); } else { - native_set(native_instance, src.native_instance); + // native_set(native_instance, src.native_instance); } } /** @@ -739,7 +739,7 @@ public class Matrix { @Override protected void finalize() throws Throwable { try { - finalizer(native_instance); + // finalizer(native_instance); } finally { super.finalize(); } @@ -747,7 +747,9 @@ public class Matrix { /*package*/ final int ni() { return native_instance; } - private static native int native_create(int native_src_or_zero); + private static /*native*/ int native_create(int native_src_or_zero) { + return 0; + } private static native boolean native_isIdentity(int native_object); private static native boolean native_rectStaysRect(int native_object); private static native void native_reset(int native_object); diff --git a/src/api-impl/android/graphics/Paint.java b/src/api-impl/android/graphics/Paint.java index 12434872..0efcb791 100644 --- a/src/api-impl/android/graphics/Paint.java +++ b/src/api-impl/android/graphics/Paint.java @@ -3,6 +3,18 @@ package android.graphics; public class Paint { private int color = 0xFF000000; + public Paint() { + } + + public Paint (int flags) { + this(); + setFlags(flags); + } + + public Paint(Paint paint) { + setColor(paint.getColor()); + } + public void setColor(int color) { this.color = color; } diff --git a/src/api-impl/android/graphics/Path.java b/src/api-impl/android/graphics/Path.java index 9427f79b..37532675 100644 --- a/src/api-impl/android/graphics/Path.java +++ b/src/api-impl/android/graphics/Path.java @@ -662,7 +662,7 @@ mDetectSimplePaths = HardwareRenderer.isAvailable(); } protected void finalize() throws Throwable { try { - finalizer(mNativePath); + // finalizer(mNativePath); } finally { super.finalize(); } diff --git a/src/api-impl/android/graphics/PointF.java b/src/api-impl/android/graphics/PointF.java new file mode 100644 index 00000000..a34c8389 --- /dev/null +++ b/src/api-impl/android/graphics/PointF.java @@ -0,0 +1,118 @@ +/* + * Copyright (C) 2007 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.graphics; + +import android.os.Parcelable; + +/** + * PointF holds two float coordinates + */ +public class PointF implements Parcelable { + public float x; + public float y; + + public PointF() {} + public PointF(float x, float y) { + this.x = x; + this.y = y; + } + + public PointF(Point p) { + this.x = p.x; + this.y = p.y; + } + /** + * Create a new PointF initialized with the values in the specified + * PointF (which is left unmodified). + * + * @param p The point whose values are copied into the new + * point. + */ + public PointF(PointF p) { + this.x = p.x; + this.y = p.y; + } + + /** + * Set the point's x and y coordinates + */ + public final void set(float x, float y) { + this.x = x; + this.y = y; + } + + /** + * Set the point's x and y coordinates to the coordinates of p + */ + public final void set(PointF p) { + this.x = p.x; + this.y = p.y; + } + + public final void negate() { + x = -x; + y = -y; + } + + public final void offset(float dx, float dy) { + x += dx; + y += dy; + } + + /** + * Returns true if the point's coordinates equal (x,y) + */ + public final boolean equals(float x, float y) { + return this.x == x && this.y == y; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + PointF pointF = (PointF) o; + if (Float.compare(pointF.x, x) != 0) return false; + if (Float.compare(pointF.y, y) != 0) return false; + return true; + } + + @Override + public int hashCode() { + int result = (x != +0.0f ? Float.floatToIntBits(x) : 0); + result = 31 * result + (y != +0.0f ? Float.floatToIntBits(y) : 0); + return result; + } + + @Override + public String toString() { + return "PointF(" + x + ", " + y + ")"; + } + + /** + * Return the euclidian distance from (0,0) to the point + */ + public final float length() { + return length(x, y); + } + + /** + * Returns the euclidian distance from (0,0) to (x,y) + */ + public static float length(float x, float y) { + return (float) Math.hypot(x, y); + } +} \ No newline at end of file diff --git a/src/api-impl/android/graphics/PorterDuffColorFilter.java b/src/api-impl/android/graphics/PorterDuffColorFilter.java new file mode 100644 index 00000000..d7ed7c7b --- /dev/null +++ b/src/api-impl/android/graphics/PorterDuffColorFilter.java @@ -0,0 +1,127 @@ +/* + * Copyright (C) 2006 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.graphics; + +/** + * A color filter that can be used to tint the source pixels using a single + * color and a specific {@link PorterDuff Porter-Duff composite mode}. + */ +public class PorterDuffColorFilter { + private int mColor; + private PorterDuff.Mode mMode; + + /** + * Create a color filter that uses the specified color and Porter-Duff mode. + * + * @param color The ARGB source color used with the specified Porter-Duff mode + * @param mode The porter-duff mode that is applied + * + * @see Color + * @see #setColor(int) + * @see #setMode(android.graphics.PorterDuff.Mode) + */ + public PorterDuffColorFilter(int color, PorterDuff.Mode mode) { + mColor = color; + mMode = mode; + update(); + } + + /** + * Returns the ARGB color used to tint the source pixels when this filter + * is applied. + * + * @see Color + * @see #setColor(int) + * + * @hide + */ + public int getColor() { + return mColor; + } + + /** + * Specifies the color to tint the source pixels with when this color + * filter is applied. + * + * @param color An ARGB {@link Color color} + * + * @see Color + * @see #getColor() + * @see #getMode() + * + * @hide + */ + public void setColor(int color) { + mColor = color; + update(); + } + + /** + * Returns the Porter-Duff mode used to composite this color filter's + * color with the source pixel when this filter is applied. + * + * @see PorterDuff + * @see #setMode(android.graphics.PorterDuff.Mode) + * + * @hide + */ + public PorterDuff.Mode getMode() { + return mMode; + } + + /** + * Specifies the Porter-Duff mode to use when compositing this color + * filter's color with the source pixel at draw time. + * + * @see PorterDuff + * @see #getMode() + * @see #getColor() + * + * @hide + */ + public void setMode(PorterDuff.Mode mode) { + mMode = mode; + update(); + } + + private void update() { + // destroyFilter(native_instance); + // native_instance = native_CreatePorterDuffFilter(mColor, mMode.nativeInt); + } + + @Override + public boolean equals(Object object) { + if (this == object) { + return true; + } + if (object == null || getClass() != object.getClass()) { + return false; + } + final PorterDuffColorFilter other = (PorterDuffColorFilter) object; + if (mColor != other.mColor || mMode != other.mMode) { + return false; + } + return true; + } + + @Override + public int hashCode() { + return 31 * mMode.hashCode() + mColor; + } + + private static native long native_CreatePorterDuffFilter(int srcColor, int porterDuffMode); +} diff --git a/src/api-impl/android/graphics/Region.java b/src/api-impl/android/graphics/Region.java index 758cd711..bccf440c 100644 --- a/src/api-impl/android/graphics/Region.java +++ b/src/api-impl/android/graphics/Region.java @@ -309,7 +309,7 @@ public class Region { } protected void finalize() throws Throwable { try { - nativeDestructor(mNativeRegion); + // nativeDestructor(mNativeRegion); } finally { super.finalize(); } @@ -330,7 +330,7 @@ public class Region { return mNativeRegion; } private static native boolean nativeEquals(int native_r1, int native_r2); - private static native int nativeConstructor(); + private static int nativeConstructor() {return -1;} private static native void nativeDestructor(int native_region); private static native void nativeSetRegion(int native_dst, int native_src); private static native boolean nativeSetRect(int native_dst, int left, diff --git a/src/api-impl/android/graphics/drawable/Animatable.java b/src/api-impl/android/graphics/drawable/Animatable.java new file mode 100644 index 00000000..a878e685 --- /dev/null +++ b/src/api-impl/android/graphics/drawable/Animatable.java @@ -0,0 +1,5 @@ +package android.graphics.drawable; + +public interface Animatable { + +} diff --git a/src/api-impl/android/graphics/drawable/ColorDrawable.java b/src/api-impl/android/graphics/drawable/ColorDrawable.java new file mode 100644 index 00000000..fcea5117 --- /dev/null +++ b/src/api-impl/android/graphics/drawable/ColorDrawable.java @@ -0,0 +1,13 @@ +package android.graphics.drawable; + +import android.graphics.Canvas; + +public class ColorDrawable extends Drawable { + + @Override + public void draw(Canvas canvas) { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'draw'"); + } + +} diff --git a/src/api-impl/android/graphics/drawable/Drawable.java b/src/api-impl/android/graphics/drawable/Drawable.java index f1d12d92..a84d08d4 100644 --- a/src/api-impl/android/graphics/drawable/Drawable.java +++ b/src/api-impl/android/graphics/drawable/Drawable.java @@ -1,11 +1,15 @@ package android.graphics.drawable; +import android.content.res.Resources; import android.graphics.Canvas; +import android.graphics.PorterDuff; import android.graphics.Rect; public abstract class Drawable { + public static interface Callback {} private Rect mBounds = new Rect(); + private int[] mStateSet = new int[0]; public int getChangingConfigurations() { return 0; @@ -14,11 +18,12 @@ public abstract class Drawable { public void setChangingConfigurations(int bitmap) {} public ConstantState getConstantState() { - return new ConstantState(); + return null; } - public class ConstantState { - + public abstract class ConstantState { + + public abstract Drawable newDrawable(Resources res); } public void setBounds(int left, int top, int right, int bottom) { @@ -30,4 +35,38 @@ public abstract class Drawable { } public abstract void draw(Canvas canvas); + + public boolean setState(int[] stateSet) { + this.mStateSet = stateSet; + return false; + } + + public int[] getState() { + return mStateSet; + } + + public void invalidateSelf() {} + + public void setCallback(Callback callback) {} + + public boolean isVisible() { + return false; + } + + public boolean setVisible (boolean visible, boolean restart) { + return false; + } + + public void clearColorFilter() {} + + public final int getLevel() {return 0;} + public final boolean setLevel(int level) {return false;} + + public void setBounds(Rect bounds) {} + + public void setColorFilter(int color, PorterDuff.Mode mode) {} + + public Drawable mutate() { + return this; + } } diff --git a/src/api-impl/android/graphics/drawable/GradientDrawable.java b/src/api-impl/android/graphics/drawable/GradientDrawable.java new file mode 100644 index 00000000..bcfb8511 --- /dev/null +++ b/src/api-impl/android/graphics/drawable/GradientDrawable.java @@ -0,0 +1,17 @@ +package android.graphics.drawable; + +import android.graphics.Canvas; + +public class GradientDrawable extends Drawable { + + @Override + public void draw(Canvas canvas) { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'draw'"); + } + + public void setColor(int color) {} + + public void setCornerRadius(float cornerRadius) {} + +} diff --git a/src/api-impl/android/graphics/drawable/LayerDrawable.java b/src/api-impl/android/graphics/drawable/LayerDrawable.java new file mode 100644 index 00000000..d093b3f6 --- /dev/null +++ b/src/api-impl/android/graphics/drawable/LayerDrawable.java @@ -0,0 +1,14 @@ +package android.graphics.drawable; + +import android.graphics.Canvas; + +public class LayerDrawable extends Drawable { + + public LayerDrawable(Drawable[] drawables) { + } + + @Override + public void draw(Canvas canvas) { + } + +} diff --git a/src/api-impl/android/net/wifi/WifiManager.java b/src/api-impl/android/net/wifi/WifiManager.java new file mode 100644 index 00000000..5526e8fc --- /dev/null +++ b/src/api-impl/android/net/wifi/WifiManager.java @@ -0,0 +1,5 @@ +package android.net.wifi; + +public class WifiManager { + +} diff --git a/src/api-impl/android/net/wifi/p2p/WifiP2pManager.java b/src/api-impl/android/net/wifi/p2p/WifiP2pManager.java new file mode 100644 index 00000000..77a9a142 --- /dev/null +++ b/src/api-impl/android/net/wifi/p2p/WifiP2pManager.java @@ -0,0 +1,5 @@ +package android.net.wifi.p2p; + +public class WifiP2pManager { + +} diff --git a/src/api-impl/android/nfc/NfcManager.java b/src/api-impl/android/nfc/NfcManager.java new file mode 100644 index 00000000..e0d82765 --- /dev/null +++ b/src/api-impl/android/nfc/NfcManager.java @@ -0,0 +1,5 @@ +package android.nfc; + +public class NfcManager { + +} diff --git a/src/api-impl/android/os/DropBoxManager.java b/src/api-impl/android/os/DropBoxManager.java new file mode 100644 index 00000000..2c29513a --- /dev/null +++ b/src/api-impl/android/os/DropBoxManager.java @@ -0,0 +1,5 @@ +package android.os; + +public class DropBoxManager { + +} diff --git a/src/api-impl/android/os/storage/StorageManager.java b/src/api-impl/android/os/storage/StorageManager.java new file mode 100644 index 00000000..a52cbfb1 --- /dev/null +++ b/src/api-impl/android/os/storage/StorageManager.java @@ -0,0 +1,5 @@ +package android.os.storage; + +public class StorageManager { + +} diff --git a/src/api-impl/android/text/TextUtils.java b/src/api-impl/android/text/TextUtils.java index 9d7a3775..237adcf0 100644 --- a/src/api-impl/android/text/TextUtils.java +++ b/src/api-impl/android/text/TextUtils.java @@ -88,4 +88,12 @@ public class TextUtils { } return false; } + + public enum TruncateAt { + START, + MIDDLE, + END, + MARQUEE, + END_SMALL + } } diff --git a/src/api-impl/android/text/method/PasswordTransformationMethod.java b/src/api-impl/android/text/method/PasswordTransformationMethod.java new file mode 100644 index 00000000..4d15afac --- /dev/null +++ b/src/api-impl/android/text/method/PasswordTransformationMethod.java @@ -0,0 +1,176 @@ +/* + * Copyright (C) 2006 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.text.method; + +import android.graphics.Rect; +import android.os.Handler; +import android.os.SystemClock; +import android.text.GetChars; +import android.text.NoCopySpan; +import android.text.Spannable; +import android.text.TextWatcher; +import android.view.View; +import java.lang.ref.WeakReference; + +public class PasswordTransformationMethod implements TransformationMethod, TextWatcher +{ + public CharSequence getTransformation(CharSequence source, View view) { + if (source instanceof Spannable) { + Spannable sp = (Spannable) source; + /* + * Remove any references to other views that may still be + * attached. This will happen when you flip the screen + * while a password field is showing; there will still + * be references to the old EditText in the text. + */ + ViewReference[] vr = sp.getSpans(0, sp.length(), + ViewReference.class); + for (int i = 0; i < vr.length; i++) { + sp.removeSpan(vr[i]); + } + removeVisibleSpans(sp); + sp.setSpan(new ViewReference(view), 0, 0, + Spannable.SPAN_POINT_POINT); + } + return new PasswordCharSequence(source); + } + + public static PasswordTransformationMethod getInstance() { + if (sInstance != null) + return sInstance; + sInstance = new PasswordTransformationMethod(); + return sInstance; + } + + public void beforeTextChanged(CharSequence s, int start, + int count, int after) { + // This callback isn't used. + } + + public void onTextChanged(CharSequence s, int start, + int before, int count) { + if (s instanceof Spannable) { + Spannable sp = (Spannable) s; + ViewReference[] vr = sp.getSpans(0, s.length(), + ViewReference.class); + if (vr.length == 0) { + return; + } + /* + * There should generally only be one ViewReference in the text, + * but make sure to look through all of them if necessary in case + * something strange is going on. (We might still end up with + * multiple ViewReferences if someone moves text from one password + * field to another.) + */ + View v = null; + for (int i = 0; v == null && i < vr.length; i++) { + v = vr[i].get(); + } + if (v == null) { + return; + } + } + } + + public void onFocusChanged(View view, CharSequence sourceText, + boolean focused, int direction, + Rect previouslyFocusedRect) { + if (!focused) { + if (sourceText instanceof Spannable) { + Spannable sp = (Spannable) sourceText; + removeVisibleSpans(sp); + } + } + } + + private static void removeVisibleSpans(Spannable sp) { + Visible[] old = sp.getSpans(0, sp.length(), Visible.class); + for (int i = 0; i < old.length; i++) { + sp.removeSpan(old[i]); + } + } + + private static class PasswordCharSequence implements CharSequence, GetChars + { + public PasswordCharSequence(CharSequence source) { + mSource = source; + } + public int length() { + return mSource.length(); + } + public char charAt(int i) { + return DOT; + } + public CharSequence subSequence(int start, int end) { + char[] buf = new char[end - start]; + getChars(start, end, buf, 0); + return new String(buf); + } + public String toString() { + return subSequence(0, length()).toString(); + } + public void getChars(int start, int end, char[] dest, int off) { + // TextUtils.getChars(mSource, start, end, dest, off); + int st = -1, en = -1; + int nvisible = 0; + int[] starts = null, ends = null; + for (int i = start; i < end; i++) { + if (! (i >= st && i < en)) { + boolean visible = false; + for (int a = 0; a < nvisible; a++) { + if (i >= starts[a] && i < ends[a]) { + visible = true; + break; + } + } + if (!visible) { + dest[i - start + off] = DOT; + } + } + } + } + private CharSequence mSource; + } + + private static class Visible extends Handler implements Runnable + { + public Visible(Spannable sp, PasswordTransformationMethod ptm) { + mText = sp; + mTransformer = ptm; + postAtTime(this, SystemClock.uptimeMillis() + 1500); + } + public void run() { + mText.removeSpan(this); + } + private Spannable mText; + private PasswordTransformationMethod mTransformer; + } + /** + * Used to stash a reference back to the View in the Editable so we + * can use it to check the settings. + */ + private static class ViewReference extends WeakReference + implements NoCopySpan { + public ViewReference(View v) { + super(v); + } + } + + private static PasswordTransformationMethod sInstance; + private static char DOT = '\u2022'; +} diff --git a/src/api-impl/android/text/method/TransformationMethod.java b/src/api-impl/android/text/method/TransformationMethod.java new file mode 100644 index 00000000..ae61f1d6 --- /dev/null +++ b/src/api-impl/android/text/method/TransformationMethod.java @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2006 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.text.method; + +import android.graphics.Rect; +import android.view.View; + +/** + * TextView uses TransformationMethods to do things like replacing the + * characters of passwords with dots, or keeping the newline characters + * from causing line breaks in single-line text fields. + */ +public interface TransformationMethod +{ + /** + * Returns a CharSequence that is a transformation of the source text -- + * for example, replacing each character with a dot in a password field. + * Beware that the returned text must be exactly the same length as + * the source text, and that if the source text is Editable, the returned + * text must mirror it dynamically instead of doing a one-time copy. + * The method should not return {@code null} unless {@code source} + * is {@code null}. + */ + public CharSequence getTransformation(CharSequence source, View view); + + /** + * This method is called when the TextView that uses this + * TransformationMethod gains or loses focus. + */ + public void onFocusChanged(View view, CharSequence sourceText, + boolean focused, int direction, + Rect previouslyFocusedRect); +} diff --git a/src/api-impl/android/util/SparseBooleanArray.java b/src/api-impl/android/util/SparseBooleanArray.java new file mode 100644 index 00000000..72e67fb3 --- /dev/null +++ b/src/api-impl/android/util/SparseBooleanArray.java @@ -0,0 +1,355 @@ +/* + * Copyright (C) 2006 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; + +import com.android.internal.util.ArrayUtils; + +/** + * SparseBooleanArrays map integers to booleans. + * Unlike a normal array of booleans + * there can be gaps in the indices. It is intended to be more memory efficient + * than using a HashMap to map Integers to Booleans, both because it avoids + * auto-boxing keys and values and its data structure doesn't rely on an extra entry object + * for each mapping. + * + *

Note that this container keeps its mappings in an array data structure, + * using a binary search to find keys. The implementation is not intended to be appropriate for + * data structures + * that may contain large numbers of items. It is generally slower than a traditional + * HashMap, since lookups require a binary search and adds and removes require inserting + * and deleting entries in the array. For containers holding up to hundreds of items, + * the performance difference is not significant, less than 50%.

+ * + *

It is possible to iterate over the items in this container using + * {@link #keyAt(int)} and {@link #valueAt(int)}. Iterating over the keys using + * keyAt(int) with ascending values of the index will return the + * keys in ascending order, or the values corresponding to the keys in ascending + * order in the case of valueAt(int).

+ */ +public class SparseBooleanArray implements Cloneable { + /** + * Creates a new SparseBooleanArray containing no mappings. + */ + public SparseBooleanArray() { + this(10); + } + + /** + * Creates a new SparseBooleanArray containing no mappings that will not + * require any additional memory allocation to store the specified + * number of mappings. If you supply an initial capacity of 0, the + * sparse array will be initialized with a light-weight representation + * not requiring any additional array allocations. + */ + public SparseBooleanArray(int initialCapacity) { + if (initialCapacity == 0) { + mKeys = ContainerHelpers.EMPTY_INTS; + mValues = ContainerHelpers.EMPTY_BOOLEANS; + } else { + initialCapacity = ArrayUtils.idealIntArraySize(initialCapacity); + mKeys = new int[initialCapacity]; + mValues = new boolean[initialCapacity]; + } + mSize = 0; + } + + @Override + public SparseBooleanArray clone() { + SparseBooleanArray clone = null; + try { + clone = (SparseBooleanArray) super.clone(); + clone.mKeys = mKeys.clone(); + clone.mValues = mValues.clone(); + } catch (CloneNotSupportedException cnse) { + /* ignore */ + } + return clone; + } + + /** + * Gets the boolean mapped from the specified key, or false + * if no such mapping has been made. + */ + public boolean get(int key) { + return get(key, false); + } + + /** + * Gets the boolean mapped from the specified key, or the specified value + * if no such mapping has been made. + */ + public boolean get(int key, boolean valueIfKeyNotFound) { + int i = ContainerHelpers.binarySearch(mKeys, mSize, key); + if (i < 0) { + return valueIfKeyNotFound; + } else { + return mValues[i]; + } + } + + /** + * Removes the mapping from the specified key, if there was any. + */ + public void delete(int key) { + int i = ContainerHelpers.binarySearch(mKeys, mSize, key); + if (i >= 0) { + System.arraycopy(mKeys, i + 1, mKeys, i, mSize - (i + 1)); + System.arraycopy(mValues, i + 1, mValues, i, mSize - (i + 1)); + mSize--; + } + } + + /** + * Removes the mapping at the specified index. + *

+ * For indices outside of the range {@code 0...size()-1}, the behavior is undefined. + */ + public void removeAt(int index) { + System.arraycopy(mKeys, index + 1, mKeys, index, mSize - (index + 1)); + System.arraycopy(mValues, index + 1, mValues, index, mSize - (index + 1)); + mSize--; + } + + /** + * Adds a mapping from the specified key to the specified value, + * replacing the previous mapping from the specified key if there + * was one. + */ + public void put(int key, boolean value) { + int i = ContainerHelpers.binarySearch(mKeys, mSize, key); + + if (i >= 0) { + mValues[i] = value; + } else { + i = ~i; + + if (mSize >= mKeys.length) { + int n = ArrayUtils.idealIntArraySize(mSize + 1); + + int[] nkeys = new int[n]; + boolean[] nvalues = new boolean[n]; + + // Log.e("SparseIntArray", "grow " + mKeys.length + " to " + n); + System.arraycopy(mKeys, 0, nkeys, 0, mKeys.length); + System.arraycopy(mValues, 0, nvalues, 0, mValues.length); + + mKeys = nkeys; + mValues = nvalues; + } + + if (mSize - i != 0) { + // Log.e("SparseIntArray", "move " + (mSize - i)); + System.arraycopy(mKeys, i, mKeys, i + 1, mSize - i); + System.arraycopy(mValues, i, mValues, i + 1, mSize - i); + } + + mKeys[i] = key; + mValues[i] = value; + mSize++; + } + } + + /** + * Returns the number of key-value mappings that this SparseBooleanArray + * currently stores. + */ + public int size() { + return mSize; + } + + /** + * Given an index in the range 0...size()-1, returns + * the key from the indexth key-value mapping that this + * SparseBooleanArray stores. + * + *

The keys corresponding to indices in ascending order are guaranteed to + * be in ascending order, e.g., keyAt(0) will return the + * smallest key and keyAt(size()-1) will return the largest + * key.

+ * + *

For indices outside of the range 0...size()-1, the behavior is undefined for + * apps targeting {@link android.os.Build.VERSION_CODES#P} and earlier, and an + * {@link ArrayIndexOutOfBoundsException} is thrown for apps targeting + * {@link android.os.Build.VERSION_CODES#Q} and later.

+ */ + public int keyAt(int index) { + return mKeys[index]; + } + + /** + * Given an index in the range 0...size()-1, returns + * the value from the indexth key-value mapping that this + * SparseBooleanArray stores. + * + *

The values corresponding to indices in ascending order are guaranteed + * to be associated with keys in ascending order, e.g., + * valueAt(0) will return the value associated with the + * smallest key and valueAt(size()-1) will return the value + * associated with the largest key.

+ * + *

For indices outside of the range 0...size()-1, the behavior is undefined for + * apps targeting {@link android.os.Build.VERSION_CODES#P} and earlier, and an + * {@link ArrayIndexOutOfBoundsException} is thrown for apps targeting + * {@link android.os.Build.VERSION_CODES#Q} and later.

+ */ + public boolean valueAt(int index) { + return mValues[index]; + } + + /** + * Directly set the value at a particular index. + * + *

For indices outside of the range 0...size()-1, the behavior is undefined for + * apps targeting {@link android.os.Build.VERSION_CODES#P} and earlier, and an + * {@link ArrayIndexOutOfBoundsException} is thrown for apps targeting + * {@link android.os.Build.VERSION_CODES#Q} and later.

+ */ + public void setValueAt(int index, boolean value) { + mValues[index] = value; + } + + /** @hide */ + public void setKeyAt(int index, int key) { + if (index >= mSize) { + // The array might be slightly bigger than mSize, in which case, indexing won't fail. + throw new ArrayIndexOutOfBoundsException(index); + } + mKeys[index] = key; + } + + /** + * Returns the index for which {@link #keyAt} would return the + * specified key, or a negative number if the specified + * key is not mapped. + */ + public int indexOfKey(int key) { + return ContainerHelpers.binarySearch(mKeys, mSize, key); + } + + /** + * Returns an index for which {@link #valueAt} would return the + * specified key, or a negative number if no keys map to the + * specified value. + * Beware that this is a linear search, unlike lookups by key, + * and that multiple keys can map to the same value and this will + * find only one of them. + */ + public int indexOfValue(boolean value) { + for (int i = 0; i < mSize; i++) + if (mValues[i] == value) + return i; + return -1; + } + + /** + * Removes all key-value mappings from this SparseBooleanArray. + */ + public void clear() { + mSize = 0; + } + + /** + * Puts a key/value pair into the array, optimizing for the case where + * the key is greater than all existing keys in the array. + */ + public void append(int key, boolean value) { + if (mSize != 0 && key <= mKeys[mSize - 1]) { + put(key, value); + return; + } + + int pos = mSize; + if (pos >= mKeys.length) { + int n = ArrayUtils.idealIntArraySize(pos + 1); + + int[] nkeys = new int[n]; + boolean[] nvalues = new boolean[n]; + + // Log.e("SparseIntArray", "grow " + mKeys.length + " to " + n); + System.arraycopy(mKeys, 0, nkeys, 0, mKeys.length); + System.arraycopy(mValues, 0, nvalues, 0, mValues.length); + + mKeys = nkeys; + mValues = nvalues; + } + + mKeys[pos] = key; + mValues[pos] = value; + mSize = pos + 1; + } + + @Override + public int hashCode() { + int hashCode = mSize; + for (int i = 0; i < mSize; i++) { + hashCode = 31 * hashCode + mKeys[i] | (mValues[i] ? 1 : 0); + } + return hashCode; + } + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (!(that instanceof SparseBooleanArray)) { + return false; + } + SparseBooleanArray other = (SparseBooleanArray) that; + if (mSize != other.mSize) { + return false; + } + for (int i = 0; i < mSize; i++) { + if (mKeys[i] != other.mKeys[i]) { + return false; + } + if (mValues[i] != other.mValues[i]) { + return false; + } + } + return true; + } + + /** + * {@inheritDoc} + * + *

This implementation composes a string by iterating over its mappings. + */ + @Override + public String toString() { + if (size() <= 0) { + return "{}"; + } + StringBuilder buffer = new StringBuilder(mSize * 28); + buffer.append('{'); + for (int i=0; i 0) { + buffer.append(", "); + } + int key = keyAt(i); + buffer.append(key); + buffer.append('='); + boolean value = valueAt(i); + buffer.append(value); + } + buffer.append('}'); + return buffer.toString(); + } + private int[] mKeys; + private boolean[] mValues; + private int mSize; +} diff --git a/src/api-impl/android/view/AbsSavedState.java b/src/api-impl/android/view/AbsSavedState.java new file mode 100644 index 00000000..30ba050d --- /dev/null +++ b/src/api-impl/android/view/AbsSavedState.java @@ -0,0 +1,5 @@ +package android.view; + +public class AbsSavedState { + +} diff --git a/src/api-impl/android/view/ActionMode.java b/src/api-impl/android/view/ActionMode.java new file mode 100644 index 00000000..932942e1 --- /dev/null +++ b/src/api-impl/android/view/ActionMode.java @@ -0,0 +1,358 @@ +/* + * Copyright (C) 2010 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.view; + +import android.graphics.Rect; + +/** + * Represents a contextual mode of the user interface. Action modes can be used to provide + * alternative interaction modes and replace parts of the normal UI until finished. + * Examples of good action modes include text selection and contextual actions. + *

+ *

Developer Guides

+ *

For information about how to provide contextual actions with {@code ActionMode}, + * read the Menus + * developer guide.

+ *
+ */ +public abstract class ActionMode { + /** + * The action mode is treated as a Primary mode. This is the default. + * Use with {@link #setType}. + */ + public static final int TYPE_PRIMARY = 0; + /** + * The action mode is treated as a Floating Toolbar. + * Use with {@link #setType}. + */ + public static final int TYPE_FLOATING = 1; + /** + * Default value to hide the action mode for + * {@link ViewConfiguration#getDefaultActionModeHideDuration()}. + */ + public static final int DEFAULT_HIDE_DURATION = -1; + private Object mTag; + private boolean mTitleOptionalHint; + private int mType = TYPE_PRIMARY; + + /** + * Set a tag object associated with this ActionMode. + * + *

Like the tag available to views, this allows applications to associate arbitrary + * data with an ActionMode for later reference. + * + * @param tag Tag to associate with this ActionMode + * + * @see #getTag() + */ + public void setTag(Object tag) { + mTag = tag; + } + + /** + * Retrieve the tag object associated with this ActionMode. + * + *

Like the tag available to views, this allows applications to associate arbitrary + * data with an ActionMode for later reference. + * + * @return Tag associated with this ActionMode + * + * @see #setTag(Object) + */ + public Object getTag() { + return mTag; + } + + /** + * Set the title of the action mode. This method will have no visible effect if + * a custom view has been set. + * + * @param title Title string to set + * + * @see #setTitle(int) + * @see #setCustomView(View) + */ + public abstract void setTitle(CharSequence title); + /** + * Set the title of the action mode. This method will have no visible effect if + * a custom view has been set. + * + * @param resId Resource ID of a string to set as the title + * + * @see #setTitle(CharSequence) + * @see #setCustomView(View) + */ + + public abstract void setTitle(int resId); + /** + * Set the subtitle of the action mode. This method will have no visible effect if + * a custom view has been set. + * + * @param subtitle Subtitle string to set + * + * @see #setSubtitle(int) + * @see #setCustomView(View) + */ + + public abstract void setSubtitle(CharSequence subtitle); + /** + * Set the subtitle of the action mode. This method will have no visible effect if + * a custom view has been set. + * + * @param resId Resource ID of a string to set as the subtitle + * + * @see #setSubtitle(CharSequence) + * @see #setCustomView(View) + */ + + public abstract void setSubtitle(int resId); + /** + * Set whether or not the title/subtitle display for this action mode + * is optional. + * + *

In many cases the supplied title for an action mode is merely + * meant to add context and is not strictly required for the action + * mode to be useful. If the title is optional, the system may choose + * to hide the title entirely rather than truncate it due to a lack + * of available space.

+ * + *

Note that this is merely a hint; the underlying implementation + * may choose to ignore this setting under some circumstances.

+ * + * @param titleOptional true if the title only presents optional information. + */ + public void setTitleOptionalHint(boolean titleOptional) { + mTitleOptionalHint = titleOptional; + } + + /** + * @return true if this action mode has been given a hint to consider the + * title/subtitle display to be optional. + * + * @see #setTitleOptionalHint(boolean) + * @see #isTitleOptional() + */ + public boolean getTitleOptionalHint() { + return mTitleOptionalHint; + } + + /** + * @return true if this action mode considers the title and subtitle fields + * as optional. Optional titles may not be displayed to the user. + */ + public boolean isTitleOptional() { + return false; + } + + /** + * Set a custom view for this action mode. The custom view will take the place of + * the title and subtitle. Useful for things like search boxes. + * + * @param view Custom view to use in place of the title/subtitle. + * + * @see #setTitle(CharSequence) + * @see #setSubtitle(CharSequence) + */ + public abstract void setCustomView(View view); + + /** + * Set a type for this action mode. This will affect how the system renders the action mode if + * it has to. + * + * @param type One of {@link #TYPE_PRIMARY} or {@link #TYPE_FLOATING}. + */ + public void setType(int type) { + mType = type; + } + + /** + * Returns the type for this action mode. + * + * @return One of {@link #TYPE_PRIMARY} or {@link #TYPE_FLOATING}. + */ + public int getType() { + return mType; + } + + /** + * Invalidate the action mode and refresh menu content. The mode's + * {@link ActionMode.Callback} will have its + * {@link Callback#onPrepareActionMode(ActionMode, Menu)} method called. + * If it returns true the menu will be scanned for updated content and any relevant changes + * will be reflected to the user. + */ + public abstract void invalidate(); + + /** + * Invalidate the content rect associated to this ActionMode. This only makes sense for + * action modes that support dynamic positioning on the screen, and provides a more efficient + * way to reposition it without invalidating the whole action mode. + * + * @see Callback2#onGetContentRect(ActionMode, View, Rect) . + */ + public void invalidateContentRect() {} + + /** + * Hide the action mode view from obstructing the content below for a short duration. + * This only makes sense for action modes that support dynamic positioning on the screen. + * If this method is called again before the hide duration expires, the later hide call will + * cancel the former and then take effect. + * NOTE that there is an internal limit to how long the mode can be hidden for. It's typically + * about a few seconds. + * + * @param duration The number of milliseconds to hide for. + * @see #DEFAULT_HIDE_DURATION + */ + public void hide(long duration) {} + + /** + * Finish and close this action mode. The action mode's {@link ActionMode.Callback} will + * have its {@link Callback#onDestroyActionMode(ActionMode)} method called. + */ + public abstract void finish(); + + /** + * Returns the menu of actions that this action mode presents. + * @return The action mode's menu. + */ + public abstract Menu getMenu(); + + /** + * Returns the current title of this action mode. + * @return Title text + */ + public abstract CharSequence getTitle(); + + /** + * Returns the current subtitle of this action mode. + * @return Subtitle text + */ + public abstract CharSequence getSubtitle(); + + /** + * Returns the current custom view for this action mode. + * @return The current custom view + */ + public abstract View getCustomView(); + + /** + * Returns a {@link MenuInflater} with the ActionMode's context. + */ + public abstract MenuInflater getMenuInflater(); + + /** + * Called when the window containing the view that started this action mode gains or loses + * focus. + * + * @param hasWindowFocus True if the window containing the view that started this action mode + * now has focus, false otherwise. + * + */ + public void onWindowFocusChanged(boolean hasWindowFocus) {} + + /** + * Returns whether the UI presenting this action mode can take focus or not. + * This is used by internal components within the framework that would otherwise + * present an action mode UI that requires focus, such as an EditText as a custom view. + * + * @return true if the UI used to show this action mode can take focus + * @hide Internal use only + */ + public boolean isUiFocusable() { + return true; + } + + /** + * Callback interface for action modes. Supplied to + * {@link View#startActionMode(Callback)}, a Callback + * configures and handles events raised by a user's interaction with an action mode. + * + *

An action mode's lifecycle is as follows: + *

    + *
  • {@link Callback#onCreateActionMode(ActionMode, Menu)} once on initial + * creation
  • + *
  • {@link Callback#onPrepareActionMode(ActionMode, Menu)} after creation + * and any time the {@link ActionMode} is invalidated
  • + *
  • {@link Callback#onActionItemClicked(ActionMode, MenuItem)} any time a + * contextual action button is clicked
  • + *
  • {@link Callback#onDestroyActionMode(ActionMode)} when the action mode + * is closed
  • + *
+ */ + public interface Callback { + /** + * Called when action mode is first created. The menu supplied will be used to + * generate action buttons for the action mode. + * + * @param mode ActionMode being created + * @param menu Menu used to populate action buttons + * @return true if the action mode should be created, false if entering this + * mode should be aborted. + */ + public boolean onCreateActionMode(ActionMode mode, Menu menu); + /** + * Called to refresh an action mode's action menu whenever it is invalidated. + * + * @param mode ActionMode being prepared + * @param menu Menu used to populate action buttons + * @return true if the menu or action mode was updated, false otherwise. + */ + public boolean onPrepareActionMode(ActionMode mode, Menu menu); + /** + * Called to report a user click on an action button. + * + * @param mode The current ActionMode + * @param item The item that was clicked + * @return true if this callback handled the event, false if the standard MenuItem + * invocation should continue. + */ + public boolean onActionItemClicked(ActionMode mode, MenuItem item); + /** + * Called when an action mode is about to be exited and destroyed. + * + * @param mode The current ActionMode being destroyed + */ + public void onDestroyActionMode(ActionMode mode); + } + + /** + * Extension of {@link ActionMode.Callback} to provide content rect information. This is + * required for ActionModes with dynamic positioning such as the ones with type + * {@link ActionMode#TYPE_FLOATING} to ensure the positioning doesn't obscure app content. If + * an app fails to provide a subclass of this class, a default implementation will be used. + */ + public static abstract class Callback2 implements ActionMode.Callback { + /** + * Called when an ActionMode needs to be positioned on screen, potentially occluding view + * content. Note this may be called on a per-frame basis. + * + * @param mode The ActionMode that requires positioning. + * @param view The View that originated the ActionMode, in whose coordinates the Rect should + * be provided. + * @param outRect The Rect to be populated with the content position. Use this to specify + * where the content in your app lives within the given view. This will be used + * to avoid occluding the given content Rect with the created ActionMode. + */ + public void onGetContentRect(ActionMode mode, View view, Rect outRect) { + if (view != null) { + outRect.set(0, 0, view.getWidth(), view.getHeight()); + } else { + outRect.set(0, 0, 0, 0); + } + } + } +} \ No newline at end of file diff --git a/src/api-impl/android/view/ContextThemeWrapper.java b/src/api-impl/android/view/ContextThemeWrapper.java new file mode 100644 index 00000000..06ef6de4 --- /dev/null +++ b/src/api-impl/android/view/ContextThemeWrapper.java @@ -0,0 +1,12 @@ +package android.view; + +import android.content.Context; +import android.content.ContextWrapper; + +public class ContextThemeWrapper extends ContextWrapper { + + public ContextThemeWrapper(Context context, int themeResId) { + super(context); + } + +} diff --git a/src/api-impl/android/view/InflateException.java b/src/api-impl/android/view/InflateException.java new file mode 100644 index 00000000..11a58c86 --- /dev/null +++ b/src/api-impl/android/view/InflateException.java @@ -0,0 +1,5 @@ +package android.view; + +public class InflateException extends Exception { + +} diff --git a/src/api-impl/android/view/LayoutInflater.java b/src/api-impl/android/view/LayoutInflater.java index a0b383cc..c428fe3c 100644 --- a/src/api-impl/android/view/LayoutInflater.java +++ b/src/api-impl/android/view/LayoutInflater.java @@ -18,14 +18,14 @@ public class LayoutInflater { public interface Factory2 { } - private Factory2 factory2; + private Factory2 mFactory2; public final LayoutInflater.Factory getFactory() { return null; } public void setFactory2(Factory2 factory) { - this.factory2 = factory; + this.mFactory2 = factory; } public static LayoutInflater from(Context context) { @@ -215,13 +215,51 @@ public class LayoutInflater { } private void parseInclude(XmlPullParser parser, View parent, AttributeSet attrs) throws Exception { - int layout = attrs.getAttributeResourceValue(null, "layout", 0); - View view = inflate(layout, (ViewGroup)parent, true); - if (view == null) - return; + int type; - int id = attrs.getAttributeResourceValue("http://schemas.android.com/apk/res/android", "id", 0); - if (id != 0) - view.setId(id); + int layout = attrs.getAttributeResourceValue(null, "layout", 0); + + final XmlResourceParser childParser = Context.this_application.getResources().getLayout(layout); + final AttributeSet childAttrs = Xml.asAttributeSet(childParser); + + while ((type = childParser.next()) != XmlPullParser.START_TAG && + type != XmlPullParser.END_DOCUMENT) { + // Empty. + } + if (type != XmlPullParser.START_TAG) { + throw new Exception(childParser.getPositionDescription() + ": No start tag found!"); + } + + final String childName = childParser.getName(); + if ("merge".equals(childName)) { + // The tag doesn't support android:theme, so + // nothing special to do here. + rInflate(childParser, parent, childAttrs, false); + } else { + final View view = createViewFromTag(parent, childName, childAttrs); + final ViewGroup group = (ViewGroup)parent; + ViewGroup.LayoutParams params = null; + try { + params = group.generateLayoutParams(attrs); + } catch (RuntimeException e) { + // Ignore, just fail over to child attrs. + } + if (params == null) { + params = group.generateLayoutParams(childAttrs); + } + view.setLayoutParams(params); + // Inflate all children. + rInflate(childParser, view, childAttrs, true); + + int id = attrs.getAttributeResourceValue("http://schemas.android.com/apk/res/android", "id", 0); + if (id != 0) + view.setId(id); + + group.addView(view); + } + } + + public LayoutInflater cloneInContext(Context context) { + return this; } } diff --git a/src/api-impl/android/view/Menu.java b/src/api-impl/android/view/Menu.java index cb78c329..6f87352c 100644 --- a/src/api-impl/android/view/Menu.java +++ b/src/api-impl/android/view/Menu.java @@ -1,4 +1,12 @@ package android.view; public interface Menu { + + public MenuItem add(int groupId, int itemId, int order, CharSequence title); + + public MenuItem add(int groupId, int itemId,int order, int titleRes); + + public MenuItem findItem(int id); + + public void clear(); } diff --git a/src/api-impl/android/view/MenuInflater.java b/src/api-impl/android/view/MenuInflater.java new file mode 100644 index 00000000..9a2796b9 --- /dev/null +++ b/src/api-impl/android/view/MenuInflater.java @@ -0,0 +1,11 @@ +package android.view; + +import android.content.Context; + +public class MenuInflater { + + public MenuInflater(Context context) {} + + public void inflate(int menuRes, Menu menu) {} + +} diff --git a/src/api-impl/android/view/MenuItem.java b/src/api-impl/android/view/MenuItem.java new file mode 100644 index 00000000..dc759b3a --- /dev/null +++ b/src/api-impl/android/view/MenuItem.java @@ -0,0 +1,11 @@ +package android.view; + +public interface MenuItem { + + public interface OnMenuItemClickListener {} + + public MenuItem setIcon(int iconRes); + + public MenuItem setVisible(boolean visible); + +} \ No newline at end of file diff --git a/src/api-impl/android/view/SubMenu.java b/src/api-impl/android/view/SubMenu.java new file mode 100644 index 00000000..f9f080b2 --- /dev/null +++ b/src/api-impl/android/view/SubMenu.java @@ -0,0 +1,5 @@ +package android.view; + +public interface SubMenu extends Menu { + +} diff --git a/src/api-impl/android/view/View.java b/src/api-impl/android/view/View.java index 6625a7cf..488f78f8 100644 --- a/src/api-impl/android/view/View.java +++ b/src/api-impl/android/view/View.java @@ -4,10 +4,16 @@ import android.content.Context; import android.content.res.Resources; import android.graphics.Canvas; import android.graphics.Rect; +import android.graphics.drawable.Drawable; +import android.os.Handler; import android.os.IBinder; +import android.os.Looper; import android.util.AttributeSet; import android.util.LayoutDirection; + +import java.util.ArrayList; import java.util.HashMap; +import java.util.Map; public class View extends Object { @@ -590,6 +596,22 @@ public class View extends Object { // boolean onKey(View v, int keyCode, KeyEvent event); } + public interface OnLongClickListener { + // TODO + } + + public interface OnHoverListener { + // TODO + } + + public interface OnApplyWindowInsetsListener { + // TODO + } + + public interface OnLayoutChangeListener { + // TODO + } + public interface OnCreateContextMenuListener { /** * Called when the context menu for this view is being built. It is not @@ -747,6 +769,7 @@ public class View extends Object { public AttributeSet attrs; protected ViewGroup.LayoutParams layout_params; private Context context; + private Map tags = new HashMap<>(); public long widget; // pointer @@ -764,6 +787,10 @@ public class View extends Object { } } + public View(Context context, AttributeSet attrs, int defStyle) { + this(context, attrs); + } + public View findViewById(int id) { /* TODO: this should probably only search among children, but the id is surely unique anyway? :P */ return view_by_id.get(id); @@ -836,6 +863,7 @@ public class View extends Object { } public void setId(int id) { + this.id = id; view_by_id.put(id, this); } @@ -950,4 +978,90 @@ public class View extends Object { public void refreshDrawableState() { } + + public void setDescendantFocusability(int value) {} + + public void setAccessibilityDelegate(AccessibilityDelegate delegate) {} + + public static class AccessibilityDelegate {} + + public Drawable getBackground() { + return null; + } + + public void setClickable(boolean clickable) {} + + public void setEnabled(boolean enabled) {} + + public CharSequence getContentDescription() { + return null; + } + + public void setOnLongClickListener(OnLongClickListener listener) {} + + public void setLongClickable(boolean longClickable) {} + + public void setOnHoverListener(OnHoverListener listener) {} + + public final void measure (int widthMeasureSpec, int heightMeasureSpec) {} + + public final int getMeasuredWidth() { + return getWidth(); + } + + public final int getMeasuredHeight() { + return getHeight(); + } + + public void setBackgroundDrawable(Drawable backgroundDrawable) {} + + public int getOverScrollMode() {return 0;} + + public void setFitsSystemWindows(boolean fitsSystemWindows) {} + + public void setWillNotDraw(boolean value) {} + + public void setScrollContainer(boolean isScrollContainer) {} + + public boolean removeCallbacks(Runnable action) {return false;} + + public void requestLayout() {}; + + public void setOverScrollMode(int mode) {} + + public int getId() {return id;} + + public boolean postDelayed(Runnable action, long delayMillis) { + new Handler(Looper.getMainLooper()).postDelayed(action, delayMillis); + return true; + } + + public boolean post(Runnable action) { + new Handler(Looper.getMainLooper()).post(action); + return true; + } + + public void setSaveFromParentEnabled(boolean enabled) {} + + public void setTag(int key, Object tag) { + tags.put(key, tag); + } + public Object getTag(int key) { + return tags.get(key); + } + + public void addOnLayoutChangeListener(OnLayoutChangeListener listener) {} + + public boolean isSelected() {return false;} + + public void sendAccessibilityEvent(int eventType) {} + + public void setMinimumHeight(int minHeight) {} + public void setMinimumWidth(int minWidth) {} + + public void setActivated (boolean activated) {} + + public int getVisibility() {return View.VISIBLE;} + + public boolean isInEditMode() {return false;} } diff --git a/src/api-impl/android/view/ViewConfiguration.java b/src/api-impl/android/view/ViewConfiguration.java new file mode 100644 index 00000000..89cf36ab --- /dev/null +++ b/src/api-impl/android/view/ViewConfiguration.java @@ -0,0 +1,34 @@ +package android.view; + +import android.content.Context; + +public class ViewConfiguration { + + public static ViewConfiguration get(Context context) { + return new ViewConfiguration(); + } + + public int getScaledTouchSlop() { + return 0; + } + + public int getScaledMaximumFlingVelocity() { + return 0; + } + + public int getScaledMinimumFlingVelocity() { + return 0; + } + + public static int getTapTimeout() { + return 0; + } + + public static int getLongPressTimeout() { + return 0; + } + + public int getScaledPagingTouchSlop(){ + return 0; + } +} diff --git a/src/api-impl/android/view/ViewGroup.java b/src/api-impl/android/view/ViewGroup.java index ea075ec6..ee5b28ec 100644 --- a/src/api-impl/android/view/ViewGroup.java +++ b/src/api-impl/android/view/ViewGroup.java @@ -1,6 +1,9 @@ package android.view; +import android.R; +import android.animation.LayoutTransition; import android.content.Context; +import android.content.res.TypedArray; import android.util.AttributeSet; import java.util.ArrayList; @@ -89,6 +92,72 @@ public class ViewGroup extends View implements ViewParent, ViewManager { return true; } + public LayoutTransition getLayoutTransition() {return null;} + + public static int getChildMeasureSpec(int spec, int padding, int childDimension) { + int specMode = MeasureSpec.getMode(spec); + int specSize = MeasureSpec.getSize(spec); + int size = Math.max(0, specSize - padding); + int resultSize = 0; + int resultMode = 0; + switch (specMode) { + // Parent has imposed an exact size on us + case MeasureSpec.EXACTLY: + if (childDimension >= 0) { + resultSize = childDimension; + resultMode = MeasureSpec.EXACTLY; + } else if (childDimension == LayoutParams.MATCH_PARENT) { + // Child wants to be our size. So be it. + resultSize = size; + resultMode = MeasureSpec.EXACTLY; + } else if (childDimension == LayoutParams.WRAP_CONTENT) { + // Child wants to determine its own size. It can't be + // bigger than us. + resultSize = size; + resultMode = MeasureSpec.AT_MOST; + } + break; + // Parent has imposed a maximum size on us + case MeasureSpec.AT_MOST: + if (childDimension >= 0) { + // Child wants a specific size... so be it + resultSize = childDimension; + resultMode = MeasureSpec.EXACTLY; + } else if (childDimension == LayoutParams.MATCH_PARENT) { + // Child wants to be our size, but our size is not fixed. + // Constrain child to not be bigger than us. + resultSize = size; + resultMode = MeasureSpec.AT_MOST; + } else if (childDimension == LayoutParams.WRAP_CONTENT) { + // Child wants to determine its own size. It can't be + // bigger than us. + resultSize = size; + resultMode = MeasureSpec.AT_MOST; + } + break; + // Parent asked to see how big we want to be + case MeasureSpec.UNSPECIFIED: + if (childDimension >= 0) { + // Child wants a specific size... let them have it + resultSize = childDimension; + resultMode = MeasureSpec.EXACTLY; + } else if (childDimension == LayoutParams.MATCH_PARENT) { + // Child wants to be our size... find out how big it should + // be + resultSize = 0; //View.sUseZeroUnspecifiedMeasureSpec ? 0 : size; + resultMode = MeasureSpec.UNSPECIFIED; + } else if (childDimension == LayoutParams.WRAP_CONTENT) { + // Child wants to determine its own size.... find out how + // big it should be + resultSize = 0; //View.sUseZeroUnspecifiedMeasureSpec ? 0 : size; + resultMode = MeasureSpec.UNSPECIFIED; + } + break; + } + //noinspection ResourceType + return MeasureSpec.makeMeasureSpec(resultSize, resultMode); + } + public static class LayoutParams { public static final int FILL_PARENT = -1; public static final int MATCH_PARENT = -1; @@ -115,9 +184,11 @@ public class ViewGroup extends View implements ViewParent, ViewManager { } public LayoutParams(Context context, AttributeSet attrs) { - this.width = attrs.getAttributeIntValue("http://schemas.android.com/apk/res/android", "layout_width", 0); - this.height = attrs.getAttributeIntValue("http://schemas.android.com/apk/res/android", "layout_height", 0); + TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ViewGroup_Layout); + width = a.getLayoutDimension(R.styleable.ViewGroup_Layout_layout_width, "layout_width"); + height = a.getLayoutDimension(R.styleable.ViewGroup_Layout_layout_height, "layout_height"); this.gravity = attrs.getAttributeIntValue("http://schemas.android.com/apk/res/android", "layout_gravity", -1); + a.recycle(); } public void setMargins(int left, int top, int right, int bottom) {} @@ -129,6 +200,10 @@ public class ViewGroup extends View implements ViewParent, ViewManager { } public static class MarginLayoutParams extends ViewGroup.LayoutParams { + public int leftMargin; + public int topMargin; + public int rightMargin; + public int bottomMargin; public MarginLayoutParams() { super(); diff --git a/src/api-impl/android/view/Window.java b/src/api-impl/android/view/Window.java index 69020983..68bd2072 100644 --- a/src/api-impl/android/view/Window.java +++ b/src/api-impl/android/view/Window.java @@ -1,8 +1,22 @@ package android.view; public class Window { - public static interface Callback {} - public static class fixme_callback implements Callback {} + public static interface Callback { + public void onContentChanged(); + + public abstract boolean onCreatePanelMenu(int featureId, Menu menu); + } + public static class fixme_callback implements Callback { + + @Override + public void onContentChanged() { + } + + @Override + public boolean onCreatePanelMenu(int featureId, Menu menu) { + return false; + } + } // FIXME private public long native_window; @@ -43,4 +57,12 @@ public class Window { public boolean requestFeature(int featureId) { return false; } + + public View findViewById(int id) { + return View.view_by_id.get(id); + } + + public View peekDecorView() { + return null; + } } diff --git a/src/api-impl/android/view/accessibility/AccessibilityManager.java b/src/api-impl/android/view/accessibility/AccessibilityManager.java new file mode 100644 index 00000000..adf1a902 --- /dev/null +++ b/src/api-impl/android/view/accessibility/AccessibilityManager.java @@ -0,0 +1,5 @@ +package android.view.accessibility; + +public class AccessibilityManager { + +} diff --git a/src/api-impl/android/view/animation/DecelerateInterpolator.java b/src/api-impl/android/view/animation/DecelerateInterpolator.java new file mode 100644 index 00000000..d0805538 --- /dev/null +++ b/src/api-impl/android/view/animation/DecelerateInterpolator.java @@ -0,0 +1,5 @@ +package android.view.animation; + +public class DecelerateInterpolator implements Interpolator{ + +} diff --git a/src/api-impl/android/view/inputmethod/BaseInputConnection.java b/src/api-impl/android/view/inputmethod/BaseInputConnection.java index 4cbe90a0..2a9418ef 100644 --- a/src/api-impl/android/view/inputmethod/BaseInputConnection.java +++ b/src/api-impl/android/view/inputmethod/BaseInputConnection.java @@ -26,7 +26,6 @@ import android.text.TextUtils; import android.util.Log; import android.view.View; -class InputMethodManager {} class Editable {} class ComposingText { diff --git a/src/api-impl/android/view/inputmethod/InputMethodManager.java b/src/api-impl/android/view/inputmethod/InputMethodManager.java new file mode 100644 index 00000000..b828624d --- /dev/null +++ b/src/api-impl/android/view/inputmethod/InputMethodManager.java @@ -0,0 +1,5 @@ +package android.view.inputmethod; + +public class InputMethodManager { + +} diff --git a/src/api-impl/android/view/textservice/TextServicesManager.java b/src/api-impl/android/view/textservice/TextServicesManager.java new file mode 100644 index 00000000..0cabf993 --- /dev/null +++ b/src/api-impl/android/view/textservice/TextServicesManager.java @@ -0,0 +1,5 @@ +package android.view.textservice; + +public class TextServicesManager { + +} diff --git a/src/api-impl/android/widget/AdapterView.java b/src/api-impl/android/widget/AdapterView.java new file mode 100644 index 00000000..286caf86 --- /dev/null +++ b/src/api-impl/android/widget/AdapterView.java @@ -0,0 +1,12 @@ +package android.widget; + +import android.view.ViewGroup; + +public abstract class AdapterView extends ViewGroup { + + public interface OnItemSelectedListener { + } + + public interface OnItemClickListener { + } +} diff --git a/src/api-impl/android/widget/Button.java b/src/api-impl/android/widget/Button.java new file mode 100644 index 00000000..8519f604 --- /dev/null +++ b/src/api-impl/android/widget/Button.java @@ -0,0 +1,17 @@ +package android.widget; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.View; + +public class Button extends View { + + public Button(Context context) { + super(context); + } + + public Button(Context context, AttributeSet attributeSet) { + super(context, attributeSet); + } + +} diff --git a/src/api-impl/android/widget/CompoundButton.java b/src/api-impl/android/widget/CompoundButton.java new file mode 100644 index 00000000..b39d928e --- /dev/null +++ b/src/api-impl/android/widget/CompoundButton.java @@ -0,0 +1,17 @@ +package android.widget; + +import android.content.Context; +import android.util.AttributeSet; + +public abstract class CompoundButton extends Button { + + public CompoundButton(Context context) { + super(context); + } + + public CompoundButton(Context context, AttributeSet attributeSet) { + super(context, attributeSet); + } + + public static interface OnCheckedChangeListener {} +} diff --git a/src/api-impl/android/widget/EdgeEffect.java b/src/api-impl/android/widget/EdgeEffect.java new file mode 100644 index 00000000..4c0f9f78 --- /dev/null +++ b/src/api-impl/android/widget/EdgeEffect.java @@ -0,0 +1,17 @@ +package android.widget; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.View; + +public class EdgeEffect extends View { + + public EdgeEffect(Context context) { + super(context); + } + + public EdgeEffect(Context context, AttributeSet attributeSet) { + super(context, attributeSet); + } + +} diff --git a/src/api-impl/android/widget/FrameLayout.java b/src/api-impl/android/widget/FrameLayout.java index f7259008..1d7850da 100644 --- a/src/api-impl/android/widget/FrameLayout.java +++ b/src/api-impl/android/widget/FrameLayout.java @@ -20,6 +20,12 @@ public class FrameLayout extends ViewGroup { native_constructor(context); } + public FrameLayout(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + + native_constructor(attrs); + } + public native void native_constructor(AttributeSet attrs); public native void native_constructor(Context context); @@ -30,7 +36,16 @@ public class FrameLayout extends ViewGroup { addView(child, index, null); } + @Override + public LayoutParams generateLayoutParams(AttributeSet attrs) { + return new LayoutParams(getContext(), attrs); + } + public static class LayoutParams extends ViewGroup.MarginLayoutParams { + public LayoutParams (Context c, AttributeSet attrs) { + super(c, attrs); + } + public LayoutParams(int width, int height) { super(width, height); } diff --git a/src/api-impl/android/widget/HorizontalScrollView.java b/src/api-impl/android/widget/HorizontalScrollView.java new file mode 100644 index 00000000..4ff7d615 --- /dev/null +++ b/src/api-impl/android/widget/HorizontalScrollView.java @@ -0,0 +1,18 @@ +package android.widget; + +import android.content.Context; +import android.util.AttributeSet; + +public class HorizontalScrollView extends FrameLayout { + + public HorizontalScrollView(Context context) { + super(context); + } + + public HorizontalScrollView(Context context, AttributeSet attributeSet) { + super(context, attributeSet); + } + + public void setHorizontalScrollBarEnabled(boolean enabled) {} + +} diff --git a/src/api-impl/android/widget/ImageButton.java b/src/api-impl/android/widget/ImageButton.java new file mode 100644 index 00000000..edd8d9cf --- /dev/null +++ b/src/api-impl/android/widget/ImageButton.java @@ -0,0 +1,20 @@ +package android.widget; + +import android.content.Context; +import android.util.AttributeSet; + +public class ImageButton extends ImageView { + + public ImageButton(Context context) { + super(context); + } + + public ImageButton(Context context, AttributeSet attributeSet) { + super(context, attributeSet); + } + + public ImageButton(Context context, AttributeSet attributeSet, int defStyleAttr) { + super(context, attributeSet, defStyleAttr); + } + +} diff --git a/src/api-impl/android/widget/ImageView.java b/src/api-impl/android/widget/ImageView.java index 2967021b..a7bcda60 100644 --- a/src/api-impl/android/widget/ImageView.java +++ b/src/api-impl/android/widget/ImageView.java @@ -16,9 +16,11 @@ public class ImageView extends View { super(context, attrs); native_constructor(attrs); - int resource = attrs.getAttributeResourceValue("http://schemas.android.com/apk/res/android", "src", 0); - if (resource != 0) - setImageResource(resource); + if (attrs != null) { + int resource = attrs.getAttributeResourceValue("http://schemas.android.com/apk/res/android", "src", 0); + if (resource != 0) + setImageResource(resource); + } } public ImageView(Context context) { @@ -51,6 +53,8 @@ public class ImageView extends View { return new BitmapDrawable(getContext().getResources(), bitmap); } + public void setImageDrawable(Drawable drawable) {} + /** * Options for scaling the bounds of an image to the bounds of this view. */ diff --git a/src/api-impl/android/widget/LinearLayout.java b/src/api-impl/android/widget/LinearLayout.java index 1c90be52..f11c357e 100644 --- a/src/api-impl/android/widget/LinearLayout.java +++ b/src/api-impl/android/widget/LinearLayout.java @@ -4,7 +4,6 @@ import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; -import android.view.ViewGroup.LayoutParams; public class LinearLayout extends ViewGroup { diff --git a/src/api-impl/android/widget/ListView.java b/src/api-impl/android/widget/ListView.java new file mode 100644 index 00000000..ccb611ed --- /dev/null +++ b/src/api-impl/android/widget/ListView.java @@ -0,0 +1,17 @@ +package android.widget; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.View; + +public class ListView extends View { + + public ListView(Context context) { + super(context); + } + + public ListView(Context context, AttributeSet attributeSet) { + super(context, attributeSet); + } + +} diff --git a/src/api-impl/android/widget/OverScroller.java b/src/api-impl/android/widget/OverScroller.java new file mode 100644 index 00000000..a4c17d0f --- /dev/null +++ b/src/api-impl/android/widget/OverScroller.java @@ -0,0 +1,14 @@ +package android.widget; + +import android.content.Context; +import android.view.ViewGroup; +import android.view.animation.Interpolator; + +public class OverScroller extends ViewGroup { + + public OverScroller(Context context, Interpolator interpolator) { + super(context); + } + + public void abortAnimation () {} +} diff --git a/src/api-impl/android/widget/PopupMenu.java b/src/api-impl/android/widget/PopupMenu.java new file mode 100644 index 00000000..f7b22767 --- /dev/null +++ b/src/api-impl/android/widget/PopupMenu.java @@ -0,0 +1,146 @@ +/* + * Copyright (C) 2010 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.widget; + +import android.content.Context; +import android.view.Gravity; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.View.OnTouchListener; +import com.android.internal.R; + +/** + * A PopupMenu displays a {@link Menu} in a modal popup window anchored to a + * {@link View}. The popup will appear below the anchor view if there is room, + * or above it if there is not. If the IME is visible the popup will not + * overlap it until it is touched. Touching outside of the popup will dismiss + * it. + */ + +public class PopupMenu { + private final Context mContext; + private final View mAnchor; + private OnMenuItemClickListener mMenuItemClickListener; + private OnDismissListener mOnDismissListener; + private OnTouchListener mDragListener; + /** + * Constructor to create a new popup menu with an anchor view. + * + * @param context Context the popup menu is running in, through which it + * can access the current theme, resources, etc. + * @param anchor Anchor view for this popup. The popup will appear below + * the anchor if there is room, or above it if there is not. + */ + public PopupMenu(Context context, View anchor) { + this(context, anchor, Gravity.NO_GRAVITY); + } + /** + * Constructor to create a new popup menu with an anchor view and alignment + * gravity. + * + * @param context Context the popup menu is running in, through which it + * can access the current theme, resources, etc. + * @param anchor Anchor view for this popup. The popup will appear below + * the anchor if there is room, or above it if there is not. + * @param gravity The {@link Gravity} value for aligning the popup with its + * anchor. + */ + public PopupMenu(Context context, View anchor, int gravity) { + this(context, anchor, gravity, R.attr.popupMenuStyle, 0); + } + /** + * Constructor a create a new popup menu with a specific style. + * + * @param context Context the popup menu is running in, through which it + * can access the current theme, resources, etc. + * @param anchor Anchor view for this popup. The popup will appear below + * the anchor if there is room, or above it if there is not. + * @param gravity The {@link Gravity} value for aligning the popup with its + * anchor. + * @param popupStyleAttr An attribute in the current theme that contains a + * reference to a style resource that supplies default values for + * the popup window. Can be 0 to not look for defaults. + * @param popupStyleRes A resource identifier of a style resource that + * supplies default values for the popup window, used only if + * popupStyleAttr is 0 or can not be found in the theme. Can be 0 + * to not look for defaults. + */ + public PopupMenu(Context context, View anchor, int gravity, int popupStyleAttr, + int popupStyleRes) { + mContext = context; + mAnchor = anchor; + } + + /** + * @return a {@link MenuInflater} that can be used to inflate menu items + * from XML into the menu returned by {@link #getMenu()} + * @see #getMenu() + */ + public MenuInflater getMenuInflater() { + return new MenuInflater(mContext); + } + + /** + * Sets a listener that will be notified when the user selects an item from + * the menu. + * + * @param listener the listener to notify + */ + public void setOnMenuItemClickListener(OnMenuItemClickListener listener) { + mMenuItemClickListener = listener; + } + + /** + * Sets a listener that will be notified when this menu is dismissed. + * + * @param listener the listener to notify + */ + public void setOnDismissListener(OnDismissListener listener) { + mOnDismissListener = listener; + } + + /** + * Interface responsible for receiving menu item click events if the items + * themselves do not have individual item click listeners. + */ + public interface OnMenuItemClickListener { + /** + * This method will be invoked when a menu item is clicked if the item + * itself did not already handle the event. + * + * @param item the menu item that was clicked + * @return {@code true} if the event was handled, {@code false} + * otherwise + */ + boolean onMenuItemClick(MenuItem item); + } + + /** + * Callback interface used to notify the application that the menu has closed. + */ + public interface OnDismissListener { + /** + * Called when the associated menu has been dismissed. + * + * @param menu the popup menu that was dismissed + */ + void onDismiss(PopupMenu menu); + } + +} \ No newline at end of file diff --git a/src/api-impl/android/widget/Scroller.java b/src/api-impl/android/widget/Scroller.java new file mode 100644 index 00000000..cae7bc48 --- /dev/null +++ b/src/api-impl/android/widget/Scroller.java @@ -0,0 +1,22 @@ +package android.widget; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.View; +import android.view.animation.Interpolator; + +public class Scroller extends View { + + public Scroller(Context context) { + super(context); + } + + public Scroller(Context context, AttributeSet attributeSet) { + super(context, attributeSet); + } + + public Scroller(Context context, Interpolator interpolator) { + this(context); + } + +} diff --git a/src/api-impl/android/widget/SeekBar.java b/src/api-impl/android/widget/SeekBar.java new file mode 100644 index 00000000..0e91af23 --- /dev/null +++ b/src/api-impl/android/widget/SeekBar.java @@ -0,0 +1,20 @@ +package android.widget; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.View; + +public class SeekBar extends View { + + public SeekBar(Context context) { + super(context); + } + + public SeekBar(Context context, AttributeSet attributeSet) { + super(context, attributeSet); + } + + public interface OnSeekBarChangeListener { + } + +} diff --git a/src/api-impl/android/widget/TextView.java b/src/api-impl/android/widget/TextView.java index 55831149..d2c3cb1a 100644 --- a/src/api-impl/android/widget/TextView.java +++ b/src/api-impl/android/widget/TextView.java @@ -6,7 +6,9 @@ import android.content.res.TypedArray; import android.graphics.Typeface; import android.text.InputFilter; import android.text.TextPaint; +import android.text.TextUtils; import android.text.TextWatcher; +import android.text.method.TransformationMethod; import android.util.AttributeSet; import android.view.View; @@ -29,6 +31,10 @@ public class TextView extends View { native_constructor(context); } + public TextView(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs); + } + native void native_constructor(AttributeSet attrs); native void native_constructor(Context context); @@ -76,6 +82,24 @@ public class TextView extends View { public void addTextChangedListener(TextWatcher watcher) {} public void setOnEditorActionListener(TextView.OnEditorActionListener l) {} + public TransformationMethod getTransformationMethod() { + return null; + } + + public void setHintTextColor(ColorStateList colorStateList) {} + public void setLinkTextColor(ColorStateList colorStateList) {} + + public void setSingleLine() {} + + public void setEllipsize(TextUtils.TruncateAt truncateAt) {} + + public void setTextAppearance(Context context, int appearance) {} + + public void setMaxLines(int maxLines) {} + + public void setMinWidth(int minWidth) {} + public void setMaxWidth(int maxWidth) {} + public static interface OnEditorActionListener { } } diff --git a/src/api-impl/meson.build b/src/api-impl/meson.build index 606cb8bc..1fa3377f 100644 --- a/src/api-impl/meson.build +++ b/src/api-impl/meson.build @@ -1,5 +1,11 @@ hax_jar = jar('hax', [ 'android/accounts/Account.java', + 'android/accounts/AccountManager.java', + 'android/animation/Animator.java', + 'android/animation/AnimatorInflater.java', + 'android/animation/AnimatorListenerAdapter.java', + 'android/animation/LayoutTransition.java', + 'android/animation/ValueAnimator.java', 'android/annotation/PrivateApi.java', 'android/annotation/SdkConstant.java', 'android/annotation/SuppressLint.java', @@ -11,14 +17,22 @@ hax_jar = jar('hax', [ 'android/app/AlertDialog.java', 'android/app/Application.java', 'android/app/Dialog.java', + 'android/app/DownloadManager.java', + 'android/app/Fragment.java', + 'android/app/FragmentManager.java', + 'android/app/FragmentTransaction.java', 'android/app/IntentService.java', 'android/app/KeyguardManager.java', 'android/app/NativeActivity.java', 'android/app/NotificationManager.java', 'android/app/PendingIntent.java', 'android/app/ProgressDialog.java', + 'android/app/SearchManager.java', 'android/app/Service.java', 'android/app/SharedPreferencesImpl.java', + 'android/app/UiModeManager.java', + 'android/app/WallpaperManager.java', + 'android/app/admin/DevicePolicyManager.java', 'android/content/ActivityNotFoundException.java', 'android/content/BroadcastReceiver.java', 'android/content/ClipboardManager.java', @@ -28,6 +42,7 @@ hax_jar = jar('hax', [ 'android/content/ContentResolver.java', 'android/content/ContentValues.java', 'android/content/Context.java', + 'android/content/ContextWrapper.java', 'android/content/DialogInterface.java', 'android/content/IntentFilter.java', 'android/content/Intent.java', @@ -67,6 +82,9 @@ hax_jar = jar('hax', [ 'android/content/SharedPreferences.java', 'android/database/Cursor.java', 'android/database/ContentObserver.java', + 'android/database/DataSetObservable.java', + 'android/database/DataSetObserver.java', + 'android/database/Observable.java', 'android/database/sqlite/DatabaseErrorHandler.java', 'android/database/sqlite/SQLiteCursorDriver.java', 'android/database/sqlite/SQLiteCursor.java', @@ -86,7 +104,9 @@ hax_jar = jar('hax', [ 'android/graphics/Paint.java', 'android/graphics/Path.java', 'android/graphics/Point.java', + 'android/graphics/PointF.java', 'android/graphics/PorterDuff.java', + 'android/graphics/PorterDuffColorFilter.java', 'android/graphics/PorterDuffXfermode.java', 'android/graphics/RectF.java', 'android/graphics/Rect.java', @@ -95,7 +115,11 @@ hax_jar = jar('hax', [ 'android/graphics/Xfermode.java', 'android/graphics/drawable/AnimationDrawable.java', 'android/graphics/drawable/BitmapDrawable.java', + 'android/graphics/drawable/ColorDrawable.java', 'android/graphics/drawable/Drawable.java', + 'android/graphics/drawable/GradientDrawable.java', + 'android/graphics/drawable/LayerDrawable.java', + 'android/graphics/drawable/Animatable.java', 'android/hardware/display/DisplayManager.java', 'android/hardware/input/InputManager.java', 'android/hardware/SensorEvent.java', @@ -116,6 +140,9 @@ hax_jar = jar('hax', [ 'android/net/ConnectivityManager.java', 'android/net/NetworkInfo.java', 'android/net/Uri.java', + 'android/net/wifi/WifiManager.java', + 'android/net/wifi/p2p/WifiP2pManager.java', + 'android/nfc/NfcManager.java', 'android/opengl/EGLConfig.java', 'android/opengl/EGLObjectHandle.java', 'android/opengl/GLES20.java', @@ -127,6 +154,7 @@ hax_jar = jar('hax', [ 'android/os/Bundle.java', 'android/os/CancellationSignal.java', 'android/os/Debug.java', + 'android/os/DropBoxManager.java', 'android/os/Environment.java', 'android/os/Handler.java', 'android/os/HandlerThread.java', @@ -148,6 +176,7 @@ hax_jar = jar('hax', [ 'android/os/SystemClock.java', 'android/os/Trace.java', 'android/os/UserHandle.java', + 'android/os/storage/StorageManager.java', 'android/preference/PreferenceManager.java', 'android/provider/Settings.java', 'android/R.java', @@ -170,6 +199,8 @@ hax_jar = jar('hax', [ 'android/text/TextPaint.java', 'android/text/TextUtils.java', 'android/text/TextWatcher.java', + 'android/text/method/PasswordTransformationMethod.java', + 'android/text/method/TransformationMethod.java', 'android/text/util/Linkify.java', 'android/util/AndroidException.java', 'android/util/AndroidRuntimeException.java', @@ -191,28 +222,39 @@ hax_jar = jar('hax', [ 'android/util/Slog.java', 'android/util/SparseArray.java', 'android/util/SparseIntArray.java', + 'android/util/SparseBooleanArray.java', 'android/util/StateSet.java', 'android/util/TypedValue.java', 'android/util/Xml.java', 'android/util/XmlPullAttributes.java', 'android/view/animation/AccelerateInterpolator.java', + 'android/view/animation/DecelerateInterpolator.java', 'android/view/animation/Interpolator.java', + 'android/view/AbsSavedState.java', + 'android/view/ActionMode.java', + 'android/view/ContextThemeWrapper.java', 'android/view/Choreographer.java', 'android/view/Display.java', 'android/view/Gravity.java', + 'android/view/InflateException.java', 'android/view/InputDevice.java', 'android/view/InputEvent.java', 'android/view/InputQueue.java', 'android/view/inputmethod/BaseInputConnection.java', 'android/view/inputmethod/InputConnection.java', + 'android/view/inputmethod/InputMethodManager.java', 'android/view/KeyCharacterMap.java', 'android/view/KeyEvent.java', 'android/view/LayoutInflater.java', 'android/view/Menu.java', + 'android/view/MenuInflater.java', + 'android/view/MenuItem.java', 'android/view/MotionEvent.java', + 'android/view/SubMenu.java', 'android/view/SurfaceHolder.java', 'android/view/Surface.java', 'android/view/SurfaceView.java', + 'android/view/ViewConfiguration.java', 'android/view/ViewGroup.java', 'android/view/View.java', 'android/view/ViewManager.java', @@ -223,19 +265,32 @@ hax_jar = jar('hax', [ 'android/view/WindowManager.java', 'android/view/animation/Animation.java', 'android/view/animation/AnimationUtils.java', + 'android/view/accessibility/AccessibilityManager.java', + 'android/view/textservice/TextServicesManager.java', 'android/webkit/DownloadListener.java', 'android/webkit/WebSettings.java', 'android/webkit/WebView.java', 'android/webkit/WebViewClient.java', + 'android/widget/AdapterView.java', + 'android/widget/Button.java', + 'android/widget/CompoundButton.java', + 'android/widget/EdgeEffect.java', 'android/widget/EditText.java', 'android/widget/FrameLayout.java', + 'android/widget/HorizontalScrollView.java', + 'android/widget/ImageButton.java', 'android/widget/ImageView.java', 'android/widget/LinearLayout.java', + 'android/widget/ListView.java', 'android/widget/MediaController.java', + 'android/widget/OverScroller.java', + 'android/widget/PopupMenu.java', 'android/widget/ProgressBar.java', 'android/widget/RadioButton.java', 'android/widget/RelativeLayout.java', + 'android/widget/Scroller.java', 'android/widget/ScrollView.java', + 'android/widget/SeekBar.java', 'android/widget/TextView.java', 'com/android/internal/Manifest.java', 'com/android/internal/R.java', @@ -263,6 +318,7 @@ hax_jar = jar('hax', [ 'javax/microedition/khronos/opengles/GL11Ext.java', 'javax/microedition/khronos/opengles/GL11.java', 'javax/microedition/khronos/opengles/GL.java', + 'org/apache/harmony/xnet/provider/jsse/SSLParametersImpl.java', ], dependencies: [ declare_dependency(link_with: hax_arsc_lib_jar) diff --git a/src/api-impl/org/apache/harmony/xnet/provider/jsse/SSLParametersImpl.java b/src/api-impl/org/apache/harmony/xnet/provider/jsse/SSLParametersImpl.java new file mode 100644 index 00000000..7caab591 --- /dev/null +++ b/src/api-impl/org/apache/harmony/xnet/provider/jsse/SSLParametersImpl.java @@ -0,0 +1,5 @@ +package org.apache.harmony.xnet.provider.jsse; + +public class SSLParametersImpl { + +}