Search in sources :

Example 1 with HelpFragmentAdapter

use of com.nightonke.saver.adapter.HelpFragmentAdapter in project CoCoin by Nightonke.

the class HelpActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mContext = this;
    setContentView(R.layout.activity_help);
    mViewPager = (MaterialViewPager) findViewById(R.id.materialViewPager);
    mViewPager.getPagerTitleStrip().setTypeface(CoCoinUtil.getInstance().typefaceLatoLight, Typeface.NORMAL);
    mViewPager.getPagerTitleStrip().setAllCaps(false);
    mViewPager.getPagerTitleStrip().setUnderlineColor(Color.parseColor("#00000000"));
    mViewPager.getPagerTitleStrip().setIndicatorColor(Color.parseColor("#00000000"));
    mViewPager.getPagerTitleStrip().setUnderlineHeight(0);
    mViewPager.getPagerTitleStrip().setIndicatorHeight(0);
    setTitle("");
    toolbar = mViewPager.getToolbar();
    if (toolbar != null) {
        setSupportActionBar(toolbar);
        final ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            actionBar.setDisplayHomeAsUpEnabled(true);
            actionBar.setDisplayShowHomeEnabled(true);
            actionBar.setDisplayShowTitleEnabled(true);
            actionBar.setDisplayUseLogoEnabled(false);
            actionBar.setHomeButtonEnabled(true);
        }
    }
    View logo = findViewById(R.id.logo_white);
    if (logo != null) {
        logo.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                mViewPager.notifyHeaderChanged();
            }
        });
    }
    adapter = new HelpFragmentAdapter(getSupportFragmentManager(), 0);
    mViewPager.getViewPager().setAdapter(adapter);
    mViewPager.getPagerTitleStrip().setViewPager(mViewPager.getViewPager());
    mViewPager.getPagerTitleStrip().invalidate();
    mViewPager.getViewPager().setOffscreenPageLimit(2);
    mViewPager.setMaterialViewPagerListener(new MaterialViewPager.Listener() {

        @Override
        public HeaderDesign getHeaderDesign(int page) {
            return HeaderDesign.fromColorAndDrawable(ContextCompat.getColor(CoCoinApplication.getAppContext(), R.color.my_blue), ContextCompat.getDrawable(CoCoinApplication.getAppContext(), R.drawable.cocoin_blue_bg));
        }
    });
}
Also used : MaterialViewPager(com.github.florent37.materialviewpager.MaterialViewPager) HeaderDesign(com.github.florent37.materialviewpager.header.HeaderDesign) HelpFragmentAdapter(com.nightonke.saver.adapter.HelpFragmentAdapter) View(android.view.View) ActionBar(android.support.v7.app.ActionBar)

Example 2 with HelpFragmentAdapter

use of com.nightonke.saver.adapter.HelpFragmentAdapter in project CoCoin by Nightonke.

the class AboutActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mContext = this;
    setContentView(R.layout.activity_help);
    mViewPager = (MaterialViewPager) findViewById(R.id.materialViewPager);
    mViewPager.getPagerTitleStrip().setTypeface(CoCoinUtil.getInstance().typefaceLatoLight, Typeface.NORMAL);
    mViewPager.getPagerTitleStrip().setAllCaps(false);
    mViewPager.getPagerTitleStrip().setUnderlineColor(Color.parseColor("#00000000"));
    mViewPager.getPagerTitleStrip().setIndicatorColor(Color.parseColor("#00000000"));
    mViewPager.getPagerTitleStrip().setUnderlineHeight(0);
    mViewPager.getPagerTitleStrip().setIndicatorHeight(0);
    setTitle("");
    toolbar = mViewPager.getToolbar();
    if (toolbar != null) {
        setSupportActionBar(toolbar);
        final ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            actionBar.setDisplayHomeAsUpEnabled(true);
            actionBar.setDisplayShowHomeEnabled(true);
            actionBar.setDisplayShowTitleEnabled(true);
            actionBar.setDisplayUseLogoEnabled(false);
            actionBar.setHomeButtonEnabled(true);
        }
    }
    View logo = findViewById(R.id.logo_white);
    if (logo != null) {
        logo.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                mViewPager.notifyHeaderChanged();
            }
        });
    }
    adapter = new HelpFragmentAdapter(getSupportFragmentManager(), 2);
    mViewPager.getViewPager().setAdapter(adapter);
    mViewPager.getPagerTitleStrip().setViewPager(mViewPager.getViewPager());
    mViewPager.getPagerTitleStrip().invalidate();
    mViewPager.getViewPager().setOffscreenPageLimit(2);
    mViewPager.setMaterialViewPagerListener(new MaterialViewPager.Listener() {

        @Override
        public HeaderDesign getHeaderDesign(int page) {
            return HeaderDesign.fromColorAndDrawable(ContextCompat.getColor(CoCoinApplication.getAppContext(), R.color.my_blue), ContextCompat.getDrawable(CoCoinApplication.getAppContext(), R.drawable.cocoin_blue_bg));
        }
    });
}
Also used : MaterialViewPager(com.github.florent37.materialviewpager.MaterialViewPager) HeaderDesign(com.github.florent37.materialviewpager.header.HeaderDesign) HelpFragmentAdapter(com.nightonke.saver.adapter.HelpFragmentAdapter) View(android.view.View) ActionBar(android.support.v7.app.ActionBar)

