Search in sources :

Example 31 with ViewPager

use of androidx.viewpager.widget.ViewPager in project FlycoTabLayout by H07000223.

the class SegmentTabActivity method tl_3.

private void tl_3() {
    final ViewPager vp_3 = ViewFindUtils.find(mDecorView, R.id.vp_2);
    vp_3.setAdapter(new MyPagerAdapter(getSupportFragmentManager()));
    mTabLayout_3.setTabData(mTitles_3);
    mTabLayout_3.setOnTabSelectListener(new OnTabSelectListener() {

        @Override
        public void onTabSelect(int position) {
            vp_3.setCurrentItem(position);
        }

        @Override
        public void onTabReselect(int position) {
        }
    });
    vp_3.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {

        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
        }

        @Override
        public void onPageSelected(int position) {
            mTabLayout_3.setCurrentTab(position);
        }

        @Override
        public void onPageScrollStateChanged(int state) {
        }
    });
    vp_3.setCurrentItem(1);
}
Also used : OnTabSelectListener(com.flyco.tablayout.listener.OnTabSelectListener) ViewPager(androidx.viewpager.widget.ViewPager)

Example 32 with ViewPager

use of androidx.viewpager.widget.ViewPager in project FlycoTabLayout by H07000223.

the class SlidingTabActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sliding_tab);
    for (String title : mTitles) {
        mFragments.add(SimpleCardFragment.getInstance(title));
    }
    View decorView = getWindow().getDecorView();
    ViewPager vp = ViewFindUtils.find(decorView, R.id.vp);
    mAdapter = new MyPagerAdapter(getSupportFragmentManager());
    vp.setAdapter(mAdapter);
    /**
     * 默认
     */
    SlidingTabLayout tabLayout_1 = ViewFindUtils.find(decorView, R.id.tl_1);
    /**
     *自定义部分属性
     */
    SlidingTabLayout tabLayout_2 = ViewFindUtils.find(decorView, R.id.tl_2);
    /**
     * 字体加粗,大写
     */
    SlidingTabLayout tabLayout_3 = ViewFindUtils.find(decorView, R.id.tl_3);
    /**
     * tab固定宽度
     */
    SlidingTabLayout tabLayout_4 = ViewFindUtils.find(decorView, R.id.tl_4);
    /**
     * indicator固定宽度
     */
    SlidingTabLayout tabLayout_5 = ViewFindUtils.find(decorView, R.id.tl_5);
    /**
     * indicator圆
     */
    SlidingTabLayout tabLayout_6 = ViewFindUtils.find(decorView, R.id.tl_6);
    /**
     * indicator矩形圆角
     */
    final SlidingTabLayout tabLayout_7 = ViewFindUtils.find(decorView, R.id.tl_7);
    /**
     * indicator三角形
     */
    SlidingTabLayout tabLayout_8 = ViewFindUtils.find(decorView, R.id.tl_8);
    /**
     * indicator圆角色块
     */
    SlidingTabLayout tabLayout_9 = ViewFindUtils.find(decorView, R.id.tl_9);
    /**
     * indicator圆角色块
     */
    SlidingTabLayout tabLayout_10 = ViewFindUtils.find(decorView, R.id.tl_10);
    tabLayout_1.setViewPager(vp);
    tabLayout_2.setViewPager(vp);
    tabLayout_2.setOnTabSelectListener(this);
    tabLayout_3.setViewPager(vp);
    tabLayout_4.setViewPager(vp);
    tabLayout_5.setViewPager(vp);
    tabLayout_6.setViewPager(vp);
    tabLayout_7.setViewPager(vp, mTitles);
    tabLayout_8.setViewPager(vp, mTitles, this, mFragments);
    tabLayout_9.setViewPager(vp);
    tabLayout_10.setViewPager(vp);
    vp.setCurrentItem(4);
    tabLayout_1.showDot(4);
    tabLayout_3.showDot(4);
    tabLayout_2.showDot(4);
    tabLayout_2.showMsg(3, 5);
    tabLayout_2.setMsgMargin(3, 0, 10);
    MsgView rtv_2_3 = tabLayout_2.getMsgView(3);
    if (rtv_2_3 != null) {
        rtv_2_3.setBackgroundColor(Color.parseColor("#6D8FB0"));
    }
    tabLayout_2.showMsg(5, 5);
    tabLayout_2.setMsgMargin(5, 0, 10);
// tabLayout_7.setOnTabSelectListener(new OnTabSelectListener() {
// @Override
// public void onTabSelect(int position) {
// Toast.makeText(mContext, "onTabSelect&position--->" + position, Toast.LENGTH_SHORT).show();
// }
// 
// @Override
// public void onTabReselect(int position) {
// mFragments.add(SimpleCardFragment.getInstance("后端"));
// mAdapter.notifyDataSetChanged();
// tabLayout_7.addNewTab("后端");
// }
// });
}
Also used : MsgView(com.flyco.tablayout.widget.MsgView) SlidingTabLayout(com.flyco.tablayout.SlidingTabLayout) MsgView(com.flyco.tablayout.widget.MsgView) View(android.view.View) ViewPager(androidx.viewpager.widget.ViewPager)

