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:
@@ -35,12 +35,12 @@ public class LayoutInflater {
|
||||
public final View createView(String name, String prefix, AttributeSet attrs) throws Exception {
|
||||
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);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -688,11 +688,14 @@ public class View extends Object {
|
||||
|
||||
public View() {} // FIXME
|
||||
|
||||
public View(AttributeSet attrs) {
|
||||
id = attrs.getAttributeResourceValue("http://schemas.android.com/apk/res/android", "id", 0);
|
||||
public View(Context context, AttributeSet attrs) {
|
||||
this(context);
|
||||
|
||||
if (id != 0)
|
||||
view_by_id.put(id, this);
|
||||
if (attrs != null) {
|
||||
id = attrs.getAttributeResourceValue("http://schemas.android.com/apk/res/android", "id", 0);
|
||||
if (id != 0)
|
||||
setId(id);
|
||||
}
|
||||
}
|
||||
|
||||
public View findViewById(int id) {
|
||||
@@ -766,7 +769,9 @@ public class View extends Object {
|
||||
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) {}
|
||||
|
||||
|
||||
@@ -18,8 +18,14 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
|
||||
children = new ArrayList<View>();
|
||||
}
|
||||
|
||||
public ViewGroup(AttributeSet attrs) {
|
||||
super(attrs);
|
||||
public ViewGroup(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
|
||||
children = new ArrayList<View>();
|
||||
}
|
||||
|
||||
public ViewGroup(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs);
|
||||
|
||||
children = new ArrayList<View>();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user