summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/com/android/internal/policy/PhoneLayoutInflater.java66
1 files changed, 66 insertions, 0 deletions
diff --git a/core/java/com/android/internal/policy/PhoneLayoutInflater.java b/core/java/com/android/internal/policy/PhoneLayoutInflater.java
index 991b6bba7396..0781f1aba87a 100644
--- a/core/java/com/android/internal/policy/PhoneLayoutInflater.java
+++ b/core/java/com/android/internal/policy/PhoneLayoutInflater.java
@@ -53,6 +53,11 @@ public class PhoneLayoutInflater extends LayoutInflater {
call through to our super class.
*/
@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) {
try {
View view = createView(name, prefix, attrs);
@@ -68,6 +73,67 @@ public class PhoneLayoutInflater extends LayoutInflater {
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) {
return new PhoneLayoutInflater(this, newContext);
}