Example 33 with ViewPager

use of androidx.viewpager.widget.ViewPager in project RxBinding by JakeWharton.

the class RxViewPagerTestActivity method onCreate.

@SuppressWarnings("ResourceType")
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    viewPager = new ViewPager(this);
    viewPager.setId(1);
    viewPager.setAdapter(new Adapter());
    setContentView(viewPager);
}
Also used : PagerAdapter(androidx.viewpager.widget.PagerAdapter) ViewPager(androidx.viewpager.widget.ViewPager)

Example 34 with ViewPager

use of androidx.viewpager.widget.ViewPager in project Signal-Android by WhisperSystems.

the class PaymentsAllActivityFragment method onViewCreated.

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    ViewPager viewPager = view.findViewById(R.id.payments_all_activity_fragment_view_pager);
    TabLayout tabLayout = view.findViewById(R.id.payments_all_activity_fragment_tabs);
    Toolbar toolbar = view.findViewById(R.id.payments_all_activity_fragment_toolbar);
    toolbar.setNavigationOnClickListener(v -> Navigation.findNavController(v).popBackStack());
    viewPager.setAdapter(new Adapter(getChildFragmentManager()));
    tabLayout.setupWithViewPager(viewPager);
}
Also used : TabLayout(com.google.android.material.tabs.TabLayout) FragmentStatePagerAdapter(androidx.fragment.app.FragmentStatePagerAdapter) ViewPager(androidx.viewpager.widget.ViewPager) Toolbar(androidx.appcompat.widget.Toolbar)

Example 35 with ViewPager

use of androidx.viewpager.widget.ViewPager in project xabber-android by redsolution.

the class TutorialActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (isFinishing()) {
        return;
    }
    setContentView(R.layout.activity_tutorial);
    overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
    ViewPager viewPager = (ViewPager) findViewById(R.id.pager);
    FragmentPagerAdapter pagerAdapter = new TutorialAdapter(getSupportFragmentManager());
    viewPager.setAdapter(pagerAdapter);
    CircleIndicator indicator = (CircleIndicator) findViewById(R.id.indicator);
    indicator.setViewPager(viewPager);
    btnLogin = (Button) findViewById(R.id.btnLogin);
    btnLogin.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            startActivity(XabberLoginActivity.createIntent(TutorialActivity.this, XabberLoginActivity.FRAGMENT_LOGIN));
        }
    });
    btnRegister = (Button) findViewById(R.id.btnRegister);
    btnRegister.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (BuildConfig.FLAVOR_destribution.equals("store")) {
                startActivity(XabberLoginActivity.createIntent(TutorialActivity.this, XabberLoginActivity.FRAGMENT_SIGNUP_STEP1));
            } else {
                String url = HttpApiManager.XABBER_SIGNUP_URL;
                Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.setData(Uri.parse(url));
                startActivity(intent);
            }
        }
    });
    ivSettings = (ImageView) findViewById(R.id.ivSettings);
    ivSettings.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            startActivity(PreferenceEditor.createIntent(TutorialActivity.this));
        }
    });
}
Also used : FragmentPagerAdapter(androidx.fragment.app.FragmentPagerAdapter) CircleIndicator(me.relex.circleindicator.CircleIndicator) Intent(android.content.Intent) TutorialAdapter(com.xabber.android.ui.adapter.TutorialAdapter) ViewPager(androidx.viewpager.widget.ViewPager) ImageView(android.widget.ImageView) View(android.view.View)

Aggregations

ViewPager (androidx.viewpager.widget.ViewPager)68 View (android.view.View)24 Intent (android.content.Intent)12 TabLayout (com.google.android.material.tabs.TabLayout)12 Toolbar (androidx.appcompat.widget.Toolbar)11 ViewGroup (android.view.ViewGroup)9 TextView (android.widget.TextView)9 ColorPreferences (me.ccrama.redditslide.Visuals.ColorPreferences)9 ImageView (android.widget.ImageView)8 PageNavigationView (me.majiajie.pagerbottomtabstrip.PageNavigationView)8 Bundle (android.os.Bundle)6 PagerAdapter (androidx.viewpager.widget.PagerAdapter)6 MyViewPagerAdapter (me.majiajie.pagerbottomtabstriptest.other.MyViewPagerAdapter)6 CircleIndicator (me.relex.circleindicator.CircleIndicator)6 LayoutInflater (android.view.LayoutInflater)5 Button (android.widget.Button)5 SamplePagerAdapter (me.relex.circleindicator.sample.SamplePagerAdapter)5 LinearInterpolator (android.view.animation.LinearInterpolator)4 NonNull (androidx.annotation.NonNull)4 FragmentStatePagerAdapter (androidx.fragment.app.FragmentStatePagerAdapter)4