// Path: android/JBox/app/src/main/java/com/jiguang/jbox/AppApplication.java
// public class AppApplication extends Application {
//   private static Context mContext;
// 
//   public static boolean shouldUpdateData = false;
// 
//   public static String currentDevKey = "";
//   public static String currentChannelName = "";
// 
//   @Override public void onCreate() {
//     super.onCreate();
//     mContext = getApplicationContext();
//     JPushInterface.init(this);
//     ActiveAndroid.initialize(this);
//   }
// 
//   @Override public void onTerminate() {
//     super.onTerminate();
//     ActiveAndroid.dispose();
//   }
// 
//   public static Context getAppContext() {
//     return mContext;
//   }
// 
//   public static String getAppKey() {
//     PackageManager pm = mContext.getPackageManager();
//     ApplicationInfo appInfo;
//     try {
//       appInfo = pm.getApplicationInfo(mContext.getPackageName(), PackageManager.GET_META_DATA);
//     } catch (PackageManager.NameNotFoundException e) {
//       e.printStackTrace();
//       return "";
//     }
//     return appInfo.metaData.getString("JPUSH_APPKEY");
//   }
// }
// 
// Path: android/JBox/app/src/main/java/com/jiguang/jbox/data/model/Channel.java
// @Table(name = "Channel")
// public class Channel extends Model {
// 
//     @Column(name = "DevKey")
//     public String devKey;
// 
//     @Column(name = "Name")
//     public String name;
// 
//     @Column(name = "UnreadCount")
//     public int unreadCount; // 未读消息数。
// 
//     @Column(name = "IsSubscribe")
//     public boolean isSubscribe;    // 默认为订阅。
// 
//     public Channel() {
//         super();
//     }
// 
//     @Override
//     public boolean equals(Object obj) {
//         if (obj == null) {
//             return false;
//         }
//         if (!(obj instanceof Channel)) {
//             return false;
//         }
//         Channel objChannel = (Channel) obj;
//         return objChannel.name.equals(name) && objChannel.isSubscribe == this.isSubscribe;
//     }
// }
// 
// Path: android/JBox/app/src/main/java/com/jiguang/jbox/ui/drawer/ChannelListFragment.java
// public class ChannelListFragment extends Fragment {
// 
//     private static final String TAG = ChannelListFragment.class.getSimpleName();
// 
//     private OnListFragmentInteractionListener mListener;
//     private List<Channel> mChannels;
// 
//     private RecyclerView mRecyclerView;
//     private ChannelDrawerRecyclerViewAdapter mAdapter;
// 
//     public ChannelListFragment() {
//         if (!TextUtils.isEmpty(AppApplication.currentDevKey)) {
//             mChannels = new Select().from(Channel.class)
//                     .where("DevKey=? AND IsSubscribe=?", AppApplication.currentDevKey, true)
//                     .execute();
// 
//             if (mChannels != null && !mChannels.isEmpty()) {
//                 AppApplication.currentChannelName = mChannels.get(0).name;
//             }
//         }
//     }
// 
//     @SuppressWarnings("unused")
//     public static ChannelListFragment newInstance(int columnCount) {
//         return new ChannelListFragment();
//     }
// 
//     @Override
//     public void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//     }
// 
//     @Override
//     public View onCreateView(LayoutInflater inflater, ViewGroup container,
//                              Bundle savedInstanceState) {
//         View view = inflater.inflate(R.layout.fragment_drawer_channel, container, false);
// 
//         ImageView ivEdit = (ImageView) view.findViewById(R.id.iv_edit);
//         ivEdit.setOnClickListener(new View.OnClickListener() {
//             @Override
//             public void onClick(View view) {
//                 Intent intent = new Intent(getActivity(), ChannelActivity.class);
//                 intent.putExtra(ChannelActivity.EXTRA_DEV_KEY, AppApplication.currentDevKey);
//                 startActivity(intent);
//             }
//         });
// 
//         Context context = view.getContext();
//         mRecyclerView = (RecyclerView) view.findViewById(R.id.rv_channel);
//         mRecyclerView.setLayoutManager(new LinearLayoutManager(context));
//         mAdapter = new ChannelDrawerRecyclerViewAdapter(mChannels, mListener);
//         mRecyclerView.setAdapter(mAdapter);
// 
//         return view;
//     }
// 
//     @Override
//     public void onResume() {
//         super.onResume();
//     }
// 
//     @Override
//     public void onAttach(Context context) {
//         super.onAttach(context);
//         if (context instanceof OnListFragmentInteractionListener) {
//             mListener = (OnListFragmentInteractionListener) context;
//         } else {
//             throw new RuntimeException(context.toString()
//                     + " must implement OnListFragmentInteractionListener");
//         }
//     }
// 
//     @Override
//     public void onDetach() {
//         super.onDetach();
//         mListener = null;
//     }
// 
//     public void updateData(String devKey) {
//         mChannels = new Select().from(Channel.class)
//                 .where("DevKey=? AND IsSubscribe=?", devKey, true)
//                 .execute();
//         mAdapter = null;
//         mAdapter = new ChannelDrawerRecyclerViewAdapter(mChannels, mListener);
//         mRecyclerView.setAdapter(mAdapter);
//     }
// 
//     public interface OnListFragmentInteractionListener {
//         void onChannelListItemClick(Channel channel);
//     }
// }


