Java Code Examples for android.support.v4.view.ViewPager#removeAllViews()

The following examples show how to use android.support.v4.view.ViewPager#removeAllViews() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainFragment.java    From Social with Apache License 2.0 6 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.main_fragment_layout,container, false);

    ViewPager viewPager = (ViewPager) view.findViewById(R.id.id_main_fragment_viewpager);
    if (viewPager != null) {
        setupViewPager(viewPager);
    }
    viewPager.removeAllViews();

    mRvAdd = (RippleView)view.findViewById(R.id.id_main_fragment_rv_add);
    mRvAdd.setOnRippleCompleteListener(this);

    mIvAdd = (ImageView)view.findViewById(R.id.id_main_fragment_iv_add);

    TabLayout tabLayout = (TabLayout) view.findViewById(R.id.id_main_fragment_tabs);
    tabLayout.setupWithViewPager(viewPager);
    return view;
}
 
Example 2
Source File: ReactViewPager.java    From react-native-GPay with MIT License 5 votes vote down vote up
/**
 * Remove all the views from the adapter and de-parents them from the ViewPager
 * After calling this, it is expected that notifyDataSetChanged should be called soon
 * afterwards.
 */
void removeAllViewsFromAdapter(ViewPager pager) {
  mViews.clear();
  pager.removeAllViews();
  // set this, so that when the next addViews is called, we return POSITION_NONE for every
  // entry so we can remove whichever views we need to and add the ones that we need to.
  mIsViewPagerInIntentionallyInconsistentState = true;
}
 
Example 3
Source File: ReactViewPager.java    From react-native-tabbed-view-pager-android with MIT License 5 votes vote down vote up
/**
 * Remove all the views from the adapter and de-parents them from the ViewPager
 * After calling this, it is expected that notifyDataSetChanged should be called soon
 * afterwards.
 */
void removeAllViewsFromAdapter(ViewPager pager) {
  mViews.clear();
  pager.removeAllViews();
  // set this, so that when the next addViews is called, we return POSITION_NONE for every
  // entry so we can remove whichever views we need to and add the ones that we need to.
  mIsViewPagerInIntentionallyInconsistentState = true;
}