PopsTabView--filter容器

PopsTabView是個filter容器,他可以自動,快速,構建不同篩選樣式,自由組合成一組tab.

Download


Download

Author

License

篩選樣式篩選種類可自定義屬性
單列單選,多選初始數據bean,篩選結果bean,tab樣式,篩選樣式
多排單選,多選初始數據bean,篩選結果beantab樣式,篩選樣式
雙列單項單選,單項多選初始數據bean,篩選結果bean,tab樣式,篩選樣式
復雜單項單選,單項多選初始數據bean,篩選結果bean,tab樣式,篩選樣式
自定義單項單選,單項多選初始數據bean,篩選結果bean,tab樣式,篩選樣式

詳情請參考代碼,以及實例
后續篩選會不斷完善補充.

PopTabView.java API

方法名功能是否必須
setOnPopTabSetListener()外部回調的監聽
setPopEntityLoader()篩選樣式加載類,新增類型可在此擴展
setResultLoader()結果集加載器,可自定義進行配置
addFilterItem()增加篩選項
setClickedItem()設置默認選中的狀態,并主動回調
removeItem()清空容器

項目地址傳送門 https://github.com/ccj659/PopsTabView

進階

  • 支持自定義參數傳送門

  • 支持自定義樣式傳送門

Show











Introduction

用戶只需要,知道自己需要哪種filter,將數據轉化FilterTabBean,然后addFilterItem(),最后自己在onPopTabSet()回調,即可使用,簡單粗暴.

優點:

  • 支持快速,構建不同篩選樣式,順序,自由組合成一組filter的tab.
  • 用接口抽象出filter樣式配置器loader,與功能代碼解耦.
  • 支持自定義配置 篩選結果ResultLoader<T>
  • 支持自定義數據bean.
  • 可以自由擴展,其他類型的Filter類型.

待完善:

  • 逐漸增加其他類型的篩選樣式
  • view的樣式可配置為可自定義

TO USE

添加依賴

In Gradle

compile 'me.ccj.PopsTabView:poptabview_lib:1.4.0'復制代碼

In Maven

<dependency><groupId>me.ccj.PopsTabView</groupId><artifactId>poptabview_lib</artifactId><version>1.4.0</version><type>pom</type>
</dependency>復制代碼

簡單方式

如果業務需求很簡單,用lib自帶的篩選即可.

1.設定,篩選器類型. 將PopTypeLoader暴露,用于用戶 篩選器類型.

需要自己按照該模式進行擴展.創建 具體 popwindow 實體對象. 創建對象和 功能代碼解耦和,細節在PopTabView.addItem()中.若有需要,需要自由擴展,配置.


