Search in sources :

Example 1 with PageIndicator

use of com.viewpagerindicator.PageIndicator in project glimmr by brk3.

the class PhotoInfoFragment method initViewPager.

private void initViewPager() {
    ViewPager viewPager = (ViewPager) mLayout.findViewById(R.id.viewPager);
    /* http://stackoverflow.com/a/13684139/663370 */
    GlimmrPagerAdapter adapter = new GlimmrPagerAdapter(getChildFragmentManager(), viewPager, mActivity.getActionBar(), CONTENT) {

        @Override
        public Fragment getItemImpl(int position) {
            switch(position) {
                case OVERVIEW_PAGE:
                    return PhotoOverviewFragment.newInstance(PhotoInfoFragment.this.mPhoto);
                case MORE_PAGE:
                    return ExifInfoFragment.newInstance(PhotoInfoFragment.this.mPhoto);
            }
            return null;
        }
    };
    viewPager.setAdapter(adapter);
    PageIndicator indicator = (TabPageIndicator) mLayout.findViewById(R.id.indicator);
    indicator.setViewPager(viewPager);
}
Also used : GlimmrPagerAdapter(com.bourke.glimmr.common.GlimmrPagerAdapter) TabPageIndicator(com.viewpagerindicator.TabPageIndicator) PageIndicator(com.viewpagerindicator.PageIndicator) TabPageIndicator(com.viewpagerindicator.TabPageIndicator) ViewPager(android.support.v4.view.ViewPager)

Example 2 with PageIndicator

use of com.viewpagerindicator.PageIndicator in project ABPlayer by winkstu.

the class DonghuaActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    // 无标题
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.donghua_tab);
    backButton = findViewById(R.id.logobutton);
    titleText = (TextView) findViewById(R.id.textViewTitle);
    FragmentPagerAdapter adapter = null;
    mAreaType = getIntent().getIntExtra("AreaType", 1);
    Log.d("QAQ", "----->" + mAreaType + titleText.getText());
    switch(mAreaType) {
        case 1:
            titleText.setText("番剧");
            adapter = new BankumiTabAdapter(getSupportFragmentManager());
            break;
        case 2:
            titleText.setText("动画");
            adapter = new DonghuaTabAdapter(getSupportFragmentManager());
            break;
        case 3:
            titleText.setText("音乐");
            adapter = new MusicTabAdapter(getSupportFragmentManager());
            break;
        case 4:
            titleText.setText("游戏");
            adapter = new YouxiTabAdapter(getSupportFragmentManager());
            break;
        case 5:
            titleText.setText("科学·技术");
            adapter = new KejiTabAdapter(getSupportFragmentManager());
            break;
        case 6:
            titleText.setText("娱乐");
            adapter = new YuleTabAdapter(getSupportFragmentManager());
            break;
        case 7:
            titleText.setText("电影");
            adapter = new DianyingTabAdapter(getSupportFragmentManager());
            break;
        case 8:
            titleText.setText("排行榜");
            adapter = new RankAdapter(getSupportFragmentManager());
            break;
        default:
            titleText.setText("电影");
            adapter = new DianyingTabAdapter(getSupportFragmentManager());
            break;
    }
    // 视图切换器
    ViewPager pager = (ViewPager) findViewById(R.id.pager);
    pager.setOffscreenPageLimit(1);
    pager.setAdapter(adapter);
    // 页面指示器
    PageIndicator indicator = (PageIndicator) findViewById(R.id.indicator);
    indicator.setViewPager(pager);
    backButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            // TODO Auto-generated method stub
            finish();
        }
    });
}
Also used : PageIndicator(com.viewpagerindicator.PageIndicator) FragmentPagerAdapter(android.support.v4.app.FragmentPagerAdapter) YuleTabAdapter(com.vanco.abplayer.adapter.YuleTabAdapter) YouxiTabAdapter(com.vanco.abplayer.adapter.YouxiTabAdapter) ViewPager(android.support.v4.view.ViewPager) View(android.view.View) TextView(android.widget.TextView) BankumiTabAdapter(com.vanco.abplayer.adapter.BankumiTabAdapter) KejiTabAdapter(com.vanco.abplayer.adapter.KejiTabAdapter) DianyingTabAdapter(com.vanco.abplayer.adapter.DianyingTabAdapter) OnClickListener(android.view.View.OnClickListener) MusicTabAdapter(com.vanco.abplayer.adapter.MusicTabAdapter) RankAdapter(com.vanco.abplayer.adapter.RankAdapter) DonghuaTabAdapter(com.vanco.abplayer.adapter.DonghuaTabAdapter)

Example 3 with PageIndicator

use of com.viewpagerindicator.PageIndicator in project ABPlayer by winkstu.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    // 无标题
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    FragmentPagerAdapter adapter = new MainTabAdapter(getSupportFragmentManager());
    // 视图切换器
    ViewPager pager = (ViewPager) findViewById(R.id.pager);
    pager.setOffscreenPageLimit(1);
    pager.setAdapter(adapter);
    // 页面指示器
    PageIndicator indicator = (PageIndicator) findViewById(R.id.indicator);
    indicator.setViewPager(pager);
    /*if (savedInstanceState == null) {
            getSupportFragmentManager().beginTransaction()
                    .add(R.id.container, new SubareaFragment())
                    .commit();
        }*/
    AdManager.getInstance(this).init("118250e2aa39dea9", "bc5f4490f33da8e6", false);
    SpotManager.getInstance(this).loadSpotAds();
    SpotManager.getInstance(this).setAnimationType(SpotManager.ANIM_ADVANCE);
    SpotManager.getInstance(this).setSpotOrientation(SpotManager.ORIENTATION_PORTRAIT);
    AdManager.getInstance(this).setUserDataCollect(true);
}
Also used : PageIndicator(com.viewpagerindicator.PageIndicator) FragmentPagerAdapter(android.support.v4.app.FragmentPagerAdapter) ViewPager(android.support.v4.view.ViewPager) MainTabAdapter(com.vanco.abplayer.adapter.MainTabAdapter)

Aggregations

ViewPager (android.support.v4.view.ViewPager)3 PageIndicator (com.viewpagerindicator.PageIndicator)3 FragmentPagerAdapter (android.support.v4.app.FragmentPagerAdapter)2 View (android.view.View)1 OnClickListener (android.view.View.OnClickListener)1 TextView (android.widget.TextView)1 GlimmrPagerAdapter (com.bourke.glimmr.common.GlimmrPagerAdapter)1 BankumiTabAdapter (com.vanco.abplayer.adapter.BankumiTabAdapter)1 DianyingTabAdapter (com.vanco.abplayer.adapter.DianyingTabAdapter)1 DonghuaTabAdapter (com.vanco.abplayer.adapter.DonghuaTabAdapter)1 KejiTabAdapter (com.vanco.abplayer.adapter.KejiTabAdapter)1 MainTabAdapter (com.vanco.abplayer.adapter.MainTabAdapter)1 MusicTabAdapter (com.vanco.abplayer.adapter.MusicTabAdapter)1 RankAdapter (com.vanco.abplayer.adapter.RankAdapter)1 YouxiTabAdapter (com.vanco.abplayer.adapter.YouxiTabAdapter)1 YuleTabAdapter (com.vanco.abplayer.adapter.YuleTabAdapter)1 TabPageIndicator (com.viewpagerindicator.TabPageIndicator)1