Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.tadeas-braun:Timeline-View:v1.0.9'
}
dependencies {
implementation("com.github.tadeas-braun:Timeline-View:v1.0.9")
}
<dependency>
<groupId>com.github.tadeas-braun</groupId>
<artifactId>Timeline-View</artifactId>
<version>v1.0.9</version>
</dependency>
libraryDependencies += "com.github.tadeas-braun" % "Timeline-View" % "v1.0.9"
:dependencies [[com.github.tadeas-braun/Timeline-View "v1.0.9"]]
Android Timeline View Library (Using RecyclerView) is simple implementation used to display view like Tracking of shipment/order, steppers etc.
You can download the latest sample APK from this repo here: https://github.com/vipulasri/Timeline-View/tree/master/apk
For information : checkout Sample App Code in repository.
Using Gradle
dependencies {
compile 'com.github.vipulasri:timelineview:1.0.6'
}
Using Maven
<dependency>
<groupId>com.github.vipulasri</groupId>
<artifactId>timelineview</artifactId>
<version>1.0.6</version>
<type>pom</type>
</dependency>
Manual - Using Android Studio:
See the project's Releases page for a list of versions with their changelogs.
If you Watch this repository, GitHub will send you an email every time I publish an update.
<com.github.vipulasri.timelineview.TimelineView
android:id="@+id/time_marker"
android:layout_width="wrap_content"
android:layout_height="match_parent"
app:markerSize="20dp"
app:lineSize="2dp"
app:line="@color/colorPrimary"/>
<com.github.vipulasri.timelineview.TimelineView
android:id="@+id/time_marker"
android:layout_width="wrap_content"
android:layout_height="match_parent"
app:markerSize="20dp"
app:lineSize="2dp"
app:line="@color/colorPrimary"
app:linePadding="5dp"/>
Configure using xml attributes or setters in code:
<table> <th>Attribute Name</th> <th>Default Value</th> <th>Description</th> <tr> <td>app:marker="@drawable/marker"</td> <td>Green Colored Oval Drawable</td> <td>sets marker drawable</td> </tr> <tr> <td>app:markerSize="25dp"</td> <td>25dp</td> <td>sets marker size</td> </tr> <tr> <td>app:markerInCenter="false"</td> <td>true</td> <td>sets the marker in center of line if `true`</td> </tr> <tr> <td>app:line="@color/primarColor"</td> <td>Dark Grey Line</td> <td>sets line color</td> </tr> <tr> <td>app:lineSize="2dp"</td> <td>2dp</td> <td>sets line width</td> </tr> <tr> <td>app:lineOrientation="horizontal"</td> <td>vertical</td> <td>sets orientation of line ie `horizontal` or `vertical`</td> </tr> <tr> <td>app:linePadding="5dp"</td> <td>0dp</td> <td>sets line padding around marker</td> </tr> </table>RecyclerView Holder :
Your RecyclerViewHolder
should have an extra paramenter in constructor i.e viewType from onCreateViewHolder
. You would also have to call the method initLine(viewType)
in constructor definition.
public class TimeLineViewHolder extends RecyclerView.ViewHolder {
public TimelineView mTimelineView;
public TimeLineViewHolder(View itemView, int viewType) {
super(itemView);
mTimelineView = (TimelineView) itemView.findViewById(R.id.time_marker);
mTimelineView.initLine(viewType);
}
}
getItemViewType
method in Adapter
@Override
public int getItemViewType(int position) {
return TimelineView.getTimeLineViewType(position,getItemCount());
}
And pass the viewType
from onCreateViewHolder
to its Holder.
@Override
public TimeLineViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = View.inflate(parent.getContext(), R.layout.item_timeline, null);
return new TimeLineViewHolder(view, viewType);
}
If you're using this library in your app and you'd like to list it here, Please let me know via email, pull requests or issues.
Apps using Timeline-View, via AppBrain Stats
Copyright 2017 Vipul Asri
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.