|
|
|
@ -1,19 +1,56 @@ |
|
|
|
package com.qhclh.ytzh.work.productiondailyw; |
|
|
|
|
|
|
|
import android.support.design.widget.TabLayout; |
|
|
|
import android.support.v4.app.Fragment; |
|
|
|
import android.support.v4.app.FragmentManager; |
|
|
|
import android.support.v4.app.FragmentPagerAdapter; |
|
|
|
import android.support.v4.view.ViewPager; |
|
|
|
import android.support.v7.widget.Toolbar; |
|
|
|
import android.view.View; |
|
|
|
|
|
|
|
import com.qhclh.ytzh.R; |
|
|
|
import com.qhclh.ytzh.base.BaseActivity; |
|
|
|
import com.qhclh.ytzh.work.tablepoultry.anqiu.AnqiuFragment; |
|
|
|
import com.qhclh.ytzh.work.tablepoultry.changle.ChangleFragment; |
|
|
|
import com.qhclh.ytzh.work.tablepoultry.qiuping.QiupingFragment; |
|
|
|
import com.qhclh.ytzh.work.tablepoultry.shouguangdong.ShouguangdFragment; |
|
|
|
import com.qhclh.ytzh.work.tablepoultry.shouguangxi.ShouguangxFragment; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import butterknife.BindView; |
|
|
|
|
|
|
|
/** |
|
|
|
* Created by 青花瓷 on 2017/12/19. |
|
|
|
*/ |
|
|
|
|
|
|
|
public class WriteDActivity extends BaseActivity { |
|
|
|
|
|
|
|
@BindView(R.id.toolbar) |
|
|
|
Toolbar mToolbar; |
|
|
|
@BindView(R.id.tabLayout_write) |
|
|
|
TabLayout mTabLayout; |
|
|
|
@BindView(R.id.viewPager_write) |
|
|
|
ViewPager mViewPager; |
|
|
|
private List<Fragment> mFragmentList = new ArrayList<>(); |
|
|
|
private List<String> mTitleList = new ArrayList<>(); |
|
|
|
private TabViewPagerAdapter mViewPagerAdapter; |
|
|
|
@Override |
|
|
|
protected int setLayoutId() { |
|
|
|
return 0; |
|
|
|
return R.layout.act_writed; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
protected void initView() { |
|
|
|
initToolbar(mToolbar, "生产日报", new View.OnClickListener() { |
|
|
|
@Override |
|
|
|
public void onClick(View view) { |
|
|
|
finish(); |
|
|
|
} |
|
|
|
}); |
|
|
|
initTabLayout(); |
|
|
|
initViewPager(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@ -26,4 +63,52 @@ public class WriteDActivity extends BaseActivity { |
|
|
|
protected void initOper() { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private void initTabLayout() { |
|
|
|
|
|
|
|
mTitleList.add(getString(R.string.changle)); |
|
|
|
mTitleList.add(getString(R.string.shouguangdong)); |
|
|
|
mTitleList.add(getString(R.string.shouguangxi)); |
|
|
|
mTitleList.add(getString(R.string.anqiu)); |
|
|
|
mTitleList.add(getString(R.string.qiuping)); |
|
|
|
|
|
|
|
|
|
|
|
mTabLayout.setTabMode(TabLayout.MODE_FIXED); |
|
|
|
} |
|
|
|
|
|
|
|
private void initViewPager() { |
|
|
|
mFragmentList.add(new ChangleFragment()); |
|
|
|
mFragmentList.add(new ShouguangdFragment()); |
|
|
|
mFragmentList.add(new ShouguangxFragment()); |
|
|
|
mFragmentList.add(new AnqiuFragment()); |
|
|
|
mFragmentList.add(new QiupingFragment()); |
|
|
|
|
|
|
|
mViewPagerAdapter = new TabViewPagerAdapter(getSupportFragmentManager()); |
|
|
|
mViewPager.setAdapter(mViewPagerAdapter); |
|
|
|
mViewPager.setOffscreenPageLimit(2); |
|
|
|
mTabLayout.setupWithViewPager(mViewPager); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private class TabViewPagerAdapter extends FragmentPagerAdapter { |
|
|
|
public TabViewPagerAdapter(FragmentManager fm) { |
|
|
|
super(fm); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Fragment getItem(int position) { |
|
|
|
return mFragmentList.get(position); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public int getCount() { |
|
|
|
return mFragmentList.size(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public CharSequence getPageTitle(int position) { |
|
|
|
return mTitleList.get(position); |
|
|
|
} |
|
|
|
} |
|
|
|
} |