Search in sources :

Example 1 with ReportViewFragmentAdapter

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

the class AccountBookReportViewActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mContext = this;
    setContentView(R.layout.activity_account_book_report_view);
    mViewPager = (MaterialViewPager) findViewById(R.id.materialViewPager);
    View view = mViewPager.getRootView();
    TextView title = (TextView) view.findViewById(R.id.logo_white);
    title.setTypeface(CoCoinUtil.typefaceLatoLight);
    title.setText(SettingManager.getInstance().getAccountBookName());
    mViewPager.getPagerTitleStrip().setTypeface(CoCoinUtil.getInstance().typefaceLatoLight, Typeface.NORMAL);
    mViewPager.getPagerTitleStrip().setTextSize(45);
    mViewPager.getPagerTitleStrip().setUnderlineColor(Color.parseColor("#00000000"));
    mViewPager.getPagerTitleStrip().setIndicatorColor(Color.parseColor("#00000000"));
    mViewPager.getPagerTitleStrip().setUnderlineHeight(0);
    mViewPager.getPagerTitleStrip().setIndicatorHeight(0);
    mViewPager.getPagerTitleStrip().setOnTabReselectedListener(new PagerSlidingTabStrip.OnTabReselectedListener() {

        @Override
        public void onTabReselected(int position) {
        //                if (CoCoinFragmentManager.reportViewFragment != null)
        //                    CoCoinFragmentManager.reportViewFragment.showDataDialog();
        }
    });
    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();
            }
        });
    }
    reportViewFragmentAdapter = new ReportViewFragmentAdapter(getSupportFragmentManager());
    mViewPager.getViewPager().setOffscreenPageLimit(1);
    mViewPager.getViewPager().setAdapter(reportViewFragmentAdapter);
    mViewPager.getPagerTitleStrip().setViewPager(mViewPager.getViewPager());
    mViewPager.getPagerTitleStrip().invalidate();
    mViewPager.setMaterialViewPagerListener(new MaterialViewPager.Listener() {

        @Override
        public HeaderDesign getHeaderDesign(int page) {
            return HeaderDesign.fromColorAndDrawable(CoCoinUtil.GetTagColor(-3), CoCoinUtil.GetTagDrawable(-3));
        }
    });
}
Also used : MaterialViewPager(com.github.florent37.materialviewpager.MaterialViewPager) PagerSlidingTabStrip(com.astuetz.PagerSlidingTabStrip) HeaderDesign(com.github.florent37.materialviewpager.header.HeaderDesign) TextView(android.widget.TextView) ReportViewFragmentAdapter(com.nightonke.saver.adapter.ReportViewFragmentAdapter) TextView(android.widget.TextView) View(android.view.View) ActionBar(android.support.v7.app.ActionBar)

Aggregations

ActionBar (android.support.v7.app.ActionBar)1 View (android.view.View)1 TextView (android.widget.TextView)1 PagerSlidingTabStrip (com.astuetz.PagerSlidingTabStrip)1 MaterialViewPager (com.github.florent37.materialviewpager.MaterialViewPager)1 HeaderDesign (com.github.florent37.materialviewpager.header.HeaderDesign)1 ReportViewFragmentAdapter (com.nightonke.saver.adapter.ReportViewFragmentAdapter)1