timelineview-v2
With this library, app users can pick DateTime intervals. Under the hood, it uses JodaTime library in order to calculate the intervals.
Setup
Import it via:
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
implementation 'net.danlew:android.joda:2.10.3'
implementation 'com.github.andob:timelineview-v2:2.1.0'
}
In your application class:
The activity:
TimelineView API
1. The dateTimeInterval
property
Use this property to get or set the selected DateTime interval. Each time this property is set, the UI updates and the DateTime interval changed event is triggered. Examples:
Note that the base class of DailyDateTimeInterval
, WeeklyDateTimeInterval
, MonthlyDateTimeInterval
, YearlyDateTimeInterval
, CustomDateTimeInterval
, InfiniteDateTimeInterval
is DateTimeInterval
, a class with the following structure:
2. Subscribing to date time interval change events.
This event is triggered each time the user selects an interval from the UI and each time the dateTimeInterval
property is set programatically.
3. Disabling interval types
By default, the user can choose between Daily, Weekly, Monthly, Yearly, All time and Custom interval options. To disable some of them:
4. Customising the horizontal scrolling RecyclerView cells
For instance, if we want to disable clicking on intervals from the future:
5. TimelineViewDefaults
Singleton class used to keep default TimelineView settings:
6. Customising the appearance
You can customise the look and feel of the TimelineView with XML:
Why v2?
This is a remake of a in-house library I started in 2017, used across some apps. The V1 library hasn't aged well, since its specifications and features changed a lot over the time. The V2 library is a clean room remake, keeping all V1's features, but with a cleaner architecture.