File tree 2 files changed +7
-6
lines changed
lib/src/main/kotlin/com/maltaisn/icondialog/pack
2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -33,18 +33,18 @@ import java.nio.ByteOrder
33
33
* Class use to load icon drawables.
34
34
* @param context Any context, needed to get resources.
35
35
*/
36
- open class IconDrawableLoader (context : Context ) {
36
+ class IconDrawableLoader (context : Context ) {
37
37
38
38
private val context = context.applicationContext
39
39
40
40
/* *
41
41
* Create the vector drawable for an [icon] and set it.
42
42
*/
43
43
@SuppressLint(" DiscouragedPrivateApi,PrivateApi" )
44
- open fun loadDrawable (icon : Icon ): Drawable ? {
44
+ fun loadDrawable (icon : Icon ) {
45
45
if (icon.drawable != null ) {
46
46
// Icon drawable is already loaded.
47
- return icon.drawable
47
+ return
48
48
}
49
49
50
50
val drawable: Drawable ?
@@ -74,11 +74,10 @@ open class IconDrawableLoader(context: Context) {
74
74
} catch (e: Exception ) {
75
75
// Could not load icon.
76
76
Log .e(TAG , " Could not create vector drawable for icon ID ${icon.id} ." , e)
77
- return null
77
+ return
78
78
}
79
79
80
80
icon.drawable = drawable
81
- return icon.drawable
82
81
}
83
82
84
83
companion object {
Original file line number Diff line number Diff line change @@ -83,7 +83,9 @@ class IconPack(val parent: IconPack? = null,
83
83
* or if the drawable couldn't be loaded with the [loader].
84
84
*/
85
85
fun getIconDrawable (id : Int , loader : IconDrawableLoader ): Drawable ? {
86
- return loader.loadDrawable(getIcon(id) ? : return null )
86
+ val icon = getIcon(id) ? : return null
87
+ loader.loadDrawable(icon)
88
+ return icon.drawable
87
89
}
88
90
89
91
/* *
You can’t perform that action at this time.
0 commit comments