Jetlime - A simple library for TimeLine view in Android

Overview

JetLime ⏱️

A simple yet highly customizable library for showing a TimeLine view

Compose Compose Maven Central Github Followers Twitter Follow

Made with using Compose

Simple Animated Fancy

Implementation

In build.gradle of app module, include the following dependency

dependencies {
  implementation("io.github.pushpalroy:jetlime:1.0.0")
}

Usage

✌🏻 To start using JetLime, use the composable JetLimeView like this:

val jetLimeList = remember {
  mutableStateListOf(
    JetLimeItem(
      title = "Item title",
      description = "Item description",
      jetLimeItemConfig = JetLimeItemConfig(
        itemHeight = 80.dp,
        iconType = IconType.Filled
      )
    )
  )
}

JetLimeView(
  jetLimeItems = jetLimeList,
  jetLimeViewConfig = JetLimeViewConfig(lineType = LineType.Solid),
  modifier = Modifier.padding(16.dp)
)

🤘🏻 To customize JetLimeView more play around with JetLimeViewConfig:

val jetTimeLineViewConfig = JetLimeViewConfig(
  backgroundColor = Color(0xFF747474),
  lineColor = Color(0xff00ACEE),
  lineThickness = 12F,
  lineType = LineType.Solid,
  lineStartMargin = 48.dp,
  lineEndMargin = 36.dp,
  iconSize = 26.dp,
  iconShape = CircleShape,
  iconBorderThickness = 2.dp,
  itemSpacing = 0.dp,
  enableItemAnimation = false,
  showIcons = true
)

👌🏻 To customize each item of the view configure JetLimeItemConfig for each item:

val jetLimeItemConfig = JetLimeItemConfig(
  titleColor = Color(0xFF2C2C2C),
  descriptionColor = Color(0xFF3A3A3A),
  iconType = IconType.Checked,
  iconColor = Color(0xFF3F51B5),
  iconBorderColor = Color(0xFFFFFFFF),
  iconBackgroundColor = Color(0xFF44485F),
  itemHeight = 60.dp
)

😲 Custom animations can be done for each item icon using iconAnimation:

  val jetLimeItemConfig = JetLimeItemConfig(
    iconAnimation = IconAnimation(
      initialValue = 0.5f,
      targetValue = 1.5f,
      keySpecs = keyframes {
        durationMillis = 500
        0.6f at 0
        0.7f at 100
        0.8f at 200
        0.9f at 300
        1f at 500
      }
    )
)

😱 Apart from title and description you can pass any composable to JetLimeItem:

JetLimeItem(
  title = "Some Title",
  description = "Some Description"
) {
  // Pass any composable here
}

🤪 Use custom icon of ImageVector type for each item:

iconType = IconType.Custom(Icons.Rounded.AccountCircle)

🙏 Got inspired by:

Timeline-View by Vipul Asri

License

MIT License

Copyright (c) 2022 Pushpal Roy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
You might also like...
FlipTimerView library for Android
FlipTimerView library for Android

