Skip to content

Commit 6e07ef6

Browse files
2 parents b13f411 + d2cd4ca commit 6e07ef6

File tree

1 file changed

+51
-74
lines changed

1 file changed

+51
-74
lines changed

README.md

Lines changed: 51 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
![Release](https://jitpack.io/v/AndroidLibrariesYoutube/SelectionDialog.svg)
44

5+
![Release](https://img.shields.io/badge/Android%20Arsenal-SelectionDialog-green.svg?style=flat)
6+
57
Hello World.
68
Enable Selections features. Now easy with SelectionDialog android library. You can now enable Single selection and Multiple selection features in your app easily.
79

@@ -22,7 +24,7 @@ Enable Selections features. Now easy with SelectionDialog android library. You c
2224

2325
```css
2426
dependencies {
25-
implementation 'com.github.AndroidLibrariesYoutube:SelectionDialog:1.0.1'
27+
implementation 'com.github.AndroidLibrariesYoutube:SelectionDialog:1.0.2'
2628
}
2729
```
2830

@@ -37,51 +39,41 @@ dependencies {
3739
Using SelectionDialog is pretty simple.
3840

3941
**Step 1**
40-
Create class of SingleSelectionDialog for using the Single Selection.
42+
Create object of SingleSelectionDialog with Builder for using the Single Selection.
4143

4244

4345

44-
// First parameter you need to pass is this means you need to implement a SingleSelectionListener in your activity then activity context and last is TAG.
45-
46+
//First parameter need to pass is current context and then TAG. TAG is for determine if you are using dialog multiple times.
47+
SingleSelectionDialog singleSelectionDialog = new SingleSelectionDialog.Builder(context, "TEST")
48+
.setTitle("Select Number")
49+
.setContent(stringArrayList) // Set ArrayList you want to show.
50+
.setColor(getResources().getColor(R.color.colorPrimaryDark))
51+
.setSelectedField(currentField)
52+
.enableSearch(true, "Search your number")
53+
.setTextColor(getResources().getColor(R.color.colorAccent))
54+
.setListener(new SingleSelectionListener() {
55+
@Override
56+
public void onDialogItemSelected(String s, int position, String tag) {
57+
58+
}
59+
60+
@Override
61+
public void onDialogError(String error, String tag) {
62+
}
63+
})
64+
.build();
4665
47-
SingleSelectionDialog singleSelectionDialog = new SingleSelectionDialog(this, context, "TAG");
48-
49-
//Then you need to the ArrayList which you want to show. ArrayList must be of String type.
50-
singleSelectionDialog.setContent(stringArrayList);
51-
66+
67+
5268
**Step 2**
53-
Add extra features to your dialog.
54-
55-
56-
singleSelectionDialog.setColor(getResources().getColor(R.color.colorPrimaryDark));
57-
singleSelectionDialog.setTitle("Select Number");
58-
singleSelectionDialog.setTextColor(getResources().getColor(R.color.colorAccent));
59-
singleSelectionDialog.setSelectedField(currentField);
60-
61-
62-
63-
**Step 3**
6469
Call show(); method for showing the dialog.
6570

6671
singleSelectionDialog.show();
67-
**Step 4**
68-
Inherit SingleSelectionListener listener in your activity like this.
69-
70-
public class MainActivity extends AppCompatActivity implements SingleSelectionListener
71-
**Step 5**
72-
Get value, positions, TAG and error from dialog.
73-
74-
72+
73+
**Step 3**
74+
Set Default value or Current value to Dialog.
7575

76-
@Override
77-
public void onDialogItemSelected(String s, int position, String tag) {
78-
79-
}
80-
81-
@Override
82-
public void onDialogError(String error, String tag) {
83-
84-
}
76+
singleSelectionDialog.setSelectedField(value); //Default value must be of String type.
8577

8678

8779
## How do I use Multi Selection Dialog?
@@ -92,53 +84,38 @@ Get value, positions, TAG and error from dialog.
9284
Using MultiSelection is also not that tough.
9385

9486
**Step 1**
95-
Create class of MultiSelectionDialog for using the Multi Selection.
87+
Create object of MultiSelectionDialog with Builder for using the Multiple Selection.
9688

9789

9890

99-
// First parameter you need to pass is this means you need to implement a MultiSelectionListenerin your activity then activity context and last is TAG.
100-
101-
102-
MultiSelectionDialog multiSelectionDialog = new MultiSelectionDialog(this, context, "TAG");
103-
104-
//Then you need to the ArrayList which you want to show. ArrayList must be of String type.
105-
multiSelectionDialog.setContent(stringArrayList);
106-
107-
108-
**Step 2**
109-
Add extra features to your dialog.
110-
91+
//First parameter need to pass is current context and then TAG. TAG is for determine if you are using dialog multiple times.
92+
MultiSelectionDialog multiSelectionDialog = new MultiSelectionDialog.Builder(context, "TEST")
93+
.setTitle("Select Number")
94+
.setContent(stringArrayList)
95+
.setColor(getResources().getColor(R.color.colorPrimaryDark))
96+
.setSelectedField(currentField)
97+
.setTextColor(getResources().getColor(R.color.colorAccent))
98+
.setListener(new MultiSelectionListener() {
99+
@Override
100+
public void onMultiDialogItemsSelected(String s, String tag, ArrayList<String> selectedItemList) {
101+
}
102+
103+
@Override
104+
public void onMultiDialogError(String error, String tag) {
105+
}
106+
})
107+
.build();
111108

112-
multiSelectionDialog.setColor(getResources().getColor(R.color.colorPrimaryDark));
113-
multiSelectionDialog.setTitle("Select Number");
114-
multiSelectionDialog.setTextColor(getResources().getColor(R.color.colorAccent));
115-
multiSelectionDialog.setSelectedFields(currentField);
116109

117-
**Step 3**
110+
**Step 2**
118111
Call show(); method for showing the dialog.
119112

120113
multiSelectionDialog.show();
121114

122-
**Step 4**
123-
Inherit MultiSelectionListener listener in your activity like this.
124-
125-
public class MainActivity extends AppCompatActivity implements MultiSelectionListener
126-
**Step 5**
127-
Get values, selected item list, TAG and error from dialog.
128-
129-
130-
131-
132-
@Override
133-
public void onMultiDialogItemsSelected(String s, String tag, ArrayList<String> selectedItemList) {
134-
135-
}
136-
137-
@Override
138-
public void onMultiDialogError(String error, String tag) {
139-
140-
}
115+
**Step 3**
116+
Set Default values or Current values to Dialog.
141117

118+
multiSelectionDialog.setSelectedFields(value); //Default values must be of String type.
142119

143120
## Author
144121
[Dheeraj Rijhwani (Android Developer)](https://www.youtube.com/channel/UCEhHMXJs1V4mXGfJ4pSWaoA)

0 commit comments

Comments
 (0)