├── .gitignore
├── .idea
├── .name
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── encodings.xml
├── gradle.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── DropDownViewLib
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── louisgeek
│ │ └── dropdownviewlib
│ │ └── ApplicationTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── louisgeek
│ │ │ └── dropdownviewlib
│ │ │ ├── ClassfiySeletPopupWindow.java
│ │ │ ├── ClassfiySeletView.java
│ │ │ ├── DateSelectPopupWindow.java
│ │ │ ├── DateSelectView.java
│ │ │ ├── DropDownPopupWindow.java
│ │ │ ├── DropDownView.java
│ │ │ ├── MultiSelectLayout.java
│ │ │ ├── MultiSelectLayout_HasChild.java
│ │ │ ├── MultiSelectView.java
│ │ │ ├── MultiSelectView_HasChild.java
│ │ │ ├── ProCateSelectView.java
│ │ │ ├── ProvinceCityAreaSelectView.java
│ │ │ ├── adapter
│ │ │ ├── DropDownViewRecycleViewAdapter.java
│ │ │ ├── MultiSelectViewContentBaseAdapter.java
│ │ │ ├── MultiSelectViewContentBaseExpandableListAdapter.java
│ │ │ ├── MultiSelectViewRecycleViewAdapter.java
│ │ │ ├── MyRecylerViewLeftAdapter.java
│ │ │ ├── MyRecylerViewOnlyOneAdapter.java
│ │ │ └── MyRecylerViewRightAdapter.java
│ │ │ ├── decoration
│ │ │ ├── GridSpacingItemDecoration.java
│ │ │ ├── ItemOffsetDecoration.java
│ │ │ ├── ListSpacingDecoration.java
│ │ │ ├── SpacesItemDecoration.java
│ │ │ └── SpacesItemDecorationTwo.java
│ │ │ ├── javabean
│ │ │ ├── Area.java
│ │ │ ├── City.java
│ │ │ ├── ClassfiyBean.java
│ │ │ ├── MultiSelectHasChildBean.java
│ │ │ ├── ProCate.java
│ │ │ └── Province.java
│ │ │ ├── tools
│ │ │ ├── DateTool.java
│ │ │ ├── KeyBoardTool.java
│ │ │ ├── MySSQTool.java
│ │ │ ├── SizeTool.java
│ │ │ └── StringTool.java
│ │ │ └── ui
│ │ │ └── MutiSelectDialogFragment.java
│ └── res
│ │ ├── anim
│ │ ├── popupwindow_bottom_in.xml
│ │ └── popupwindow_bottom_out.xml
│ │ ├── drawable-hdpi
│ │ ├── ic_check_grey_600_18dp.png
│ │ ├── ic_check_grey_700_48dp.png
│ │ ├── ic_check_light_green_600_18dp.png
│ │ ├── ic_check_light_green_700_48dp.png
│ │ ├── ic_keyboard_arrow_down_blue_grey_400_18dp.png
│ │ ├── ic_keyboard_arrow_down_blue_grey_400_24dp.png
│ │ ├── ic_keyboard_arrow_down_blue_grey_400_36dp.png
│ │ └── ic_keyboard_arrow_down_blue_grey_400_48dp.png
│ │ ├── drawable-mdpi
│ │ ├── ic_check_grey_600_18dp.png
│ │ ├── ic_check_grey_700_48dp.png
│ │ ├── ic_check_light_green_600_18dp.png
│ │ ├── ic_check_light_green_700_48dp.png
│ │ ├── ic_keyboard_arrow_down_blue_grey_400_18dp.png
│ │ ├── ic_keyboard_arrow_down_blue_grey_400_24dp.png
│ │ ├── ic_keyboard_arrow_down_blue_grey_400_36dp.png
│ │ └── ic_keyboard_arrow_down_blue_grey_400_48dp.png
│ │ ├── drawable-xhdpi
│ │ ├── ic_check_grey_600_18dp.png
│ │ ├── ic_check_grey_700_48dp.png
│ │ ├── ic_check_light_green_600_18dp.png
│ │ ├── ic_check_light_green_700_48dp.png
│ │ ├── ic_keyboard_arrow_down_blue_grey_400_18dp.png
│ │ ├── ic_keyboard_arrow_down_blue_grey_400_24dp.png
│ │ ├── ic_keyboard_arrow_down_blue_grey_400_36dp.png
│ │ └── ic_keyboard_arrow_down_blue_grey_400_48dp.png
│ │ ├── drawable-xxhdpi
│ │ ├── ic_check_grey_600_18dp.png
│ │ ├── ic_check_grey_700_48dp.png
│ │ ├── ic_check_light_green_600_18dp.png
│ │ ├── ic_check_light_green_700_48dp.png
│ │ ├── ic_keyboard_arrow_down_blue_grey_400_18dp.png
│ │ ├── ic_keyboard_arrow_down_blue_grey_400_24dp.png
│ │ ├── ic_keyboard_arrow_down_blue_grey_400_36dp.png
│ │ └── ic_keyboard_arrow_down_blue_grey_400_48dp.png
│ │ ├── drawable-xxxhdpi
│ │ ├── ic_check_grey_600_18dp.png
│ │ ├── ic_check_grey_700_48dp.png
│ │ ├── ic_check_light_green_600_18dp.png
│ │ ├── ic_check_light_green_700_48dp.png
│ │ ├── ic_keyboard_arrow_down_blue_grey_400_18dp.png
│ │ ├── ic_keyboard_arrow_down_blue_grey_400_24dp.png
│ │ ├── ic_keyboard_arrow_down_blue_grey_400_36dp.png
│ │ └── ic_keyboard_arrow_down_blue_grey_400_48dp.png
│ │ ├── drawable
│ │ ├── selector_item_checked.xml
│ │ ├── selector_item_text.xml
│ │ ├── selector_left_item.xml
│ │ ├── selector_shape_list_item_nobottom.xml
│ │ ├── selector_shape_list_item_notop.xml
│ │ ├── shape_list.xml
│ │ └── shape_view.xml
│ │ ├── layout
│ │ ├── dropdown_item.xml
│ │ ├── dropdown_item_muti.xml
│ │ ├── item.xml
│ │ ├── layout_mutiselect_dialog_frag.xml
│ │ ├── layout_mutiselect_dialog_frag_content_list.xml
│ │ ├── layout_mutiselect_dialog_frag_has_child.xml
│ │ ├── layout_mutiselect_dialog_frag_list.xml
│ │ ├── layout_mutiselect_enter.xml
│ │ ├── layout_popupwindow_datepick.xml
│ │ ├── layout_popupwindow_dropdown.xml
│ │ ├── layout_popupwindow_selectview.xml
│ │ ├── layout_procate_selectview.xml
│ │ ├── layout_provincecityarea_selectview.xml
│ │ ├── left_item.xml
│ │ ├── mutiselect_dialog_frag_list_group_item.xml
│ │ ├── mutiselect_dialog_frag_list_item.xml
│ │ ├── mutiselect_enter_list_item.xml
│ │ ├── right_item_all.xml
│ │ └── right_item_normal.xml
│ │ ├── raw
│ │ ├── pro_cate.json
│ │ ├── pro_cate_bak.json
│ │ ├── ssq.json
│ │ └── ssq_bak.json
│ │ └── values
│ │ ├── arrays.xml
│ │ ├── attrs.xml
│ │ ├── colors.xml
│ │ ├── ids.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── louisgeek
│ └── dropdownviewlib
│ └── ExampleUnitTest.java
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── louisgeek
│ │ └── louisdropdownview
│ │ └── ApplicationTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── louisgeek
│ │ │ └── louisdropdownview
│ │ │ └── MainActivity.java
│ └── res
│ │ ├── layout
│ │ └── activity_main.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-w820dp
│ │ └── dimens.xml
│ │ └── values
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── louisgeek
│ └── louisdropdownview
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── screenshots
├── pic1.png
├── pic2.png
├── pic3.png
├── pic4.png
├── pic5.png
└── pic6.png
└── 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 | LouisDropDownView
--------------------------------------------------------------------------------
/.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 |
24 |
25 |
--------------------------------------------------------------------------------
/.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 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 | 1.8
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/.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 |
--------------------------------------------------------------------------------
/DropDownViewLib/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/DropDownViewLib/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.3"
6 |
7 | defaultConfig {
8 | minSdkVersion 15
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.3.0'
25 | compile 'com.android.support:recyclerview-v7:23.3.0'
26 | compile 'com.orhanobut:logger:1.13'
27 | compile 'com.alibaba:fastjson:1.1.52.android'
28 | compile 'com.yqritc:recyclerview-flexibledivider:1.4.0'
29 | }
30 |
--------------------------------------------------------------------------------
/DropDownViewLib/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:\LouisIDE\Android\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 |
--------------------------------------------------------------------------------
/DropDownViewLib/src/androidTest/java/com/louisgeek/dropdownviewlib/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.louisgeek.dropdownviewlib;
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 | public void testA(){
14 | ProCateSelectView proCateSelectView=new ProCateSelectView(getContext());
15 | }
16 | }
--------------------------------------------------------------------------------
/DropDownViewLib/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/DropDownViewLib/src/main/java/com/louisgeek/dropdownviewlib/DateSelectPopupWindow.java:
--------------------------------------------------------------------------------
1 | package com.louisgeek.dropdownviewlib;
2 |
3 | import android.content.Context;
4 | import android.graphics.drawable.ColorDrawable;
5 | import android.util.Log;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.DatePicker;
10 | import android.widget.PopupWindow;
11 | import android.widget.TextView;
12 |
13 | import com.louisgeek.dropdownviewlib.tools.DateTool;
14 |
15 | import java.util.Calendar;
16 | import java.util.Date;
17 |
18 | /**
19 | * Created by louisgeek on 2016/6/5.
20 | */
21 | public class DateSelectPopupWindow extends PopupWindow{
22 |
23 | private View view;
24 | private Context mContext;
25 | private TextView id_btn_date_ok;
26 | private TextView id_btn_date_cancel;
27 | private DateSelectPopupWindow dateSelectPopupWindow;
28 | private DatePicker datePick1;
29 |
30 | private int mYear;
31 | private int mMonthOfYear;
32 | private int mDayOfMonth;
33 | private static final String TAG = "DateSelectPopupWindow";
34 |
35 | private String mNowDateTextInner;
36 | private String mStartDateTextInner;
37 | private String mEndDateTextInner;
38 |
39 | public DateSelectPopupWindow(Context context,String nowDateTextInner,String startDateTextInner,String endDateTextInner) {
40 | super(context);
41 | mContext = context;
42 | mNowDateTextInner=nowDateTextInner;
43 | mStartDateTextInner=startDateTextInner;
44 | mEndDateTextInner=endDateTextInner;
45 | initView();
46 | dateSelectPopupWindow=this;
47 | }
48 |
49 | private void initView() {
50 | LayoutInflater inflater = (LayoutInflater) mContext
51 | .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
52 | view= inflater.inflate(R.layout.layout_popupwindow_datepick, null);
53 |
54 | datePick1= (DatePicker) view.findViewById(R.id.datePick1);
55 |
56 | initDatePicker();
57 |
58 | id_btn_date_ok= (TextView) view.findViewById(R.id.id_btn_date_ok);
59 | id_btn_date_cancel= (TextView) view.findViewById(R.id.id_btn_date_cancel);
60 | id_btn_date_ok.setOnClickListener(new View.OnClickListener() {
61 | @Override
62 | public void onClick(View v) {
63 | dateSelectPopupWindow.dismiss();
64 | mOnDateSelectListener.onDateSelect(mYear,mMonthOfYear,mDayOfMonth);
65 | }
66 | });
67 | id_btn_date_cancel.setOnClickListener(new View.OnClickListener() {
68 | @Override
69 | public void onClick(View v) {
70 | dateSelectPopupWindow.dismiss();
71 | }
72 | });
73 |
74 | //设置PopupWindow的View
75 | this.setContentView(view);
76 | //设置PopupWindow弹出窗体的宽
77 | this.setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
78 | //设置PopupWindow弹出窗体的高
79 | this.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
80 | this.setBackgroundDrawable(new ColorDrawable(0xffffffff));//必须设置 ps:xml bg和这个不冲突
81 | this.setAnimationStyle(R.style.selectDataViewAnimation);
82 | this.setFocusable(true);//设置后 达到返回按钮先消失popupWindow
83 | }
84 |
85 | private void initDatePicker() {
86 | Calendar calendar;
87 | if(mNowDateTextInner!=null&&!mNowDateTextInner.equals("")&&!mNowDateTextInner.equals("null")
88 | &&!mNowDateTextInner.contains(DateSelectView.DEFAULT_DATA)&&!mNowDateTextInner.equals(DateSelectView.DEFAULT_STR)){
89 | //显示上一次选择数据
90 | Date date=DateTool.parseStr2Date(mNowDateTextInner,DateTool.FORMAT_DATE);
91 | calendar=DateTool.parseDate2Calendar(date);
92 | }else{
93 | calendar=Calendar.getInstance();//初始化时间
94 | }
95 | int year=calendar.get(Calendar.YEAR);
96 | int monthOfYear=calendar.get(Calendar.MONTH);
97 | int dayOfMonth=calendar.get(Calendar.DAY_OF_MONTH);
98 |
99 | DatePicker.OnDateChangedListener dcl=new DatePicker.OnDateChangedListener() {
100 | @Override
101 | public void onDateChanged(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
102 | mYear=year;
103 | mMonthOfYear=monthOfYear;
104 | mDayOfMonth=dayOfMonth;
105 | }
106 | };
107 | //
108 | datePick1.init(year,monthOfYear,dayOfMonth,dcl);
109 | //
110 | Log.i(TAG, "initDatePicker: mNowDateTextInner:"+mNowDateTextInner);
111 | Log.i(TAG, "initDatePicker: mStartDateTextInner:"+mStartDateTextInner);
112 | if (mStartDateTextInner!=null){
113 | Calendar calendar_s=DateTool.parseStr2Calendar(mStartDateTextInner,DateTool.FORMAT_DATE);
114 | long time_s=calendar_s.getTimeInMillis();
115 | Log.i(TAG, "initDatePicker: time_s:"+time_s);
116 | datePick1.setMinDate(time_s);
117 | }
118 | Log.i(TAG, "initDatePicker: mEndDateTextInner:"+mEndDateTextInner);
119 | if (mEndDateTextInner!=null){
120 | Calendar calendar_e=DateTool.parseStr2Calendar(mEndDateTextInner,DateTool.FORMAT_DATE);
121 | long time_e=calendar_e.getTimeInMillis();
122 | Log.i(TAG, "initDatePicker: calendar_e:"+calendar_e);
123 | datePick1.setMaxDate(time_e);
124 | }
125 |
126 |
127 | }
128 |
129 |
130 | public interface OnDateSelectListener {
131 | void onDateSelect(int year, int monthOfYear, int dayOfMonth);
132 | }
133 |
134 | public void setOnDateSelectListener(OnDateSelectListener onDateSelectListener) {
135 | mOnDateSelectListener = onDateSelectListener;
136 | }
137 |
138 | private OnDateSelectListener mOnDateSelectListener;
139 |
140 | }
141 |
--------------------------------------------------------------------------------
/DropDownViewLib/src/main/java/com/louisgeek/dropdownviewlib/DateSelectView.java:
--------------------------------------------------------------------------------
1 | package com.louisgeek.dropdownviewlib;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.util.Log;
6 | import android.view.Gravity;
7 | import android.view.View;
8 | import android.widget.TextView;
9 |
10 | import com.louisgeek.dropdownviewlib.tools.DateTool;
11 | import com.louisgeek.dropdownviewlib.tools.KeyBoardTool;
12 | import com.louisgeek.dropdownviewlib.tools.SizeTool;
13 |
14 | import java.util.Date;
15 |
16 | /**
17 | * Created by louisgeek on 2016/6/5.
18 | */
19 | public class DateSelectView extends TextView implements View.OnClickListener {
20 | private Context mContext;
21 | private String mNowDateText;
22 | private String startDateText;
23 | private String endDateText;
24 | private final String DEFAULT_DATA_TIME="1970-01-01 00:00:00";
25 | public static final String DEFAULT_DATA="1970-01-01";
26 | public static final String DEFAULT_STR="请选择";
27 | private static final String TAG = "DateSelectView";
28 | public DateSelectView(Context context) {
29 | super(context);
30 | init(context);
31 | }
32 |
33 | public DateSelectView(Context context, AttributeSet attrs) {
34 | super(context, attrs);
35 | init(context);
36 | }
37 |
38 | public DateSelectView(Context context, AttributeSet attrs, int defStyleAttr) {
39 | super(context, attrs, defStyleAttr);
40 | init(context);
41 | }
42 |
43 | private void init(Context context) {
44 | mContext=context;
45 |
46 | initDate();//初始化
47 |
48 | if (this.getPaddingTop()==0&&this.getPaddingBottom()==0&&this.getPaddingLeft()==0&&this.getPaddingRight()==0) {
49 | int paddingLeft_Right = SizeTool.dp2px(mContext, 10);
50 | int paddingTop_Bottom = SizeTool.dp2px(mContext, 6);
51 | this.setPadding(paddingLeft_Right, paddingTop_Bottom, paddingLeft_Right, paddingTop_Bottom);
52 | }
53 | this.setOnClickListener(this);
54 | this.setCompoundDrawablesWithIntrinsicBounds(0,0,R.drawable.ic_keyboard_arrow_down_blue_grey_400_18dp,0);
55 | this.setBackgroundResource(R.drawable.shape_list);
56 | }
57 |
58 |
59 | @Override
60 | public void onClick(final View v) {
61 | //
62 | KeyBoardTool.hideKeyboard(v);
63 |
64 | DateSelectPopupWindow myPopupwindow=new DateSelectPopupWindow(mContext,mNowDateText,startDateText,endDateText);
65 | myPopupwindow.showAtLocation(v, Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL,0,0);
66 | myPopupwindow.setOnDateSelectListener(new DateSelectPopupWindow.OnDateSelectListener() {
67 | @Override
68 | public void onDateSelect(int year, int monthOfYear, int dayOfMonth) {
69 | // SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
70 | if (year==0&&monthOfYear==0&&dayOfMonth==0){
71 | if (mNowDateText.trim().equals("")||mNowDateText.trim().equals(DEFAULT_STR)) {
72 | mNowDateText = DateTool.getChinaDate();
73 | }
74 | }else{
75 | mNowDateText=DateTool.getChinaDateFromCalendar(year,monthOfYear,dayOfMonth);
76 | }
77 | ((DateSelectView)v).setText(mNowDateText);
78 | }
79 | });
80 | }
81 |
82 | /**
83 | *
84 | * @param nowDataText
85 | */
86 | public void setupDateText(String nowDataText){
87 | Log.i(TAG, "setupDateText nowDataText Only: nowDataText:"+nowDataText);
88 | setupDateText(nowDataText,null,null);
89 | }
90 |
91 | /**
92 | *
93 | * @param nowDateText
94 | * @param startDateText
95 | * @param endDateText
96 | */
97 | public void setupDateText(String nowDateText,String startDateText,String endDateText){
98 | Log.i(TAG, "setupDateText: nowDateText:"+nowDateText);
99 | Log.i(TAG, "setupDateText: startDateText:"+startDateText);
100 | Log.i(TAG, "setupDateText: endDateText:"+endDateText);
101 | if (nowDateText==null||nowDateText.trim().equals("")||nowDateText.trim().equals("null")
102 | ||nowDateText.contains(DEFAULT_DATA)||nowDateText.equals(DEFAULT_STR))
103 | {
104 | mNowDateText=DEFAULT_STR;
105 | }else{
106 | //先转
107 | Date date=DateTool.parseStr2Date(nowDateText,DateTool.FORMAT_DATE);
108 | if (date!=null) {
109 | mNowDateText = DateTool.parseDate2Str(date, DateTool.FORMAT_DATE);
110 | }else{
111 | mNowDateText=DEFAULT_STR;
112 | }
113 | if (mNowDateText.contains(DEFAULT_DATA)){
114 | mNowDateText=DEFAULT_STR;
115 | }
116 | }
117 | this.setText(mNowDateText);
118 | //
119 | this.startDateText=startDateText;
120 | this.endDateText=endDateText;
121 | }
122 | private void initDate(){
123 | setupDateText(null);
124 | }
125 |
126 | @Deprecated
127 | public CharSequence getText() {
128 | return super.getText();
129 | }
130 |
131 | public String getNowSelectData(){
132 | String nowData="";
133 | if (this.getText() != null){
134 | nowData=this.getText().toString();
135 | }
136 | return nowData.trim().equals("")||nowData.trim().equals(DEFAULT_STR)?DEFAULT_DATA:nowData;
137 | }
138 |
139 | /**
140 | * 未设置的返回当前时间
141 | * @return
142 | */
143 | public String getNowSelectDataFixedNowData(){
144 | return getNowSelectData()==null?DateTool.getChinaDate():getNowSelectData();
145 | }
146 | }
147 |
--------------------------------------------------------------------------------
/DropDownViewLib/src/main/java/com/louisgeek/dropdownviewlib/DropDownPopupWindow.java:
--------------------------------------------------------------------------------
1 | package com.louisgeek.dropdownviewlib;
2 |
3 | import android.content.Context;
4 | import android.graphics.drawable.ColorDrawable;
5 | import android.support.v7.widget.GridLayoutManager;
6 | import android.support.v7.widget.LinearLayoutManager;
7 | import android.support.v7.widget.RecyclerView;
8 | import android.util.Log;
9 | import android.view.LayoutInflater;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 | import android.widget.PopupWindow;
13 |
14 | import com.louisgeek.dropdownviewlib.adapter.DropDownViewRecycleViewAdapter;
15 |
16 | import java.lang.reflect.Method;
17 | import java.util.List;
18 | import java.util.Map;
19 |
20 | /**
21 | * Created by louisgeek on 2016/6/3.
22 | */
23 | public class DropDownPopupWindow extends PopupWindow implements DropDownViewRecycleViewAdapter.OnItemViewClickListener {
24 | private List