当前位置: 首页>>代码示例>>Java>>正文


Java SimpleOnPageChangeListener类代码示例

本文整理汇总了Java中android.support.v4.view.ViewPager.SimpleOnPageChangeListener的典型用法代码示例。如果您正苦于以下问题:Java SimpleOnPageChangeListener类的具体用法?Java SimpleOnPageChangeListener怎么用?Java SimpleOnPageChangeListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SimpleOnPageChangeListener类属于android.support.v4.view.ViewPager包,在下文中一共展示了SimpleOnPageChangeListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initViewPager

import android.support.v4.view.ViewPager.SimpleOnPageChangeListener; //导入依赖的package包/类
private void initViewPager() {
    this.mViewPager.setOffscreenPageLimit(5);
    this.mViewPager.setAdapter(new ArrayPagerAdapter(getSupportFragmentManager(), this
            .mContentFragments, this.mTitles));
    this.mSlidingTab.setViewPager(this.mViewPager);
    this.mSlidingTab.setOnPageChangeListener(new SimpleOnPageChangeListener() {
        public void onPageSelected(int position) {
            if (position == 1 && AddFoodListActivity.this.mFavoriteFragment.isFirstLoad) {
                MobclickAgent.onEvent(AddFoodListActivity.this.ctx, Event
                        .TOOL_FOODANDSPORT_FAVORITETAB);
                AddFoodListActivity.this.mFavoriteFragment.firstLoad();
            } else if (position == 2 && AddFoodListActivity.this.mCustomFoodFragmennt
                    .isFirstLoad) {
                MobclickAgent.onEvent(AddFoodListActivity.this.ctx, Event
                        .TOOL_FOODANDSPORT_MINETAB);
                AddFoodListActivity.this.mCustomFoodFragmennt.firstLoad();
            } else if (position == 3 && AddFoodListActivity.this.mUploadFoodFragment
                    .isFirstLoad) {
                AddFoodListActivity.this.mUploadFoodFragment.firstLoad();
            } else if (position == 4 && AddFoodListActivity.this.mCookFoodFragment
                    .isFirstLoad) {
                AddFoodListActivity.this.mCookFoodFragment.firstLoad();
            }
        }
    });
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:27,代码来源:AddFoodListActivity.java

示例2: init

import android.support.v4.view.ViewPager.SimpleOnPageChangeListener; //导入依赖的package包/类
private void init() {
    if (getIntent() == null) {
        finish();
        return;
    }
    this.mCurrentIndex = getIntent().getIntExtra(KEY_INDEX, 0);
    this.mPhotoList = getIntent().getParcelableArrayListExtra(KEY_WEIGHT_PHOTOS);
    if (this.mPhotoList == null || this.mPhotoList.size() == 0) {
        finish();
        return;
    }
    this.mAdapter = new ImagePagerAdapter(getSupportFragmentManager(), this.mPhotoList);
    this.viewpager.setAdapter(this.mAdapter);
    this.viewpager.addOnPageChangeListener(new SimpleOnPageChangeListener() {
        public void onPageSelected(int position) {
            NewWeightGalleryActivity.this.mCurrentIndex = position;
            NewWeightGalleryActivity.this.setCurrentItem();
        }
    });
    setCurrentItem();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:22,代码来源:NewWeightGalleryActivity.java

示例3: addListener

import android.support.v4.view.ViewPager.SimpleOnPageChangeListener; //导入依赖的package包/类
private void addListener() {
    this.mPullListView.setOnRefreshListener(new OnRefreshListener<ListView>() {
        public void onRefresh(PullToRefreshBase<ListView> pullToRefreshBase) {
            ShopMainFragment.this.requestShopHomePages();
        }
    });
    this.mPullListView.setOnLastItemVisibleListener(new OnLastItemVisibleListener() {
        public void onLastItemVisible() {
            if (ShopMainFragment.this.mPage > ShopMainFragment.this.mCurrentPage &&
                    ShopMainFragment.this.hasMore) {
                ShopMainFragment.this.mCurrentPage = ShopMainFragment.this.mPage;
                ShopMainFragment.this.requestShopHomeMoreGoods();
            }
        }
    });
    this.mIndicator.setOnPageChangeListener(new SimpleOnPageChangeListener() {
        public void onPageSelected(int position) {
            super.onPageSelected(position);
            ShopMainFragment.this.mCurrentIndex = position;
        }
    });
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:23,代码来源:ShopMainFragment.java

示例4: initView

import android.support.v4.view.ViewPager.SimpleOnPageChangeListener; //导入依赖的package包/类
private void initView() {
    initFragments();
    this.adapter = new CollectionPagerAdapter(getSupportFragmentManager(), this.fragmentList);
    this.viewpager.setAdapter(this.adapter);
    this.viewpager.setOffscreenPageLimit(2);
    this.slidingTabs.setViewPager(this.viewpager);
    this.slidingTabs.setOnPageChangeListener(new SimpleOnPageChangeListener() {
        public void onPageSelected(int position) {
            if (position == 1 && MyFavoriteActivity.this.webFavoriteFragment != null &&
                    MyFavoriteActivity.this.webFavoriteFragment.isFirstLoad()) {
                MyFavoriteActivity.this.webFavoriteFragment.pullToRefresh();
                MyFavoriteActivity.this.webFavoriteFragment.setIsFirstLoad(false);
            }
            super.onPageSelected(position);
        }
    });
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:18,代码来源:MyFavoriteActivity.java

示例5: initView

import android.support.v4.view.ViewPager.SimpleOnPageChangeListener; //导入依赖的package包/类
private void initView() {
    if (this.mentionList != null && this.mentionList.size() != 0) {
        this.pagerAdapter = new MentionPreviewPagerAdapter(getSupportFragmentManager(), this
                .mentionList);
        this.viewPager.setAdapter(this.pagerAdapter);
        this.viewPager.addOnPageChangeListener(new SimpleOnPageChangeListener() {
            public void onPageSelected(int position) {
                super.onPageSelected(position);
                MentionPreviewActivity.this.videoView.stopPlayback();
                MentionPreviewActivity.this.currentMention = (Mention) MentionPreviewActivity
                        .this.mentionList.get(position);
                MentionPreviewActivity.this.setCurrentIndex(position);
            }
        });
        this.viewPager.setCurrentItem(this.position);
        setCurrentIndex(this.position);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:19,代码来源:MentionPreviewActivity.java

示例6: initActionbar

import android.support.v4.view.ViewPager.SimpleOnPageChangeListener; //导入依赖的package包/类
private void initActionbar() {
    View view_tab = LayoutInflater.from(this).inflate(R.layout.h1, null);
    this.mSlidingTab = (PagerSlidingTabStrip) view_tab.findViewById(R.id.sliding_tabs);
    LayoutParams layoutParams = new LayoutParams(-2, -1);
    layoutParams.gravity = GravityCompat.END;
    getSupportActionBar().setDisplayShowCustomEnabled(true);
    getSupportActionBar().setCustomView(view_tab, layoutParams);
    this.mSlidingTab.setViewPager(this.viewpager);
    this.mSlidingTab.setOnPageChangeListener(new SimpleOnPageChangeListener() {
        public void onPageSelected(int position) {
            super.onPageSelected(position);
            if (position == 1 && !GoodsDetailActivity.this.isSecondLoad) {
                GoodsDetailActivity.this.goodsPostsFragment.loadFirst();
                GoodsDetailActivity.this.isSecondLoad = true;
            }
        }
    });
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:19,代码来源:GoodsDetailActivity.java

示例7: initListener

import android.support.v4.view.ViewPager.SimpleOnPageChangeListener; //导入依赖的package包/类
private void initListener() {
    findViewById(R.id.back_iv).setOnClickListener(this);
    this.mDownloadIv.setOnClickListener(this);
    this.mContentHvp.addOnPageChangeListener(new SimpleOnPageChangeListener() {
        public void onPageSelected(int position) {
            MQPhotoPreviewActivity.this.renderTitleTv();
        }
    });
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:10,代码来源:MQPhotoPreviewActivity.java

示例8: initListener

import android.support.v4.view.ViewPager.SimpleOnPageChangeListener; //导入依赖的package包/类
private void initListener() {
    findViewById(R.id.back_iv).setOnClickListener(this);
    this.mSubmitTv.setOnClickListener(this);
    this.mChooseTv.setOnClickListener(this);
    this.mContentHvp.addOnPageChangeListener(new SimpleOnPageChangeListener() {
        public void onPageSelected(int position) {
            MQPhotoPickerPreviewActivity.this.handlePageSelectedStatus();
        }
    });
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:11,代码来源:MQPhotoPickerPreviewActivity.java

示例9: setListener

import android.support.v4.view.ViewPager.SimpleOnPageChangeListener; //导入依赖的package包/类
protected void setListener() {
    this.mContentVp.addOnPageChangeListener(new SimpleOnPageChangeListener() {
        public void onPageSelected(int position) {
            for (int i = 0; i < MQEmotionKeyboardLayout.this.mIndicatorIvList.size(); i++) {
                ((ImageView) MQEmotionKeyboardLayout.this.mIndicatorIvList.get(i)).setEnabled
                        (false);
            }
            ((ImageView) MQEmotionKeyboardLayout.this.mIndicatorIvList.get(position))
                    .setEnabled(true);
        }
    });
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:13,代码来源:MQEmotionKeyboardLayout.java

示例10: initViewPager

import android.support.v4.view.ViewPager.SimpleOnPageChangeListener; //导入依赖的package包/类
private void initViewPager() {
    this.mViewPager.setOffscreenPageLimit(this.mTitles.length);
    this.mViewPager.setAdapter(new ArrayPagerAdapter(getSupportFragmentManager(), this
            .mContentFragments, this.mTitles));
    this.mSlidingTab.setViewPager(this.mViewPager);
    this.mSlidingTab.setOnPageChangeListener(new SimpleOnPageChangeListener() {
        public void onPageSelected(int position) {
            if (position == 1 && AddSportListActivity.this.mCustomSportFragment.isFirstLoad) {
                AddSportListActivity.this.mCustomSportFragment.firstLoad();
            }
        }
    });
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:14,代码来源:AddSportListActivity.java

示例11: initView

import android.support.v4.view.ViewPager.SimpleOnPageChangeListener; //导入依赖的package包/类
private void initView() {
    this.scrollview.setOnRefreshListener(new OnRefreshListener<ScrollView>() {
        public void onRefresh(PullToRefreshBase<ScrollView> pullToRefreshBase) {
            BetFragment.this.loadData();
        }
    });
    this.tipsIndicator.setOnPageChangeListener(new SimpleOnPageChangeListener() {
        public void onPageSelected(int position) {
            super.onPageSelected(position);
            BetFragment.this.currentItem = position;
        }
    });
    ViewUtils.setViewScaleHeight(getActivity(), this.ivBetTop, 750, 250);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:15,代码来源:BetFragment.java

示例12: addListener

import android.support.v4.view.ViewPager.SimpleOnPageChangeListener; //导入依赖的package包/类
private void addListener() {
    this.scrollView.setOnRefreshListener(new OnRefreshListener<ScrollView>() {
        public void onRefresh(PullToRefreshBase<ScrollView> pullToRefreshBase) {
            NewPartnerFragment.this.initUI();
        }
    });
    this.indicator.setOnPageChangeListener(new SimpleOnPageChangeListener() {
        public void onPageSelected(int position) {
            super.onPageSelected(position);
            NewPartnerFragment.this.mCurrentItem = position;
        }
    });
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:14,代码来源:NewPartnerFragment.java

示例13: onActivityCreated

import android.support.v4.view.ViewPager.SimpleOnPageChangeListener; //导入依赖的package包/类
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    this.mTabLayout = ((MainActivity) getActivity()).getPartnerTab();
    this.mTitleList.add("精选");
    this.mTitleList.add("好友圈");
    this.mFabButton.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            if (!PartnerFragment.this.isDetached()) {
                new BuilderIntent(PartnerFragment.this.getActivity(), StatusPostTextActivity
                        .class).startActivity();
            }
        }
    });
    this.mAdapter = new PartnerFragmentAdapter(getActivity().getSupportFragmentManager());
    this.mFragmentList.add(new PartnerDiscoverFragment());
    this.mFragmentList.add(new HomeTimelineFragment());
    this.mViewPager.setAdapter(this.mAdapter);
    this.mViewPager.addOnPageChangeListener(new SimpleOnPageChangeListener() {
        public void onPageSelected(int position) {
            PartnerFragment.this.mCache.put(CacheKey.HOME_STATUS_TAB, String.valueOf(position));
        }
    });
    this.mTabLayout.setupWithViewPager(this.mViewPager);
    this.mTabLayout.setTabMode(1);
    EventBus.getDefault().register(this);
    this.mViewPager.post(new Runnable() {
        public void run() {
            try {
                PartnerFragment.this.mViewPager.setCurrentItem(Integer.parseInt
                        (PartnerFragment.this.mCache.getAsString(CacheKey.HOME_STATUS_TAB)));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:37,代码来源:PartnerFragment.java

示例14: setImage

import android.support.v4.view.ViewPager.SimpleOnPageChangeListener; //导入依赖的package包/类
public void setImage(ArrayList<Integer> imageList) {
	for (int i = 0; i < imageList.size(); i++) {
		Integer imageID = ((Integer) imageList.get(i)).intValue();
		ImageView iv = new ImageView(mContext);
		iv.setLayoutParams(new LayoutParams(
				LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
		iv.setScaleType(ImageView.ScaleType.FIT_XY);
		iv.setImageResource(imageID);
		iv.setOnClickListener(this);
		mViewList.add(iv);
	}
	mPager.setAdapter(new ImageAdapater());
	mPager.addOnPageChangeListener(new SimpleOnPageChangeListener() {
		@Override
		public void onPageSelected(int position) {
			setButton(position);
		}
	});

	mCount = imageList.size();
	for (int i = 0; i < mCount; i++) {
		RadioButton radio = new RadioButton(mContext);
		radio.setLayoutParams(new RadioGroup.LayoutParams(dip_15, dip_15));
		radio.setGravity(Gravity.CENTER);
		radio.setButtonDrawable(R.drawable.indicator_selector);
		mGroup.addView(radio);
	}
	mPager.setCurrentItem(0);
	setButton(0);
}
 
开发者ID:Luodian,项目名称:Shared-Route,代码行数:31,代码来源:BannerPager.java

示例15: initViewPager

import android.support.v4.view.ViewPager.SimpleOnPageChangeListener; //导入依赖的package包/类
private void initViewPager() {
	mViewPager.setPageMargin(UIUtils.dip2px(10));
	mViewPager.setPageMarginDrawable(new ColorDrawable(0x00FFFFFF));

	mAdapter = new HomePagerAdapter(getChildFragmentManager());
	mViewPager.setAdapter(mAdapter);
	mViewPager.setOnPageChangeListener(new SimpleOnPageChangeListener() {
		@Override
		public void onPageSelected(int position) {
			mTabView.switchButton(position == 0);
		}
	});
}
 
开发者ID:fengyanjava,项目名称:msb-android,代码行数:14,代码来源:Home.java


注:本文中的android.support.v4.view.ViewPager.SimpleOnPageChangeListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。