1010import android .widget .Toast ;
1111
1212import com .gzeinnumer .mylibsearchviewdialog .constant .ButtonStyle ;
13- import com .gzeinnumer .mylibsearchviewdialog .dialog .searchViewDialog .SearchViewDialog ;
13+ import com .gzeinnumer .mylibsearchviewdialog .dialog .searchViewDialog .SearchViewDialogOldOld ;
14+ import com .gzeinnumer .mylibsearchviewdialog .dialog .searchViewDialogNew .SearchViewDialog ;
1415import com .gzeinnumer .mylibsearchviewdialog .model .SearchViewModel ;
1516
1617import java .util .ArrayList ;
@@ -57,20 +58,22 @@ public void onClick(View v) {
5758// initDialogMulti();
5859// initDialogSingleCustom();
5960// initDialogMultiCustom();
60- initDialogSingleEgi10 ();
61+ // initDialogSingleEgi10();
62+ // initDialogSingleGZeinNumer();
63+ initDialogSingleGZeinNumer2 ();
6164 }
6265 });
6366 }
6467
6568 private static final String TAG = "Main_Activity" ;
6669
6770 private void initDialogSingle () {
68- new SearchViewDialog (getSupportFragmentManager (), listString )
71+ new SearchViewDialogOldOld (getSupportFragmentManager (), listString )
6972 .setTitle ("ini title" )
7073 .setContent ("ini content" )
7174 .setButtonStyle (ButtonStyle .ButtonContained )
7275 .setButtonColor (R .color .amber_200 )
73- .onOkPressedCallBackSingle (new SearchViewDialog .OnOkPressedSingle () {
76+ .onOkPressedCallBackSingle (new SearchViewDialogOldOld .OnOkPressedSingle () {
7477 @ Override
7578 public void onOkSingle (int position , String value ) {
7679 String temp = "Single Select :\n \n " ;
@@ -81,7 +84,7 @@ public void onOkSingle(int position, String value) {
8184 Toast .makeText (MainActivity .this , temp , Toast .LENGTH_SHORT ).show ();
8285 }
8386 })
84- .onCancelPressedCallBack (new SearchViewDialog .OnCancelPressed () {
87+ .onCancelPressedCallBack (new SearchViewDialogOldOld .OnCancelPressed () {
8588 @ Override
8689 public void onCancelPressed () {
8790 Toast .makeText (MainActivity .this , "Cancel" , Toast .LENGTH_SHORT ).show ();
@@ -91,11 +94,11 @@ public void onCancelPressed() {
9194 }
9295
9396 private void initDialogMulti () {
94- new SearchViewDialog (getSupportFragmentManager (), listString )
97+ new SearchViewDialogOldOld (getSupportFragmentManager (), listString )
9598 .enableFullScreen ()
9699 .setTitle ("ini title" )
97100 .setContent ("ini content" )
98- .onOkPressedCallBackMulti (new SearchViewDialog .OnOkPressedMulti (){
101+ .onOkPressedCallBackMulti (new SearchViewDialogOldOld .OnOkPressedMulti (){
99102 @ Override
100103 public void onOkMulti (List <SearchViewModel > data ) {
101104 String temp = "Multi Select :\n " ;
@@ -107,7 +110,7 @@ public void onOkMulti(List<SearchViewModel> data) {
107110 tv .setText (temp );
108111 }
109112 })
110- .onCancelPressedCallBack (new SearchViewDialog .OnCancelPressed () {
113+ .onCancelPressedCallBack (new SearchViewDialogOldOld .OnCancelPressed () {
111114 @ Override
112115 public void onCancelPressed () {
113116 Toast .makeText (MainActivity .this , "Cancel" , Toast .LENGTH_SHORT ).show ();
@@ -117,7 +120,7 @@ public void onCancelPressed() {
117120 }
118121
119122 private void initDialogSingleCustom () {
120- new SearchViewDialog (getSupportFragmentManager (), listString )
123+ new SearchViewDialogOldOld (getSupportFragmentManager (), listString )
121124 .setCanvasWidth (1.0 )
122125 .setDialogCanvas (getResources ().getDrawable (R .drawable .rounded_corner_2 ))
123126
@@ -164,7 +167,7 @@ private void initDialogSingleCustom() {
164167 .setTextListColor (getResources ().getColor (R .color .colorAccent ))
165168// .setTextListColor(Color.parseColor("#03DAC5"))
166169
167- .onOkPressedCallBackSingle (new SearchViewDialog .OnOkPressedSingle () {
170+ .onOkPressedCallBackSingle (new SearchViewDialogOldOld .OnOkPressedSingle () {
168171 @ Override
169172 public void onOkSingle (int position , String value ) {
170173 String temp = "Single Select :\n \n " ;
@@ -175,7 +178,7 @@ public void onOkSingle(int position, String value) {
175178 Toast .makeText (MainActivity .this , temp , Toast .LENGTH_SHORT ).show ();
176179 }
177180 })
178- .onCancelPressedCallBack (new SearchViewDialog .OnCancelPressed () {
181+ .onCancelPressedCallBack (new SearchViewDialogOldOld .OnCancelPressed () {
179182 @ Override
180183 public void onCancelPressed () {
181184 Toast .makeText (MainActivity .this , "Cancel" , Toast .LENGTH_SHORT ).show ();
@@ -186,7 +189,7 @@ public void onCancelPressed() {
186189 }
187190
188191 private void initDialogMultiCustom () {
189- new SearchViewDialog (getSupportFragmentManager (), listString )
192+ new SearchViewDialogOldOld (getSupportFragmentManager (), listString )
190193 .setCanvasWidth (1.0 )
191194 .setDialogCanvas (getResources ().getDrawable (R .drawable .rounded_corner_2 ))
192195
@@ -232,7 +235,7 @@ private void initDialogMultiCustom() {
232235 .setTextListColor (getResources ().getColor (R .color .colorAccent ))
233236// .setTextListColor(Color.parseColor("#03DAC5"))
234237
235- .onOkPressedCallBackMulti (new SearchViewDialog .OnOkPressedMulti (){
238+ .onOkPressedCallBackMulti (new SearchViewDialogOldOld .OnOkPressedMulti (){
236239 @ Override
237240 public void onOkMulti (List <SearchViewModel > data ) {
238241 String temp = "Multi Select :\n " ;
@@ -244,7 +247,7 @@ public void onOkMulti(List<SearchViewModel> data) {
244247 tv .setText (temp );
245248 }
246249 })
247- .onCancelPressedCallBack (new SearchViewDialog .OnCancelPressed () {
250+ .onCancelPressedCallBack (new SearchViewDialogOldOld .OnCancelPressed () {
248251 @ Override
249252 public void onCancelPressed () {
250253 Toast .makeText (MainActivity .this , "Cancel" , Toast .LENGTH_SHORT ).show ();
@@ -261,15 +264,15 @@ private void initDialogSingleEgi10() {
261264 listObject .add (new ExampleModel (4 , "Zein4" , "Balbar4" ));
262265
263266 String [] arrayString = {"M" , "Fadli" , "Zein" };
264- new SearchViewDialog (getSupportFragmentManager (),listString )
267+ new SearchViewDialogOldOld (getSupportFragmentManager (),listString )
265268// .setItems(listString)
266269// .setItems(listObject)
267270// .setItems(arrayString)
268271 .setTitle ("ini title" )
269272 .setContent ("ini content" )
270273 .setButtonStyle (ButtonStyle .ButtonContained )
271274 .setButtonColor (R .color .amber_200 )
272- .onOkPressedCallBackSingle (new SearchViewDialog .OnOkPressedSingle () {
275+ .onOkPressedCallBackSingle (new SearchViewDialogOldOld .OnOkPressedSingle () {
273276 @ Override
274277 public void onOkSingle (int position , String value ) {
275278 String temp = "Single Select :\n \n " ;
@@ -280,6 +283,84 @@ public void onOkSingle(int position, String value) {
280283 Toast .makeText (MainActivity .this , temp , Toast .LENGTH_SHORT ).show ();
281284 }
282285 })
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+
296+ private void initDialogSingleGZeinNumer () {
297+
298+ String [] arrayString = {"M" , "Fadli" , "Zein" };
299+ new SearchViewDialog <String >(getSupportFragmentManager ())
300+ .setItems (arrayString )
301+ .setTitle ("ini title" )
302+ .setContent ("ini content" )
303+ .setButtonStyle (ButtonStyle .ButtonContained )
304+ .onOkPressedCallBackSingle (new SearchViewDialog .OnOkPressedSingle <String >() {
305+ @ Override
306+ public void onOkSingle (String data ) {
307+ String temp = "Single Select : \n " +data .toString ();
308+ tv .setText (temp );
309+ }
310+ })
311+ .onOkPressedCallBackMulti (new SearchViewDialog .OnOkPressedMulti <String >() {
312+ @ Override
313+ public void onOkMulti (List <String > data ) {
314+ String temp = "Multi Select :\n " ;
315+ temp = temp + "Total Data => " +data .size ()+"\n \n " ;
316+ for (String d : data ){
317+ temp = temp + "Value => " + d +"\n " ;
318+ }
319+ tv .setText (temp );
320+ }
321+ })
322+ .onCancelPressedCallBack (new SearchViewDialog .OnCancelPressed () {
323+ @ Override
324+ public void onCancelPressed () {
325+ Toast .makeText (MainActivity .this , "Cancel" , Toast .LENGTH_SHORT ).show ();
326+ }
327+ })
328+ .show ();
329+ }
330+
331+
332+
333+ private void initDialogSingleGZeinNumer2 () {
334+ ArrayList <ExampleModel > listObject = new ArrayList <>();
335+ listObject .add (new ExampleModel (1 , "Zein" , "Balbar" ));
336+ listObject .add (new ExampleModel (2 , "Zein2" , "Balbar2" ));
337+ listObject .add (new ExampleModel (3 , "Zein3" , "Balbar3" ));
338+ listObject .add (new ExampleModel (4 , "Zein4" , "Balbar4" ));
339+
340+ new SearchViewDialog <ExampleModel >(getSupportFragmentManager ())
341+ .setItems (listObject )
342+ .setTitle ("ini title" )
343+ .setContent ("ini content" )
344+ .setButtonStyle (ButtonStyle .ButtonContained )
345+ .onOkPressedCallBackSingle (new SearchViewDialog .OnOkPressedSingle <ExampleModel >() {
346+ @ Override
347+ public void onOkSingle (ExampleModel data ) {
348+ String temp = "Single Select : \n " +data .toString ();
349+ tv .setText (temp );
350+ }
351+ })
352+ .onOkPressedCallBackMulti (new SearchViewDialog .OnOkPressedMulti <ExampleModel >() {
353+ @ Override
354+ public void onOkMulti (List <ExampleModel > data ) {
355+ String temp = "Multi Select :\n " ;
356+ temp = temp + "Total Data => " +data .size ()+"\n \n " ;
357+ for (ExampleModel d : data ){
358+ temp = temp + "Value => " +d .getName ()+"\n " ;
359+ temp = temp + "Value => " +d .getAddress ()+"\n " ;
360+ }
361+ tv .setText (temp );
362+ }
363+ })
283364 .onCancelPressedCallBack (new SearchViewDialog .OnCancelPressed () {
284365 @ Override
285366 public void onCancelPressed () {
0 commit comments