|
1 | 1 | package com.gzeinnumer.mylibsearchviewdialog; |
2 | 2 |
|
3 | 3 | import android.os.Bundle; |
4 | | -import android.view.Gravity; |
5 | 4 | import android.view.View; |
6 | 5 | import android.widget.Button; |
7 | 6 | import android.widget.TextView; |
|
10 | 9 | import androidx.appcompat.app.AppCompatActivity; |
11 | 10 |
|
12 | 11 | import com.gzeinnumer.mylibsearchviewdialog.constant.ButtonStyle; |
13 | | -import com.gzeinnumer.mylibsearchviewdialog.dialog.searchViewDialog.SearchViewDialogOldOld; |
14 | 12 | import com.gzeinnumer.mylibsearchviewdialog.dialog.searchViewDialogNew.SearchViewDialog; |
15 | | -import com.gzeinnumer.mylibsearchviewdialog.model.SearchViewModel; |
16 | 13 |
|
17 | 14 | import java.util.ArrayList; |
18 | 15 | import java.util.List; |
@@ -54,244 +51,14 @@ private void initOnClick() { |
54 | 51 | @Override |
55 | 52 | public void onClick(View v) { |
56 | 53 | //choise 1 |
57 | | -// initDialogSingle(); |
58 | | -// initDialogMulti(); |
59 | | -// initDialogSingleCustom(); |
60 | | -// initDialogMultiCustom(); |
61 | | -// initDialogSingleEgi10(); |
62 | | -// initDialogSingleGZeinNumer(); |
63 | | - initDialogSingleGZeinNumer2(); |
| 54 | + initDialogSingleGZeinNumer(); |
| 55 | +// initDialogSingleGZeinNumer2(); |
64 | 56 | } |
65 | 57 | }); |
66 | 58 | } |
67 | 59 |
|
68 | 60 | private static final String TAG = "Main_Activity"; |
69 | 61 |
|
70 | | - private void initDialogSingle() { |
71 | | - new SearchViewDialogOldOld(getSupportFragmentManager(), listString) |
72 | | - .setTitle("ini title") |
73 | | - .setContent("ini content") |
74 | | - .setButtonStyle(ButtonStyle.ButtonContained) |
75 | | - .setButtonColor(R.color.amber_200) |
76 | | - .onOkPressedCallBackSingle(new SearchViewDialogOldOld.OnOkPressedSingle() { |
77 | | - @Override |
78 | | - public void onOkSingle(int position, String value) { |
79 | | - String temp = "Single Select :\n\n"; |
80 | | - temp = temp+"position on list => "+position+"\n"; |
81 | | - temp = temp+"value on list => "+value+"\n"; |
82 | | - |
83 | | - tv.setText(temp); |
84 | | - Toast.makeText(MainActivity.this, temp, Toast.LENGTH_SHORT).show(); |
85 | | - } |
86 | | - }) |
87 | | - .onCancelPressedCallBack(new SearchViewDialogOldOld.OnCancelPressed() { |
88 | | - @Override |
89 | | - public void onCancelPressed() { |
90 | | - Toast.makeText(MainActivity.this, "Cancel", Toast.LENGTH_SHORT).show(); |
91 | | - } |
92 | | - }) |
93 | | - .show(); |
94 | | - } |
95 | | - |
96 | | - private void initDialogMulti() { |
97 | | - new SearchViewDialogOldOld(getSupportFragmentManager(), listString) |
98 | | - .enableFullScreen() |
99 | | - .setTitle("ini title") |
100 | | - .setContent("ini content") |
101 | | - .onOkPressedCallBackMulti(new SearchViewDialogOldOld.OnOkPressedMulti(){ |
102 | | - @Override |
103 | | - public void onOkMulti(List<SearchViewModel> data) { |
104 | | - String temp = "Multi Select :\n"; |
105 | | - temp = temp + "Total Data => "+data.size()+"\n\n"; |
106 | | - for (SearchViewModel d: data){ |
107 | | - temp = temp + "position on list => "+d.getPosition()+"\n"; |
108 | | - temp = temp + "value on list => "+d.getName()+"\n\n"; |
109 | | - } |
110 | | - tv.setText(temp); |
111 | | - } |
112 | | - }) |
113 | | - .onCancelPressedCallBack(new SearchViewDialogOldOld.OnCancelPressed() { |
114 | | - @Override |
115 | | - public void onCancelPressed() { |
116 | | - Toast.makeText(MainActivity.this, "Cancel", Toast.LENGTH_SHORT).show(); |
117 | | - } |
118 | | - }) |
119 | | - .show(); |
120 | | - } |
121 | | - |
122 | | - private void initDialogSingleCustom() { |
123 | | - new SearchViewDialogOldOld(getSupportFragmentManager(), listString) |
124 | | - .setCanvasWidth(1.0) |
125 | | - .setDialogCanvas(getResources().getDrawable(R.drawable.rounded_corner_2)) |
126 | | - |
127 | | - .setTitle("ini title") |
128 | | - .setTitleSize(21) |
129 | | - .setTitleColor(getResources().getColor(R.color.colorAccent)) |
130 | | -// .setTitleColor(Color.parseColor("#03DAC5")) |
131 | | - .setTitleAlignment(View.TEXT_ALIGNMENT_TEXT_END) |
132 | | - |
133 | | - .setContent("ini content") |
134 | | - .setContentSize(21) |
135 | | - .setContentColor(getResources().getColor(R.color.colorAccent)) |
136 | | -// .setContentColor(Color.parseColor("#03DAC5")) |
137 | | - .setContentAlignment(View.TEXT_ALIGNMENT_TEXT_END) |
138 | | - |
139 | | - .setBtnCancelTitle("Batal") |
140 | | - .setBtnCancelTitleColor(getResources().getColor(R.color.colorAccent)) |
141 | | -// .setBtnCancelTitleColor(Color.parseColor("#03DAC5")) |
142 | | - .setCancelIconLeft(R.drawable.ic_baseline_add_24) |
143 | | - .setCancelIconTop(R.drawable.ic_baseline_add_24) |
144 | | - .setCancelIconRight(R.drawable.ic_baseline_add_24) |
145 | | - .setCancelIconBottom(R.drawable.ic_baseline_add_24) |
146 | | - |
147 | | - .setBtnOkTitle("Yuhuu") |
148 | | - .setBtnOkTitleColor(getResources().getColor(R.color.colorAccent)) |
149 | | -// .setBtnOkTitleColor(Color.parseColor("#03DAC5")) |
150 | | - .setOkIconLeft(R.drawable.ic_baseline_add_24) |
151 | | - .setOkIconTop(R.drawable.ic_baseline_add_24) |
152 | | - .setOkIconTop(R.drawable.ic_baseline_add_24) |
153 | | - .setOkIconBottom(R.drawable.ic_baseline_add_24) |
154 | | - |
155 | | - .setButtonTextSize(21) |
156 | | - .setButtonStyle(ButtonStyle.ButtonOutlined) |
157 | | - .setButtonGravity(Gravity.CENTER) |
158 | | - .setButtonColor(R.color.amber_200) |
159 | | - |
160 | | - .setTextSearchSize(30) |
161 | | - .setTextSearchColor(getResources().getColor(R.color.colorAccent)) |
162 | | -// .setTextSearchColor(Color.parseColor("#03DAC5")) |
163 | | - |
164 | | - .setContentListHeight(900) |
165 | | - |
166 | | - .setTextListSize(30) |
167 | | - .setTextListColor(getResources().getColor(R.color.colorAccent)) |
168 | | -// .setTextListColor(Color.parseColor("#03DAC5")) |
169 | | - |
170 | | - .onOkPressedCallBackSingle(new SearchViewDialogOldOld.OnOkPressedSingle() { |
171 | | - @Override |
172 | | - public void onOkSingle(int position, String value) { |
173 | | - String temp = "Single Select :\n\n"; |
174 | | - temp = temp+"position on list => "+position+"\n"; |
175 | | - temp = temp+"value on list => "+value+"\n"; |
176 | | - |
177 | | - tv.setText(temp); |
178 | | - Toast.makeText(MainActivity.this, temp, Toast.LENGTH_SHORT).show(); |
179 | | - } |
180 | | - }) |
181 | | - .onCancelPressedCallBack(new SearchViewDialogOldOld.OnCancelPressed() { |
182 | | - @Override |
183 | | - public void onCancelPressed() { |
184 | | - Toast.makeText(MainActivity.this, "Cancel", Toast.LENGTH_SHORT).show(); |
185 | | - } |
186 | | - }) |
187 | | - .show(); |
188 | | - |
189 | | - } |
190 | | - |
191 | | - private void initDialogMultiCustom() { |
192 | | - new SearchViewDialogOldOld(getSupportFragmentManager(), listString) |
193 | | - .setCanvasWidth(1.0) |
194 | | - .setDialogCanvas(getResources().getDrawable(R.drawable.rounded_corner_2)) |
195 | | - |
196 | | - .setTitle("ini title") |
197 | | - .setTitleSize(21) |
198 | | - .setTitleColor(getResources().getColor(R.color.colorAccent)) |
199 | | -// .setTitleColor(Color.parseColor("#03DAC5")) |
200 | | - .setTitleAlignment(View.TEXT_ALIGNMENT_TEXT_END) |
201 | | - |
202 | | - .setContent("ini content") |
203 | | - .setContentSize(21) |
204 | | - .setContentColor(getResources().getColor(R.color.colorAccent)) |
205 | | -// .setContentColor(Color.parseColor("#03DAC5")) |
206 | | - .setContentAlignment(View.TEXT_ALIGNMENT_TEXT_END) |
207 | | - |
208 | | - .setBtnCancelTitle("Batal") |
209 | | - .setBtnCancelTitleColor(getResources().getColor(R.color.colorAccent)) |
210 | | -// .setBtnCancelTitleColor(Color.parseColor("#03DAC5")) |
211 | | - .setCancelIconLeft(R.drawable.ic_baseline_add_24) |
212 | | - .setCancelIconTop(R.drawable.ic_baseline_add_24) |
213 | | - .setCancelIconRight(R.drawable.ic_baseline_add_24) |
214 | | - .setCancelIconBottom(R.drawable.ic_baseline_add_24) |
215 | | - |
216 | | - .setBtnOkTitle("Yuhuu") |
217 | | - .setBtnOkTitleColor(getResources().getColor(R.color.colorAccent)) |
218 | | -// .setBtnOkTitleColor(Color.parseColor("#03DAC5")) |
219 | | - .setOkIconLeft(R.drawable.ic_baseline_add_24) |
220 | | - .setOkIconTop(R.drawable.ic_baseline_add_24) |
221 | | - .setOkIconTop(R.drawable.ic_baseline_add_24) |
222 | | - .setOkIconBottom(R.drawable.ic_baseline_add_24) |
223 | | - |
224 | | - .setButtonTextSize(21) |
225 | | - .setButtonStyle(ButtonStyle.ButtonOutlined) |
226 | | - .setButtonGravity(Gravity.CENTER) |
227 | | - |
228 | | - .setTextSearchSize(30) |
229 | | - .setTextSearchColor(getResources().getColor(R.color.colorAccent)) |
230 | | -// .setTextSearchColor(Color.parseColor("#03DAC5")) |
231 | | - |
232 | | - .setContentListHeight(900) |
233 | | - |
234 | | - .setTextListSize(30) |
235 | | - .setTextListColor(getResources().getColor(R.color.colorAccent)) |
236 | | -// .setTextListColor(Color.parseColor("#03DAC5")) |
237 | | - |
238 | | - .onOkPressedCallBackMulti(new SearchViewDialogOldOld.OnOkPressedMulti(){ |
239 | | - @Override |
240 | | - public void onOkMulti(List<SearchViewModel> data) { |
241 | | - String temp = "Multi Select :\n"; |
242 | | - temp = temp + "Total Data => "+data.size()+"\n\n"; |
243 | | - for (SearchViewModel d: data){ |
244 | | - temp = temp + "position on list => "+d.getPosition()+"\n"; |
245 | | - temp = temp + "value on list => "+d.getName()+"\n\n"; |
246 | | - } |
247 | | - tv.setText(temp); |
248 | | - } |
249 | | - }) |
250 | | - .onCancelPressedCallBack(new SearchViewDialogOldOld.OnCancelPressed() { |
251 | | - @Override |
252 | | - public void onCancelPressed() { |
253 | | - Toast.makeText(MainActivity.this, "Cancel", Toast.LENGTH_SHORT).show(); |
254 | | - } |
255 | | - }) |
256 | | - .show(); |
257 | | - } |
258 | | - |
259 | | - private void initDialogSingleEgi10() { |
260 | | - ArrayList<ExampleModel> listObject = new ArrayList<>(); |
261 | | - listObject.add(new ExampleModel(1, "Zein", "Balbar")); |
262 | | - listObject.add(new ExampleModel(2, "Zein2", "Balbar2")); |
263 | | - listObject.add(new ExampleModel(3, "Zein3", "Balbar3")); |
264 | | - listObject.add(new ExampleModel(4, "Zein4", "Balbar4")); |
265 | | - |
266 | | - String[] arrayString = {"M", "Fadli", "Zein"}; |
267 | | - new SearchViewDialogOldOld(getSupportFragmentManager(),listString) |
268 | | -// .setItems(listString) |
269 | | -// .setItems(listObject) |
270 | | -// .setItems(arrayString) |
271 | | - .setTitle("ini title") |
272 | | - .setContent("ini content") |
273 | | - .setButtonStyle(ButtonStyle.ButtonContained) |
274 | | - .setButtonColor(R.color.amber_200) |
275 | | - .onOkPressedCallBackSingle(new SearchViewDialogOldOld.OnOkPressedSingle() { |
276 | | - @Override |
277 | | - public void onOkSingle(int position, String value) { |
278 | | - String temp = "Single Select :\n\n"; |
279 | | - temp = temp+"position on list => "+position+"\n"; |
280 | | - temp = temp+"value on list => "+value+"\n"; |
281 | | - |
282 | | - tv.setText(temp); |
283 | | - Toast.makeText(MainActivity.this, temp, Toast.LENGTH_SHORT).show(); |
284 | | - } |
285 | | - }) |
286 | | - .onCancelPressedCallBack(new SearchViewDialogOldOld.OnCancelPressed() { |
287 | | - @Override |
288 | | - public void onCancelPressed() { |
289 | | - Toast.makeText(MainActivity.this, "Cancel", Toast.LENGTH_SHORT).show(); |
290 | | - } |
291 | | - }) |
292 | | - .show(); |
293 | | - } |
294 | | - |
295 | 62 |
|
296 | 63 | private void initDialogSingleGZeinNumer() { |
297 | 64 |
|
@@ -338,7 +105,7 @@ private void initDialogSingleGZeinNumer2() { |
338 | 105 | listObject.add(new ExampleModel(4, "Zein4", "Balbar4")); |
339 | 106 |
|
340 | 107 | new SearchViewDialog<ExampleModel>(getSupportFragmentManager()) |
341 | | - .setAnimationStyle(R.style.LibSearchViewDialog_DialogStyle_In) |
| 108 | + .setAnimationStyle(R.style.DialogStyle_In) |
342 | 109 | .setItems(listObject) |
343 | 110 | .setTitle("ini title") |
344 | 111 | .setContent("ini content") |
|
0 commit comments