|
34 | 34 | 然后在项目的build.gradle中添加 |
35 | 35 |
|
36 | 36 | dependencies { |
37 | | - implementation 'com.github.caixiquan:myLinkage:1.0.0' |
| 37 | + implementation 'com.github.caixiquan:myLinkage:1.0.1' |
38 | 38 | } |
39 | 39 | ###使用maven方式依赖 |
40 | 40 |
|
@@ -70,25 +70,32 @@ new CustomAlertDialog(MainActivity.this); |
70 | 70 | /** |
71 | 71 | * 显示信息对话框 |
72 | 72 | */ |
73 | | - private void showAlertDialog(boolean cancelable, CustomAlertDialog.OnAlertClickListener listener) { |
74 | | - if (alertDialog == null) { |
75 | | - alertDialog = new CustomAlertDialog(this); |
| 73 | + private void showAlertDialog(int selectedColor, int type, CustomAlertDialog.OnAlertClickListener listener) { |
| 74 | + if (alertDialog == null) { |
| 75 | + alertDialog = new CustomAlertDialog(this); |
| 76 | + } |
| 77 | + alertDialog.setContent(selectedColor,type); |
| 78 | + alertDialog.setOnAlertClickListener(listener); |
| 79 | + alertDialog.show(); |
76 | 80 | } |
77 | | - alertDialog.setCancelable(cancelable); |
78 | | - alertDialog.setOnAlertClickListener(listener); |
79 | | - alertDialog.show(); |
80 | | - } |
81 | 81 | ``` |
82 | 82 | 在需要使用该功能的控件点击事件中如下使用 |
83 | 83 |
|
84 | 84 | ``` |
85 | | -showAlertDialog(true, new CustomAlertDialog.OnAlertClickListener() { |
| 85 | +showAlertDialog(R.color.colorPrimary,alertDialog.THE_SECONDARY_LINKAGE, new CustomAlertDialog.OnAlertClickListener() { |
| 86 | + @SuppressLint("SetTextI18n") |
86 | 87 | @Override |
87 | | - public void onQuClick(String string) { |
88 | | - addr.setText(string); |
| 88 | + public void onQuClick(String province, String city, String district) { |
| 89 | + if (city == null){ |
| 90 | + addr.setText(province + district); |
| 91 | + }else { |
| 92 | + addr.setText(province + city + district); |
| 93 | + } |
89 | 94 | } |
90 | 95 | }); |
91 | 96 | ``` |
| 97 | +selectedColor为卡片颜色 |
| 98 | +type可以选择两个,一个是三级联动(THE_THREE_LINKAGE)一个是二级联动(THE_SECONDARY_LINKAGE) |
92 | 99 |
|
93 | 100 | <a name="其他"></a> |
94 | 101 | ## 其他 |
|
0 commit comments