Skip to content

Commit 93e7e8e

Browse files
author
Paul Kunda
committed
Read Me Update
1 parent bd5e32f commit 93e7e8e

File tree

2 files changed

+51
-2
lines changed

2 files changed

+51
-2
lines changed

README.md

+50-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,56 @@ public class MainActivity extends AppCompatActivity {
5959
}
6060
}
6161
```
62-
62+
```kotlin
63+
class MainActivity : AppCompatActivity() {
64+
override fun onCreate(savedInstanceState: Bundle?) {
65+
super.onCreate(savedInstanceState)
66+
setContentView(R.layout.activity_main)
67+
val pickDistrictEditText = findViewById<EditText>(R.id.pickDistrictEditText)
68+
val pickProvinceEditText = findViewById<EditText>(R.id.pickProvinceEditText)
69+
val nrcNumber = findViewById<EditText>(R.id.nrcNumber)
70+
val validateFields = findViewById<Button>(R.id.validateFields)
71+
pickProvinceEditText.setOnClickListener { view: View? ->
72+
showDialog(
73+
"Select Province",
74+
this@MainActivity,
75+
PROVINCES,
76+
pickProvinceEditText
77+
)
78+
}
79+
pickDistrictEditText.setOnClickListener { view: View? ->
80+
if (pickProvinceEditText.text.toString().isEmpty()) {
81+
pickDistrictEditText.setText("Please select a province")
82+
} else {
83+
showDialog(
84+
"Select District From " + pickProvinceEditText.text.toString(),
85+
this@MainActivity,
86+
getDistrictArray(
87+
pickProvinceEditText.text.toString()
88+
),
89+
pickDistrictEditText
90+
)
91+
}
92+
}
93+
nrcValidation(nrcNumber)
94+
val editTexts = arrayOf(pickDistrictEditText, pickProvinceEditText, nrcNumber)
95+
validateFields.setOnClickListener { v: View? ->
96+
val isAllCool =
97+
validateEditFields(
98+
resources,
99+
editTexts
100+
)
101+
if (isAllCool) {
102+
Toast.makeText(
103+
applicationContext,
104+
"All Good",
105+
Toast.LENGTH_SHORT
106+
).show()
107+
}
108+
}
109+
}
110+
}
111+
```
63112
## Using Library to Pass your custom options
64113
```java
65114
final String[] bloodGroups = {"A+", "B+", "O+", "AB+", "A-", "B-", "O-", "A-"};

ZedEditOptions/src/main/java/com/visionarymindszm/zededitoptions/ZedUtils.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ object ZedUtils {
9999
fun showDialog(
100100
title: String?,
101101
callingActivity_Fragment: Context?,
102-
optionsPassed: Array<String?>,
102+
optionsPassed: Array<String>,
103103
fieldCalled: EditText
104104
) {
105105
val builder = AlertDialog.Builder(

0 commit comments

Comments
 (0)