use of com.andframe.annotation.pager.load.idname.LoadContentViewId$ in project AndFrameWorks by scwang90.
the class AfLoadHelper method findContentView.
// <editor-fold desc="初始化布局">
public View findContentView() {
Class<?> stop = mPager instanceof Activity ? AfLoadActivity.class : AfLoadFragment.class;
LoadContentViewId id = AfReflecter.getAnnotation(mPager.getClass(), stop, LoadContentViewId.class);
if (id != null) {
return mPager.findViewById(id.value());
}
LoadContentViewId$ id$ = AfReflecter.getAnnotation(mPager.getClass(), stop, LoadContentViewId$.class);
if (id$ != null) {
Context context = AfApp.get();
if (context != null) {
int idv = context.getResources().getIdentifier(id$.value(), "id", context.getPackageName());
if (idv > 0) {
return mPager.findViewById(idv);
}
}
}
LoadContentViewType type = AfReflecter.getAnnotation(mPager.getClass(), stop, LoadContentViewType.class);
if (type != null) {
return AfApp.get().newViewQuery(mPager).$(type.value()).view();
}
Queue<View> views = new LinkedBlockingQueue<>(Collections.singletonList(mPager.getView()));
do {
View view = views.poll();
if (view != null) {
if (view instanceof AbsListView || view instanceof RecyclerView || view instanceof ScrollView || view instanceof WebView || view instanceof NestedScrollView || view instanceof ViewPager) {
return view;
} else if (view instanceof ViewGroup) {
ViewGroup group = (ViewGroup) view;
for (int j = 0; j < group.getChildCount(); j++) {
views.add(group.getChildAt(j));
}
}
}
} while (!views.isEmpty());
return null;
}
Aggregations