目前版本v1.1
| 篩選樣式 | 篩選種類 |
|---|---|
| 單列 | 單選,多選 |
| 三行 | 單選,多選 |
| 雙列 | 單選,多選 |
| 復雜 | 單項單選,單項多選 |
后續篩選會不斷完善補充.
項目地址傳送門 https://github.com/ccj659/PopsTabView




用戶只需要,知道自己需要哪種filter,將數據轉化FilterTabBean,然后addFilterItem(),最后自己在onPopTabSet()回調,即可使用,簡單粗暴.
##優點:
for()循環全自動配置,自動記住位置,并在點擊時,返回位置以及選取值.ResultLoader<T>##待完善:
PopTypeLoader暴露,用于用戶 篩選器類型.需要自己按照該模式進行擴展.創建 具體 popwindow 實體對象. 創建對象和 功能代碼解耦和,細節在PopTabView.addItem()中.若有需要,需要自由擴展,配置.
public class PopTypeLoaderImp implements PopTypeLoader {
@Override
public PopupWindow getPopEntity(Context context, List data, OnMultipeFilterSetListener filterSetListener, int tag, int type) {
PopupWindow popupWindow = null;
switch (tag) {
case FilterConfig.TYPE_POPWINDOW_LINKED:
popupWindow = new LinkFilterPopupWindow(context, data, filterSetListener,type);
break;
case FilterConfig.TYPE_POPWINDOW_SORT:
popupWindow = new SortPopupWindow(context, data, filterSetListener, tag,type);
break;
default:
popupWindow = new MSingleFilterWindow(context, data, filterSetListener,type);
break;
}
return popupWindow;
}
}
###2.1 Builder模式,完成篩選器的創建.
popTabView.setOnPopTabSetListener(this)
.setPopEntityLoader(new PopTypeLoaderImp()) //配置 {篩選類型} 方式
.addFilterItem("篩選1", singleFilterList1.getFilter_tab(), singleFilterList1.getTab_group_type(), FilterConfig.FILTER_TYPE_MUTIFY)
.addFilterItem("篩選2", linkFilterList.getFilter_tab(), linkFilterList.getTab_group_type(), FilterConfig.FILTER_TYPE_MUTIFY)
.addFilterItem("篩選3", singleFilterList2.getFilter_tab(), singleFilterList2.getTab_group_type(), FilterConfig.FILTER_TYPE_MUTIFY)
.addFilterItem("篩選4", sortFilterList.getFilter_tab(), sortFilterList.getTab_group_type(), FilterConfig.FILTER_TYPE_MUTIFY);
###2.2 for()循環全自動配置模式,完成篩選器的創建.
/**
*
* @param title 篩選標題
* @param data 篩選數據
* @param tag 篩選類別- 一級篩選,二級篩選,復雜篩選
* @param type 篩選方式-單選or多選
* @return
*/
popTabView.addFilterItem("篩選" + i, singleFilterList1.getFilter_tab(), singleFilterList1.getTab_group_type(), FilterConfig.FILTER_TYPE_SINGLE);
ResultLoader<T>
public class ResultLoaderImp implements ResultLoader<String> {
@Override
public String getResultParamsIds(List<FilterTabBean> selectedList) {
StringBuilder stringIds =new StringBuilder();
for (int i = 0; i < selectedList.size(); i++) {
stringIds.append(selectedList.get(i).getTab_id()+",");
}
return builderToString(stringIds);
}
@Override
public String getResultShowValues(List<FilterTabBean> selectedList) {
StringBuilder stringValues =new StringBuilder();
for (int i = 0; i < selectedList.size(); i++) {
stringValues.append(selectedList.get(i).getTab_name()+",");
}
return builderToString(stringValues);
}
/**
* @param index 操作的 filter的下標號 0.1.2.3
* @param lable 操作的 filter的對應的標簽title
* @param params 選中的 參數(需要傳參)
* @param value 選中的 值
*/
@Override
public void onPopTabSet(int index, String lable, String params, String value) {
Toast.makeText(this, "lable=" + index + "\n&value=" + value, Toast.LENGTH_SHORT).show();
tv_content.setText("&篩選項=" + index + "\n&篩選傳參=" + params + "\n&篩選值=" + value);
}
1.可在各級Adapter.ViewHolder 中自己定義.
2.可在xml文件中自定義修改
3.O__O "….....好吧,還是我太懶了....以后會補充的~~
CSDN:http://blog.csdn.net/ccj659/article/
簡書:http://www.jianshu.com/u/94423b4ef5cf
github: https//github.com/ccj659/
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。