// Path: app/src/main/java/io/bxbxbai/zhuanlan/ui/AllPeopleActivity.java
// public class AllPeopleActivity extends ToolBarActivity {
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_all_people);
//         setTitle(R.string.all_people);
// 
//         getSupportFragmentManager().beginTransaction().add(R.id.container,
//                 PeopleListFragment.newInstance()).commit();
//     }
// 
//     public static void start(Activity activity) {
//         activity.startActivity(new Intent(activity, AllPeopleActivity.class));
//     }
// }
// 
// Path: app/src/main/java/io/bxbxbai/zhuanlan/ui/RecentPostListActivity.java
// public class RecentPostListActivity extends ListBaseActivity {
// 
//     private List<Post> postList;
//     private PostListAdapter adapter;
// 
//     //按文章的发布时间排序
//     final Comparator<Post> mPublishTimeComparator = new Comparator<Post>() {
//         @Override
//         public int compare(Post lhs, Post rhs) {
//             return Utils.compareTime(lhs.getPublishedTime(), rhs.getPublishedTime());
//         }
//     };
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setTitle(R.string.recent_news);
// 
//         adapter = new PostListAdapter(this);
//         recyclerView.setAdapter(adapter);
//         postList = new ArrayList<>();
// 
//         String[] ids = getResources().getStringArray(R.array.people_ids);
// 
//         for (int i = 0; ids != null && i < ids.length; i++) {
//             sendRequest(ids[i], 0);
//         }
//     }
// 
//     public void sendRequest(String id, int page) {
//         ZhuanLanApi.getZhuanlanApi()
//                 .getPosts(id, ZhuanLanApi.DEFAULT_COUNT, page * ZhuanLanApi.DEFAULT_COUNT)
//                 .enqueue(new SimpleCallback<List<Post>>() {
//                     @Override
//                     public void onResponse(List<Post> posts, int code, String msg) {
//                         onSuccess(posts);
//                     }
//                 });
//     }
// 
//     private void onSuccess(List<Post> posts) {
//         if (postList.size() > 0) {
//             recyclerView.setVisibility(View.VISIBLE);
//             mLoadingView.setVisibility(View.GONE);
//         }
//         postList.addAll(filterNews(posts));
//         Collections.sort(postList, mPublishTimeComparator);
//         adapter.setItemList(postList);
//     }
// 
//     public List<Post> filterNews(List<Post> origin) {
//         List<Post> list = new ArrayList<>();
// 
//         for (Post post : origin) {
//             if (Utils.withinDays(post.getPublishedTime(), 7)) {
//                 list.add(post);
//             }
//         }
//         return list;
//     }
// 
//     public static boolean start(final Context context) {
//         final Intent intent = new Intent();
//         intent.setClass(context, RecentPostListActivity.class);
//         CommonExecutor.MAIN_HANDLER.postDelayed(new Runnable() {
//             @Override
//             public void run() {
//                 context.startActivity(intent);
//             }
//         }, 300);
//         return true;
//     }
// }


import android.app.Activity;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.view.View;
import android.widget.AdapterView;
import io.bxbxbai.common.Tips;
import io.bxbxbai.zhuanlan.R;
import io.bxbxbai.zhuanlan.ui.AllPeopleActivity;
import io.bxbxbai.zhuanlan.ui.RecentPostListActivity;
package io.bxbxbai.zhuanlan.widget;



/**
 *
 * 点击事件
 * @author bxbxbai
 */
public class OnMenuListClickListener implements AdapterView.OnItemClickListener {

    private Activity mActivity;
    private DrawerLayout mDrawerLayout;

    public OnMenuListClickListener(Activity activity, DrawerLayout drawerLayout) {
        mActivity = activity;
        mDrawerLayout = drawerLayout;
    }

    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        DrawerMenuContent.DrawerItem item = (DrawerMenuContent.DrawerItem) view.getTag(R.id.key_data);

        if (mDrawerLayout != null && mDrawerLayout.isDrawerOpen(GravityCompat.START)) {
            mDrawerLayout.closeDrawers();
        }

