diff --git a/app/src/main/java/com/qhclh/ytzh/work/productiondailyw/BasicattributesFragment.java b/app/src/main/java/com/qhclh/ytzh/work/productiondailyw/BasicattributesFragment.java new file mode 100644 index 0000000..7c60634 --- /dev/null +++ b/app/src/main/java/com/qhclh/ytzh/work/productiondailyw/BasicattributesFragment.java @@ -0,0 +1,30 @@ +package com.qhclh.ytzh.work.productiondailyw; + +import com.qhclh.ytzh.R; +import com.qhclh.ytzh.base.BaseFragment; + +/** + * Created by 青花瓷 on 2017/12/4. + */ + +public class BasicattributesFragment extends BaseFragment { + @Override + protected int setLayout() { + return R.layout.fragment_basicattr; + } + + @Override + protected void initView() { + + } + + @Override + protected void initData() { + + } + + @Override + protected void initOper() { + + } +} diff --git a/app/src/main/java/com/qhclh/ytzh/work/productiondailyw/DetailsofdocumentsFragment.java b/app/src/main/java/com/qhclh/ytzh/work/productiondailyw/DetailsofdocumentsFragment.java new file mode 100644 index 0000000..40c86c2 --- /dev/null +++ b/app/src/main/java/com/qhclh/ytzh/work/productiondailyw/DetailsofdocumentsFragment.java @@ -0,0 +1,30 @@ +package com.qhclh.ytzh.work.productiondailyw; + +import com.qhclh.ytzh.R; +import com.qhclh.ytzh.base.BaseFragment; + +/** + * Created by 青花瓷 on 2017/12/4. + */ + +public class DetailsofdocumentsFragment extends BaseFragment { + @Override + protected int setLayout() { + return R.layout.fragment_detailsofdoc; + } + + @Override + protected void initView() { + + } + + @Override + protected void initData() { + + } + + @Override + protected void initOper() { + + } +} diff --git a/app/src/main/java/com/qhclh/ytzh/work/productiondailyw/ProductiondailywActivity.java b/app/src/main/java/com/qhclh/ytzh/work/productiondailyw/ProductiondailywActivity.java index 7dc42e9..3f8afcf 100644 --- a/app/src/main/java/com/qhclh/ytzh/work/productiondailyw/ProductiondailywActivity.java +++ b/app/src/main/java/com/qhclh/ytzh/work/productiondailyw/ProductiondailywActivity.java @@ -1,11 +1,19 @@ 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 java.util.ArrayList; +import java.util.List; + import butterknife.BindView; /** @@ -15,6 +23,14 @@ import butterknife.BindView; public class ProductiondailywActivity extends BaseActivity { @BindView(R.id.toolbar) Toolbar mToolbar; + @BindView(R.id.tabLayout_productiondailyw) + TabLayout mTabLayout; + @BindView(R.id.viewPager_productiondailyw) + ViewPager mViewPager; + + private List mFragmentList = new ArrayList<>(); + private List mTitleList = new ArrayList<>(); + private TabViewPagerAdapter mViewPagerAdapter; @Override protected int setLayoutId() { return R.layout.act_productiondailyw; @@ -28,6 +44,8 @@ public class ProductiondailywActivity extends BaseActivity { finish(); } }); + initTabLayout(); + initViewPager(); } @Override @@ -39,4 +57,49 @@ public class ProductiondailywActivity extends BaseActivity { protected void initOper() { } + + private void initViewPager() { + mFragmentList.add(new BasicattributesFragment()); + mFragmentList.add(new DetailsofdocumentsFragment()); + + + mViewPagerAdapter = new TabViewPagerAdapter(getSupportFragmentManager()); + mViewPager.setAdapter(mViewPagerAdapter); + mViewPager.setOffscreenPageLimit(2); + mTabLayout.setupWithViewPager(mViewPager); + } + + + private void initTabLayout() { + mTitleList.add(getString(R.string.Basicattributes)); + mTitleList.add(getString(R.string.Detailsofdocuments)); + + + for (String title : mTitleList) { + mTabLayout.addTab(mTabLayout.newTab().setText(title)); + } + + mTabLayout.setTabMode(TabLayout.MODE_FIXED); + } + + 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); + } + } } diff --git a/app/src/main/res/layout/act_productiondailyw.xml b/app/src/main/res/layout/act_productiondailyw.xml index 8d110f9..55bb08a 100644 --- a/app/src/main/res/layout/act_productiondailyw.xml +++ b/app/src/main/res/layout/act_productiondailyw.xml @@ -1,12 +1,26 @@ - + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_basicattr.xml b/app/src/main/res/layout/fragment_basicattr.xml new file mode 100644 index 0000000..08fefd9 --- /dev/null +++ b/app/src/main/res/layout/fragment_basicattr.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_detailsofdoc.xml b/app/src/main/res/layout/fragment_detailsofdoc.xml new file mode 100644 index 0000000..0930172 --- /dev/null +++ b/app/src/main/res/layout/fragment_detailsofdoc.xml @@ -0,0 +1,10 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 1f7882f..cd6ab67 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -60,5 +60,7 @@ 邱平 生产日报表 生产日报 + 基本属性 + 单据明细