Search in sources :

Example 1 with FactoryMethodModelFragment

use of com.shiming.andrioddesignpattern.ui.FactoryMethodModelFragment in project AndriodDesignPattern by Shimingli.

the class CreatorModelActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.creator_model_activity_layout);
    ViewPager pager = (ViewPager) findViewById(R.id.viewpager);
    SlidingTabLayout tab = (SlidingTabLayout) findViewById(R.id.tap);
    mTitles = new String[] { this.getResources().getString(R.string.all_order_tab1), this.getResources().getString(R.string.all_order_tab2), this.getResources().getString(R.string.all_order_tab3), this.getResources().getString(R.string.all_order_tab4) };
    mFragments.add(new FactoryMethodModelFragment());
    mFragments.add(new SingletonModelFragment());
    mFragments.add(new BuilderModelFragment());
    mFragments.add(new ProtoTypeModelFragment());
    mAdapter = new MyPagerAdapter(getSupportFragmentManager());
    pager.setAdapter(mAdapter);
    tab.setViewPager(pager);
}
Also used : FactoryMethodModelFragment(com.shiming.andrioddesignpattern.ui.FactoryMethodModelFragment) ProtoTypeModelFragment(com.shiming.andrioddesignpattern.ui.ProtoTypeModelFragment) SlidingTabLayout(com.flyco.tablayout.SlidingTabLayout) ViewPager(android.support.v4.view.ViewPager) SingletonModelFragment(com.shiming.andrioddesignpattern.ui.SingletonModelFragment) BuilderModelFragment(com.shiming.andrioddesignpattern.ui.BuilderModelFragment)

Aggregations

ViewPager (android.support.v4.view.ViewPager)1 SlidingTabLayout (com.flyco.tablayout.SlidingTabLayout)1 BuilderModelFragment (com.shiming.andrioddesignpattern.ui.BuilderModelFragment)1 FactoryMethodModelFragment (com.shiming.andrioddesignpattern.ui.FactoryMethodModelFragment)1 ProtoTypeModelFragment (com.shiming.andrioddesignpattern.ui.ProtoTypeModelFragment)1 SingletonModelFragment (com.shiming.andrioddesignpattern.ui.SingletonModelFragment)1