项目:gloomy-dungeons-2
文件:_HoloFragmentInflater.java
private static View inflate(AttributeSet attrs,View parent,FragmentActivity activity,Fragment parentFragment) {
String fname = attrs.getAttributeValue(null,"class");
TypedArray a = activity.obtainStyledAttributes(attrs,FragmentTag.Fragment);
if (fname == null) {
fname = a.getString(FragmentTag.Fragment_name);
}
if (fname.startsWith(".")) {
fname = activity.getPackageName() + fname;
}
int id = a.getResourceId(FragmentTag.Fragment_id,View.NO_ID);
String tag = a.getString(FragmentTag.Fragment_tag);
a.recycle();
int containerId = parent != null ? parent.getId() : View.NO_ID;
if (containerId == View.NO_ID && id == View.NO_ID && tag == null) {
throw new IllegalArgumentException(
attrs.getPositionDescription()
+ ": Must specify unique android:id,android:tag,or have a parent with an id for "
+ fname);
}
FragmentManagerImpl impl = obtainFragmentManager(activity,parentFragment);
Fragment fragment = id != View.NO_ID ? impl.findFragmentById(id) : null;
if (fragment == null && tag != null) {
fragment = impl.findFragmentByTag(tag);
}
if (fragment == null && containerId != View.NO_ID) {
fragment = impl.findFragmentById(containerId);
}
if (fragment == null) {
fragment = Fragment.instantiate(activity,fname);
fragment.mParentFragment = parentFragment;
fragment.mActivity = activity;
fragment.mFromLayout = true;
fragment.mFragmentId = id != 0 ? id : containerId;
fragment.mContainer = (ViewGroup) parent;
fragment.mContainerId = containerId;
fragment.mTag = tag;
fragment.mInLayout = true;
fragment.mFragmentManager = impl;
fragment.onInflate(activity,attrs,fragment.mSavedFragmentState);
impl.addFragment(fragment,true);
} else if (fragment.mInLayout) {
throw new IllegalArgumentException(attrs.getPositionDescription()
+ ": Duplicate id 0x" + Integer.toHexString(id)
+ ",tag " + tag + ",or parent id 0x" + Integer.toHexString(containerId)
+ " with another fragment for " + fname);
} else {
fragment.mInLayout = true;
if (!fragment.mRetaining) {
fragment.onInflate(activity,fragment.mSavedFragmentState);
}
impl.movetoState(fragment);
}
if (fragment.mView == null) {
throw new IllegalStateException("Fragment " + fname
+ " did not create a view.");
}
if (id != 0) {
fragment.mView.setId(id);
}
if (fragment.mView.getTag() == null) {
fragment.mView.setTag(tag);
}
return fragment.mView;
}
项目:laposte-android
文件:_HoloFragmentInflater.java
private static View inflate(AttributeSet attrs,View.NO_ID);
String tag = a.getString(FragmentTag.Fragment_tag);
a.recycle();
int containerId = parent != null ? parent.getId() : 0;
if (containerId == View.NO_ID && id == View.NO_ID && tag == null) {
throw new IllegalArgumentException(
attrs.getPositionDescription()
+ ": Must specify unique android:id,fragment.mSavedFragmentState);
}
impl.movetoState(fragment);
}
if (fragment.mView == null) {
throw new IllegalStateException("Fragment " + fname
+ " did not create a view.");
}
if (id != 0) {
fragment.mView.setId(id);
}
if (fragment.mView.getTag() == null) {
fragment.mView.setTag(tag);
}
return fragment.mView;
}
项目:TflTravelAlerts
文件:_HoloFragmentInflater.java
private static View inflate(AttributeSet attrs,fragment.mSavedFragmentState);
}
impl.movetoState(fragment);
}
if (fragment.mView == null) {
throw new IllegalStateException("Fragment " + fname
+ " did not create a view.");
}
if (id != 0) {
fragment.mView.setId(id);
}
if (fragment.mView.getTag() == null) {
fragment.mView.setTag(tag);
}
return fragment.mView;
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。