import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.jiguang.jbox.AppApplication;
import com.jiguang.jbox.R;
import com.jiguang.jbox.data.model.Channel;
import com.jiguang.jbox.ui.drawer.ChannelListFragment;
import java.util.ArrayList;
import java.util.List;
package com.jiguang.jbox.ui.drawer.adapter;




public class ChannelDrawerRecyclerViewAdapter extends
        RecyclerView.Adapter<ChannelDrawerRecyclerViewAdapter.ViewHolder> {

// Path: android/JBox/app/src/main/java/com/jiguang/jbox/AppApplication.java
// public class AppApplication extends Application {
//   private static Context mContext;
// 
//   public static boolean shouldUpdateData = false;
// 
//   public static String currentDevKey = "";
//   public static String currentChannelName = "";
// 
//   @Override public void onCreate() {
//     super.onCreate();
//     mContext = getApplicationContext();
//     JPushInterface.init(this);
//     ActiveAndroid.initialize(this);
//   }
// 
//   @Override public void onTerminate() {
//     super.onTerminate();
//     ActiveAndroid.dispose();
//   }
// 
//   public static Context getAppContext() {
//     return mContext;
//   }
// 
//   public static String getAppKey() {
//     PackageManager pm = mContext.getPackageManager();
//     ApplicationInfo appInfo;
//     try {
//       appInfo = pm.getApplicationInfo(mContext.getPackageName(), PackageManager.GET_META_DATA);
//     } catch (PackageManager.NameNotFoundException e) {
//       e.printStackTrace();
//       return "";
//     }
//     return appInfo.metaData.getString("JPUSH_APPKEY");
//   }
// }
// 
// Path: android/JBox/app/src/main/java/com/jiguang/jbox/data/model/Channel.java
// @Table(name = "Channel")
// public class Channel extends Model {
// 
//     @Column(name = "DevKey")
//     public String devKey;
// 
//     @Column(name = "Name")
//     public String name;
// 
//     @Column(name = "UnreadCount")
//     public int unreadCount; // 未读消息数。
// 
//     @Column(name = "IsSubscribe")
//     public boolean isSubscribe;    // 默认为订阅。
// 
//     public Channel() {
//         super();
//     }
// 
//     @Override
//     public boolean equals(Object obj) {
//         if (obj == null) {
//             return false;
//         }
//         if (!(obj instanceof Channel)) {
//             return false;
//         }
//         Channel objChannel = (Channel) obj;
//         return objChannel.name.equals(name) && objChannel.isSubscribe == this.isSubscribe;
//     }
// }
// 
// Path: android/JBox/app/src/main/java/com/jiguang/jbox/ui/drawer/ChannelListFragment.java
// public class ChannelListFragment extends Fragment {
// 
//     private static final String TAG = ChannelListFragment.class.getSimpleName();
// 
//     private OnListFragmentInteractionListener mListener;
//     private List<Channel> mChannels;
// 
//     private RecyclerView mRecyclerView;
//     private ChannelDrawerRecyclerViewAdapter mAdapter;
// 
//     public ChannelListFragment() {
//         if (!TextUtils.isEmpty(AppApplication.currentDevKey)) {
//             mChannels = new Select().from(Channel.class)
//                     .where("DevKey=? AND IsSubscribe=?", AppApplication.currentDevKey, true)
//                     .execute();
// 
//             if (mChannels != null && !mChannels.isEmpty()) {
//                 AppApplication.currentChannelName = mChannels.get(0).name;
//             }
//         }
//     }
// 
//     @SuppressWarnings("unused")
//     public static ChannelListFragment newInstance(int columnCount) {
//         return new ChannelListFragment();
//     }
// 
//     @Override
//     public void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//     }
// 
//     @Override
//     public View onCreateView(LayoutInflater inflater, ViewGroup container,
//                              Bundle savedInstanceState) {
//         View view = inflater.inflate(R.layout.fragment_drawer_channel, container, false);
// 
//         ImageView ivEdit = (ImageView) view.findViewById(R.id.iv_edit);
//         ivEdit.setOnClickListener(new View.OnClickListener() {
//             @Override
//             public void onClick(View view) {
//                 Intent intent = new Intent(getActivity(), ChannelActivity.class);
//                 intent.putExtra(ChannelActivity.EXTRA_DEV_KEY, AppApplication.currentDevKey);
//                 startActivity(intent);
//             }
//         });
// 
//         Context context = view.getContext();
//         mRecyclerView = (RecyclerView) view.findViewById(R.id.rv_channel);
//         mRecyclerView.setLayoutManager(new LinearLayoutManager(context));
//         mAdapter = new ChannelDrawerRecyclerViewAdapter(mChannels, mListener);
//         mRecyclerView.setAdapter(mAdapter);
// 
//         return view;
//     }
// 
//     @Override
//     public void onResume() {
//         super.onResume();
//     }
// 
//     @Override
//     public void onAttach(Context context) {
//         super.onAttach(context);
//         if (context instanceof OnListFragmentInteractionListener) {
//             mListener = (OnListFragmentInteractionListener) context;
//         } else {
//             throw new RuntimeException(context.toString()
//                     + " must implement OnListFragmentInteractionListener");
//         }
//     }
// 
//     @Override
//     public void onDetach() {
//         super.onDetach();
//         mListener = null;
//     }
// 
//     public void updateData(String devKey) {
//         mChannels = new Select().from(Channel.class)
//                 .where("DevKey=? AND IsSubscribe=?", devKey, true)
//                 .execute();
//         mAdapter = null;
//         mAdapter = new ChannelDrawerRecyclerViewAdapter(mChannels, mListener);
//         mRecyclerView.setAdapter(mAdapter);
//     }
// 
//     public interface OnListFragmentInteractionListener {
//         void onChannelListItemClick(Channel channel);
//     }
// }


// Path: android/JBox/app/src/main/java/com/jiguang/jbox/ui/drawer/adapter/ChannelDrawerRecyclerViewAdapter.java
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.jiguang.jbox.AppApplication;
import com.jiguang.jbox.R;
import com.jiguang.jbox.data.model.Channel;
import com.jiguang.jbox.ui.drawer.ChannelListFragment;
import java.util.ArrayList;
import java.util.List;

package com.jiguang.jbox.ui.drawer.adapter;




public class ChannelDrawerRecyclerViewAdapter extends
        RecyclerView.Adapter<ChannelDrawerRecyclerViewAdapter.ViewHolder> {

    private List<Channel> mValues = new ArrayList<>();