mikepenz / Android-Iconics

Android-Iconics - Use any icon font, or vector (.svg) as drawable in your application.
https://mikepenz.dev
Apache License 2.0
5.18k stars 617 forks source link

iconicsDrawableStart setVisible false not working #489

Closed Nailik closed 4 years ago

Nailik commented 4 years ago

I have a IconicsTextView in XML:

<com.mikepenz.iconics.view.IconicsTextView
            android:id="@+id/txtInformation"
            style="@style/TextViewCaption"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:alpha="0.5"
            android:paddingTop="8dp"
            android:textColor="?attr/color_on_surface_background_themed"
            app:iiv_start_color="?attr/color_on_surface_background_themed"
            app:iiv_start_icon="@string/icon_barcode"
            app:iiv_start_size="20dp" />

when i set: itemView.txtInformation.iconicsDrawableStart!!.setVisible(false, false) the Icon is still visible. It returns true (hasChanged) and false for isVisible.

I use:

I would be happy if anyone can check this or if i'm the only one with this bug.

mikepenz commented 4 years ago

@Nailik the start is basically just a synonym for the compoundDrawableLeft if you want to remove a compound drawable programmatically. just use the relevant TextView method

https://developer.android.com/reference/android/widget/TextView#setCompoundDrawables(android.graphics.drawable.Drawable,%20android.graphics.drawable.Drawable,%20android.graphics.drawable.Drawable,%20android.graphics.drawable.Drawable)

(pass null for all)

Nailik commented 4 years ago

But why is it not possible to set it to invisible (Why is there the function when it doesn't work). I now use itemView.txtInformation.iconicsDrawableStart!!.alpha(0)

mikepenz commented 4 years ago

This function is from the Drawable class and not from IconicsDrawable

Nailik commented 4 years ago

I see (.. didn't check) ... So i think it's somewhere in TextView invalidateDrawable and just doesn't work with the IconcisDrawable but i can't check at the moment. Couldn't this be fixed in Iconics or do you just want to wait if this one day get's fixed in the Android lib?

mikepenz commented 4 years ago

image

As of the Drawable documentation. We might will support this at some date. But no promise. Will investigate regarding if it makes sense to offer.