| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package com.android.internal.policy; |
| 18 |
|
| 19 |
import android.content.Context; |
| 20 |
import android.util.AttributeSet; |
| 21 |
import android.view.LayoutInflater; |
| 22 |
import android.view.View; |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
public class PhoneLayoutInflater extends LayoutInflater { |
| 28 |
private static final String[] sClassPrefixList = { |
| 29 |
"android.widget.", |
| 30 |
"android.webkit.", |
| 31 |
"android.app." |
| 32 |
}; |
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
public PhoneLayoutInflater(Context context) { |
| 44 |
super(context); |
| 45 |
} |
| 46 |
|
| 47 |
protected PhoneLayoutInflater(LayoutInflater original, Context newContext) { |
| 48 |
super(original, newContext); |
| 49 |
} |
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
@Override protected View onCreateView(String name, AttributeSet attrs) throws ClassNotFoundException { |
| 56 |
for (String prefix : sClassPrefixList) { |
| 57 |
try { |
| 58 |
View view = createView(name, prefix, attrs); |
| 59 |
if (view != null) { |
| 60 |
return view; |
| 61 |
} |
| 62 |
} catch (ClassNotFoundException e) { |
| 63 |
|
| 64 |
|
| 65 |
} |
| 66 |
} |
| 67 |
|
| 68 |
return super.onCreateView(name, attrs); |
| 69 |
} |
| 70 |
|
| 71 |
public LayoutInflater cloneInContext(Context newContext) { |
| 72 |
return new PhoneLayoutInflater(this, newContext); |
| 73 |
} |
| 74 |
} |
| 75 |
|