FlipTimerView Preview FlipTimerView library for Android Getting started Add it in your root build.gradle at the end of repositories: allprojects { re

[NO LONGER MAINTAINED] Android library for better Picker DialogFragments
[NO LONGER MAINTAINED] Android library for better Picker DialogFragments

/!\ This Project is no longer maintained /!\ DialogFragments modeled after the AOSP Clock and Calendar apps to improve UX for picking time, date, numb

A customizable, easy-to-use, and functional circular time range picker library for Android
A customizable, easy-to-use, and functional circular time range picker library for Android

A customizable, easy-to-use, and functional circular time range picker library for Android. Use this library to mimic Apple's iOS or Samsung's bedtime picker.

Country-code-picker-compose - An android library Jetpack Compose which provides an easy way to search and select country or country phone code
Android Compose wheel picker library based on LazyColumn in vertical and LazyRow in horizontal.

About Android Compose wheel picker library based on LazyColumn in vertical and LazyRow in horizontal. Gradle Sample Default Item size Unfocused count

Nepali Date Picker library in Jetpack compose for android with Date conversion from BS to AD and vice-versa
Nepali Date Picker library in Jetpack compose for android with Date conversion from BS to AD and vice-versa

Nepali Date picker Converter - Re in Compose This is a re-work of Nepali Date Picker Converter in jetpack compose and kotlin. English Locale Nepali Lo

Alwan 🎨 is an Android Jetpack Compose color picker library.
Alwan 🎨 is an Android Jetpack Compose color picker library.

Alwan Alwan is an Android Jetpack Compose color picker library. Preview Recording.mp4 Download Gradle: dependencies { implementation 'com.raedapps:a

JetCalendarView - A calendar library for Jetpack Compose
JetCalendarView - A calendar library for Jetpack Compose

JetCalendar WIP 2022 Hit Refresh! Calendar view ❤️ Jetpack Compose License Copyr

A Material design back port of Android's CalendarView
A Material design back port of Android's CalendarView

Material Calendar View A Material design back port of Android's CalendarView. The goal is to have a Material look and feel, rather than 100% parity wi

Comments
  • Way to scroll to particular JetLimeItem?

    Way to scroll to particular JetLimeItem?

    Is there any way right now to be able to scroll to particular JetLimeItem in the list? I'm using for bus stops on particular route and ideally would like, as data is updated, to scroll to JetLimeItem for the next stop a bus is due to arrive at.

    opened by joreilly 2
  • Possible recomposition issue

    Possible recomposition issue

    Hi, I'm having issue where UI isn't updating when I create new JetLimeItemsModel in response to some data being updated...I have made changes locally that seems to fix it but not sure if there are other ramifications of making that change.

    So, firstly this is more or less what I have

    val listState = rememberLazyListState()
    
    val busInfoList by viewModel.busInfoList.collectAsState(emptyList())
    val busStopList by viewModel.allBusStops.collectAsState(emptyList())
    
    val jetLimeItemsModel by derivedStateOf {
            val jetItemList: MutableList<JetLimeItemsModel.JetLimeItem> = mutableStateListOf()
    
            if (busInfoList.isNotEmpty()) {
                val bus = busInfoList.find { it.vehicle_id == vechicleId }
                val nextStopRef = bus?.next_stop_ref
    
                val busList: List<String> = bus?.route ?: emptyList()
                busList.forEach { busStopRef ->
                    val busStop = busStopList.find { it.stopRef == busStopRef }
    
                    val busStopIndex = busList.indexOf(busStopRef)
                    val nextBusStopIndex = busList.indexOf(nextStopRef)
    
                    val jetLimeItemConfig = if (busStopRef == nextStopRef)
                        JetLimeItemConfig(iconAnimation = IconAnimation())
                    else {
                        if (busStopIndex < nextBusStopIndex) {
                            JetLimeItemConfig(itemHeight = 80.dp, iconType = IconType.Checked)
                        } else {
                            JetLimeItemConfig(itemHeight = 80.dp, iconType = IconType.Empty)
                        }
    
                    }
    
                    jetItemList.add(
                        JetLimeItemsModel.JetLimeItem(
                            title = busStop?.shortName ?: "",
                            description = busStopRef,
                            jetLimeItemConfig = jetLimeItemConfig
                        )
                    )
                }
            }
            JetLimeItemsModel(jetItemList)
        }
    
    
    
    JetLimeView(
        jetLimeItemsModel = jetLimeItemsModel,
        jetLimeViewConfig = JetLimeViewConfig(lineType = LineType.Solid),
        listState = listState
    )
    
    

    I'm seeing that when nextStopRef changes (with resultant change to model) the UI is not updating (to show animation for that stop). Issue seems to be related to following code in JetLineView.

    val jetLimeItem = remember { mutableStateOf(item) }
    
    ....
    
              JetLimeItemView(
                title = jetLimeItem.value.title,
                description = jetLimeItem.value.description,
                content = jetLimeItem.value.content,
                itemConfig = jetLimeItem.value.jetLimeItemConfig.apply { position = pos },
                viewConfig = jetLimeViewConfig,
                totalItems = jetLimeItemsModel.items.size
              )
    
    

    If I replace jetLimeItem.value with just item above then recomposition seems to work correctly when the model value changes.

    bug 
    opened by joreilly 1
  • Fix issue with recomposition when JetLimeItemsModel state changes

    Fix issue with recomposition when JetLimeItemsModel state changes

    • Fix issue with recomposition

    • Add sample for demonstrating how the state of a JetLimeItemsModel can be updated

    • enableItemAnimation property has been added in JetLimeViewConfig to disable the item placement animation (by default set as false)

    opened by pushpalroy 0
  • Way to click/interact with JetLimeItem?

    Way to click/interact with JetLimeItem?

    Is there a way to be able to click on a JetLimeItem? I'm currently looking to add a dialog once the user clicks on a JetLimeItem to display the route's information and to navigate to a map screen.

    opened by MauResendez 0
Releases(1.0.3)
Owner
Pushpal Roy
Android Developer
Pushpal Roy
An android library which provides a compact calendar view much like the one used in google calenders.

CompactCalendarView CompactCalendarView is a simple calendar view which provides scrolling between months. It's based on Java's Date and Calendar clas

SundeepK 1.5k Dec 9, 2022
Standalone Android widget for picking a single date from a calendar view.

TimesSquare for Android Standalone Android widget for picking a single date from a calendar view. Usage Include CalendarPickerView in your layout XML.

Square 4.4k Dec 20, 2022
Android calendar view (like card)

android-calendar-card (Google Play Demo) Android calendar view (like card) Simple and easy to modify Author: Michał Szwarc #CalendarCardPager License

Michał Szwarc 473 Nov 10, 2022
Android calendar view inspired by Sunrise calendar and iOS7 stock calendar

SilkCal Android calendar view inspired by Sunrise calendar and iOS7 stock calendar. Usage Add compile 'me.nlmartian.silkcal:library:0.1.1' to your dep

JunGuan Zhu 385 Nov 25, 2022
A material-styled android view that provisions picking of a date, time & recurrence option, all from a single user-interface.

SublimePicker A customizable view that provisions picking of a date, time & recurrence option, all from a single user-interface. You can also view 'Su

Vikram 2.3k Jan 4, 2023
A lightweight monthly calendar view for Android, fully written in Kotlin. Designed to meet the minimum demands for typical calendars.

Light Calendar View A lightweight monthly calendar view for Android, fully written in Kotlin. Designed to meet the minimum demands for typical calenda

Recruit Marketing Partners Co.,Ltd 444 Dec 9, 2022
Color-My-View-App - Layouts - ColorMyViews app

Layouts - ColorMyViews app This is the second toy app for lesson 2 of the Androi

null 0 Jan 7, 2022
Time-DatePicker - A Simple Time Date Picker With Kotlin

Time-DatePicker Time.DatePicker.mp4

Faysal Hossain 0 Jan 19, 2022
A simple compose weight picker drawn with canvas.

CanvasWeightPicker A simple compose weight picker drawn with canvas. Features Drag scale to select weight Haptic feedback on weight selected Video of

Timothy Serem 5 Dec 2, 2022
[NO LONGER MAINTAINED] Android library for better Picker DialogFragments

/!\ This Project is no longer maintained /!\ DialogFragments modeled after the AOSP Clock and Calendar apps to improve UX for picking time, date, numb

Code-Troopers 2.7k Dec 29, 2022