// Path: app/src/main/java/com/testerhome/nativeandroid/Config.java
// public class Config {
// 
// //    recent - 最新
// //    popular - 热门的话题（回帖和喜欢超过一定的数量
// //    no_reply - 还没有任何回帖的
// //    excellent - 精华帖
// //    last_actived - 最近活跃的
// 
//     public static final String TOPICS_TYPE_RECENT = "recent";
//     public static final String TOPICS_TYPE_POPULAR = "popular";
//     public static final String TOPICS_TYPE_NO_REPLY = "no_reply";
//     public static final String TOPICS_TYPE_EXCELLENT = "excellent";
//     public static final String TOPICS_TYPE_LAST_ACTIVED = "last_actived";
//     public static final int TOPIC_JOB_NODEID = 19;
//     public static final String BASE_URL = "https://testerhome.com/api/v3";
//     public static final String TOPICREPLY = "TopicReply";
//     public static final String FOLLOW = "Follow";
//     public static final String TOPIC = "Topic";
// 
//     public static String getImageUrl(String imagePath){
//         if(!imagePath.contains("https://testerhome.com")){
//             return "https://testerhome.com".concat(imagePath);
//         }else{
//             return imagePath;
//         }
// 
//     }
// }


import android.os.Bundle;
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 com.testerhome.nativeandroid.Config;
import com.testerhome.nativeandroid.R;
import butterknife.Bind;
package com.testerhome.nativeandroid.fragments;




/**
 * Created by vclub on 15/9/15.
 */
public class HomeFragment extends BaseFragment {


    @Bind(R.id.tl_topics)
    TabLayout tabLayoutTopicsTab;

    @Bind(R.id.vp_topics)
    ViewPager viewPagerTopics;

    private TopicViewPagerAdapter mAdapter;

    @Override
    protected int getLayoutRes() {
        return R.layout.fragment_home;
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        setupView();
    }

    private void setupView(){

        mAdapter = new TopicViewPagerAdapter(getActivity().getSupportFragmentManager());
        viewPagerTopics.setAdapter(mAdapter);

        tabLayoutTopicsTab.setupWithViewPager(viewPagerTopics);
        tabLayoutTopicsTab.setTabsFromPagerAdapter(mAdapter);
    }

    public class TopicViewPagerAdapter extends FragmentPagerAdapter {

        private String[] typeName = {"最新","最热","沙发","精华"};
// Path: app/src/main/java/com/testerhome/nativeandroid/Config.java
// public class Config {
// 
// //    recent - 最新
// //    popular - 热门的话题（回帖和喜欢超过一定的数量
// //    no_reply - 还没有任何回帖的
// //    excellent - 精华帖
// //    last_actived - 最近活跃的
// 
//     public static final String TOPICS_TYPE_RECENT = "recent";
//     public static final String TOPICS_TYPE_POPULAR = "popular";
//     public static final String TOPICS_TYPE_NO_REPLY = "no_reply";
//     public static final String TOPICS_TYPE_EXCELLENT = "excellent";
//     public static final String TOPICS_TYPE_LAST_ACTIVED = "last_actived";
//     public static final int TOPIC_JOB_NODEID = 19;
//     public static final String BASE_URL = "https://testerhome.com/api/v3";
//     public static final String TOPICREPLY = "TopicReply";
//     public static final String FOLLOW = "Follow";
//     public static final String TOPIC = "Topic";
// 
//     public static String getImageUrl(String imagePath){
//         if(!imagePath.contains("https://testerhome.com")){
//             return "https://testerhome.com".concat(imagePath);
//         }else{
//             return imagePath;
//         }
// 
//     }
// }


// Path: app/src/main/java/com/testerhome/nativeandroid/fragments/HomeFragment.java
import android.os.Bundle;
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 com.testerhome.nativeandroid.Config;
import com.testerhome.nativeandroid.R;
import butterknife.Bind;

package com.testerhome.nativeandroid.fragments;




/**
 * Created by vclub on 15/9/15.
 */
public class HomeFragment extends BaseFragment {


    @Bind(R.id.tl_topics)
    TabLayout tabLayoutTopicsTab;

    @Bind(R.id.vp_topics)
    ViewPager viewPagerTopics;

    private TopicViewPagerAdapter mAdapter;

    @Override
    protected int getLayoutRes() {
        return R.layout.fragment_home;
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        setupView();
    }

    private void setupView(){

        mAdapter = new TopicViewPagerAdapter(getActivity().getSupportFragmentManager());
        viewPagerTopics.setAdapter(mAdapter);

        tabLayoutTopicsTab.setupWithViewPager(viewPagerTopics);
        tabLayoutTopicsTab.setTabsFromPagerAdapter(mAdapter);
    }

    public class TopicViewPagerAdapter extends FragmentPagerAdapter {

        private String[] typeName = {"最新","最热","沙发","精华"};
        private String[] typeValue = {Config.TOPICS_TYPE_RECENT,