Awesome Open Source
Awesome Open Source

JitPack API License: MIT Android Arsenal

KrumbsView

The ultimate breadcrumbs view for Android!

Inspired by JotterPad's breadcrumbs.

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 {
    ...
    implementation 'com.github.adrielcafe:krumbsview:$latestVersion'
}

Current version:

JitPack

XML

<cafe.adriel.krumbsview.KrumbsView
    ...
    app:krumbsStartItem="[string]"
    app:krumbsPaddingStartItem="[dimension]"
    app:krumbsPreviousItemCharacters="[integer]"
    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)
    setPaddingStartItem(10f)
    setPreviousItemCharacters(2)
    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
}

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
android (6,230
kotlin (3,516
android-library (794
kotlin-android (329
android-ui (219
kotlin-library (135
android-view (21
breadcrumbs (21

Find Open Source By Browsing 7,000 Topics Across 59 Categories