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 missing Context attribute to all View constructors
This commit is contained in:
@@ -27,8 +27,8 @@ public class GLSurfaceView extends View implements SurfaceHolder.Callback { // T
|
|||||||
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {}
|
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {}
|
||||||
public void surfaceDestroyed(SurfaceHolder holder) {}
|
public void surfaceDestroyed(SurfaceHolder holder) {}
|
||||||
|
|
||||||
public GLSurfaceView(AttributeSet attrs) {
|
public GLSurfaceView(Context context, AttributeSet attrs) {
|
||||||
super(attrs);
|
super(context, attrs);
|
||||||
|
|
||||||
java_egl_wrapper = (EGL10)EGLContext.getEGL();
|
java_egl_wrapper = (EGL10)EGLContext.getEGL();
|
||||||
java_gl_wrapper = (GL10)EGLContext.getGL();
|
java_gl_wrapper = (GL10)EGLContext.getGL();
|
||||||
|
|||||||
@@ -35,12 +35,12 @@ public class LayoutInflater {
|
|||||||
public final View createView(String name, String prefix, AttributeSet attrs) throws Exception {
|
public final View createView(String name, String prefix, AttributeSet attrs) throws Exception {
|
||||||
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>> createView(" + name + ", " + prefix + ", " + attrs + ");");
|
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>> createView(" + name + ", " + prefix + ", " + attrs + ");");
|
||||||
|
|
||||||
String view_class_name = prefix + name;
|
String view_class_name = prefix!=null ? prefix + name : name;
|
||||||
Class view_class = Class.forName(view_class_name);
|
Class view_class = Class.forName(view_class_name);
|
||||||
|
|
||||||
Constructor constructor = view_class.getConstructor(AttributeSet.class);
|
Constructor constructor = view_class.getConstructor(Context.class, AttributeSet.class);
|
||||||
|
|
||||||
View view_instance = (View)constructor.newInstance(attrs);
|
View view_instance = (View)constructor.newInstance(Context.this_application, attrs);
|
||||||
|
|
||||||
return view_instance;
|
return view_instance;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -688,11 +688,14 @@ public class View extends Object {
|
|||||||
|
|
||||||
public View() {} // FIXME
|
public View() {} // FIXME
|
||||||
|
|
||||||
public View(AttributeSet attrs) {
|
public View(Context context, AttributeSet attrs) {
|
||||||
id = attrs.getAttributeResourceValue("http://schemas.android.com/apk/res/android", "id", 0);
|
this(context);
|
||||||
|
|
||||||
if (id != 0)
|
if (attrs != null) {
|
||||||
view_by_id.put(id, this);
|
id = attrs.getAttributeResourceValue("http://schemas.android.com/apk/res/android", "id", 0);
|
||||||
|
if (id != 0)
|
||||||
|
setId(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public View findViewById(int id) {
|
public View findViewById(int id) {
|
||||||
@@ -766,7 +769,9 @@ public class View extends Object {
|
|||||||
System.out.println("setContentDescription called with: >" + contentDescription + "<");
|
System.out.println("setContentDescription called with: >" + contentDescription + "<");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(int id) {}
|
public void setId(int id) {
|
||||||
|
view_by_id.put(id, this);
|
||||||
|
}
|
||||||
|
|
||||||
public void setOnKeyListener(OnKeyListener l) {}
|
public void setOnKeyListener(OnKeyListener l) {}
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,14 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
|
|||||||
children = new ArrayList<View>();
|
children = new ArrayList<View>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ViewGroup(AttributeSet attrs) {
|
public ViewGroup(Context context, AttributeSet attrs) {
|
||||||
super(attrs);
|
super(context, attrs);
|
||||||
|
|
||||||
|
children = new ArrayList<View>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ViewGroup(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||||
|
super(context, attrs);
|
||||||
|
|
||||||
children = new ArrayList<View>();
|
children = new ArrayList<View>();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
package android.widget;
|
package android.widget;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
public class EditText extends TextView {
|
public class EditText extends TextView {
|
||||||
public EditText(Context context) {
|
public EditText(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EditText(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import android.view.ViewGroup.LayoutParams;
|
|||||||
|
|
||||||
public class FrameLayout extends ViewGroup {
|
public class FrameLayout extends ViewGroup {
|
||||||
|
|
||||||
public FrameLayout(AttributeSet attrs) {
|
public FrameLayout(Context context, AttributeSet attrs) {
|
||||||
super(attrs);
|
super(context, attrs);
|
||||||
|
|
||||||
native_constructor(attrs);
|
native_constructor(attrs);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ public class ImageView extends View {
|
|||||||
|
|
||||||
private Bitmap bitmap;
|
private Bitmap bitmap;
|
||||||
|
|
||||||
public ImageView(AttributeSet attrs) {
|
public ImageView(Context context, AttributeSet attrs) {
|
||||||
super(attrs);
|
super(context, attrs);
|
||||||
|
|
||||||
native_constructor(attrs);
|
native_constructor(attrs);
|
||||||
int resource = attrs.getAttributeResourceValue("http://schemas.android.com/apk/res/android", "src", 0);
|
int resource = attrs.getAttributeResourceValue("http://schemas.android.com/apk/res/android", "src", 0);
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ public class LinearLayout extends ViewGroup {
|
|||||||
|
|
||||||
boolean orientation;
|
boolean orientation;
|
||||||
|
|
||||||
public LinearLayout(AttributeSet attrs) {
|
public LinearLayout(Context context, AttributeSet attrs) {
|
||||||
super(attrs);
|
super(context, attrs);
|
||||||
|
|
||||||
native_constructor(attrs);
|
native_constructor(attrs);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import android.util.AttributeSet;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
public class ProgressBar extends View {
|
public class ProgressBar extends View {
|
||||||
public ProgressBar(AttributeSet attrs) {
|
public ProgressBar(Context context, AttributeSet attrs) {
|
||||||
super(attrs);
|
super(context, attrs);
|
||||||
|
|
||||||
native_constructor(attrs);
|
native_constructor(attrs);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ public class RelativeLayout extends ViewGroup {
|
|||||||
|
|
||||||
boolean orientation;
|
boolean orientation;
|
||||||
|
|
||||||
public RelativeLayout(AttributeSet attrs) {
|
public RelativeLayout(Context context, AttributeSet attrs) {
|
||||||
super(attrs);
|
super(context, attrs);
|
||||||
|
|
||||||
native_constructor(attrs);
|
native_constructor(attrs);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import android.view.ViewGroup;
|
|||||||
import android.view.ViewGroup.LayoutParams;
|
import android.view.ViewGroup.LayoutParams;
|
||||||
|
|
||||||
public class ScrollView extends ViewGroup {
|
public class ScrollView extends ViewGroup {
|
||||||
public ScrollView(AttributeSet attrs) {
|
public ScrollView(Context context, AttributeSet attrs) {
|
||||||
super(attrs);
|
super(context, attrs);
|
||||||
|
|
||||||
native_constructor(attrs);
|
native_constructor(attrs);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ public class TextView extends View {
|
|||||||
id = _id;
|
id = _id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextView(AttributeSet attrs) {
|
public TextView(Context context, AttributeSet attrs) {
|
||||||
super(attrs);
|
super(context, attrs);
|
||||||
|
|
||||||
native_constructor(attrs);
|
native_constructor(attrs);
|
||||||
}
|
}
|
||||||
@@ -44,6 +44,10 @@ public class TextView extends View {
|
|||||||
native_set_markup(1);
|
native_set_markup(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setText(int resId) {
|
||||||
|
setText(getContext().getResources().getText(resId));
|
||||||
|
}
|
||||||
|
|
||||||
private native final void native_set_markup(int bool);
|
private native final void native_set_markup(int bool);
|
||||||
|
|
||||||
public native final void native_setText(String text);
|
public native final void native_setText(String text);
|
||||||
|
|||||||
Reference in New Issue
Block a user