Example 3 with HelpFragmentAdapter

use of com.nightonke.saver.adapter.HelpFragmentAdapter in project CoCoin by Nightonke.

the class FeedbackActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mContext = this;
    setContentView(R.layout.activity_help);
    mViewPager = (MaterialViewPager) findViewById(R.id.materialViewPager);
    mViewPager.getPagerTitleStrip().setTypeface(CoCoinUtil.getInstance().typefaceLatoLight, Typeface.NORMAL);
    mViewPager.getPagerTitleStrip().setAllCaps(false);
    mViewPager.getPagerTitleStrip().setUnderlineColor(Color.parseColor("#00000000"));
    mViewPager.getPagerTitleStrip().setIndicatorColor(Color.parseColor("#00000000"));
    mViewPager.getPagerTitleStrip().setUnderlineHeight(0);
    mViewPager.getPagerTitleStrip().setIndicatorHeight(0);
    setTitle("");
    toolbar = mViewPager.getToolbar();
    if (toolbar != null) {
        setSupportActionBar(toolbar);
        final ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            actionBar.setDisplayHomeAsUpEnabled(true);
            actionBar.setDisplayShowHomeEnabled(true);
            actionBar.setDisplayShowTitleEnabled(true);
            actionBar.setDisplayUseLogoEnabled(false);
            actionBar.setHomeButtonEnabled(true);
        }
    }
    View logo = findViewById(R.id.logo_white);
    if (logo != null) {
        logo.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                mViewPager.notifyHeaderChanged();
            }
        });
    }
    adapter = new HelpFragmentAdapter(getSupportFragmentManager(), 1);
    mViewPager.getViewPager().setAdapter(adapter);
    mViewPager.getPagerTitleStrip().setViewPager(mViewPager.getViewPager());
    mViewPager.getPagerTitleStrip().invalidate();
    mViewPager.getViewPager().setOffscreenPageLimit(2);
    mViewPager.setMaterialViewPagerListener(new MaterialViewPager.Listener() {

        @Override
        public HeaderDesign getHeaderDesign(int page) {
            return HeaderDesign.fromColorAndDrawable(ContextCompat.getColor(CoCoinApplication.getAppContext(), R.color.my_blue), ContextCompat.getDrawable(CoCoinApplication.getAppContext(), R.drawable.cocoin_blue_bg));
        }
    });
}
Also used : MaterialViewPager(com.github.florent37.materialviewpager.MaterialViewPager) HeaderDesign(com.github.florent37.materialviewpager.header.HeaderDesign) HelpFragmentAdapter(com.nightonke.saver.adapter.HelpFragmentAdapter) View(android.view.View) ActionBar(android.support.v7.app.ActionBar)

Aggregations

ActionBar (android.support.v7.app.ActionBar)3 View (android.view.View)3 MaterialViewPager (com.github.florent37.materialviewpager.MaterialViewPager)3 HeaderDesign (com.github.florent37.materialviewpager.header.HeaderDesign)3 HelpFragmentAdapter (com.nightonke.saver.adapter.HelpFragmentAdapter)3