diff options
Diffstat (limited to 'library/src/main/kotlin/ca/allanwang')
4 files changed, 7 insertions, 9 deletions
diff --git a/library/src/main/kotlin/ca/allanwang/kau/changelog/Changelog.kt b/library/src/main/kotlin/ca/allanwang/kau/changelog/Changelog.kt index 14b8c4e..7f71195 100644 --- a/library/src/main/kotlin/ca/allanwang/kau/changelog/Changelog.kt +++ b/library/src/main/kotlin/ca/allanwang/kau/changelog/Changelog.kt @@ -34,7 +34,7 @@ internal class ChangelogAdapter(val items: List<Pair<String, ChangelogType>>) : override fun getItemCount() = items.size internal class ChangelogVH(itemView: View) : RecyclerView.ViewHolder(itemView) { - val text: TextView = itemView.findViewById(R.id.kau_changelog_text) as TextView + val text: TextView = itemView.findViewById<TextView>(R.id.kau_changelog_text) } } diff --git a/library/src/main/kotlin/ca/allanwang/kau/kpref/items/KPrefItemCore.kt b/library/src/main/kotlin/ca/allanwang/kau/kpref/items/KPrefItemCore.kt index dcb9dc5..8d5eca2 100644 --- a/library/src/main/kotlin/ca/allanwang/kau/kpref/items/KPrefItemCore.kt +++ b/library/src/main/kotlin/ca/allanwang/kau/kpref/items/KPrefItemCore.kt @@ -42,7 +42,7 @@ abstract class KPrefItemCore(val builder: KPrefAdapterBuilder, desc?.visible()?.setText(description) else desc?.gone() - if (iicon != null) icon?.visible()?.setIcon(iicon, 48) + if (iicon != null) icon?.visible()?.setIcon(iicon, 24) else icon?.gone() innerFrame?.removeAllViews() val textColor = builder.textColor?.invoke() diff --git a/library/src/main/kotlin/ca/allanwang/kau/utils/IIconUtils.kt b/library/src/main/kotlin/ca/allanwang/kau/utils/IIconUtils.kt index d47d133..4bb72a8 100644 --- a/library/src/main/kotlin/ca/allanwang/kau/utils/IIconUtils.kt +++ b/library/src/main/kotlin/ca/allanwang/kau/utils/IIconUtils.kt @@ -11,9 +11,10 @@ import com.mikepenz.iconics.typeface.IIcon /** * Created by Allan Wang on 2017-05-29. */ -fun IIcon.toDrawable(c: Context, sizeDp: Int = 24, @ColorInt color: Int = Color.WHITE): Drawable { +fun IIcon.toDrawable(c: Context, sizeDp: Int = 24, @ColorInt color: Int = Color.WHITE, builder: IconicsDrawable.() -> Unit = {}): Drawable { val state = ColorStateList.valueOf(color) val icon = IconicsDrawable(c).icon(this).sizeDp(sizeDp) icon.setTintList(state) + icon.builder() return icon }
\ No newline at end of file diff --git a/library/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt b/library/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt index bd8478d..72b8573 100644 --- a/library/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt +++ b/library/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt @@ -1,17 +1,14 @@ package ca.allanwang.kau.utils -import android.content.res.ColorStateList import android.graphics.Color import android.support.annotation.ColorInt -import android.support.annotation.ColorRes import android.support.annotation.StringRes import android.support.design.widget.Snackbar -import android.support.v4.content.ContextCompat import android.view.View import android.view.ViewGroup import android.widget.ImageView -import android.widget.ProgressBar import android.widget.TextView +import com.mikepenz.iconics.IconicsDrawable import com.mikepenz.iconics.typeface.IIcon @@ -57,8 +54,8 @@ fun TextView.setTextIfValid(@StringRes id: Int) { if (id > 0) text = context.string(id) } -fun ImageView.setIcon(icon: IIcon?, sizeDp: Int = 24, @ColorInt color: Int = Color.WHITE) { +fun ImageView.setIcon(icon: IIcon?, sizeDp: Int = 24, @ColorInt color: Int = Color.WHITE, builder: IconicsDrawable.() -> Unit = {}) { if (icon == null) return - setImageDrawable(icon.toDrawable(context, sizeDp, color)) + setImageDrawable(icon.toDrawable(context, sizeDp = sizeDp, color = color, builder = builder)) } |