// Path: app/src/main/java/com/github/cchao/touchnews/contract/FragmentContainerContract.java
// public interface FragmentContainerContract {
// 
//     interface View {
//         void setFragment(List<BaseFragment> fragments, String[] titles);
//     }
// 
//     interface Presenter {
//         List<BaseFragment> getFragments();
// 
//         String[] getTitles();
//     }
// }
// 
// Path: app/src/main/java/com/github/cchao/touchnews/presenter/NewsFragmentsContainerPresenter.java
// public class NewsFragmentsContainerPresenter implements FragmentContainerContract.Presenter {
//     List<BaseFragment> mFragments;
//     String[] mTitles;
//     FragmentContainerContract.View mView;
// 
//     public NewsFragmentsContainerPresenter(FragmentContainerContract.View view) {
//         mView = view;
//         mView.setFragment(getFragments(), getTitles());
//     }
// 
//     /**
//      * @return 新闻频道List
//      */
//     public List<BaseFragment> getFragments() {
//         if (mFragments == null) {
//             mFragments = new ArrayList<>();
//             //Arguments 加入新闻频道ID
//             String[] newsChannelId = BaseApplication.getContext().getResources().getStringArray(R.array.news_channelId);
//             for (int i = 0; i < newsChannelId.length; i++) {
//                 NewsListFragments newsListFragments = new NewsListFragments();
// //                        Bundle bundle= new Bundle (  );
// //                        bundle.putString ( "channelId", newsChannelId[ i ] );
// //                        newsListFragments.setArguments ( bundle );
//                 newsListFragments.setChannelId(newsChannelId[i]);
//                 mFragments.add(newsListFragments);
//             }
//         }
//         return mFragments;
//     }
// 
//     /**
//      * @return 新闻页的标题
//      */
//     public String[] getTitles() {
//         mTitles = BaseApplication.getContext().getResources().getStringArray(R.array.news_titles);
//         return mTitles;
//     }
// 
// 
// }
// 
// Path: app/src/main/java/com/github/cchao/touchnews/ui/adapter/NewsFragmentsPagerAdapter.java
// public class NewsFragmentsPagerAdapter extends FragmentPagerAdapter {
//     private List<BaseFragment> mListFragments = null;
//     private String[] mTitles = null;
// 
//     public NewsFragmentsPagerAdapter(FragmentManager fm, String[] titles, List<BaseFragment> fragments) {
//         super(fm);
//         mListFragments = fragments;
//         mTitles = titles;
// 
//     }
// 
//     @Override
//     public int getCount() {
//         if (mListFragments != null) {
//             return mListFragments.size();
//         } else {
//             return 0;
//         }
//     }
// 
//     @Override
//     public Fragment getItem(int position) {
//         if (mListFragments != null && position >= 0 && position < mListFragments.size()) {
//             return mListFragments.get(position);
//         } else {
//             return null;
//         }
//     }
// 
//     @Override
//     public CharSequence getPageTitle(int position) {
//         return mTitles[position];
//     }
// }
// 
// Path: app/src/main/java/com/github/cchao/touchnews/ui/fragment/base/BaseFragment.java
// public abstract class BaseFragment extends BaseLazyFragment {
//     protected Toolbar mToolbar;
//     protected View mRootView;
// 
//     @Nullable
//     @Override
//     public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
//         mRootView = inflater.inflate(getLayoutId(), null);
//         ButterKnife.bind(this, mRootView);
//         mToolbar = ButterKnife.findById(mRootView, R.id.toolbar);
//         return mRootView;
//     }
// 
//     @Override
//     public void onViewCreated(View view, Bundle savedInstanceState) {
//         super.onViewCreated(view, savedInstanceState);
//         initialize();
//     }
// 
//     protected void initialize() {
//     }
// 
//     @Override
//     public void onFirstUserVisible() {
//         super.onFirstUserVisible();
//         setSupportActionBar();
//     }
// 
//     //布局ID
//     protected abstract
//     @LayoutRes
//     int getLayoutId();
// 
//     @Override
//     public void onUserVisible() {
//         super.onUserVisible();
//         setSupportActionBar();
//     }
// 
//     /**
//      * 设置toolbar
//      */
//     private void setSupportActionBar() {
//         ((AppCompatActivity) getActivity()).setSupportActionBar(mToolbar);
//         ((HomeActivity) getActivity()).addDrawerListener(mToolbar);
//     }
// }


import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import com.github.cchao.touchnews.R;
import com.github.cchao.touchnews.contract.FragmentContainerContract;
import com.github.cchao.touchnews.presenter.NewsFragmentsContainerPresenter;
import com.github.cchao.touchnews.ui.adapter.NewsFragmentsPagerAdapter;
import com.github.cchao.touchnews.ui.fragment.base.BaseFragment;
import java.util.List;
import butterknife.Bind;
package com.github.cchao.touchnews.ui.fragment;





/**
 * Created by cchao on 2016/3/30.
 * E-mail:   cchao1024@163.com
 * Description: 新闻资讯容器Fragment
 */
