Merge "Revert "LayoutInflater: Special case well-known View constructors""
This commit is contained in:
@@ -53,11 +53,6 @@ public class PhoneLayoutInflater extends LayoutInflater {
|
|||||||
call through to our super class.
|
call through to our super class.
|
||||||
*/
|
*/
|
||||||
@Override protected View onCreateView(String name, AttributeSet attrs) throws ClassNotFoundException {
|
@Override protected View onCreateView(String name, AttributeSet attrs) throws ClassNotFoundException {
|
||||||
View fastView = fastCreateView(name, getContext(), attrs);
|
|
||||||
if (fastView != null) {
|
|
||||||
return fastView;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (String prefix : sClassPrefixList) {
|
for (String prefix : sClassPrefixList) {
|
||||||
try {
|
try {
|
||||||
View view = createView(name, prefix, attrs);
|
View view = createView(name, prefix, attrs);
|
||||||
@@ -73,67 +68,6 @@ public class PhoneLayoutInflater extends LayoutInflater {
|
|||||||
return super.onCreateView(name, attrs);
|
return super.onCreateView(name, attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final View fastCreateView(String name, Context context, AttributeSet attrs) {
|
|
||||||
switch (name) {
|
|
||||||
case "ActionMenuView":
|
|
||||||
return new android.widget.ActionMenuView(context, attrs);
|
|
||||||
case "AutoCompleteTextView":
|
|
||||||
return new android.widget.AutoCompleteTextView(context, attrs);
|
|
||||||
case "Button":
|
|
||||||
return new android.widget.Button(context, attrs);
|
|
||||||
case "CheckBox":
|
|
||||||
return new android.widget.CheckBox(context, attrs);
|
|
||||||
case "CheckedTextView":
|
|
||||||
return new android.widget.CheckedTextView(context, attrs);
|
|
||||||
case "EditText":
|
|
||||||
return new android.widget.EditText(context, attrs);
|
|
||||||
case "FrameLayout":
|
|
||||||
return new android.widget.FrameLayout(context, attrs);
|
|
||||||
case "ImageButton":
|
|
||||||
return new android.widget.ImageButton(context, attrs);
|
|
||||||
case "ImageView":
|
|
||||||
return new android.widget.ImageView(context, attrs);
|
|
||||||
case "LinearLayout":
|
|
||||||
return new android.widget.LinearLayout(context, attrs);
|
|
||||||
case "ListView":
|
|
||||||
return new android.widget.ListView(context, attrs);
|
|
||||||
case "MultiAutoCompleteTextView":
|
|
||||||
return new android.widget.AutoCompleteTextView(context, attrs);
|
|
||||||
case "ProgressBar":
|
|
||||||
return new android.widget.ProgressBar(context, attrs);
|
|
||||||
case "RadioButton":
|
|
||||||
return new android.widget.RadioButton(context, attrs);
|
|
||||||
case "RatingBar":
|
|
||||||
return new android.widget.RatingBar(context, attrs);
|
|
||||||
case "RelativeLayout":
|
|
||||||
return new android.widget.RelativeLayout(context, attrs);
|
|
||||||
case "ScrollView":
|
|
||||||
return new android.widget.ScrollView(context, attrs);
|
|
||||||
case "SeekBar":
|
|
||||||
return new android.widget.SeekBar(context, attrs);
|
|
||||||
case "Space":
|
|
||||||
return new android.widget.Space(context, attrs);
|
|
||||||
case "Spinner":
|
|
||||||
return new android.widget.Spinner(context, attrs);
|
|
||||||
case "TextureView":
|
|
||||||
return new android.view.TextureView(context, attrs);
|
|
||||||
case "TextView":
|
|
||||||
return new android.widget.TextView(context, attrs);
|
|
||||||
case "ToggleButton":
|
|
||||||
return new android.widget.ToggleButton(context, attrs);
|
|
||||||
case "Toolbar":
|
|
||||||
return new android.widget.Toolbar(context, attrs);
|
|
||||||
case "View":
|
|
||||||
return new android.view.View(context, attrs);
|
|
||||||
case "ViewFlipper":
|
|
||||||
return new android.widget.ViewFlipper(context, attrs);
|
|
||||||
case "ViewStub":
|
|
||||||
return new android.view.ViewStub(context, attrs);
|
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public LayoutInflater cloneInContext(Context newContext) {
|
public LayoutInflater cloneInContext(Context newContext) {
|
||||||
return new PhoneLayoutInflater(this, newContext);
|
return new PhoneLayoutInflater(this, newContext);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user