/ Breadcrumbs

The ultimate breadcrumbs view for Android

The ultimate breadcrumbs view for Android

KrumbsView

The ultimate breadcrumbs view for Android!

Inspired by JotterPad's breadcrumbs.

KrumbsView

Features:

  • [X] Custom typeface (from /assets and /res/font folders, also works with Downloadable Fonts)
  • [X] Customisable (text colors, text size, separator icon)
  • [X] Cool animations
  • [X] Swipe right to go back to the previous item
  • [X] Survive Activity recreations
  • [X] Extensible (open classes and protected members, extend it to get the job done!)

How to use

Import to your project

First, add it in your root build.gradle at the end of repositories:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Next, add the dependency to your app modules:

dependencies {
    ...
    compile 'com.github.adrielcafe:krumbsview:$latestVersion'
}

Current version:

JitPack

XML

<cafe.adriel.krumbsview.KrumbsView
    ...
    app:krumbsStartItem="[string]"
    app:krumbsTypeface="[string|font]"
    app:krumbsTextSize="[dimension]"
    app:krumbsBoldText="[true|false]"
    app:krumbsCurrentItemTextColor="[color]"
    app:krumbsPreviousItemTextColor="[color]"
    app:krumbsSeparatorTintColor="[color]"
    app:krumbsSeparatorIcon="[drawable]"
    app:krumbsAnimationType="[slideLeftRight|fadeInOut|growShrink]"
    app:krumbsAnimationDuration="[shortDuration|longDuration]"/>

Example:

<cafe.adriel.krumbsview.KrumbsView
    android:id="@+id/krumbsView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/colorPrimary"
    app:krumbsStartItem="Home"
    app:krumbsTypeface="@font/quicksand"
    app:krumbsTextSize="24sp"
    app:krumbsCurrentItemTextColor="@color/colorAccent"
    app:krumbsPreviousItemTextColor="@color/colorPrimaryDark"
    app:krumbsSeparatorTintColor="@color/colorPrimaryDark"
    app:krumbsSeparatorIcon="@drawable/ic_play_arrow"
    app:krumbsAnimationType="growShrink"
    app:krumbsAnimationDuration="longDuration"/>

Kotlin/Java

with(krumbsView){
    size
    getItems()
    getCurrentItem()
    addItem(Krumb("Lorem Ipsum"))
    removeLastItem()
    removeAllItems()
    goToFirstItem()
    setOnPreviousItemClickListener { /* ... */ } // Swipe right also triggers this listener
    
    // All XML options are available
    setTypeface("fonts/quicksand.ttf") // From /assets folder
    setTypeface(R.font.quicksand) // From /res/font folder
    setTypeface(MyCustomTypeface)
    setTextSizeSp(20f)
    setTextSizePx(40f)
    setBoldText(true)
    setCurrentItemTextColor(Color.WHITE)
    setPreviousItemTextColor(color(R.color.transparent_white))
    setSeparatorTintColor(color(R.color.transparent_white))
    setSeparatorIcon(R.drawable.ic_keyboard_arrow_right)
    setAnimationType(KrumbsAnimationType.GROW_SHRINK)
    setAnimationDuration(KrumbsAnimationDuration.SHORT)
}

You can also use your custom Krumb implementation:

data class MyKrumb(val id: Int, 
                   val folderName: String, 
                   val createdAt: Date) : Krumb(folderName)

with(krumbsView){
    addItem(MyKrumb(123, "Folder XYZ", now))

    val myKrumb = getCurrentItem() as MyKrumb
}

GitHub