public class NewsContainerFragment extends BaseFragment implements FragmentContainerContract.View {
    @Bind(R.id.tab_news)
    TabLayout mTabLayout;
    @Bind(R.id.viewpager_news)
    ViewPager mViewPager;
    FragmentPagerAdapter mFragmentsPagerAdapter;
    FragmentContainerContract.Presenter mPresenter;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setHasOptionsMenu(true);
    }

    protected int getLayoutId() {
        return R.layout.fragment_news_container;
    }

    @Override
    protected void initialize() {
        super.initialize();
// Path: app/src/main/java/com/github/cchao/touchnews/contract/FragmentContainerContract.java
// public interface FragmentContainerContract {
// 
//     interface View {
//         void setFragment(List<BaseFragment> fragments, String[] titles);
//     }
// 
//     interface Presenter {
//         List<BaseFragment> getFragments();
// 
//         String[] getTitles();
//     }
// }
// 
// Path: app/src/main/java/com/github/cchao/touchnews/presenter/NewsFragmentsContainerPresenter.java
// public class NewsFragmentsContainerPresenter implements FragmentContainerContract.Presenter {
//     List<BaseFragment> mFragments;
//     String[] mTitles;
//     FragmentContainerContract.View mView;
// 
//     public NewsFragmentsContainerPresenter(FragmentContainerContract.View view) {
//         mView = view;
//         mView.setFragment(getFragments(), getTitles());
//     }
// 
//     /**
//      * @return 新闻频道List
//      */
//     public List<BaseFragment> getFragments() {
//         if (mFragments == null) {
//             mFragments = new ArrayList<>();
//             //Arguments 加入新闻频道ID
//             String[] newsChannelId = BaseApplication.getContext().getResources().getStringArray(R.array.news_channelId);
//             for (int i = 0; i < newsChannelId.length; i++) {
//                 NewsListFragments newsListFragments = new NewsListFragments();
// //                        Bundle bundle= new Bundle (  );
// //                        bundle.putString ( "channelId", newsChannelId[ i ] );
// //                        newsListFragments.setArguments ( bundle );
//                 newsListFragments.setChannelId(newsChannelId[i]);
//                 mFragments.add(newsListFragments);
//             }
//         }
//         return mFragments;
//     }
// 
//     /**
//      * @return 新闻页的标题
//      */
//     public String[] getTitles() {
//         mTitles = BaseApplication.getContext().getResources().getStringArray(R.array.news_titles);
//         return mTitles;
//     }
// 
// 
// }
// 
// Path: app/src/main/java/com/github/cchao/touchnews/ui/adapter/NewsFragmentsPagerAdapter.java
// public class NewsFragmentsPagerAdapter extends FragmentPagerAdapter {
//     private List<BaseFragment> mListFragments = null;
//     private String[] mTitles = null;
// 
//     public NewsFragmentsPagerAdapter(FragmentManager fm, String[] titles, List<BaseFragment> fragments) {
//         super(fm);
//         mListFragments = fragments;
//         mTitles = titles;
// 
//     }
// 
//     @Override
//     public int getCount() {
//         if (mListFragments != null) {
//             return mListFragments.size();
//         } else {
//             return 0;
//         }
//     }
// 
//     @Override
//     public Fragment getItem(int position) {
//         if (mListFragments != null && position >= 0 && position < mListFragments.size()) {
//             return mListFragments.get(position);
//         } else {
//             return null;
//         }
//     }
// 
//     @Override
//     public CharSequence getPageTitle(int position) {
//         return mTitles[position];
//     }
// }
// 
// Path: app/src/main/java/com/github/cchao/touchnews/ui/fragment/base/BaseFragment.java
// public abstract class BaseFragment extends BaseLazyFragment {
//     protected Toolbar mToolbar;
//     protected View mRootView;
// 
//     @Nullable
//     @Override
//     public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
//         mRootView = inflater.inflate(getLayoutId(), null);
//         ButterKnife.bind(this, mRootView);
//         mToolbar = ButterKnife.findById(mRootView, R.id.toolbar);
//         return mRootView;
//     }
// 
//     @Override
//     public void onViewCreated(View view, Bundle savedInstanceState) {
//         super.onViewCreated(view, savedInstanceState);
//         initialize();
//     }
// 
//     protected void initialize() {
//     }
// 
//     @Override
//     public void onFirstUserVisible() {
//         super.onFirstUserVisible();
//         setSupportActionBar();
//     }
// 
//     //布局ID
//     protected abstract
//     @LayoutRes
//     int getLayoutId();
// 
//     @Override
//     public void onUserVisible() {
//         super.onUserVisible();
//         setSupportActionBar();
//     }
// 
//     /**
//      * 设置toolbar
//      */
//     private void setSupportActionBar() {
//         ((AppCompatActivity) getActivity()).setSupportActionBar(mToolbar);
//         ((HomeActivity) getActivity()).addDrawerListener(mToolbar);
//     }
// }


// Path: app/src/main/java/com/github/cchao/touchnews/ui/fragment/NewsContainerFragment.java
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import com.github.cchao.touchnews.R;
import com.github.cchao.touchnews.contract.FragmentContainerContract;
import com.github.cchao.touchnews.presenter.NewsFragmentsContainerPresenter;
import com.github.cchao.touchnews.ui.adapter.NewsFragmentsPagerAdapter;
import com.github.cchao.touchnews.ui.fragment.base.BaseFragment;
import java.util.List;
import butterknife.Bind;

package com.github.cchao.touchnews.ui.fragment;





/**
 * Created by cchao on 2016/3/30.
 * E-mail:   cchao1024@163.com
 * Description: 新闻资讯容器Fragment
 */
public class NewsContainerFragment extends BaseFragment implements FragmentContainerContract.View {
    @Bind(R.id.tab_news)
    TabLayout mTabLayout;
    @Bind(R.id.viewpager_news)
    ViewPager mViewPager;
    FragmentPagerAdapter mFragmentsPagerAdapter;
    FragmentContainerContract.Presenter mPresenter;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setHasOptionsMenu(true);
    }

    protected int getLayoutId() {
        return R.layout.fragment_news_container;
    }

    @Override
    protected void initialize() {
        super.initialize();
        mPresenter = new NewsFragmentsContainerPresenter(this);