private void intializeVP(final int selection_line, final int selection_sharp) { fragmentsList = new ArrayList<Fragment>(); Fragment linety = NewLegendListFragment.newInstance(selection_line, START_LINE_INDEX, END_LINE_INDEX, 0); Fragment featurety = NewLegendListFragment.newInstance(selection_sharp, START_SHARP_INDEX, END_SHARP_INDEX, 1); // Fragment friendsFragment = Drumb.newInstance("Hello Friends."); // Fragment chatFragment = TestFragment.newInstance("Hello Chat."); fragmentsList.add(linety); fragmentsList.add(featurety); // fragmentsList.add(friendsFragment); // fragmentsList.add(chatFragment); this.mViewPager = (ViewPager) super.findViewById(R.id.viewpager); this.mViewPager.setAdapter(new FPAManager(getFragmentManager(), fragmentsList)); this.mViewPager.setOffscreenPageLimit(3); this.mViewPager.setCurrentItem(0); this.mViewPager.setOnPageChangeListener(this); this.mViewPager.setPageTransformer(true, new ZoomInOutViewPagerTransformer()); }
/** * this is the interaction when the selection of the line or feature is taken and occured * * @param index_id * @param Role */ @Override public void onPickList(int index_id, int Role) { if (Role == NewLegendListFragment.roleFeature) { Tool.trace(this, "Feature # selected ID: " + index_id); } else if (Role == NewLegendListFragment.roleLine) { if (mLineFactory.getLetterIntrinsic() != index_id) { Tool.trace(this, "Line ID selected: " + index_id); final NewLegendListFragment LOF = (NewLegendListFragment) fragmentsList.get(NewLegendListFragment.roleLine); LOF.refresh(); } else { // this happens when the first selection of line is pressed and change the tab into the // FEATURE TYPE tab. Tool.trace(this, "Same ID found: " + index_id); final NewLegendListFragment LOF = (NewLegendListFragment) fragmentsList.get(NewLegendListFragment.roleFeature); LOF.take_list_render(DataHandler.get_list_from_letter_by_ref_id(index_id, this), -1) .refresh(); this.mTabHost.setCurrentTab(NewLegendListFragment.roleFeature); } } hasChanges = true; mLineFactory.updateMechanicallyByIntrinsicN(index_id).invalidate(); }