From e6358ca224b4a3f46f210235ce30e4d9ab2b19df Mon Sep 17 00:00:00 2001 From: Conny Duck Date: Wed, 1 May 2024 20:21:09 +0200 Subject: [PATCH 1/5] improve breadcrumbs --- .../org/fossify/commons/views/Breadcrumbs.kt | 141 ++++-------------- .../src/main/res/layout/item_breadcrumb.xml | 3 +- .../main/res/layout/item_breadcrumb_first.xml | 19 --- 3 files changed, 31 insertions(+), 132 deletions(-) delete mode 100644 commons/src/main/res/layout/item_breadcrumb_first.xml diff --git a/commons/src/main/kotlin/org/fossify/commons/views/Breadcrumbs.kt b/commons/src/main/kotlin/org/fossify/commons/views/Breadcrumbs.kt index baabcf951..bd8bb0543 100644 --- a/commons/src/main/kotlin/org/fossify/commons/views/Breadcrumbs.kt +++ b/commons/src/main/kotlin/org/fossify/commons/views/Breadcrumbs.kt @@ -2,39 +2,38 @@ package org.fossify.commons.views import android.content.Context import android.content.res.ColorStateList -import android.graphics.drawable.ColorDrawable import android.util.AttributeSet import android.util.TypedValue import android.view.LayoutInflater import android.view.View import android.widget.HorizontalScrollView import android.widget.LinearLayout -import androidx.core.content.ContextCompat -import androidx.core.view.ViewCompat +import androidx.core.widget.TextViewCompat import org.fossify.commons.R import org.fossify.commons.databinding.ItemBreadcrumbBinding -import org.fossify.commons.databinding.ItemBreadcrumbFirstBinding -import org.fossify.commons.extensions.* +import org.fossify.commons.extensions.getBasePath +import org.fossify.commons.extensions.getProperPrimaryColor +import org.fossify.commons.extensions.getProperTextColor +import org.fossify.commons.extensions.humanizePath import org.fossify.commons.models.FileDirItem class Breadcrumbs(context: Context, attrs: AttributeSet) : HorizontalScrollView(context, attrs) { private val inflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater private val itemsLayout: LinearLayout private var textColor = context.getProperTextColor() + private var accentColor = context.getProperPrimaryColor() private var fontSize = resources.getDimension(R.dimen.bigger_text_size) private var lastPath = "" private var isLayoutDirty = true private var isScrollToSelectedItemPending = false private var isFirstScroll = true - private var stickyRootInitialLeft = 0 - private var rootStartPadding = 0 private val textColorStateList: ColorStateList get() = ColorStateList( arrayOf(intArrayOf(android.R.attr.state_activated), intArrayOf()), intArrayOf( - textColor, - textColor.adjustAlpha(0.6f) + accentColor, + textColor ) ) @@ -45,49 +44,9 @@ class Breadcrumbs(context: Context, attrs: AttributeSet) : HorizontalScrollView( isHorizontalScrollBarEnabled = false itemsLayout = LinearLayout(context) itemsLayout.orientation = LinearLayout.HORIZONTAL - rootStartPadding = paddingStart - itemsLayout.setPaddingRelative(0, paddingTop, paddingEnd, paddingBottom) + itemsLayout.setPaddingRelative(paddingStart, paddingTop, paddingEnd, paddingBottom) setPaddingRelative(0, 0, 0, 0) addView(itemsLayout, LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT)) - onGlobalLayout { - stickyRootInitialLeft = if (itemsLayout.childCount > 0) { - itemsLayout.getChildAt(0).left - } else { - 0 - } - } - } - - private fun recomputeStickyRootLocation(left: Int) { - stickyRootInitialLeft = left - handleRootStickiness(scrollX) - } - - private fun handleRootStickiness(scrollX: Int) { - if (scrollX > stickyRootInitialLeft) { - stickRoot(scrollX - stickyRootInitialLeft) - } else { - freeRoot() - } - } - - private fun freeRoot() { - if (itemsLayout.childCount > 0) { - itemsLayout.getChildAt(0).translationX = 0f - } - } - - private fun stickRoot(translationX: Int) { - if (itemsLayout.childCount > 0) { - val root = itemsLayout.getChildAt(0) - root.translationX = translationX.toFloat() - ViewCompat.setTranslationZ(root, translationZ) - } - } - - override fun onScrollChanged(scrollX: Int, scrollY: Int, oldScrollX: Int, oldScrollY: Int) { - super.onScrollChanged(scrollX, scrollY, oldScrollX, oldScrollY) - handleRootStickiness(scrollX) } override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) { @@ -98,8 +57,6 @@ class Breadcrumbs(context: Context, attrs: AttributeSet) : HorizontalScrollView( scrollToSelectedItem() isScrollToSelectedItemPending = false } - - recomputeStickyRootLocation(left) } private fun scrollToSelectedItem() { @@ -146,73 +103,36 @@ class Breadcrumbs(context: Context, attrs: AttributeSet) : HorizontalScrollView( val tempPath = context.humanizePath(fullPath) itemsLayout.removeAllViews() - val dirs = tempPath.split("/").dropLastWhile(String::isEmpty) - for (i in dirs.indices) { - val dir = dirs[i] - if (i > 0) { - currPath += dir + "/" - } - - if (dir.isEmpty()) { - continue - } - - currPath = "${currPath.trimEnd('/')}/" - val item = FileDirItem(currPath, dir, true, 0, 0, 0) - addBreadcrumb(item, i, i > 0) - scrollToSelectedItem() - } - } - - private fun addBreadcrumb(item: FileDirItem, index: Int, addPrefix: Boolean) { - if (itemsLayout.childCount == 0) { - val firstItemBgColor = if (isShownInDialog && context.baseConfig.isUsingSystemTheme) { - resources.getColor(R.color.you_dialog_background_color, context.theme) - } else { - context.getProperBackgroundColor() - } - - - ItemBreadcrumbFirstBinding.inflate(inflater, itemsLayout, false).apply { - resources.apply { - breadcrumbText.background = ContextCompat.getDrawable(context, R.drawable.button_background) - breadcrumbText.background.applyColorFilter(textColor) - elevation = 1f - background = ColorDrawable(firstItemBgColor) - val medium = getDimension(R.dimen.medium_margin).toInt() - breadcrumbText.setPadding(medium, medium, medium, medium) - setPadding(rootStartPadding, 0, 0, 0) + tempPath.split("/") + .dropLastWhile(String::isEmpty) + .forEachIndexed { i, dir -> + if (i > 0) { + currPath += "$dir/" } - - isActivated = item.path.trimEnd('/') == lastPath.trimEnd('/') - breadcrumbText.text = item.name - breadcrumbText.setTextColor(textColorStateList) - breadcrumbText.setTextSize(TypedValue.COMPLEX_UNIT_PX, fontSize) - - itemsLayout.addView(this.root) - - breadcrumbText.setOnClickListener { - if (itemsLayout.getChildAt(index) != null) { - listener?.breadcrumbClicked(index) - } + if (dir.isEmpty()) { + return@forEachIndexed } - - root.tag = item + currPath = "${currPath.trimEnd('/')}/" + val item = FileDirItem(currPath, dir, true, 0, 0, 0) + addBreadcrumb(item, i, i > 0) + scrollToSelectedItem() } - } else { - ItemBreadcrumbBinding.inflate(inflater, itemsLayout, false).apply { - var textToAdd = item.name - if (addPrefix) { - textToAdd = "> $textToAdd" - } + } - isActivated = item.path.trimEnd('/') == lastPath.trimEnd('/') + private fun addBreadcrumb(item: FileDirItem, index: Int, isLast: Boolean) { + ItemBreadcrumbBinding.inflate(inflater, itemsLayout, false).apply { + breadcrumbText.isActivated = isLast - breadcrumbText.text = textToAdd + breadcrumbText.text = item.name breadcrumbText.setTextColor(textColorStateList) breadcrumbText.setTextSize(TypedValue.COMPLEX_UNIT_PX, fontSize) + breadcrumbText.text itemsLayout.addView(root) + if (index > 0) { + TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(breadcrumbText, R.drawable.ic_chevron_right_vector, 0, 0, 0) + TextViewCompat.setCompoundDrawableTintList(breadcrumbText, textColorStateList) + } breadcrumbText.setOnClickListener { v -> if (itemsLayout.getChildAt(index) != null && itemsLayout.getChildAt(index) == v) { @@ -226,7 +146,6 @@ class Breadcrumbs(context: Context, attrs: AttributeSet) : HorizontalScrollView( root.tag = item } - } } fun updateColor(color: Int) { diff --git a/commons/src/main/res/layout/item_breadcrumb.xml b/commons/src/main/res/layout/item_breadcrumb.xml index 05980f6c8..829cf8863 100644 --- a/commons/src/main/res/layout/item_breadcrumb.xml +++ b/commons/src/main/res/layout/item_breadcrumb.xml @@ -3,10 +3,9 @@ android:id="@+id/breadcrumb_text" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:background="@drawable/selector_clickable" android:gravity="center_vertical" android:minHeight="@dimen/breadcrumbs_layout_height" - android:paddingLeft="@dimen/small_margin" android:paddingTop="@dimen/medium_margin" - android:paddingRight="@dimen/small_margin" android:paddingBottom="@dimen/medium_margin" android:textSize="@dimen/normal_text_size" /> diff --git a/commons/src/main/res/layout/item_breadcrumb_first.xml b/commons/src/main/res/layout/item_breadcrumb_first.xml deleted file mode 100644 index 145ddadf3..000000000 --- a/commons/src/main/res/layout/item_breadcrumb_first.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - From 5329d2fb917b3e81f649c4e04c51a239a0d39166 Mon Sep 17 00:00:00 2001 From: Conny Duck Date: Tue, 19 Nov 2024 11:40:30 +0100 Subject: [PATCH 2/5] restore frame around first breadcrumb item --- .../org/fossify/commons/views/Breadcrumbs.kt | 51 +++++++++++-------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/commons/src/main/kotlin/org/fossify/commons/views/Breadcrumbs.kt b/commons/src/main/kotlin/org/fossify/commons/views/Breadcrumbs.kt index bd8bb0543..9967787f6 100644 --- a/commons/src/main/kotlin/org/fossify/commons/views/Breadcrumbs.kt +++ b/commons/src/main/kotlin/org/fossify/commons/views/Breadcrumbs.kt @@ -8,9 +8,12 @@ import android.view.LayoutInflater import android.view.View import android.widget.HorizontalScrollView import android.widget.LinearLayout +import androidx.core.content.ContextCompat +import androidx.core.view.updatePadding import androidx.core.widget.TextViewCompat import org.fossify.commons.R import org.fossify.commons.databinding.ItemBreadcrumbBinding +import org.fossify.commons.extensions.applyColorFilter import org.fossify.commons.extensions.getBasePath import org.fossify.commons.extensions.getProperPrimaryColor import org.fossify.commons.extensions.getProperTextColor @@ -120,32 +123,36 @@ class Breadcrumbs(context: Context, attrs: AttributeSet) : HorizontalScrollView( } private fun addBreadcrumb(item: FileDirItem, index: Int, isLast: Boolean) { - ItemBreadcrumbBinding.inflate(inflater, itemsLayout, false).apply { - breadcrumbText.isActivated = isLast - - breadcrumbText.text = item.name - breadcrumbText.setTextColor(textColorStateList) - breadcrumbText.setTextSize(TypedValue.COMPLEX_UNIT_PX, fontSize) - breadcrumbText.text - - itemsLayout.addView(root) - if (index > 0) { - TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(breadcrumbText, R.drawable.ic_chevron_right_vector, 0, 0, 0) - TextViewCompat.setCompoundDrawableTintList(breadcrumbText, textColorStateList) - } + ItemBreadcrumbBinding.inflate(inflater, itemsLayout, false).apply { + breadcrumbText.isActivated = isLast + + breadcrumbText.text = item.name + breadcrumbText.setTextColor(textColorStateList) + breadcrumbText.setTextSize(TypedValue.COMPLEX_UNIT_PX, fontSize) + + itemsLayout.addView(root) + if (index > 0) { + TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(breadcrumbText, R.drawable.ic_chevron_right_vector, 0, 0, 0) + TextViewCompat.setCompoundDrawableTintList(breadcrumbText, textColorStateList) + } else { + breadcrumbText.background = ContextCompat.getDrawable(context, R.drawable.button_background) + breadcrumbText.background.applyColorFilter(textColor) + val horizontalPadding = context.resources.getDimensionPixelSize(R.dimen.normal_margin) + breadcrumbText.updatePadding(left = horizontalPadding, right = horizontalPadding) + } - breadcrumbText.setOnClickListener { v -> - if (itemsLayout.getChildAt(index) != null && itemsLayout.getChildAt(index) == v) { - if ((v.tag as? FileDirItem)?.path?.trimEnd('/') == lastPath.trimEnd('/')) { - scrollToSelectedItem() - } else { - listener?.breadcrumbClicked(index) - } + breadcrumbText.setOnClickListener { v -> + if (itemsLayout.getChildAt(index) != null && itemsLayout.getChildAt(index) == v) { + if ((v.tag as? FileDirItem)?.path?.trimEnd('/') == lastPath.trimEnd('/')) { + scrollToSelectedItem() + } else { + listener?.breadcrumbClicked(index) } } - - root.tag = item } + + root.tag = item + } } fun updateColor(color: Int) { From 1c00f26602b2b9e88d241631f9672ddb1121a87d Mon Sep 17 00:00:00 2001 From: Naveen Singh Date: Tue, 7 Jan 2025 00:21:56 +0530 Subject: [PATCH 3/5] Fix last breadcrumb check --- .../src/main/kotlin/org/fossify/commons/views/Breadcrumbs.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commons/src/main/kotlin/org/fossify/commons/views/Breadcrumbs.kt b/commons/src/main/kotlin/org/fossify/commons/views/Breadcrumbs.kt index 9967787f6..2d873c6a6 100644 --- a/commons/src/main/kotlin/org/fossify/commons/views/Breadcrumbs.kt +++ b/commons/src/main/kotlin/org/fossify/commons/views/Breadcrumbs.kt @@ -117,7 +117,7 @@ class Breadcrumbs(context: Context, attrs: AttributeSet) : HorizontalScrollView( } currPath = "${currPath.trimEnd('/')}/" val item = FileDirItem(currPath, dir, true, 0, 0, 0) - addBreadcrumb(item, i, i > 0) + addBreadcrumb(item = item, index = i, isLast = item.path.trimEnd('/') == lastPath.trimEnd('/')) scrollToSelectedItem() } } From ca1a79de215c95b4fb2d1a015683dcbd3b3cbacf Mon Sep 17 00:00:00 2001 From: Naveen Singh Date: Thu, 9 Jan 2025 17:10:16 +0530 Subject: [PATCH 4/5] Fix breadcrumb button click listener It didn't call `breadcrumbClicked()` when there is only one item. --- .../src/main/kotlin/org/fossify/commons/views/Breadcrumbs.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commons/src/main/kotlin/org/fossify/commons/views/Breadcrumbs.kt b/commons/src/main/kotlin/org/fossify/commons/views/Breadcrumbs.kt index 2d873c6a6..a708861a1 100644 --- a/commons/src/main/kotlin/org/fossify/commons/views/Breadcrumbs.kt +++ b/commons/src/main/kotlin/org/fossify/commons/views/Breadcrumbs.kt @@ -143,7 +143,7 @@ class Breadcrumbs(context: Context, attrs: AttributeSet) : HorizontalScrollView( breadcrumbText.setOnClickListener { v -> if (itemsLayout.getChildAt(index) != null && itemsLayout.getChildAt(index) == v) { - if ((v.tag as? FileDirItem)?.path?.trimEnd('/') == lastPath.trimEnd('/')) { + if (index != 0 && isLast) { scrollToSelectedItem() } else { listener?.breadcrumbClicked(index) From 2906377f9003d0cdea4fc6ee84ade39e90630402 Mon Sep 17 00:00:00 2001 From: Naveen Singh Date: Thu, 9 Jan 2025 19:10:11 +0530 Subject: [PATCH 5/5] Restore sticky breadcrumb and fix overlap --- .../commons/extensions/Context-styling.kt | 11 +++ .../org/fossify/commons/views/Breadcrumbs.kt | 88 +++++++++++++++++-- .../drawable/breadcrumb_button_background.xml | 17 ++++ .../src/main/res/layout/item_breadcrumb.xml | 12 ++- 4 files changed, 116 insertions(+), 12 deletions(-) create mode 100644 commons/src/main/res/drawable/breadcrumb_button_background.xml diff --git a/commons/src/main/kotlin/org/fossify/commons/extensions/Context-styling.kt b/commons/src/main/kotlin/org/fossify/commons/extensions/Context-styling.kt index ca32edb5e..eba99dec0 100644 --- a/commons/src/main/kotlin/org/fossify/commons/extensions/Context-styling.kt +++ b/commons/src/main/kotlin/org/fossify/commons/extensions/Context-styling.kt @@ -7,6 +7,7 @@ import android.content.pm.PackageManager import android.content.res.Configuration import android.graphics.Color import android.view.ViewGroup +import androidx.core.content.res.ResourcesCompat import androidx.loader.content.CursorLoader import org.fossify.commons.R import org.fossify.commons.helpers.* @@ -216,3 +217,13 @@ fun Context.getBottomNavigationBackgroundColor(): Int { } return bottomColor } + +fun Context.getDialogBackgroundColor(): Int { + return when { + isDynamicTheme() -> ResourcesCompat.getColor( + resources, R.color.you_dialog_background_color, theme + ) + + else -> baseConfig.backgroundColor + } +} \ No newline at end of file diff --git a/commons/src/main/kotlin/org/fossify/commons/views/Breadcrumbs.kt b/commons/src/main/kotlin/org/fossify/commons/views/Breadcrumbs.kt index a708861a1..dadbf2275 100644 --- a/commons/src/main/kotlin/org/fossify/commons/views/Breadcrumbs.kt +++ b/commons/src/main/kotlin/org/fossify/commons/views/Breadcrumbs.kt @@ -2,26 +2,34 @@ package org.fossify.commons.views import android.content.Context import android.content.res.ColorStateList +import android.graphics.drawable.GradientDrawable +import android.graphics.drawable.RippleDrawable import android.util.AttributeSet import android.util.TypedValue import android.view.LayoutInflater import android.view.View import android.widget.HorizontalScrollView import android.widget.LinearLayout -import androidx.core.content.ContextCompat +import androidx.appcompat.content.res.AppCompatResources +import androidx.core.view.ViewCompat import androidx.core.view.updatePadding import androidx.core.widget.TextViewCompat import org.fossify.commons.R import org.fossify.commons.databinding.ItemBreadcrumbBinding -import org.fossify.commons.extensions.applyColorFilter +import org.fossify.commons.extensions.adjustAlpha import org.fossify.commons.extensions.getBasePath +import org.fossify.commons.extensions.getDialogBackgroundColor import org.fossify.commons.extensions.getProperPrimaryColor import org.fossify.commons.extensions.getProperTextColor import org.fossify.commons.extensions.humanizePath +import org.fossify.commons.extensions.onGlobalLayout +import org.fossify.commons.extensions.setDrawablesRelativeWithIntrinsicBounds +import org.fossify.commons.helpers.MEDIUM_ALPHA import org.fossify.commons.models.FileDirItem class Breadcrumbs(context: Context, attrs: AttributeSet) : HorizontalScrollView(context, attrs) { - private val inflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater + private val inflater = + context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater private val itemsLayout: LinearLayout private var textColor = context.getProperTextColor() private var accentColor = context.getProperPrimaryColor() @@ -30,6 +38,7 @@ class Breadcrumbs(context: Context, attrs: AttributeSet) : HorizontalScrollView( private var isLayoutDirty = true private var isScrollToSelectedItemPending = false private var isFirstScroll = true + private var stickyRootInitialLeft = 0 private val textColorStateList: ColorStateList get() = ColorStateList( @@ -50,6 +59,45 @@ class Breadcrumbs(context: Context, attrs: AttributeSet) : HorizontalScrollView( itemsLayout.setPaddingRelative(paddingStart, paddingTop, paddingEnd, paddingBottom) setPaddingRelative(0, 0, 0, 0) addView(itemsLayout, LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT)) + onGlobalLayout { + stickyRootInitialLeft = if (itemsLayout.childCount > 0) { + itemsLayout.getChildAt(0).left + } else { + 0 + } + } + } + + private fun recomputeStickyRootLocation(left: Int) { + stickyRootInitialLeft = left + handleRootStickiness(scrollX) + } + + private fun handleRootStickiness(scrollX: Int) { + if (scrollX > stickyRootInitialLeft) { + stickRoot(scrollX - stickyRootInitialLeft) + } else { + freeRoot() + } + } + + private fun freeRoot() { + if (itemsLayout.childCount > 0) { + itemsLayout.getChildAt(0).translationX = 0f + } + } + + private fun stickRoot(translationX: Int) { + if (itemsLayout.childCount > 0) { + val root = itemsLayout.getChildAt(0) + root.translationX = translationX.toFloat() + ViewCompat.setTranslationZ(root, translationZ) + } + } + + override fun onScrollChanged(scrollX: Int, scrollY: Int, oldScrollX: Int, oldScrollY: Int) { + super.onScrollChanged(scrollX, scrollY, oldScrollX, oldScrollY) + handleRootStickiness(scrollX) } override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) { @@ -60,6 +108,8 @@ class Breadcrumbs(context: Context, attrs: AttributeSet) : HorizontalScrollView( scrollToSelectedItem() isScrollToSelectedItemPending = false } + + recomputeStickyRootLocation(left) } private fun scrollToSelectedItem() { @@ -117,7 +167,11 @@ class Breadcrumbs(context: Context, attrs: AttributeSet) : HorizontalScrollView( } currPath = "${currPath.trimEnd('/')}/" val item = FileDirItem(currPath, dir, true, 0, 0, 0) - addBreadcrumb(item = item, index = i, isLast = item.path.trimEnd('/') == lastPath.trimEnd('/')) + addBreadcrumb( + item = item, + index = i, + isLast = item.path.trimEnd('/') == lastPath.trimEnd('/') + ) scrollToSelectedItem() } } @@ -132,12 +186,18 @@ class Breadcrumbs(context: Context, attrs: AttributeSet) : HorizontalScrollView( itemsLayout.addView(root) if (index > 0) { - TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(breadcrumbText, R.drawable.ic_chevron_right_vector, 0, 0, 0) + breadcrumbText.setDrawablesRelativeWithIntrinsicBounds( + start = AppCompatResources.getDrawable( + context, R.drawable.ic_chevron_right_vector + ) + ) + TextViewCompat.setCompoundDrawableTintList(breadcrumbText, textColorStateList) } else { - breadcrumbText.background = ContextCompat.getDrawable(context, R.drawable.button_background) - breadcrumbText.background.applyColorFilter(textColor) - val horizontalPadding = context.resources.getDimensionPixelSize(R.dimen.normal_margin) + breadcrumbText.elevation = context.resources.getDimension(R.dimen.one_dp) + setupStickyBreadcrumbBackground(breadcrumbText) + val horizontalPadding = + context.resources.getDimensionPixelSize(R.dimen.normal_margin) breadcrumbText.updatePadding(left = horizontalPadding, right = horizontalPadding) } @@ -155,6 +215,18 @@ class Breadcrumbs(context: Context, attrs: AttributeSet) : HorizontalScrollView( } } + private fun setupStickyBreadcrumbBackground(view: MyTextView) { + val drawable = view.background.mutate() as RippleDrawable + (drawable.getDrawable(0) as GradientDrawable) + .apply { + setColor(context.getDialogBackgroundColor()) + setStroke( + context.resources.getDimensionPixelSize(R.dimen.one_dp), + context.getProperPrimaryColor().adjustAlpha(MEDIUM_ALPHA) + ) + } + } + fun updateColor(color: Int) { textColor = color setBreadcrumb(lastPath) diff --git a/commons/src/main/res/drawable/breadcrumb_button_background.xml b/commons/src/main/res/drawable/breadcrumb_button_background.xml new file mode 100644 index 000000000..924727ccd --- /dev/null +++ b/commons/src/main/res/drawable/breadcrumb_button_background.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + diff --git a/commons/src/main/res/layout/item_breadcrumb.xml b/commons/src/main/res/layout/item_breadcrumb.xml index 829cf8863..6026156be 100644 --- a/commons/src/main/res/layout/item_breadcrumb.xml +++ b/commons/src/main/res/layout/item_breadcrumb.xml @@ -1,11 +1,15 @@ + android:paddingVertical="@dimen/medium_margin" + android:paddingStart="0dp" + android:paddingEnd="@dimen/tiny_margin" + android:textSize="@dimen/normal_text_size" + tools:drawableStart="@drawable/ic_chevron_right_vector" + tools:text="Fossify" />