Skip to content

Commit 2e3e8ae

Browse files
committed
Added IconDialog parameter to callback, release info
1 parent f8bd6ca commit 2e3e8ae

File tree

5 files changed

+18
-12
lines changed

5 files changed

+18
-12
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## v2.4.0
2+
- Added a parameter with the dialog instance to the callback method.
3+
- Spanish translation, thanks to hieudev.
4+
15
### v2.3.2
26
- Added a parameter with the instance of the IconHelper in `LoadCallback.onDataLoaded`.
37

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Icon picker dialog
22
A fully customizable icon picker dialog that provides easy access to quality icons without having to include them in your probject. Icons used by this library are nearly all part of the [Material Design Icons](https://github.com/Templarian/MaterialDesign) set, made by Google as well as several contributors. The picker include a default set of 1,045 icons as of 2.2.0 but custom icons can be added. Additional icons released on MDI may also be included in future versions.
33

4-
All icons are SVG files from which only the path was kept, which allow for a very small size. Adding this library to your app should result in a 320kB total increase in size: ~140kB from the icons, ~30kB from each language of the labels and 60kB from the code itself. For comparison, if vector drawable files were used instead of only paths, the size only for the icons would be over 400kB. Performance should not be a problem on most phones as drawables are cached.
4+
All icons are SVG files from which only the path was kept, which allow for a very small size. Adding this library to your app should result in a 350kB total increase in size: ~140kB from the icons, ~30kB from each language of the labels and 60kB from the code itself. For comparison, if vector drawable files were used instead of only paths, the size only for the icons would be over 400kB. Performance should not be a problem on most phones as drawables are cached.
55

66
### Gradle dependency
77
`compile 'com.maltaisn:icondialog:X.Y.Z'`
@@ -26,4 +26,4 @@ View [changelog](https://github.com/maltaisn/icondialoglib/blob/master/CHANGELOG
2626
- Other icons - Apache License 2.0
2727

2828
## Translations
29-
This library is available in English, French, Portuguese and German. If you make a translation please send a pull request. Translating the whole library actually takes between 3 to 5 hours (over 1,000 labels not counting aliases). For more information, visit the wiki page [Translating](https://github.com/maltaisn/icondialoglib/wiki/Translating).
29+
This library is available in English, French, Portuguese, German and Spanish. If you make a translation please send a pull request. Translating the whole library actually takes between 3 to 5 hours (over 1,000 labels not counting aliases). A collection of images with the icons for each label can be downloaded [here](https://github.com/maltaisn/icondialoglib/files/2957686/label-images.zip) and can be very useful when translating. For more information, visit the wiki page [Translating](https://github.com/maltaisn/icondialoglib/wiki/Translating).

app/src/main/java/com/maltaisn/icondialoglib/MainActivity.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ public void onSaveInstanceState(@NonNull Bundle state) {
295295
}
296296

297297
@Override
298-
public void onIconDialogIconsSelected(@NonNull Icon[] icons) {
298+
public void onIconDialogIconsSelected(IconDialog dialog, @NonNull Icon[] icons) {
299299
// Sort selected icons by ID
300300
Arrays.sort(icons, new Comparator<Icon>() {
301301
@Override
@@ -415,8 +415,8 @@ public void onClick(View v) {
415415
if (infoToast != null) infoToast.cancel();
416416
infoToast = Toast.makeText(MainActivity.this,
417417
infoFmt.format(new Object[]{icon.getId(),
418-
icon.getCategory().getName(MainActivity.this),
419-
labelsSb.toString()}), Toast.LENGTH_LONG);
418+
icon.getCategory().getName(MainActivity.this),
419+
labelsSb.toString()}), Toast.LENGTH_LONG);
420420
infoToast.show();
421421
}
422422
});
@@ -426,7 +426,8 @@ public void onClick(View v) {
426426
}
427427

428428
@Override
429-
public @NonNull IconViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
429+
public @NonNull
430+
IconViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
430431
return new IconViewHolder(getLayoutInflater().inflate(R.layout.item_icon, parent, false));
431432
}
432433

icondialog/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ ext {
1414
siteUrl = 'https://github.com/maltaisn/icondialoglib'
1515
gitUrl = 'https://github.com/maltaisn/icondialoglib.git'
1616

17-
libraryVersionCode = 13
18-
libraryVersion = '2.3.2'
17+
libraryVersionCode = 14
18+
libraryVersion = '2.4.0'
1919

2020
developerId = 'maltaisn'
2121

icondialog/src/main/java/com/maltaisn/icondialog/IconDialog.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ private void callSelectCallback() {
494494
for (int i = 0; i < icons.length; i++) {
495495
icons[i] = selectedItems.get(i).icon;
496496
}
497-
((Callback) getCaller()).onIconDialogIconsSelected(icons);
497+
((Callback) getCaller()).onIconDialogIconsSelected(this, icons);
498498
} catch (ClassCastException e) {
499499
// Callback interface is not implemented by caller
500500
}
@@ -1061,16 +1061,17 @@ public interface Callback {
10611061
/**
10621062
* Called on the target fragment, parent fragment or parent activity when
10631063
* icons are selected and user confirms the selection.
1064-
* @param icons selected icons, never null.
1064+
* @param dialog the dialog instance.
1065+
* @param icons selected icons, never null.
10651066
*/
1066-
void onIconDialogIconsSelected(@NonNull Icon[] icons);
1067+
void onIconDialogIconsSelected(IconDialog dialog, @NonNull Icon[] icons);
10671068
}
10681069

10691070
public interface DismissCallback {
10701071
/**
10711072
* Called when user dismissed the dialog.
10721073
* Called when clicked outside, when cancelled and when icons are selected
1073-
* (after {@link Callback#onIconDialogIconsSelected(Icon[])}).
1074+
* (after {@link Callback#onIconDialogIconsSelected(IconDialog, Icon[])}).
10741075
*/
10751076
void onIconDialogDismissed();
10761077
}

0 commit comments

Comments
 (0)