You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
add 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
This commit is contained in:
12
src/api-impl/android/widget/AdapterView.java
Normal file
12
src/api-impl/android/widget/AdapterView.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package android.widget;
|
||||
|
||||
import android.view.ViewGroup;
|
||||
|
||||
public abstract class AdapterView extends ViewGroup {
|
||||
|
||||
public interface OnItemSelectedListener {
|
||||
}
|
||||
|
||||
public interface OnItemClickListener {
|
||||
}
|
||||
}
|
||||
17
src/api-impl/android/widget/Button.java
Normal file
17
src/api-impl/android/widget/Button.java
Normal file
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
17
src/api-impl/android/widget/CompoundButton.java
Normal file
17
src/api-impl/android/widget/CompoundButton.java
Normal file
@@ -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 {}
|
||||
}
|
||||
17
src/api-impl/android/widget/EdgeEffect.java
Normal file
17
src/api-impl/android/widget/EdgeEffect.java
Normal file
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
18
src/api-impl/android/widget/HorizontalScrollView.java
Normal file
18
src/api-impl/android/widget/HorizontalScrollView.java
Normal file
@@ -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) {}
|
||||
|
||||
}
|
||||
20
src/api-impl/android/widget/ImageButton.java
Normal file
20
src/api-impl/android/widget/ImageButton.java
Normal file
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
17
src/api-impl/android/widget/ListView.java
Normal file
17
src/api-impl/android/widget/ListView.java
Normal file
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
14
src/api-impl/android/widget/OverScroller.java
Normal file
14
src/api-impl/android/widget/OverScroller.java
Normal file
@@ -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 () {}
|
||||
}
|
||||
146
src/api-impl/android/widget/PopupMenu.java
Normal file
146
src/api-impl/android/widget/PopupMenu.java
Normal file
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
22
src/api-impl/android/widget/Scroller.java
Normal file
22
src/api-impl/android/widget/Scroller.java
Normal file
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
20
src/api-impl/android/widget/SeekBar.java
Normal file
20
src/api-impl/android/widget/SeekBar.java
Normal file
@@ -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 {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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 {
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user