// Path: architecture/src/main/java/com/jiang/android/architecture/adapter/BaseAdapter.java
// public abstract class BaseAdapter extends RecyclerView.Adapter<BaseViewHolder> {
// 
// 
//     @Override
//     public BaseViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
//         final BaseViewHolder holder = new BaseViewHolder(LayoutInflater.from(parent.getContext()).inflate(viewType, parent, false));
// 
//         if (clickable()) {
//             holder.getConvertView().setClickable(true);
//             holder.getConvertView().setOnClickListener(new View.OnClickListener() {
//                 @Override
//                 public void onClick(View v) {
//                     onItemClick(v, holder.getLayoutPosition());
//                 }
//             });
//         }
//         return holder;
//     }
// 
//     @Override
//     public void onBindViewHolder(final BaseViewHolder holder, final int position) {
// 
//         onBindView(holder, holder.getLayoutPosition());
// 
//     }
// 
//     public abstract void onBindView(BaseViewHolder holder, int position);
// 
//     @Override
//     public int getItemViewType(int position) {
//         return getLayoutID(position);
//     }
// 
// 
//     public abstract int getLayoutID(int position);
// 
//     public abstract boolean clickable();
// 
//     public void onItemClick(View v, int position) {
//     }
// 
// 
// }


import android.app.Activity;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.PopupWindow;
import com.jiang.android.architecture.adapter.BaseAdapter;
import com.jiang.android.zhihu_topanswer.R;
package com.jiang.android.zhihu_topanswer.view;



/**
 * Created by jiang on 2016/12/24.
 */

public class SelectPopupWindow extends PopupWindow {

    private final View mMenuView;
    private final RecyclerView mRecyclerView;

    public SelectPopupWindow(Activity context) {
        super(context);
        LayoutInflater inflater = (LayoutInflater) context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        mMenuView = inflater.inflate(R.layout.popwindow_layout, null);
        mRecyclerView = (RecyclerView) mMenuView.findViewById(R.id.pop_layout1);

        this.setContentView(mMenuView);
        this.setWidth(ViewGroup.LayoutParams.FILL_PARENT);
        this.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
        this.setFocusable(true);

        ColorDrawable dw = new ColorDrawable(0xb0000000);
        this.setBackgroundDrawable(dw);
        setOutsideTouchable(false);

    }

// Path: architecture/src/main/java/com/jiang/android/architecture/adapter/BaseAdapter.java
// public abstract class BaseAdapter extends RecyclerView.Adapter<BaseViewHolder> {
// 
// 
//     @Override
//     public BaseViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
//         final BaseViewHolder holder = new BaseViewHolder(LayoutInflater.from(parent.getContext()).inflate(viewType, parent, false));
// 
//         if (clickable()) {
//             holder.getConvertView().setClickable(true);
//             holder.getConvertView().setOnClickListener(new View.OnClickListener() {
//                 @Override
//                 public void onClick(View v) {
//                     onItemClick(v, holder.getLayoutPosition());
//                 }
//             });
//         }
//         return holder;
//     }
// 
//     @Override
//     public void onBindViewHolder(final BaseViewHolder holder, final int position) {
// 
//         onBindView(holder, holder.getLayoutPosition());
// 
//     }
// 
//     public abstract void onBindView(BaseViewHolder holder, int position);
// 
//     @Override
//     public int getItemViewType(int position) {
//         return getLayoutID(position);
//     }
// 
// 
//     public abstract int getLayoutID(int position);
// 
//     public abstract boolean clickable();
// 
//     public void onItemClick(View v, int position) {
//     }
// 
// 
// }


// Path: app/src/main/java/com/jiang/android/zhihu_topanswer/view/SelectPopupWindow.java
import android.app.Activity;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.PopupWindow;
import com.jiang.android.architecture.adapter.BaseAdapter;
import com.jiang.android.zhihu_topanswer.R;

package com.jiang.android.zhihu_topanswer.view;



/**
 * Created by jiang on 2016/12/24.
 */

public class SelectPopupWindow extends PopupWindow {

    private final View mMenuView;
    private final RecyclerView mRecyclerView;

    public SelectPopupWindow(Activity context) {
        super(context);
        LayoutInflater inflater = (LayoutInflater) context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        mMenuView = inflater.inflate(R.layout.popwindow_layout, null);
        mRecyclerView = (RecyclerView) mMenuView.findViewById(R.id.pop_layout1);

        this.setContentView(mMenuView);
        this.setWidth(ViewGroup.LayoutParams.FILL_PARENT);
        this.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
        this.setFocusable(true);

        ColorDrawable dw = new ColorDrawable(0xb0000000);
        this.setBackgroundDrawable(dw);
        setOutsideTouchable(false);

    }

    public void setAdapter(BaseAdapter adapter) {