@Test public void testInstantiateItem() throws Exception { testAddPageView(); ViewPager viewPager = new ViewPager(child.getContext()); viewPager.setAdapter(adapter); Object obj = adapter.instantiateItem(viewPager,adapter.getRealCount()); assertEquals(child,obj); }
@Override public Object instantiateItem(ViewGroup container, int position) { View pageView = null; try { pageView = shadow.get(position); if (WXEnvironment.isApkDebugable()) { WXLogUtils.d("onPageSelected >>>> instantiateItem >>>>> position:" + position + ",position % getRealCount()" + position % getRealCount()); } if (pageView.getParent() == null) { container.addView(pageView); } else { ((ViewGroup) pageView.getParent()).removeView(pageView); container.addView(pageView); } } catch (Exception e) { WXLogUtils.e("[CirclePageAdapter] instantiateItem: ", e); } return pageView; }
WXCirclePageAdapter extends PagerAdapter { @Override public Object instantiateItem(ViewGroup container, int position) { View pageView = null; try { pageView = shadow.get(position); if (WXEnvironment.isApkDebugable()) { WXLogUtils.d("onPageSelected >>>> instantiateItem >>>>> position:" + position + ",position % getRealCount()" + position % getRealCount()); } if (pageView.getParent() == null) { container.addView(pageView); } else { ((ViewGroup) pageView.getParent()).removeView(pageView); container.addView(pageView); } } catch (Exception e) { WXLogUtils.e("[CirclePageAdapter] instantiateItem: ", e); } return pageView; } }
WXCirclePageAdapter extends PagerAdapter { @Override public Object instantiateItem(ViewGroup container, int position) { View pageView = null; try { pageView = shadow.get(position); if (WXEnvironment.isApkDebugable()) { WXLogUtils.d("onPageSelected >>>> instantiateItem >>>>> position:" + position + ",position % getRealCount()" + position % getRealCount()); } if (pageView.getParent() == null) { container.addView(pageView); } else { ((ViewGroup) pageView.getParent()).removeView(pageView); container.addView(pageView); } } catch (Exception e) { WXLogUtils.e("[CirclePageAdapter] instantiateItem: ", e); } return pageView; } WXCirclePageAdapter(List<View> views, boolean needLoop);  WXCirclePageAdapter();  WXCirclePageAdapter(boolean needLoop); }
WXCirclePageAdapter extends PagerAdapter { @Override public Object instantiateItem(ViewGroup container, int position) { View pageView = null; try { pageView = shadow.get(position); if (WXEnvironment.isApkDebugable()) { WXLogUtils.d("onPageSelected >>>> instantiateItem >>>>> position:" + position + ",position % getRealCount()" + position % getRealCount()); } if (pageView.getParent() == null) { container.addView(pageView); } else { ((ViewGroup) pageView.getParent()).removeView(pageView); container.addView(pageView); } } catch (Exception e) { WXLogUtils.e("[CirclePageAdapter] instantiateItem: ", e); } return pageView; } WXCirclePageAdapter(List<View> views, boolean needLoop);  WXCirclePageAdapter();  WXCirclePageAdapter(boolean needLoop); void addPageView(View view); void removePageView(View view); void replacePageView(View oldView, View newView); @Override int getCount(); int getRealCount(); @Override Object instantiateItem(ViewGroup container, int position); @Override void destroyItem(ViewGroup container, int position, Object object); @Override boolean isViewFromObject(View view, Object object); @Override int getItemPosition(Object object); int getPagePosition(View page); int getItemIndex(Object object); List<View> getViews(); int getRealPosition(int shadowPosition); int getFirst(); }
WXCirclePageAdapter extends PagerAdapter { @Override public Object instantiateItem(ViewGroup container, int position) { View pageView = null; try { pageView = shadow.get(position); if (WXEnvironment.isApkDebugable()) { WXLogUtils.d("onPageSelected >>>> instantiateItem >>>>> position:" + position + ",position % getRealCount()" + position % getRealCount()); } if (pageView.getParent() == null) { container.addView(pageView); } else { ((ViewGroup) pageView.getParent()).removeView(pageView); container.addView(pageView); } } catch (Exception e) { WXLogUtils.e("[CirclePageAdapter] instantiateItem: ", e); } return pageView; } WXCirclePageAdapter(List<View> views, boolean needLoop);  WXCirclePageAdapter();  WXCirclePageAdapter(boolean needLoop); void addPageView(View view); void removePageView(View view); void replacePageView(View oldView, View newView); @Override int getCount(); int getRealCount(); @Override Object instantiateItem(ViewGroup container, int position); @Override void destroyItem(ViewGroup container, int position, Object object); @Override boolean isViewFromObject(View view, Object object); @Override int getItemPosition(Object object); int getPagePosition(View page); int getItemIndex(Object object); List<View> getViews(); int getRealPosition(int shadowPosition); int getFirst();  }