├── .gitignore
├── .idea
├── .name
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── encodings.xml
├── gradle.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── README.md
├── android-expandpoptab-library
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── warmtel
│ │ └── expandtab
│ │ └── ApplicationTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── warmtel
│ │ │ └── expandtab
│ │ │ ├── ExpandPopTabView.java
│ │ │ ├── KeyValueBean.java
│ │ │ ├── PopOneListView.java
│ │ │ ├── PopTwoListView.java
│ │ │ └── PopViewAdapter.java
│ └── res
│ │ ├── anim
│ │ ├── pophidden_anim.xml
│ │ └── popshow_anim.xml
│ │ ├── color
│ │ └── expand_tab_item_textcolor_selector.xml
│ │ ├── drawable-hdpi
│ │ ├── expand_tab_item_check.9.png
│ │ ├── expand_tab_item_norm.9.png
│ │ ├── expand_tab_item_press.9.png
│ │ ├── expand_tab_parent_item_selected.jpg
│ │ ├── expand_tab_popview1_bg.9.png
│ │ ├── expand_tab_popview1_select.9.png
│ │ └── expand_tab_popview2_bg.9.png
│ │ ├── drawable
│ │ ├── expand_tab_item_selector.xml
│ │ ├── expand_tab_popview2_chilred_item_selector.xml
│ │ ├── expand_tab_popview_item_selector.xml
│ │ └── pop_listview_parent_selector.xml
│ │ ├── layout
│ │ ├── expand_tab_popview1_layout.xml
│ │ ├── expand_tab_popview2_layout.xml
│ │ ├── expand_tab_popview_item1_layout.xml
│ │ └── expand_tab_toggle_button.xml
│ │ └── values
│ │ ├── attrs.xml
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── drawables.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── warmtel
│ └── expandtab
│ └── ExampleUnitTest.java
├── app
├── .gitignore
├── build.gradle
├── libs
│ └── fastjson-1.2.2.jar
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── warmtel
│ │ └── expandpop
│ │ └── ApplicationTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── assets
│ │ └── searchType
│ ├── java
│ │ └── com
│ │ │ └── warmtel
│ │ │ └── expandpop
│ │ │ ├── ExpandPopTabActivity.java
│ │ │ └── dto
│ │ │ ├── BaseDTO.java
│ │ │ ├── ConfigAreaDTO.java
│ │ │ ├── ConfigListDTO.java
│ │ │ ├── ConfigsDTO.java
│ │ │ └── ConfigsMessageDTO.java
│ └── res
│ │ ├── layout
│ │ └── activity_expand_pop_tabs_layout.xml
│ │ ├── mipmap-hdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ └── ic_launcher.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── warmtel
│ └── expandpop
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 |
--------------------------------------------------------------------------------
/.idea/.name:
--------------------------------------------------------------------------------
1 | ExpandPopTabView
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
19 |
20 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 二级下拉列表菜单(仿大众点评,美团)
2 |
3 |
4 |
5 |
6 | android-expandpoptab-library制作的第三方包,项目中直接引用即可。
7 |
8 | Demo调用方式参ExpandPopTabActivit.java类
9 |
--------------------------------------------------------------------------------
/android-expandpoptab-library/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/android-expandpoptab-library/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.1"
6 |
7 | defaultConfig {
8 | minSdkVersion 14
9 | targetSdkVersion 23
10 | versionCode 1
11 | versionName "1.0"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | compile fileTree(dir: 'libs', include: ['*.jar'])
23 | testCompile 'junit:junit:4.12'
24 | compile 'com.android.support:appcompat-v7:23.1.1'
25 | }
26 |
--------------------------------------------------------------------------------
/android-expandpoptab-library/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in E:\soft\android-sdk_r23.0.5-windows\android-sdk-windows/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/android-expandpoptab-library/src/androidTest/java/com/warmtel/expandtab/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.warmtel.expandtab;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/android-expandpoptab-library/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/android-expandpoptab-library/src/main/java/com/warmtel/expandtab/ExpandPopTabView.java:
--------------------------------------------------------------------------------
1 | package com.warmtel.expandtab;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.content.res.TypedArray;
6 | import android.graphics.Color;
7 | import android.util.AttributeSet;
8 | import android.view.LayoutInflater;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 | import android.widget.LinearLayout;
12 | import android.widget.PopupWindow;
13 | import android.widget.PopupWindow.OnDismissListener;
14 | import android.widget.RelativeLayout;
15 | import android.widget.ToggleButton;
16 |
17 | import java.util.ArrayList;
18 |
19 | public class ExpandPopTabView extends LinearLayout implements OnDismissListener {
20 | private ArrayList mViewLists = new ArrayList();
21 | private ToggleButton mSelectedToggleBtn;
22 | private PopupWindow mPopupWindow;
23 | private Context mContext;
24 | private int mDisplayWidth;
25 | private int mDisplayHeight;
26 | private int mSelectPosition;
27 | private int mTabPostion = -1; //记录TAB页号
28 | private int mToggleBtnBackground;
29 | private int mToggleBtnBackgroundColor;
30 | private int mToggleTextColor;
31 | private int mPopViewBackgroundColor;
32 | private float mToggleTextSize;
33 |
34 | public ExpandPopTabView(Context context) {
35 | super(context);
36 | init(context,null);
37 | }
38 |
39 | public ExpandPopTabView(Context context, AttributeSet attrs) {
40 | super(context, attrs);
41 | init(context, attrs);
42 | }
43 |
44 | private void init(Context context, AttributeSet attrs) {
45 | TypedArray a = null;
46 | try {
47 | a = context.obtainStyledAttributes(attrs, R.styleable.ExpandPopTabView);
48 | mToggleBtnBackground = a.getResourceId(R.styleable.ExpandPopTabView_tab_toggle_btn_bg, -1);
49 | mToggleBtnBackgroundColor = a.getColor(R.styleable.ExpandPopTabView_tab_toggle_btn_color, -1);
50 | mToggleTextColor = a.getColor(R.styleable.ExpandPopTabView_tab_toggle_btn_font_color,-1);
51 | mPopViewBackgroundColor = a.getColor(R.styleable.ExpandPopTabView_tab_pop_bg_color,-1);
52 | mToggleTextSize = a.getDimension(R.styleable.ExpandPopTabView_tab_toggle_btn_font_size, -1);
53 | } catch (Exception e) {
54 | e.printStackTrace();
55 | }finally {
56 | if(a != null) {
57 | a.recycle();
58 | }
59 | }
60 | mContext = context;
61 | mDisplayWidth = ((Activity) mContext).getWindowManager().getDefaultDisplay().getWidth();
62 | mDisplayHeight = ((Activity) mContext).getWindowManager().getDefaultDisplay().getHeight();
63 | setOrientation(LinearLayout.HORIZONTAL);
64 | }
65 |
66 | public void addItemToExpandTab(String tabTitle, ViewGroup tabItemView) {
67 | ToggleButton tButton = (ToggleButton) LayoutInflater.from(mContext).inflate(R.layout.expand_tab_toggle_button, this, false);
68 | if(mToggleBtnBackground != -1){
69 | tButton.setBackgroundResource(mToggleBtnBackground);
70 | }
71 | if(mToggleBtnBackgroundColor != -1){
72 | tButton.setBackgroundColor(mToggleBtnBackgroundColor);
73 | }
74 | if(mToggleTextColor != -1){
75 | tButton.setTextColor(mToggleTextColor);
76 | }
77 | if(mToggleTextSize != -1){
78 | tButton.setTextSize(mToggleTextSize);
79 | }
80 |
81 | tButton.setText(tabTitle);
82 | tButton.setTag(++mTabPostion);
83 | tButton.setOnClickListener(new OnClickListener() {
84 | @Override
85 | public void onClick(View view) {
86 | ToggleButton tButton = (ToggleButton) view;
87 | if (mSelectedToggleBtn != null && mSelectedToggleBtn != tButton) {
88 | mSelectedToggleBtn.setChecked(false);
89 | }
90 | mSelectedToggleBtn = tButton;
91 | mSelectPosition = (Integer) mSelectedToggleBtn.getTag();
92 | expandPopView();
93 | }
94 | });
95 | addView(tButton);
96 |
97 | RelativeLayout popContainerView = new RelativeLayout(mContext);
98 |
99 | if(mPopViewBackgroundColor != -1){
100 | popContainerView.setBackgroundColor(mPopViewBackgroundColor);
101 | }else{
102 | popContainerView.setBackgroundColor(Color.parseColor("#b0000000"));
103 | }
104 | RelativeLayout.LayoutParams rl = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, (int) (mDisplayHeight * 0.7));
105 | popContainerView.addView(tabItemView, rl);
106 | popContainerView.setOnClickListener(new OnClickListener() {
107 | @Override
108 | public void onClick(View v) {
109 | onExpandPopView();
110 | }
111 | });
112 |
113 | mViewLists.add(popContainerView);
114 | }
115 |
116 | public void setToggleButtonText(String tabTitle){
117 | ToggleButton toggleButton = (ToggleButton) getChildAt(mSelectPosition);
118 | toggleButton.setText(tabTitle);
119 | }
120 |
121 | private void expandPopView() {
122 | if (mPopupWindow == null) {
123 | mPopupWindow = new PopupWindow(mViewLists.get(mSelectPosition), mDisplayWidth, mDisplayHeight);
124 | mPopupWindow.setAnimationStyle(R.style.PopupWindowAnimation);
125 | mPopupWindow.setFocusable(false);
126 | mPopupWindow.setOutsideTouchable(true);
127 | }
128 |
129 | if (mSelectedToggleBtn.isChecked()) {
130 | if (!mPopupWindow.isShowing()) {
131 | showPopView();
132 | } else {
133 | mPopupWindow.setOnDismissListener(this);
134 | mPopupWindow.dismiss();
135 | }
136 | } else {
137 | if (mPopupWindow.isShowing()) {
138 | mPopupWindow.dismiss();
139 | }
140 | }
141 | }
142 |
143 | /**
144 | * 如果菜单成展开状态,则让菜单收回去
145 | * 注:Activty 销毁时 如果对话框没有关闭刚关闭
146 | */
147 | public boolean onExpandPopView() {
148 | if (mPopupWindow != null && mPopupWindow.isShowing()) {
149 | mPopupWindow.dismiss();
150 | if (mSelectedToggleBtn != null) {
151 | mSelectedToggleBtn.setChecked(false);
152 | }
153 | return true;
154 | } else {
155 | return false;
156 | }
157 | }
158 |
159 | public void showPopView(){
160 | if (mPopupWindow.getContentView() != mViewLists.get(mSelectPosition)) {
161 | mPopupWindow.setContentView(mViewLists.get(mSelectPosition));
162 | }
163 | mPopupWindow.showAsDropDown(this, 0, 0);
164 | }
165 |
166 | @Override
167 | public void onDismiss() {
168 | showPopView();
169 | mPopupWindow.setOnDismissListener(null);
170 | }
171 |
172 | }
173 |
--------------------------------------------------------------------------------
/android-expandpoptab-library/src/main/java/com/warmtel/expandtab/KeyValueBean.java:
--------------------------------------------------------------------------------
1 | package com.warmtel.expandtab;
2 |
3 | public class KeyValueBean {
4 | private String key;
5 | private String value;
6 |
7 | public String getKey() {
8 | return key;
9 | }
10 | public void setKey(String key) {
11 | this.key = key;
12 | }
13 |
14 | public String getValue() {
15 | return value;
16 | }
17 |
18 | public void setValue(String value) {
19 | this.value = value;
20 | }
21 |
22 | public KeyValueBean(String key, String value) {
23 | super();
24 | this.key = key;
25 | this.value = value;
26 | }
27 |
28 | public KeyValueBean() {
29 | super();
30 | }
31 |
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/android-expandpoptab-library/src/main/java/com/warmtel/expandtab/PopOneListView.java:
--------------------------------------------------------------------------------
1 | package com.warmtel.expandtab;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.view.LayoutInflater;
6 | import android.widget.ListView;
7 | import android.widget.RelativeLayout;
8 |
9 | import java.util.List;
10 |
11 | public class PopOneListView extends RelativeLayout {
12 | private ListView mListView;
13 | private PopViewAdapter mAdapter;
14 | private OnSelectListener mOnSelectListener;
15 | private ExpandPopTabView mExpandPopTabView;
16 | private String mDefaultParentText = null;
17 | private String mDefaultParentkey = null;
18 | public interface OnSelectListener {
19 | void getValue(String key, String value);
20 | }
21 |
22 | public void setOnSelectListener(ExpandPopTabView expandPopTabView,OnSelectListener onSelectListener) {
23 | mOnSelectListener = onSelectListener;
24 | mExpandPopTabView = expandPopTabView;
25 | }
26 |
27 | public PopOneListView(Context context) {
28 | super(context);
29 | init(context);
30 | }
31 |
32 | public PopOneListView(Context context, AttributeSet attrs, int defStyle) {
33 | super(context, attrs, defStyle);
34 | init(context);
35 | }
36 |
37 | public PopOneListView(Context context, AttributeSet attrs) {
38 | super(context, attrs);
39 | init(context);
40 | }
41 |
42 | public void init(Context context) {
43 | LayoutInflater.from(context).inflate(R.layout.expand_tab_popview1_layout, this, true);
44 | setBackgroundResource(R.drawable.expand_tab_popview1_bg);
45 | mListView = (ListView) findViewById(R.id.expand_tab_popview1_listView);
46 | mAdapter = new PopViewAdapter(context);
47 | mAdapter.setTextSize(16);
48 | mAdapter.setSelectorResId(R.drawable.expand_tab_popview1_select, R.drawable.expand_tab_popview2_chilred_item_selector);
49 | mListView.setAdapter(mAdapter);
50 | /**
51 | * mListView.setOnItemClickListener() 无响应,重新定义列表选项单击接口
52 | */
53 | mAdapter.setOnItemClickListener(new PopViewAdapter.OnItemClickListener() {
54 | @Override
55 | public void onItemClick(PopViewAdapter adapter, int position) {
56 | if (mOnSelectListener != null) {
57 | KeyValueBean KeyValueBean = (KeyValueBean) adapter.getItem(position);
58 | String showValue = KeyValueBean.getValue();
59 | onSelectItemExandPopView(showValue);
60 | mOnSelectListener.getValue(KeyValueBean.getKey(), showValue);
61 | }
62 | }
63 | });
64 | }
65 |
66 | /**
67 | * 关闭弹窗,显示选中项
68 | * @param showValue
69 | */
70 | public void onSelectItemExandPopView(String showValue){
71 | mExpandPopTabView.onExpandPopView();
72 | mExpandPopTabView.setToggleButtonText(showValue);
73 | }
74 |
75 | /**
76 | * 设置默认选中项通过内容
77 | * 注:在 setCallBackAndData()方法前执行有效
78 | * @param text1
79 | */
80 | public void setDefaultSelectByValue(String text1){
81 | mDefaultParentText = text1;
82 | }
83 |
84 | /**
85 | * 设置默认选中项通过关键字Key
86 | * 注:在 setCallBackAndData()方法前执行有效
87 | * @param key1
88 | */
89 | public void setDefaultSelectByKey(String key1){
90 | mDefaultParentkey = key1;
91 | }
92 | public void setAdapterData(List itemValues) {
93 | mAdapter.setList(itemValues);
94 | }
95 |
96 | public void setCallBackAndData(List itemValues, ExpandPopTabView expandPopTabView, OnSelectListener selectListener) {
97 | if(mDefaultParentText != null && !mDefaultParentText.equals("")){
98 | mAdapter.setSelectorText(mDefaultParentText);
99 | }else{
100 | if(mDefaultParentkey != null && !mDefaultParentkey.equals("")) {
101 | for (KeyValueBean keyValueBean : itemValues) {
102 | if (keyValueBean.getKey().equals(mDefaultParentkey)) {
103 | mAdapter.setSelectorText(keyValueBean.getValue());
104 | break;
105 | }
106 | }
107 | }
108 | }
109 | mAdapter.setList(itemValues);
110 | mOnSelectListener = selectListener;
111 | mExpandPopTabView = expandPopTabView;
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/android-expandpoptab-library/src/main/java/com/warmtel/expandtab/PopTwoListView.java:
--------------------------------------------------------------------------------
1 | package com.warmtel.expandtab;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.view.LayoutInflater;
6 | import android.widget.LinearLayout;
7 | import android.widget.ListView;
8 |
9 | import java.util.ArrayList;
10 | import java.util.List;
11 |
12 | public class PopTwoListView extends LinearLayout {
13 | private ListView parentListView;
14 | private ListView childListView;
15 | private List groups = new ArrayList();
16 | private List childrenItem = new ArrayList();
17 | private List> children = new ArrayList>();
18 |
19 | private PopViewAdapter childListViewAdapter;
20 | private PopViewAdapter parentListViewAdapter;
21 | private int mParentPosition = 0;
22 | private String mSelectParentKey = "";
23 |
24 | private String mDefaultParentText = null;
25 | private String mDefaultChildredText = null;
26 | private String mDefaultParentkey = null;
27 | private String mDefaultChildredkey = null;
28 |
29 | private ExpandPopTabView mExpandPopTabView;
30 | private OnSelectListener mOnSelectListener;
31 |
32 | public interface OnSelectListener {
33 | void getValue(String showText, String parentKey, String childrenKey);
34 | }
35 |
36 | public PopTwoListView(Context context) {
37 | super(context);
38 | init(context);
39 | }
40 |
41 | public PopTwoListView(Context context, AttributeSet attrs) {
42 | super(context, attrs);
43 | init(context);
44 | }
45 |
46 | private void init(Context context) {
47 | LayoutInflater.from(context).inflate(R.layout.expand_tab_popview2_layout, this, true);
48 | parentListView = (ListView) findViewById(R.id.parent_listView);
49 | childListView = (ListView) findViewById(R.id.child_listView);
50 |
51 | parentListViewAdapter = new PopViewAdapter(context);
52 | parentListViewAdapter.setTextSize(16);
53 | parentListViewAdapter.setSelectorResId(R.drawable.expand_tab_parent_item_selected, R.drawable.expand_tab_popview_item_selector);
54 | parentListView.setAdapter(parentListViewAdapter);
55 | parentListViewAdapter.setOnItemClickListener(new PopViewAdapter.OnItemClickListener() {
56 |
57 | @Override
58 | public void onItemClick(PopViewAdapter adapter, int position) {
59 | if (position < children.size()) {
60 | mParentPosition = position;
61 | KeyValueBean keyValueBean = (KeyValueBean) adapter.getItem(position);
62 | mSelectParentKey = keyValueBean.getKey();
63 | childrenItem.clear();
64 | childrenItem.addAll(children.get(position));
65 | childListViewAdapter.setList(childrenItem);
66 | }
67 | }
68 | });
69 |
70 | childListViewAdapter = new PopViewAdapter(context);
71 | childListViewAdapter.setTextSize(14);
72 | childListViewAdapter.setSelectorResId(R.drawable.expand_tab_popview1_select, R.drawable.expand_tab_popview2_chilred_item_selector);
73 | childListView.setAdapter(childListViewAdapter);
74 | childListViewAdapter
75 | .setOnItemClickListener(new PopViewAdapter.OnItemClickListener() {
76 |
77 | @Override
78 | public void onItemClick(PopViewAdapter adapter, int position) {
79 | KeyValueBean keyValueBean = (KeyValueBean) adapter.getItem(position);
80 | if (mOnSelectListener != null) {
81 | mExpandPopTabView.onExpandPopView();
82 | mExpandPopTabView.setToggleButtonText(keyValueBean.getValue());
83 | mOnSelectListener.getValue(keyValueBean.getValue(), mSelectParentKey, keyValueBean.getKey());
84 | }
85 |
86 | }
87 | });
88 | }
89 |
90 | private void setDefaultSelect(){
91 | if(children.size() <= 0){
92 | return;
93 | }
94 | parentListViewAdapter.setSelectorText(mDefaultParentText);
95 | int position = 0;
96 | for(KeyValueBean keyValueBean : groups){
97 | if(keyValueBean.getValue().equals(mDefaultParentText)){
98 | break;
99 | }
100 | ++position;
101 | }
102 | childrenItem.clear();
103 | childrenItem.addAll(children.get(position));
104 | childListViewAdapter.setSelectorText(mDefaultChildredText);
105 | childListViewAdapter.setList(childrenItem);
106 | }
107 |
108 | private void setDefaultSelectBykey(){
109 | if(children.size() <= 0){
110 | return;
111 | }
112 |
113 | int position = 0;
114 | for(KeyValueBean keyValueBean : groups){
115 | if(keyValueBean.getKey().equals(mDefaultParentkey)){
116 | parentListViewAdapter.setSelectorText(keyValueBean.getValue());
117 | break;
118 | }
119 | ++position;
120 | }
121 | childrenItem.clear();
122 | childrenItem.addAll(children.get(position));
123 |
124 | for(KeyValueBean keyValueBean : childrenItem){
125 | if(keyValueBean.getKey().equals(mDefaultChildredkey)){
126 | childListViewAdapter.setSelectorText(keyValueBean.getValue());
127 | break;
128 | }
129 | }
130 | childListViewAdapter.setList(childrenItem);
131 | }
132 |
133 | /**
134 | * 设置默认选中项通过内容
135 | * @param text1
136 | * @param text2
137 | */
138 | public void setDefaultSelectByValue(String text1,String text2){
139 | mDefaultParentText = text1;
140 | mDefaultChildredText = text2;
141 | }
142 |
143 | /**
144 | * 设置默认选中项通过关键字Key
145 | * @param key1
146 | * @param key2
147 | */
148 | public void setDefaultSelectByKey(String key1,String key2){
149 | mDefaultParentkey = key1;
150 | mDefaultChildredkey = key2;
151 | }
152 | public void setOnSelectListener(OnSelectListener onSelectListener) {
153 | mOnSelectListener = onSelectListener;
154 | }
155 |
156 | public void setAdapterData(List _groups, List> _children) {
157 | groups = _groups;
158 | children = _children;
159 | parentListViewAdapter.setList(_groups);
160 | childrenItem.addAll(children.get(mParentPosition));
161 | childListViewAdapter.setList(childrenItem);
162 | if(mDefaultParentText == null && mDefaultParentkey == null){
163 | if(children.size() < 0 )
164 | return;
165 | parentListViewAdapter.setSelectorText(groups.get(0).getValue());
166 | childrenItem.addAll(children.get(0));
167 | }else {
168 | if (mDefaultParentText != null) {
169 | setDefaultSelect();
170 | } else {
171 | setDefaultSelectBykey();
172 | }
173 | }
174 | }
175 |
176 | public void setCallBackAndData(ExpandPopTabView expandPopTabView, List _groups, List> _children, OnSelectListener onSelectListener) {
177 | groups = _groups;
178 | children = _children;
179 | parentListViewAdapter.setList(_groups);
180 | childrenItem.addAll(children.get(mParentPosition));
181 | childListViewAdapter.setList(childrenItem);
182 | mExpandPopTabView = expandPopTabView;
183 | mOnSelectListener = onSelectListener;
184 |
185 | if(mDefaultParentText == null && mDefaultParentkey == null){
186 | if(children.size() < 0 )
187 | return;
188 | parentListViewAdapter.setSelectorText(groups.get(0).getValue());
189 | // childrenItem.addAll(children.get(0));
190 | }else {
191 | if (mDefaultParentText != null) {
192 | setDefaultSelect();
193 | } else {
194 | setDefaultSelectBykey();
195 | }
196 | }
197 | }
198 |
199 | }
200 |
--------------------------------------------------------------------------------
/android-expandpoptab-library/src/main/java/com/warmtel/expandtab/PopViewAdapter.java:
--------------------------------------------------------------------------------
1 | package com.warmtel.expandtab;
2 |
3 |
4 | import android.content.Context;
5 | import android.util.TypedValue;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.BaseAdapter;
10 | import android.widget.TextView;
11 |
12 | import java.util.ArrayList;
13 | import java.util.List;
14 |
15 | public class PopViewAdapter extends BaseAdapter {
16 | private List list = new ArrayList<>();
17 | private LayoutInflater layoutInflater;
18 | private Context context;
19 | private String selectorText;
20 | private float textSize = -1;
21 | private int selectorResId;
22 | private int normalResId;
23 | private OnItemClickListener mOnItemClickListener;
24 |
25 | public interface OnItemClickListener {
26 | void onItemClick(PopViewAdapter adapter, int position);
27 | }
28 |
29 | public void setOnItemClickListener(OnItemClickListener l) {
30 | mOnItemClickListener = l;
31 | }
32 |
33 | public PopViewAdapter(Context context) {
34 | layoutInflater = LayoutInflater.from(context);
35 | this.context = context;
36 | }
37 |
38 | public void setList(List list) {
39 | this.list = list;
40 | notifyDataSetChanged();
41 | }
42 |
43 | public void setTextSize(float tSize) {
44 | textSize = tSize;
45 | }
46 |
47 | public void setSelectorText(String text) {
48 | selectorText = text;
49 | }
50 |
51 | public void setSelectorResId(int resId, int nresId) {
52 | selectorResId = resId;
53 | normalResId = nresId;
54 | }
55 |
56 | public void setSelectedPositionNotify(int position) {
57 | if (list != null && list.size() > 0) {
58 | selectorText = list.get(position).getValue();
59 | notifyDataSetChanged();
60 | }
61 | }
62 |
63 | @Override
64 | public int getCount() {
65 | return list.size();
66 | }
67 |
68 | @Override
69 | public Object getItem(int position) {
70 | return list.get(position);
71 | }
72 |
73 | @Override
74 | public long getItemId(int position) {
75 | return position;
76 | }
77 |
78 | @Override
79 | public View getView(int position, View convertView, ViewGroup parent) {
80 | TextView view;
81 | if (convertView == null) {
82 | view = (TextView) layoutInflater.inflate(R.layout.expand_tab_popview_item1_layout, null);
83 | } else {
84 | view = (TextView) convertView;
85 | }
86 |
87 | KeyValueBean keyValueBean = (KeyValueBean) getItem(position);
88 | if (keyValueBean.getValue().equals(selectorText)) {
89 | view.setBackgroundResource(selectorResId);
90 | } else {
91 | view.setBackgroundResource(normalResId);
92 | }
93 | int pading = context.getResources().getDimensionPixelSize(R.dimen.expand_tab_popview_padingtop);
94 |
95 | view.setText(keyValueBean.getValue());
96 | view.setTag(position);
97 | if(textSize != -1) {
98 | view.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSize);
99 | }
100 | view.setPadding(pading, pading, 0, pading);
101 |
102 | view.setOnClickListener(new View.OnClickListener() {
103 |
104 | @Override
105 | public void onClick(View view) {
106 | if (mOnItemClickListener != null) {
107 | TextView txtView = (TextView) view;
108 | int position = (int) txtView.getTag();
109 | setSelectorText(txtView.getText().toString());
110 | setSelectedPositionNotify(position);
111 | mOnItemClickListener.onItemClick(PopViewAdapter.this, position);
112 | }
113 | }
114 | });
115 |
116 | return view;
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/android-expandpoptab-library/src/main/res/anim/pophidden_anim.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/android-expandpoptab-library/src/main/res/anim/popshow_anim.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/android-expandpoptab-library/src/main/res/color/expand_tab_item_textcolor_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/android-expandpoptab-library/src/main/res/drawable-hdpi/expand_tab_item_check.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yihu0817/ExpandPopTabView/0e6b4050024cbf46c94b84d4ec6ff582e98e12d9/android-expandpoptab-library/src/main/res/drawable-hdpi/expand_tab_item_check.9.png
--------------------------------------------------------------------------------
/android-expandpoptab-library/src/main/res/drawable-hdpi/expand_tab_item_norm.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yihu0817/ExpandPopTabView/0e6b4050024cbf46c94b84d4ec6ff582e98e12d9/android-expandpoptab-library/src/main/res/drawable-hdpi/expand_tab_item_norm.9.png
--------------------------------------------------------------------------------
/android-expandpoptab-library/src/main/res/drawable-hdpi/expand_tab_item_press.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yihu0817/ExpandPopTabView/0e6b4050024cbf46c94b84d4ec6ff582e98e12d9/android-expandpoptab-library/src/main/res/drawable-hdpi/expand_tab_item_press.9.png
--------------------------------------------------------------------------------
/android-expandpoptab-library/src/main/res/drawable-hdpi/expand_tab_parent_item_selected.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yihu0817/ExpandPopTabView/0e6b4050024cbf46c94b84d4ec6ff582e98e12d9/android-expandpoptab-library/src/main/res/drawable-hdpi/expand_tab_parent_item_selected.jpg
--------------------------------------------------------------------------------
/android-expandpoptab-library/src/main/res/drawable-hdpi/expand_tab_popview1_bg.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yihu0817/ExpandPopTabView/0e6b4050024cbf46c94b84d4ec6ff582e98e12d9/android-expandpoptab-library/src/main/res/drawable-hdpi/expand_tab_popview1_bg.9.png
--------------------------------------------------------------------------------
/android-expandpoptab-library/src/main/res/drawable-hdpi/expand_tab_popview1_select.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yihu0817/ExpandPopTabView/0e6b4050024cbf46c94b84d4ec6ff582e98e12d9/android-expandpoptab-library/src/main/res/drawable-hdpi/expand_tab_popview1_select.9.png
--------------------------------------------------------------------------------
/android-expandpoptab-library/src/main/res/drawable-hdpi/expand_tab_popview2_bg.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yihu0817/ExpandPopTabView/0e6b4050024cbf46c94b84d4ec6ff582e98e12d9/android-expandpoptab-library/src/main/res/drawable-hdpi/expand_tab_popview2_bg.9.png
--------------------------------------------------------------------------------
/android-expandpoptab-library/src/main/res/drawable/expand_tab_item_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/android-expandpoptab-library/src/main/res/drawable/expand_tab_popview2_chilred_item_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/android-expandpoptab-library/src/main/res/drawable/expand_tab_popview_item_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/android-expandpoptab-library/src/main/res/drawable/pop_listview_parent_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/android-expandpoptab-library/src/main/res/layout/expand_tab_popview1_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
14 |
--------------------------------------------------------------------------------
/android-expandpoptab-library/src/main/res/layout/expand_tab_popview2_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
22 |
23 |
24 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/android-expandpoptab-library/src/main/res/layout/expand_tab_popview_item1_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
--------------------------------------------------------------------------------
/android-expandpoptab-library/src/main/res/layout/expand_tab_toggle_button.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
--------------------------------------------------------------------------------
/android-expandpoptab-library/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/android-expandpoptab-library/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | #000000
5 | #f4f4f4
6 | #ffffff
7 | #00000000
8 | #ff5a00
9 |
10 |
--------------------------------------------------------------------------------
/android-expandpoptab-library/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 14sp
5 | 45dp
6 | 16dp
7 | 16dp
8 | 45dp
9 | 380dp
10 | 10dp
11 | 16dp
12 |
13 |
--------------------------------------------------------------------------------
/android-expandpoptab-library/src/main/res/values/drawables.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | - @android:color/white
4 |
5 |
--------------------------------------------------------------------------------
/android-expandpoptab-library/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Android-ExpandPopTab-Library
3 |
4 |
--------------------------------------------------------------------------------
/android-expandpoptab-library/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
--------------------------------------------------------------------------------
/android-expandpoptab-library/src/test/java/com/warmtel/expandtab/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.warmtel.expandtab;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.1"
6 |
7 | defaultConfig {
8 | applicationId "com.warmtel.expandpop"
9 | minSdkVersion 15
10 | targetSdkVersion 23
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(include: ['*.jar'], dir: 'libs')
24 | testCompile 'junit:junit:4.12'
25 | compile files('libs/fastjson-1.2.2.jar')
26 | compile 'com.android.support:appcompat-v7:23.1.1'
27 | compile 'com.android.support:support-v4:23.1.1'
28 | compile project(':android-expandpoptab-library')
29 | }
30 |
--------------------------------------------------------------------------------
/app/libs/fastjson-1.2.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yihu0817/ExpandPopTabView/0e6b4050024cbf46c94b84d4ec6ff582e98e12d9/app/libs/fastjson-1.2.2.jar
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\android-sdk-windows/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/warmtel/expandpop/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.warmtel.expandpop;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/assets/searchType:
--------------------------------------------------------------------------------
1 | {"info":{"cantonAndCircle":[{"businessCircle":[{"key":"","value":"全部区域"}],"key":"","value":"全部区域"},{"businessCircle":[{"key":"","value":"武侯全区"},{"key":"39","value":"磨子桥"},{"key":"40","value":"红牌楼"},{"key":"37","value":"内双楠"},{"key":"202","value":"外双楠"},{"key":"34","value":"玉林"},{"key":"33","value":"科华北路"},{"key":"203","value":"科华南路"},{"key":"35","value":"桐梓林"},{"key":"36","value":"武侯祠"},{"key":"38","value":"高升桥"},{"key":"204","value":"桂溪"},{"key":"205","value":"紫荆"},{"key":"206","value":"玉林广场"},{"key":"207","value":"红瓦寺"},{"key":"208","value":"林荫街"},{"key":"209","value":"新南门"},{"key":"210","value":"鹭岛社区"},{"key":"211","value":"置信广场"},{"key":"278","value":"五大花园"},{"key":"287","value":"亚太广场"},{"key":"288","value":"西部车城"},{"key":"522","value":"其他"}],"key":"11","value":"武侯区"},{"businessCircle":[{"key":"","value":"锦江全区"},{"key":"43","value":"合江亭"},{"key":"42","value":"盐市口"},{"key":"48","value":"大慈寺111"},{"key":"49","value":"双桥子"},{"key":"50","value":"九眼桥"},{"key":"41","value":"春熙路"},{"key":"45","value":"书院街"},{"key":"46","value":"牛市口"},{"key":"44","value":"万达广场"},{"key":"47","value":"四川师大"},{"key":"198","value":"红星路"},{"key":"199","value":"总府路"},{"key":"200","value":"海椒市"},{"key":"289","value":"东光小区"},{"key":"523","value":"其他"}],"key":"12","value":"锦江区"},{"businessCircle":[{"key":"","value":"金牛全区"},{"key":"56","value":"沙湾"},{"key":"57","value":"九里堤"},{"key":"58","value":"高笋塘"},{"key":"59","value":"蜀汉路"},{"key":"51","value":"茶店子"},{"key":"52","value":"西南交大"},{"key":"53","value":"火车站"},{"key":"54","value":"梁家巷"},{"key":"55","value":"抚琴"},{"key":"245","value":"北大街"},{"key":"246","value":"解放路"},{"key":"247","value":"一品天下"},{"key":"248","value":"人民北路"},{"key":"249","value":"城隍庙"},{"key":"250","value":"星辉西路"},{"key":"251","value":"星辉中路"},{"key":"252","value":"西大街"},{"key":"253","value":"曹家巷"},{"key":"254","value":"马家花园"},{"key":"255","value":"张家巷"},{"key":"256","value":"花牌坊"},{"key":"257","value":"马鞍南路"},{"key":"228","value":"西门车站"},{"key":"258","value":"马鞍北路"},{"key":"259","value":"五丁桥"},{"key":"260","value":"西安北路"},{"key":"261","value":"西安南路"},{"key":"262","value":"实业街"},{"key":"263","value":"李家沱"},{"key":"264","value":"西体路"},{"key":"266","value":"红花村"},{"key":"885","value":"营门口"},{"key":"524","value":"其他"}],"key":"13","value":"金牛区"},{"businessCircle":[{"key":"","value":"青羊全区"},{"key":"66","value":"宽窄巷子"},{"key":"67","value":"金沙"},{"key":"68","value":"光华"},{"key":"69","value":"太升路"},{"key":"62","value":"杜甫草堂"},{"key":"60","value":"青羊宫"},{"key":"217","value":"浣花溪"},{"key":"218","value":"百花中心"},{"key":"64","value":"府南新区"},{"key":"63","value":"人民公园"},{"key":"61","value":"骡马市"},{"key":"65","value":"草市街"},{"key":"219","value":"铂金城"},{"key":"220","value":"新城市"},{"key":"221","value":"八宝街"},{"key":"222","value":"北门大桥"},{"key":"223","value":"时代印象"},{"key":"224","value":"中医大"},{"key":"225","value":"顺城大街"},{"key":"226","value":"鼓楼北街"},{"key":"227","value":"大石西路"},{"key":"229","value":"玉沙路"},{"key":"230","value":"新开寺街"},{"key":"231","value":"人民中路"},{"key":"232","value":"太升北路"},{"key":"233","value":"大安西路"},{"key":"234","value":"大安中路"},{"key":"235","value":"天盛壹"},{"key":"236","value":"优品道"},{"key":"237","value":"东城根"},{"key":"267","value":"中医附院"},{"key":"238","value":"西安路"},{"key":"290","value":"彩虹桥"},{"key":"291","value":"长顺街"},{"key":"292","value":"锦里路"},{"key":"293","value":"青羊小区"},{"key":"562","value":"文殊院"},{"key":"525","value":"其他"}],"key":"14","value":"青羊区"},{"businessCircle":[{"key":"","value":"成华全区"},{"key":"72","value":"万年场"},{"key":"71","value":"双林路"},{"key":"70","value":"建设路"},{"key":"268","value":"猛追湾"},{"key":"269","value":"音乐公园"},{"key":"270","value":"八里小区"},{"key":"279","value":"五桂桥"},{"key":"294","value":"玉双路"},{"key":"560","value":"驷马桥"},{"key":"561","value":"动物园"},{"key":"526","value":"其他"},{"key":"265","value":"府青路"}],"key":"15","value":"成华区"},{"businessCircle":[{"key":"","value":"高新全区"},{"key":"273","value":"天府长城"},{"key":"274","value":"新会展"},{"key":"527","value":"其他"}],"key":"108","value":"高新区"},{"businessCircle":[{"key":"","value":"龙泉驿区"}],"key":"161","value":"龙泉驿区"},{"businessCircle":[{"key":"","value":"温江全部"}],"key":"164","value":"温江区"},{"businessCircle":[{"key":"","value":"都江堰全部"}],"key":"165","value":"都江堰"},{"businessCircle":[{"key":"","value":"双流全县"},{"key":"295","value":"戛纳湾"},{"key":"296","value":"第V大道"},{"key":"297","value":"缤纷广场"},{"key":"554","value":"天府大道"},{"key":"555","value":"华新街"},{"key":"556","value":"航空港"},{"key":"528","value":"其他"}],"key":"170","value":"双流县"},{"businessCircle":[{"key":"","value":"郫县全县"}],"key":"171","value":"郫县"},{"businessCircle":[{"key":"","value":"大邑全县"},{"key":"563","value":"花水湾"},{"key":"564","value":"其他"}],"key":"172","value":"大邑县"},{"businessCircle":[{"key":"","value":"新津县"},{"key":"890","value":"永商镇"},{"key":"891","value":"其他"}],"key":"174","value":"新津县"},{"businessCircle":[{"key":"","value":"其他全部"},{"key":"895","value":"甘孜州"},{"key":"896","value":"其他"}],"key":"893","value":"其他地区"}],"decorType":[{"key":"","value":"不限"},{"key":"ROUGHCAST","value":"毛坯"},{"key":"SIMPLE","value":"简单装修"},{"key":"DECOR_MEDI","value":"中等装修"},{"key":"HARDCOVER","value":"精装"},{"key":"LUXURIOUS","value":"豪华装修"}],"managerType":[{"key":"","value":"不限"},{"key":"HOUSE","value":"住宅"},{"key":"AFFORDABLE","value":"经济适用房"},{"key":"VILLA_MANAGER","value":"别墅"},{"key":"OFFICE","value":"写字楼"},{"key":"SHOP","value":"商铺"},{"key":"TWO_LIMIT","value":"两限房"}],"openDateType":[{"key":"","value":"不限"},{"key":"OPEN_THIS_MONTH","value":"本月开盘"},{"key":"OPEN_NEXT_MONTH","value":"下月开盘"},{"key":"OPEN_TREE_MONTH","value":"三个月内开盘"},{"key":"OPEN_SIX_MONTH","value":"六个月内开盘"}],"priceType":[{"key":"","value":"不限"},{"key":"LE4K","value":"4000元/㎡以内"},{"key":"IN4K_6K","value":"4000-6000元/㎡"},{"key":"IN6K_8K","value":"6000-8000元/㎡"},{"key":"IN8K_1W","value":"8000-10000元/㎡"},{"key":"GE1W","value":"10000元/㎡以上"}],"sortType":[{"key":"ES_SORT_DEFAULT","value":"默认"},{"key":"ES_MOST_DISCOUNT","value":"优惠最多"},{"key":"ES_NEW_OPEN","value":"最新开盘"},{"key":"ES_NEW_END","value":"最近入住"},{"key":"ES_H_L","value":"价格由高到低"},{"key":"ES_L_H","value":"价格由低到高"}]},"resultCode":"0","resultInfo":"SUCCESS"}
--------------------------------------------------------------------------------
/app/src/main/java/com/warmtel/expandpop/ExpandPopTabActivity.java:
--------------------------------------------------------------------------------
1 | package com.warmtel.expandpop;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.util.Log;
6 |
7 | import com.alibaba.fastjson.JSONObject;
8 | import com.warmtel.expandpop.dto.ConfigAreaDTO;
9 | import com.warmtel.expandpop.dto.ConfigsDTO;
10 | import com.warmtel.expandpop.dto.ConfigsMessageDTO;
11 | import com.warmtel.expandtab.ExpandPopTabView;
12 | import com.warmtel.expandtab.KeyValueBean;
13 | import com.warmtel.expandtab.PopOneListView;
14 | import com.warmtel.expandtab.PopTwoListView;
15 |
16 | import java.io.ByteArrayOutputStream;
17 | import java.io.IOException;
18 | import java.io.InputStream;
19 | import java.util.ArrayList;
20 | import java.util.List;
21 |
22 | public class ExpandPopTabActivity extends AppCompatActivity {
23 | private ExpandPopTabView expandTabView;
24 | private List mParentLists = new ArrayList<>();
25 | private List> mChildrenListLists = new ArrayList<>();
26 | private List mPriceLists;
27 | private List mSortLists;
28 | private List mFavorLists;
29 |
30 | @Override
31 | protected void onCreate(Bundle savedInstanceState) {
32 | super.onCreate(savedInstanceState);
33 | setContentView(R.layout.activity_expand_pop_tabs_layout);
34 |
35 | setConfigsDatas();
36 |
37 | expandTabView = (ExpandPopTabView) findViewById(R.id.expandtab_view);
38 | addItem(expandTabView, mPriceLists, "", "价格");
39 | addItem(expandTabView, mFavorLists, "默认", "排序");
40 | addItem(expandTabView, mSortLists, "优惠最多", "优惠");
41 | addItem(expandTabView, mParentLists, mChildrenListLists, "锦江区", "合江亭", "区域");
42 | // addItem(expandTabView, mParentLists, mChildrenListLists, null, null, "区域");
43 | }
44 |
45 | public void addItem(ExpandPopTabView expandTabView, List lists, String defaultSelect, String defaultShowText) {
46 | PopOneListView popOneListView = new PopOneListView(this);
47 | popOneListView.setDefaultSelectByValue(defaultSelect);
48 | //popViewOne.setDefaultSelectByKey(defaultSelect);
49 | popOneListView.setCallBackAndData(lists, expandTabView, new PopOneListView.OnSelectListener() {
50 | @Override
51 | public void getValue(String key, String value) {
52 | Log.e("tag", "key :" + key + " ,value :" + value);
53 | }
54 | });
55 | expandTabView.addItemToExpandTab(defaultShowText, popOneListView);
56 | }
57 |
58 | public void addItem(ExpandPopTabView expandTabView, List parentLists,
59 | List> childrenListLists, String defaultParentSelect, String defaultChildSelect, String defaultShowText) {
60 | PopTwoListView popTwoListView = new PopTwoListView(this);
61 | popTwoListView.setDefaultSelectByValue(defaultParentSelect, defaultChildSelect);
62 | //distanceView.setDefaultSelectByKey(defaultParent, defaultChild);
63 | popTwoListView.setCallBackAndData(expandTabView, parentLists, childrenListLists, new PopTwoListView.OnSelectListener() {
64 | @Override
65 | public void getValue(String showText, String parentKey, String childrenKey) {
66 | Log.e("tag", "showText :" + showText + " ,parentKey :" + parentKey + " ,childrenKey :" + childrenKey);
67 | }
68 | });
69 | expandTabView.addItemToExpandTab(defaultShowText, popTwoListView);
70 | }
71 |
72 | @Override
73 | protected void onDestroy() {
74 | super.onDestroy();
75 | if(expandTabView != null){
76 | expandTabView.onExpandPopView();
77 | }
78 | }
79 |
80 | private void setConfigsDatas() {
81 | try {
82 | InputStream is = getAssets().open("searchType");
83 | String searchTypeJson = readStream(is);
84 | ConfigsMessageDTO messageDTO = JSONObject.parseObject(searchTypeJson, ConfigsMessageDTO.class);
85 | ConfigsDTO configsDTO = messageDTO.getInfo();
86 |
87 | mPriceLists = configsDTO.getPriceType();
88 | mSortLists = configsDTO.getSortType();
89 | mFavorLists = configsDTO.getSortType();
90 |
91 | List configAreaListDTO = configsDTO.getCantonAndCircle();
92 | for (ConfigAreaDTO configAreaDTO : configAreaListDTO) {
93 | KeyValueBean keyValueBean = new KeyValueBean();
94 | keyValueBean.setKey(configAreaDTO.getKey());
95 | keyValueBean.setValue(configAreaDTO.getValue());
96 | mParentLists.add(keyValueBean);
97 |
98 | ArrayList childrenLists = new ArrayList<>();
99 | for (KeyValueBean keyValueBean1 : configAreaDTO.getBusinessCircle()) {
100 | childrenLists.add(keyValueBean1);
101 | }
102 | mChildrenListLists.add(childrenLists);
103 | }
104 |
105 | } catch (IOException e) {
106 | e.printStackTrace();
107 | }
108 | }
109 |
110 | public String readStream(InputStream is) {
111 | try {
112 | ByteArrayOutputStream bo = new ByteArrayOutputStream();
113 | int i = is.read();
114 | while (i != -1) {
115 | bo.write(i);
116 | i = is.read();
117 | }
118 | return bo.toString();
119 | } catch (IOException e) {
120 | return "";
121 | }
122 | }
123 | }
124 |
--------------------------------------------------------------------------------
/app/src/main/java/com/warmtel/expandpop/dto/BaseDTO.java:
--------------------------------------------------------------------------------
1 | package com.warmtel.expandpop.dto;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * Created with IntelliJ IDEA. User: LanJian Date: 12-6-5 Time: 下午5:21 To change
7 | * this template use File | Settings | File Templates.
8 | */
9 | @SuppressWarnings("serial")
10 | public class BaseDTO implements Serializable {
11 | private String id;
12 | private String name;
13 |
14 | public String getId() {
15 | return id;
16 | }
17 |
18 | public void setId(String id) {
19 | this.id = id;
20 | }
21 |
22 | public String getName() {
23 | return name;
24 | }
25 |
26 | public void setName(String name) {
27 | this.name = name;
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/app/src/main/java/com/warmtel/expandpop/dto/ConfigAreaDTO.java:
--------------------------------------------------------------------------------
1 | package com.warmtel.expandpop.dto;
2 |
3 | import com.warmtel.expandtab.KeyValueBean;
4 |
5 | import java.util.List;
6 |
7 | @SuppressWarnings("serial")
8 | public class ConfigAreaDTO extends BaseDTO {
9 | private String key;
10 | private String value;
11 | private List businessCircle;
12 |
13 | public String getKey() {
14 | return key;
15 | }
16 |
17 | public void setKey(String key) {
18 | this.key = key;
19 | }
20 |
21 | public String getValue() {
22 | return value;
23 | }
24 |
25 | public void setValue(String value) {
26 | this.value = value;
27 | }
28 |
29 | public List getBusinessCircle() {
30 | return businessCircle;
31 | }
32 |
33 | public void setBusinessCircle(List businessCircle) {
34 | this.businessCircle = businessCircle;
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/app/src/main/java/com/warmtel/expandpop/dto/ConfigListDTO.java:
--------------------------------------------------------------------------------
1 | package com.warmtel.expandpop.dto;
2 |
3 | import com.warmtel.expandtab.KeyValueBean;
4 |
5 | import java.util.List;
6 |
7 | public class ConfigListDTO extends BaseDTO {
8 | private List info;
9 |
10 | public List getInfo() {
11 | return info;
12 | }
13 |
14 | public void setInfo(List info) {
15 | this.info = info;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/app/src/main/java/com/warmtel/expandpop/dto/ConfigsDTO.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2012 viktor.zhou
3 | */
4 | package com.warmtel.expandpop.dto;
5 |
6 | import com.warmtel.expandtab.KeyValueBean;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * @Description: TODO
12 | * @author: viktor.zhou(zhous028@gmail.com)
13 | * @date:2012-6-18
14 | * @version: v1.0.0
15 | */
16 | public class ConfigsDTO extends BaseDTO {
17 | List cantonAndCircle;
18 | List decorType;
19 | List managerType;
20 | List openDateType;
21 | List priceType;
22 | List sortType;
23 |
24 | public List getCantonAndCircle() {
25 | return cantonAndCircle;
26 | }
27 |
28 | public void setCantonAndCircle(List cantonAndCircle) {
29 | this.cantonAndCircle = cantonAndCircle;
30 | }
31 |
32 | public List getDecorType() {
33 | return decorType;
34 | }
35 |
36 | public void setDecorType(List decorType) {
37 | this.decorType = decorType;
38 | }
39 |
40 | public List getManagerType() {
41 | return managerType;
42 | }
43 |
44 | public void setManagerType(List managerType) {
45 | this.managerType = managerType;
46 | }
47 |
48 | public List getOpenDateType() {
49 | return openDateType;
50 | }
51 |
52 | public void setOpenDateType(List openDateType) {
53 | this.openDateType = openDateType;
54 | }
55 |
56 | public List getPriceType() {
57 | return priceType;
58 | }
59 |
60 | public void setPriceType(List priceType) {
61 | this.priceType = priceType;
62 | }
63 |
64 | public List getSortType() {
65 | return sortType;
66 | }
67 |
68 | public void setSortType(List sortType) {
69 | this.sortType = sortType;
70 | }
71 |
72 | }
73 |
--------------------------------------------------------------------------------
/app/src/main/java/com/warmtel/expandpop/dto/ConfigsMessageDTO.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2012 viktor.zhou
3 | */
4 | package com.warmtel.expandpop.dto;
5 |
6 | /**
7 | * @Description: TODO
8 | * @author: viktor.zhou(zhous028@gmail.com)
9 | * @date:2012-6-18
10 | * @version: v1.0.0
11 | */
12 | public class ConfigsMessageDTO {
13 | private String resultCode;
14 | private String resultInfo;
15 | private ConfigsDTO info;
16 | public String getResultCode() {
17 | return resultCode;
18 | }
19 | public void setResultCode(String resultCode) {
20 | this.resultCode = resultCode;
21 | }
22 | public String getResultInfo() {
23 | return resultInfo;
24 | }
25 | public void setResultInfo(String resultInfo) {
26 | this.resultInfo = resultInfo;
27 | }
28 | public ConfigsDTO getInfo() {
29 | return info;
30 | }
31 | public void setInfo(ConfigsDTO info) {
32 | this.info = info;
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_expand_pop_tabs_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yihu0817/ExpandPopTabView/0e6b4050024cbf46c94b84d4ec6ff582e98e12d9/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yihu0817/ExpandPopTabView/0e6b4050024cbf46c94b84d4ec6ff582e98e12d9/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yihu0817/ExpandPopTabView/0e6b4050024cbf46c94b84d4ec6ff582e98e12d9/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yihu0817/ExpandPopTabView/0e6b4050024cbf46c94b84d4ec6ff582e98e12d9/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yihu0817/ExpandPopTabView/0e6b4050024cbf46c94b84d4ec6ff582e98e12d9/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | ExpandPopTabView
3 |
4 | "暂无数据"
5 | 没有找到符合条件的房源
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/com/warmtel/expandpop/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.warmtel.expandpop;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:1.5.0'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yihu0817/ExpandPopTabView/0e6b4050024cbf46c94b84d4ec6ff582e98e12d9/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Oct 21 11:34:03 PDT 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':android-expandpoptab-library'
2 |
--------------------------------------------------------------------------------