public class PopTypeLoaderImp implements PopTypeLoader {@Overridepublic 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.使用方式

####2.1 Builder模式,完成篩選器的創建.

private void addMyMethod() {FilterGroup filterGroup1 = getMyData("篩選1", FilterConfig.TYPE_POPWINDOW_ROWS,FilterConfig.FILTER_TYPE_SINGLE);FilterGroup filterGroup2 = getMyData("篩選2", FilterConfig.TYPE_POPWINDOW_LINKED,FilterConfig.FILTER_TYPE_MUTIFY);FilterGroup filterGroup3 = getMyData("篩選3", FilterConfig.TYPE_POPWINDOW_SINGLE,FilterConfig.FILTER_TYPE_SINGLE);FilterGroup filterGroup4 = getMyData("篩選4", FilterConfig.TYPE_POPWINDOW_SORT,FilterConfig.FILTER_TYPE_MUTIFY);popTabView.setOnPopTabSetListener(this).setPopEntityLoader(new PopEntityLoaderImp()).setResultLoader(new ResultLoaderImp()) //配置 {篩選類型}  方式/**** @param title 篩選標題* @param data 篩選數據* @param tag 篩選類別- 一級篩選,二級篩選,復雜篩選* @param type 篩選方式-單選or多選* @return*/.addFilterItem(filterGroup1.getTab_group_name(), filterGroup1.getFilter_tab(), filterGroup1.getTab_group_type(), filterGroup1.getSingle_or_mutiply()).addFilterItem(filterGroup2.getTab_group_name(), filterGroup2.getFilter_tab(), filterGroup2.getTab_group_type(), filterGroup2.getSingle_or_mutiply()).addFilterItem(filterGroup3.getTab_group_name(), filterGroup3.getFilter_tab(), filterGroup3.getTab_group_type(), filterGroup3.getSingle_or_mutiply()).addFilterItem(filterGroup4.getTab_group_name(), filterGroup4.getFilter_tab(), filterGroup4.getTab_group_type(), filterGroup4.getSingle_or_mutiply());}復制代碼

3.配置篩選后的返回值樣式ResultLoader<T>

/*** 如果 遇到復雜的 業務需求, 只需要在這里,對篩選結果進行構建即可.* Created by chenchangjun on 17/7/25.*/public class ResultLoaderImp implements ResultLoader<String> {@Overridepublic String getResultParamsIds(List<BaseFilterTabBean> selectedList, int filterType) {StringBuilder stringValues = new StringBuilder();for (int i = 0; i < selectedList.size(); i++) {FilterTabBean filterTabBean= (FilterTabBean) selectedList.get(i);stringValues.append( filterTabBean.getTab_id()+ ",");}return PopsTabUtils.builderToString(stringValues);}@Overridepublic String getResultShowValues(List<BaseFilterTabBean> selectedList, int filterType) {StringBuilder stringValues = new StringBuilder();for (int i = 0; i < selectedList.size(); i++) {stringValues.append(selectedList.get(i).getTab_name() + ",");}return PopsTabUtils.builderToString(stringValues);}復制代碼

4.成功的回調,可配置為借口傳參.此處回調,可以自主修改,擴展.

 /*** @param index  操作的 filter的下標號 0.1.2.3* @param lable  操作的 filter的對應的標簽title* @param params 選中的 參數(需要傳參)* @param value  選中的 值*/@Overridepublic 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 "….....好吧,還是我太懶了....以后會補充的~~

About Me

===
CSDN:http://blog.csdn.net/ccj659/article/

簡書:http://www.jianshu.com/u/94423b4ef5cf

github: https//github.com/ccj659/

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/279058.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/279058.shtml
英文地址,請注明出處:http://en.pswp.cn/news/279058.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

git 基本使用方法

git clone https://gitee.com/kuaiyiwazz.git //開始下載服務器項目文件&#xff08;后邊是服務地項目的地址&#xff09;git add . //這里有個點&#xff08;仔細看&#xff09;git status //檢查項目修改狀態git commit -m"注釋(修改的內容)" git push //添…

大學留級兩年不敢和家人說_您說什么:如何與家人保持聯系?

大學留級兩年不敢和家人說Earlier this week we asked you to share your tips, tricks, and techniques for staying connected when you’re away from your home broadband connection. Now we’re back with a roundup of what you said. 本周早些時候&#xff0c;我們要求…

DevExpress v17.2新版亮點—WinForms篇(四)

2019獨角獸企業重金招聘Python工程師標準>>> DevExpress首推團隊升級培訓套包&#xff0c;最高可省10萬元&#xff01;查看詳情>>> 用戶界面套包DevExpress v17.2終于正式發布&#xff0c;本站將以連載的形式為大家介紹各版本新增內容。開篇介紹了DevExpre…

Solr 11 - Solr集群模式的部署(基于Solr 4.10.4搭建SolrCloud)

目錄 1 SolrCloud結構說明2 環境的安裝2.1 環境說明2.2 部署并啟動ZooKeeper集群2.3 部署Solr單機服務2.4 添加Solr的索引庫3 部署Solr集群服務(SolrCloud)3.1 啟動ZooKeeper3.2 ZooKeeper管理配置文件3.3 修改SolrCloud監聽端口3.4 關聯Solr與ZooKeeper3.5 分發SolrCloud服務3…

matlab怎么畫一箭穿心,MATLAB學習與使用:如何繪制三維心形圖 經驗告訴你該這樣...

MATLAB是MATrix & LABoratory(矩陣實驗室)的縮寫&#xff0c;是一款強大的科學軟件&#xff0c;具有編程、繪圖、仿真等功能。利用MATLAB繪制一款三維的心形圖&#xff0c;然后送給心愛的姑娘&#xff0c;也是理工男撩妹的一項小技能。工具/材料MATLAB三維心形圖操作方法01…

mac重置系統_如何在Mac上重置打印系統

mac重置系統Printers are notorious for failing frequently. A quick restart of the printer or computer usually fixes most intermittent issues, but occasionally it’s best to reset your printing settings and reinstall the printer completely. Consider this a f…

COW奶牛!Copy On Write機制了解一下

前言 只有光頭才能變強 在讀《Redis設計與實現》關于哈希表擴容的時候&#xff0c;發現這么一段話&#xff1a; 執行BGSAVE命令或者BGREWRITEAOF命令的過程中&#xff0c;Redis需要創建當前服務器進程的子進程&#xff0c;而大多數操作系統都采用寫時復制&#xff08;copy-on-w…

參數回調

1.場景 參數回調方式與調用本地 callback 或 listener 相同&#xff0c;只需要在 Spring 的配置文件中聲明哪個參數是 callback 類型即可。 Dubbo 將基于長連接生成反向代理&#xff0c;這樣就可以從服務器端調用客戶端邏輯 2.

matlab胡良劍第五章,MATLAB習題參考答案(胡良劍,孫曉君)

MATLAB習題參考答案第一章 MATLAB入門4、求近似解解&#xff1a;>> x-2:0.05:2;yx.^4-2.^x兩個近似解&#xff1a;y1f(-0.85) -0.0328; y2f(1.250) 0.0630第二章 MATLAB編程與作圖1、 設x是數組&#xff0c;求均值和方差 解&#xff1a;函數文件如下&#xff1a;function…

windows 全局變量_如何在Windows中使用全局系統環境變量

windows 全局變量Any system administrator who spends a good bit of time in the command prompt or batch scripts is probably well aware of built in environment variables Windows offers (i.e. Path, WinDir, ProgramFiles, UserProfile, etc.). If you find yourself…

Day2-T1

原題目 Describe&#xff1a;貪心&#xff0c;左邊和右邊中選字典序小的 code&#xff1a; #include<bits/stdc.h> using namespace std; int n,step,head,tail; char p[50005]; int main() {freopen("bcl.in","r",stdin);freopen("bcl.out&quo…

hadoop編譯java,Hadoop源碼編譯(2.4.1)

背景Hadoop 2.4.1預編譯版本自帶的libhadoop.so是在32位機器上編譯上,導致在64位OS上運行時&#xff0c;總出現如下告警&#xff1a;WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable查看…

C# System.Windows.Forms.NumericUpDown 控件全選其中文字

num_length.Focus(); UpDownBase updbText (UpDownBase)num_length; num_length.Select(0, updbText.Text.Length);轉載于:https://www.cnblogs.com/LuoEast/p/7942476.html

twitter api使用_使用P2創建自己的Twitter風格的組博客

twitter api使用Would you like a great way to post stuff quickly online and communicate with your readers? Here’s how you can use the P2 theme to transform WordPress into a great collaboration and communications platform. 您是否想以一種很好的方式在網上快…

10_30_unittest

1、斷言 1&#xff09;、self.assertEqual(2,res)#期望值qian、結果值hou2&#xff09;TextTestRunner 源碼 必要的參數3&#xff09;測試結果 上下文管理器 with open("test.txt",w,encodingutf-8) as file:runner unittest.TextTestRunner(streamfile,verbosity2)…

用maven profile實現環境配置切換

前言 互聯網后端服務通常會部署多個環境&#xff1a;開發環境、測試環境、預發布環境和生產環境。不同的環境通常有各自的環境配置&#xff0c;例如mysql服務器的地址、用戶名密碼&#xff0c;zookeeper的ip和端口等等。為了使打出的jar包能獲取不同環境的配置&#xff0c;業界…

laravel graphql php,結合 Laravel 初步學習 GraphQL

本文字數&#xff1a;7134&#xff0c;大概需要14.27分鐘。按照官網所述的&#xff1a;A query language for your API一種用于 API 的查詢語言GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data. GraphQL provides a…

wi-fi共享大師免廣告_如何保護Wi-Fi網絡免受入侵

wi-fi共享大師免廣告Insecure Wi-Fi is the easiest way for people to access your home network, leech your internet, and cause you serious headaches with more malicious behavior. Read on as we show you how to secure your home Wi-Fi network. 不安全的Wi-Fi是人們…

MongoDb分片集群認證

本文主要基于已經搭建好的未認證集群&#xff0c;結合上篇Mongodb副本集分片集群模式環境部署&#xff08;https://www.cnblogs.com/woxingwoxue/p/9875878.html&#xff09;&#xff0c; MongoDb分片集群認證幾個主要流程1.在分片集群環境中&#xff0c;副本集內成員之間需要用…

漢克爾變換matlab,HankelTransform

HankelTransform所屬分類&#xff1a;matlab例程開發工具&#xff1a;matlab文件大小&#xff1a;135KB下載次數&#xff1a;66上傳日期&#xff1a;2011-09-17 13:41:39上 傳 者&#xff1a;甜頭說明&#xff1a; Matlab Hankel變換源代碼&#xff0c;可以直接當做MATLAB too…