@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { UtilDBG.logMethod(); mActivity = (MXWActivity) getActivity(); mMaxwellBLE = MGActivityTracker.getInstance(mActivity); View view = inflater.inflate(R.layout.df_add_new_device, (mFragment == null) ? container : null); mFAddSelectType = new FAddSelectType(); mFAddSearch = new FAddSearch(); mFAddTrouble = new FAddTrouble(); mFAdd60 = new FAdd60(); mDFDeviceInfo = new DFDeviceInfo(); mFAddSelectType.setDFAddNew(this); mFAddSelectType.setIsFirstLaunch(mFragment != null); mFAddSearch.setDFAddNew(this); mFAddTrouble.setDFAddNew(this); mFAdd60.setDFAddNew(this); mDFDeviceInfo.setDFAddNew(this); mPD = DBProgramData.getInstance(); initViewPager(view); setCancelable(false); return view; }
@Override public Fragment getItem(int position) { switch (position) { case INDEX_SELECT_DEVICE: return mFAddSelectType; case INDEX_SEARCH: return mFAddSearch; case INDEX_TROUBLE: return mFAddTrouble; case INDEX_ADD_60: return mFAdd60; case INDEX_EDIT_DEVICE: return mDFDeviceInfo; } UtilDBG.e("DFAddNewDevice, getItem, position" + Integer.toString(position)); return null; }