        switch (item.id) {
            case R.id.menu_search :
                Tips.showToast("Coming soon...");
                break;

// Path: app/src/main/java/io/bxbxbai/zhuanlan/ui/AllPeopleActivity.java
// public class AllPeopleActivity extends ToolBarActivity {
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_all_people);
//         setTitle(R.string.all_people);
// 
//         getSupportFragmentManager().beginTransaction().add(R.id.container,
//                 PeopleListFragment.newInstance()).commit();
//     }
// 
//     public static void start(Activity activity) {
//         activity.startActivity(new Intent(activity, AllPeopleActivity.class));
//     }
// }
// 
// Path: app/src/main/java/io/bxbxbai/zhuanlan/ui/RecentPostListActivity.java
// public class RecentPostListActivity extends ListBaseActivity {
// 
//     private List<Post> postList;
//     private PostListAdapter adapter;
// 
//     //按文章的发布时间排序
//     final Comparator<Post> mPublishTimeComparator = new Comparator<Post>() {
//         @Override
//         public int compare(Post lhs, Post rhs) {
//             return Utils.compareTime(lhs.getPublishedTime(), rhs.getPublishedTime());
//         }
//     };
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setTitle(R.string.recent_news);
// 
//         adapter = new PostListAdapter(this);
//         recyclerView.setAdapter(adapter);
//         postList = new ArrayList<>();
// 
//         String[] ids = getResources().getStringArray(R.array.people_ids);
// 
//         for (int i = 0; ids != null && i < ids.length; i++) {
//             sendRequest(ids[i], 0);
//         }
//     }
// 
//     public void sendRequest(String id, int page) {
//         ZhuanLanApi.getZhuanlanApi()
//                 .getPosts(id, ZhuanLanApi.DEFAULT_COUNT, page * ZhuanLanApi.DEFAULT_COUNT)
//                 .enqueue(new SimpleCallback<List<Post>>() {
//                     @Override
//                     public void onResponse(List<Post> posts, int code, String msg) {
//                         onSuccess(posts);
//                     }
//                 });
//     }
// 
//     private void onSuccess(List<Post> posts) {
//         if (postList.size() > 0) {
//             recyclerView.setVisibility(View.VISIBLE);
//             mLoadingView.setVisibility(View.GONE);
//         }
//         postList.addAll(filterNews(posts));
//         Collections.sort(postList, mPublishTimeComparator);
//         adapter.setItemList(postList);
//     }
// 
//     public List<Post> filterNews(List<Post> origin) {
//         List<Post> list = new ArrayList<>();
// 
//         for (Post post : origin) {
//             if (Utils.withinDays(post.getPublishedTime(), 7)) {
//                 list.add(post);
//             }
//         }
//         return list;
//     }
// 
//     public static boolean start(final Context context) {
//         final Intent intent = new Intent();
//         intent.setClass(context, RecentPostListActivity.class);
//         CommonExecutor.MAIN_HANDLER.postDelayed(new Runnable() {
//             @Override
//             public void run() {
//                 context.startActivity(intent);
//             }
//         }, 300);
//         return true;
//     }
// }


// Path: app/src/main/java/io/bxbxbai/zhuanlan/widget/OnMenuListClickListener.java
import android.app.Activity;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.view.View;
import android.widget.AdapterView;
import io.bxbxbai.common.Tips;
import io.bxbxbai.zhuanlan.R;
import io.bxbxbai.zhuanlan.ui.AllPeopleActivity;
import io.bxbxbai.zhuanlan.ui.RecentPostListActivity;

package io.bxbxbai.zhuanlan.widget;



/**
 *
 * 点击事件
 * @author bxbxbai
 */
public class OnMenuListClickListener implements AdapterView.OnItemClickListener {

    private Activity mActivity;
    private DrawerLayout mDrawerLayout;

    public OnMenuListClickListener(Activity activity, DrawerLayout drawerLayout) {
        mActivity = activity;
        mDrawerLayout = drawerLayout;
    }

    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        DrawerMenuContent.DrawerItem item = (DrawerMenuContent.DrawerItem) view.getTag(R.id.key_data);

        if (mDrawerLayout != null && mDrawerLayout.isDrawerOpen(GravityCompat.START)) {
            mDrawerLayout.closeDrawers();
        }

        switch (item.id) {
            case R.id.menu_search :
                Tips.showToast("Coming soon...");
                break;

            case R.id.menu_all_people: