Skip to content

Commit

Permalink
add more options to toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
am3n committed Jan 14, 2022
1 parent 51299dd commit c1515e3
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion needtool/src/main/java/ir/am3n/needtool/views/A3Toolbar.kt
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ class A3Toolbar : RelativeLayout {
imgbBack?.scaleX = if (isRtl) -1f else 1f



txtTitle?.updateLayoutParams<LayoutParams> {
width = LayoutParams.MATCH_PARENT
height = layoutParams.height
Expand Down Expand Up @@ -292,6 +291,25 @@ class A3Toolbar : RelativeLayout {

//**************************************************************************************************

fun setBackIcon(@DrawableRes iconResource: Int?) {
if (iconResource != null) {
imgbBackIcon = iconResource
imgbBack?.setImageResource(imgbBackIcon!!)
}
}

fun setBackIconTint(@ColorInt tint: Int?) {
if (imgbBack != null && tint != null) {
imgbBackTint = tint
ImageViewCompat.setImageTintList(imgbBack!!, imgbBackTint!!.asStateList)
}
}

fun setBackIconPadding(padding: Int) {
imgbBackPadding = padding
imgbBack?.setPadding(imgbBackPadding!!)
}

fun setTitle(title: String) {
txtTitle?.text = title
}
Expand Down

0 comments on commit c1515e3

Please sign in to comment.