@@ -78,11 +78,13 @@ public class IconDialog extends DialogFragment {
78
78
79
79
@ Retention (RetentionPolicy .SOURCE )
80
80
@ IntDef (value = {VISIBILITY_ALWAYS , VISIBILITY_NEVER , VISIBILITY_IF_LANG_AVAILABLE })
81
- public @interface SearchVisibility {}
81
+ public @interface SearchVisibility {
82
+ }
82
83
83
84
@ Retention (RetentionPolicy .SOURCE )
84
85
@ IntDef (value = {VISIBILITY_ALWAYS , VISIBILITY_NEVER , VISIBILITY_IF_NO_SEARCH })
85
- public @interface TitleVisibility {}
86
+ public @interface TitleVisibility {
87
+ }
86
88
87
89
public static final int MAX_SELECTION_NONE = -1 ;
88
90
@@ -101,23 +103,29 @@ public class IconDialog extends DialogFragment {
101
103
private int iconSize ;
102
104
private int [] iconColors ;
103
105
104
- private @ SearchVisibility int searchVisibility ;
105
- private @ Nullable Locale searchLanguage ;
106
+ private @ SearchVisibility
107
+ int searchVisibility ;
108
+ private @ Nullable
109
+ Locale searchLanguage ;
106
110
private boolean showHeaders ;
107
111
private boolean stickyHeaders ;
108
112
private boolean showSelectBtn ;
109
113
private int maxSelection ;
110
114
private boolean maxSelShowMessage ;
111
- private @ Nullable String maxSelMessage ;
115
+ private @ Nullable
116
+ String maxSelMessage ;
112
117
private boolean showClearBtn ;
113
- private @ TitleVisibility int dialogTitleVisibility ;
114
- private @ Nullable String dialogTitle ;
118
+ private @ TitleVisibility
119
+ int dialogTitleVisibility ;
120
+ private @ Nullable
121
+ String dialogTitle ;
115
122
private BaseIconFilter iconFilter ;
116
123
private boolean loadIconDrawables ;
117
124
118
125
private List <Item > listItems ;
119
126
private List <Item > selectedItems ;
120
- private @ Nullable int [] selectedIconsId ;
127
+ private @ Nullable
128
+ int [] selectedIconsId ;
121
129
private String searchText ;
122
130
123
131
private boolean searchIgnoreDelay ;
@@ -155,9 +163,9 @@ public void onCreate(Bundle savedInstanceState) {
155
163
iconHelper = IconHelper .getInstance (getActivity ());
156
164
iconHelper .addLoadCallback (new IconHelper .LoadCallback () {
157
165
@ Override
158
- public void onDataLoaded () {
166
+ public void onDataLoaded (IconHelper helper ) {
159
167
if (loadIconDrawables ) {
160
- iconHelper .loadIconDrawables ();
168
+ helper .loadIconDrawables ();
161
169
}
162
170
}
163
171
});
@@ -258,7 +266,7 @@ public void onClick(View v) {
258
266
259
267
iconHelper .addLoadCallback (new IconHelper .LoadCallback () {
260
268
@ Override
261
- public void onDataLoaded () {
269
+ public void onDataLoaded (IconHelper helper ) {
262
270
loadPb .setVisibility (View .GONE );
263
271
264
272
final EditText searchEdt = view .findViewById (R .id .icd_edt_search );
@@ -305,10 +313,12 @@ public void run() {
305
313
searchEdt .setText (searchText );
306
314
searchEdt .addTextChangedListener (new TextWatcher () {
307
315
@ Override
308
- public void beforeTextChanged (CharSequence s , int start , int count , int after ) { }
316
+ public void beforeTextChanged (CharSequence s , int start , int count , int after ) {
317
+ }
309
318
310
319
@ Override
311
- public void onTextChanged (CharSequence s , int start , int before , int count ) { }
320
+ public void onTextChanged (CharSequence s , int start , int before , int count ) {
321
+ }
312
322
313
323
@ Override
314
324
public void afterTextChanged (Editable text ) {
@@ -507,6 +517,7 @@ private Object getCaller() {
507
517
508
518
/**
509
519
* Get the list of icons matching search with category headers
520
+ *
510
521
* @param search null to get whole list, or text to search among icon labels to filter icons
511
522
* @return the list of items
512
523
*/
@@ -597,6 +608,7 @@ public int compare(Item i1, Item i2) {
597
608
598
609
/**
599
610
* Get the position of items in the adapter
611
+ *
600
612
* @param items array of icon items (varargs)
601
613
* @return the array of positions
602
614
*/
@@ -622,6 +634,7 @@ private int[] getItemsPosition(Item... items) {
622
634
/**
623
635
* Depending on the setting set at {@link #setSearchEnabled(int, Locale)}, checks
624
636
* whether search will be enabled or not
637
+ *
625
638
* @return true if search is enabled
626
639
*/
627
640
public boolean isSearchAvailable () {
@@ -658,6 +671,7 @@ public boolean isSearchAvailable() {
658
671
* Set whether search is enabled or not
659
672
* By default, search is only enabled if device's language is available
660
673
* When search is not enabled, a title will be shown on the dialog instead of the search bar
674
+ *
661
675
* @param visibility {@link #VISIBILITY_ALWAYS} to always enable search.
662
676
* {@link #VISIBILITY_NEVER} to always disable search.
663
677
* {@link #VISIBILITY_IF_LANG_AVAILABLE} to enable search only if the language is available
@@ -676,6 +690,7 @@ public IconDialog setSearchEnabled(@SearchVisibility int visibility, @Nullable L
676
690
677
691
/**
678
692
* Set the title of the dialog and when it is shown
693
+ *
679
694
* @param visibility {@link #VISIBILITY_ALWAYS} to always show the title
680
695
* {@link #VISIBILITY_NEVER} to never show the title
681
696
* {@link #VISIBILITY_IF_NO_SEARCH} to only show the title if search is not available
@@ -691,6 +706,7 @@ public IconDialog setTitle(@TitleVisibility int visibility, @Nullable String tit
691
706
/**
692
707
* Set list header options
693
708
* By default, headers are shown and are sticky
709
+ *
694
710
* @param show whether to show the headers or not
695
711
* @param sticky if headers are shown, whether they appear on top of the list when scrolling down
696
712
* @return the dialog
@@ -705,6 +721,7 @@ public IconDialog setShowHeaders(boolean show, boolean sticky) {
705
721
* Set whether the select button and the other dialog dialog buttons are shown
706
722
* If not, dialog will be dismissed immediately after an icon is clicked.
707
723
* By default, selection is shown. It is always shown if multiple selection is allowed
724
+ *
708
725
* @param show whether select button is shown or not
709
726
* @return the dialog
710
727
*/
@@ -715,6 +732,7 @@ public IconDialog setShowSelectButton(boolean show) {
715
732
716
733
/**
717
734
* Set initial selected icons
735
+ *
718
736
* @param iconIds varargs of icons id, null or empty array for no initial selection
719
737
* @return the dialog
720
738
*/
@@ -729,6 +747,7 @@ public IconDialog setSelectedIcons(@Nullable int... iconIds) {
729
747
730
748
/**
731
749
* Set initial selected icons
750
+ *
732
751
* @param icons varargs of icons, null or empty array for no initial selection
733
752
* @return the dialog
734
753
*/
@@ -750,6 +769,7 @@ public IconDialog setSelectedIcons(@Nullable Icon... icons) {
750
769
751
770
/**
752
771
* Set maximum number of icons that can be selected
772
+ *
753
773
* @param max maximum number
754
774
* @param showMessage If true, a message will be shown when maximum selection is reached
755
775
* User will need to deselect icons to select others
@@ -774,6 +794,7 @@ public IconDialog setMaxSelection(int max, boolean showMessage) {
774
794
/**
775
795
* Set whether to show the neutral clear button to unselect all icons
776
796
* By default, this button is not shown.
797
+ *
777
798
* @param show whether to show it or not
778
799
* @return the dialog
779
800
*/
@@ -788,6 +809,7 @@ public IconDialog setShowClearButton(boolean show) {
788
809
* and will be sorted by category, then by labels and then by ID
789
810
* in its value. Multiple search terms can be separated with either " ", "," or ";"
790
811
* A custom icon searcher can be set by subclassing {@link IconFilter}
812
+ *
791
813
* @param filter icon filter
792
814
* @return the dialog
793
815
*/
@@ -802,6 +824,7 @@ public IconDialog setIconFilter(BaseIconFilter filter) {
802
824
/**
803
825
* Get the IconFilter used to search and sort icons.
804
826
* You can set additionnal settings with it
827
+ *
805
828
* @return the icon searcher
806
829
* @see IconFilter#setDisabledCategories(int...)
807
830
* @see IconFilter#setDisabledIcons(int...)
@@ -814,6 +837,7 @@ public BaseIconFilter getIconFilter() {
814
837
/**
815
838
* Set whether all icon drawables will be preloaded when dialog is shown to allow a smoother
816
839
* scrolling in the icon list. By default, drawables are preloaded.
840
+ *
817
841
* @param load whether to load them or not
818
842
* @return the dialog
819
843
* @see IconHelper#loadIconDrawables()
@@ -1053,6 +1077,7 @@ public interface Callback {
1053
1077
/**
1054
1078
* Called on the target fragment, parent fragment or parent activity when
1055
1079
* icons are selected and user confirms the selection.
1080
+ *
1056
1081
* @param icons selected icons, never null.
1057
1082
*/
1058
1083
void onIconDialogIconsSelected (@ NonNull Icon [] icons );
0 commit comments