ChathuraHettiarachchi / TimeAgo

This will help to get how much time have passed. Useful in showing messages, notifications time and etc.
Apache License 2.0
170 stars 33 forks source link
android-library notifications timeago

TimeAgo Download

I know what is mostly experianced problem when doing my development. So I decide to write this library to get how much time passed. Many of us having problem how to show how much time have passed, how to show it like in messages, notifications... Yeah, you looking at the right place. This will fix your issue.

logo

Let's take a look how to add this to your project

For the android project just include the following dependency inside you buil.gradle's depedency list.

Gradle

repositories {
  jcenter()
}

dependencies {
    ...
    compile 'com.chootdev:timezago:1.1.8'
}

if you using maven use following Maven

<dependency>
  <groupId>com.chootdev</groupId>
  <artifactId>timezago</artifactId>
  <version>1.1.8</version>
  <type>pom</type>
</dependency>

After setup installing lib to your project you just need only to calls it using just two lines of code. It will return you a string with the resuls.

Usage

TimeAgo timeAgo = new TimeAgo();
String result = timeAgo.getTimeAgo(YOUR_PAST_DATE);
TimeAgo timeAgo = new TimeAgo().locale(CONTEXT).with(CUSTOM_DATE_FORMAT);
String result = timeAgo.getTimeAgo(YOUR_CUSTOM_PAST_DATE);

Limitations

Output patterns

Screenshot

src

Changelog

Author

Chathura Hettiarachchi, chathura93@yahoo.com

Checkout my other contributions, https://github.com/ChathuraHettiarachchi?tab=repositories

License

Copyright 2016 Chathura Hettiarachchi

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.