Skip to content

Commit

Permalink
Code fixes and gradle 4.10.1
Browse files Browse the repository at this point in the history
  • Loading branch information
maltaisn committed Mar 10, 2019
1 parent 7f34ec0 commit 6416f40
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 38 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### v2.3.2
- Added a parameter with the instance of the IconHelper in `LoadCallback.onDataLoaded`.

### v2.3.1
- Prevented ADB bug where category string references weren't changed to an ID.

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'

Expand Down
4 changes: 2 additions & 2 deletions icondialog/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ ext {
siteUrl = 'https://github.com/maltaisn/icondialoglib'
gitUrl = 'https://github.com/maltaisn/icondialoglib.git'

libraryVersionCode = 12
libraryVersion = '2.3.1'
libraryVersionCode = 13
libraryVersion = '2.3.2'

developerId = 'maltaisn'

Expand Down
45 changes: 14 additions & 31 deletions icondialog/src/main/java/com/maltaisn/icondialog/IconDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,11 @@ public class IconDialog extends DialogFragment {

@Retention(RetentionPolicy.SOURCE)
@IntDef(value = {VISIBILITY_ALWAYS, VISIBILITY_NEVER, VISIBILITY_IF_LANG_AVAILABLE})
public @interface SearchVisibility {
}
public @interface SearchVisibility {}

@Retention(RetentionPolicy.SOURCE)
@IntDef(value = {VISIBILITY_ALWAYS, VISIBILITY_NEVER, VISIBILITY_IF_NO_SEARCH})
public @interface TitleVisibility {
}
public @interface TitleVisibility {}

public static final int MAX_SELECTION_NONE = -1;

Expand All @@ -103,29 +101,29 @@ public class IconDialog extends DialogFragment {
private int iconSize;
private int[] iconColors;

private @SearchVisibility
int searchVisibility;
private @Nullable
Locale searchLanguage;
@SearchVisibility
private int searchVisibility;
@Nullable
private Locale searchLanguage;
private boolean showHeaders;
private boolean stickyHeaders;
private boolean showSelectBtn;
private int maxSelection;
private boolean maxSelShowMessage;
private @Nullable
String maxSelMessage;
@Nullable
private String maxSelMessage;
private boolean showClearBtn;
private @TitleVisibility
int dialogTitleVisibility;
private @Nullable
String dialogTitle;
@TitleVisibility
private int dialogTitleVisibility;
@Nullable
private String dialogTitle;
private BaseIconFilter iconFilter;
private boolean loadIconDrawables;

private List<Item> listItems;
private List<Item> selectedItems;
private @Nullable
int[] selectedIconsId;
@Nullable
private int[] selectedIconsId;
private String searchText;

private boolean searchIgnoreDelay;
Expand Down Expand Up @@ -517,7 +515,6 @@ private Object getCaller() {

/**
* Get the list of icons matching search with category headers
*
* @param search null to get whole list, or text to search among icon labels to filter icons
* @return the list of items
*/
Expand Down Expand Up @@ -608,7 +605,6 @@ public int compare(Item i1, Item i2) {

/**
* Get the position of items in the adapter
*
* @param items array of icon items (varargs)
* @return the array of positions
*/
Expand All @@ -634,7 +630,6 @@ private int[] getItemsPosition(Item... items) {
/**
* Depending on the setting set at {@link #setSearchEnabled(int, Locale)}, checks
* whether search will be enabled or not
*
* @return true if search is enabled
*/
public boolean isSearchAvailable() {
Expand Down Expand Up @@ -671,7 +666,6 @@ public boolean isSearchAvailable() {
* Set whether search is enabled or not
* By default, search is only enabled if device's language is available
* When search is not enabled, a title will be shown on the dialog instead of the search bar
*
* @param visibility {@link #VISIBILITY_ALWAYS} to always enable search.
* {@link #VISIBILITY_NEVER} to always disable search.
* {@link #VISIBILITY_IF_LANG_AVAILABLE} to enable search only if the language is available
Expand All @@ -690,7 +684,6 @@ public IconDialog setSearchEnabled(@SearchVisibility int visibility, @Nullable L

/**
* Set the title of the dialog and when it is shown
*
* @param visibility {@link #VISIBILITY_ALWAYS} to always show the title
* {@link #VISIBILITY_NEVER} to never show the title
* {@link #VISIBILITY_IF_NO_SEARCH} to only show the title if search is not available
Expand All @@ -706,7 +699,6 @@ public IconDialog setTitle(@TitleVisibility int visibility, @Nullable String tit
/**
* Set list header options
* By default, headers are shown and are sticky
*
* @param show whether to show the headers or not
* @param sticky if headers are shown, whether they appear on top of the list when scrolling down
* @return the dialog
Expand All @@ -721,7 +713,6 @@ public IconDialog setShowHeaders(boolean show, boolean sticky) {
* Set whether the select button and the other dialog dialog buttons are shown
* If not, dialog will be dismissed immediately after an icon is clicked.
* By default, selection is shown. It is always shown if multiple selection is allowed
*
* @param show whether select button is shown or not
* @return the dialog
*/
Expand All @@ -732,7 +723,6 @@ public IconDialog setShowSelectButton(boolean show) {

/**
* Set initial selected icons
*
* @param iconIds varargs of icons id, null or empty array for no initial selection
* @return the dialog
*/
Expand All @@ -747,7 +737,6 @@ public IconDialog setSelectedIcons(@Nullable int... iconIds) {

/**
* Set initial selected icons
*
* @param icons varargs of icons, null or empty array for no initial selection
* @return the dialog
*/
Expand All @@ -769,7 +758,6 @@ public IconDialog setSelectedIcons(@Nullable Icon... icons) {

/**
* Set maximum number of icons that can be selected
*
* @param max maximum number
* @param showMessage If true, a message will be shown when maximum selection is reached
* User will need to deselect icons to select others
Expand All @@ -794,7 +782,6 @@ public IconDialog setMaxSelection(int max, boolean showMessage) {
/**
* Set whether to show the neutral clear button to unselect all icons
* By default, this button is not shown.
*
* @param show whether to show it or not
* @return the dialog
*/
Expand All @@ -809,7 +796,6 @@ public IconDialog setShowClearButton(boolean show) {
* and will be sorted by category, then by labels and then by ID
* in its value. Multiple search terms can be separated with either " ", "," or ";"
* A custom icon searcher can be set by subclassing {@link IconFilter}
*
* @param filter icon filter
* @return the dialog
*/
Expand All @@ -824,7 +810,6 @@ public IconDialog setIconFilter(BaseIconFilter filter) {
/**
* Get the IconFilter used to search and sort icons.
* You can set additionnal settings with it
*
* @return the icon searcher
* @see IconFilter#setDisabledCategories(int...)
* @see IconFilter#setDisabledIcons(int...)
Expand All @@ -837,7 +822,6 @@ public BaseIconFilter getIconFilter() {
/**
* Set whether all icon drawables will be preloaded when dialog is shown to allow a smoother
* scrolling in the icon list. By default, drawables are preloaded.
*
* @param load whether to load them or not
* @return the dialog
* @see IconHelper#loadIconDrawables()
Expand Down Expand Up @@ -1077,7 +1061,6 @@ public interface Callback {
/**
* Called on the target fragment, parent fragment or parent activity when
* icons are selected and user confirms the selection.
*
* @param icons selected icons, never null.
*/
void onIconDialogIconsSelected(@NonNull Icon[] icons);
Expand Down
11 changes: 7 additions & 4 deletions icondialog/src/main/java/com/maltaisn/icondialog/IconHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,12 @@ public class IconHelper {
private List<Label> groupLabels;
private SparseArray<Category> categories;

private @XmlRes
int extraIconsXml;
private @XmlRes
int extraLabelsXml;
@XmlRes
private int extraIconsXml;

@XmlRes
private int extraLabelsXml;

private boolean extraIconsSet;
private boolean extraIconsLoadPending;

Expand Down Expand Up @@ -711,6 +713,7 @@ public interface LoadCallback {
/**
* Called when icon data is done loading.
* All calls to get icons, labels and categories will return null before this is called.
* @param helper The icon helper instance.
*/
void onDataLoaded(IconHelper helper);
}
Expand Down

0 comments on commit 6416f40

Please sign in to comment.