├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ ├── colors.xml
│ │ │ │ ├── dimens.xml
│ │ │ │ └── styles.xml
│ │ │ ├── drawable-nodpi
│ │ │ │ ├── img_0.png
│ │ │ │ ├── img_1.png
│ │ │ │ ├── img_2.png
│ │ │ │ ├── img_3.png
│ │ │ │ ├── img_4.png
│ │ │ │ ├── img_5.png
│ │ │ │ ├── img_6.png
│ │ │ │ ├── img_7.png
│ │ │ │ ├── img_8.png
│ │ │ │ └── img_9.png
│ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── values-w820dp
│ │ │ │ └── dimens.xml
│ │ │ └── layout
│ │ │ │ ├── activity_timeline_test.xml
│ │ │ │ └── activity_main.xml
│ │ ├── java
│ │ │ └── org
│ │ │ │ └── qap
│ │ │ │ └── timelineviewtest
│ │ │ │ ├── MainActivity.java
│ │ │ │ └── TimelineTest.java
│ │ └── AndroidManifest.xml
│ ├── test
│ │ └── java
│ │ │ └── org
│ │ │ └── qap
│ │ │ └── timelineviewtest
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── org
│ │ └── qap
│ │ └── timelineviewtest
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
└── build.gradle
├── ctimelineview
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── drawable
│ │ │ │ ├── d_circle.png
│ │ │ │ └── circle_shape.xml
│ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ └── plurals.xml
│ │ │ ├── values-ru
│ │ │ │ ├── strings.xml
│ │ │ │ └── plurals.xml
│ │ │ ├── values-ar
│ │ │ │ ├── strings.xml
│ │ │ │ └── plurals.xml
│ │ │ └── layout
│ │ │ │ └── ctimeline_row.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── org
│ │ │ └── qap
│ │ │ └── ctimelineview
│ │ │ ├── TimelineRow.java
│ │ │ └── TimelineViewAdapter.java
│ ├── test
│ │ └── java
│ │ │ └── org
│ │ │ └── qap
│ │ │ └── ctimelineview
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── org
│ │ └── qap
│ │ └── ctimelineview
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── Screenshot.png
├── .idea
├── copyright
│ └── profiles_settings.xml
├── encodings.xml
├── vcs.xml
├── modules.xml
├── runConfigurations.xml
├── compiler.xml
├── gradle.xml
└── misc.xml
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .gitignore
├── gradle.properties
├── gradlew.bat
├── README.md
└── gradlew
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/ctimelineview/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':ctimelineview'
2 |
--------------------------------------------------------------------------------
/Screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qapqap/TimelineView/HEAD/Screenshot.png
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | TimelineView
3 |
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qapqap/TimelineView/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/img_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qapqap/TimelineView/HEAD/app/src/main/res/drawable-nodpi/img_0.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/img_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qapqap/TimelineView/HEAD/app/src/main/res/drawable-nodpi/img_1.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/img_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qapqap/TimelineView/HEAD/app/src/main/res/drawable-nodpi/img_2.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/img_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qapqap/TimelineView/HEAD/app/src/main/res/drawable-nodpi/img_3.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/img_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qapqap/TimelineView/HEAD/app/src/main/res/drawable-nodpi/img_4.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/img_5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qapqap/TimelineView/HEAD/app/src/main/res/drawable-nodpi/img_5.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/img_6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qapqap/TimelineView/HEAD/app/src/main/res/drawable-nodpi/img_6.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/img_7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qapqap/TimelineView/HEAD/app/src/main/res/drawable-nodpi/img_7.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/img_8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qapqap/TimelineView/HEAD/app/src/main/res/drawable-nodpi/img_8.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/img_9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qapqap/TimelineView/HEAD/app/src/main/res/drawable-nodpi/img_9.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qapqap/TimelineView/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qapqap/TimelineView/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qapqap/TimelineView/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qapqap/TimelineView/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qapqap/TimelineView/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ctimelineview/src/main/res/drawable/d_circle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qapqap/TimelineView/HEAD/ctimelineview/src/main/res/drawable/d_circle.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/ctimelineview/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | CTimelineView
3 |
4 | and
5 |
6 |
7 |
--------------------------------------------------------------------------------
/ctimelineview/src/main/res/values-ru/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | CTimelineView
3 |
4 | и
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ctimelineview/src/main/res/values-ar/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | CTimelineView
4 | و
5 |
6 |
--------------------------------------------------------------------------------
/ctimelineview/src/main/res/drawable/circle_shape.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat Jul 15 10:56:52 AST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
7 |
--------------------------------------------------------------------------------
/ctimelineview/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/org/qap/timelineviewtest/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package org.qap.timelineviewtest;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/ctimelineview/src/test/java/org/qap/ctimelineview/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package org.qap.ctimelineview;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/java/org/qap/timelineviewtest/MainActivity.java:
--------------------------------------------------------------------------------
1 | package org.qap.timelineviewtest;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.view.View;
7 |
8 | public class MainActivity extends AppCompatActivity {
9 |
10 | @Override
11 | protected void onCreate(Bundle savedInstanceState) {
12 | super.onCreate(savedInstanceState);
13 | setContentView(R.layout.activity_main);
14 |
15 | }
16 |
17 | public void StartTimelineTest(View view) {
18 | Intent intent = new Intent(this, TimelineTest.class);
19 | startActivity(intent);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/qap/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/ctimelineview/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/qap/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_timeline_test.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/org/qap/timelineviewtest/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package org.qap.timelineviewtest;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("org.qap.timelineview", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/ctimelineview/src/androidTest/java/org/qap/ctimelineview/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package org.qap.ctimelineview;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("org.qap.ctimelineview.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/ctimelineview/src/main/res/values/plurals.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | - %d year
4 | - %d years
5 |
6 |
7 |
8 | - %d month
9 | - %d months
10 |
11 |
12 |
13 | - %d day
14 | - %d days
15 |
16 |
17 |
18 | - %d hour
19 | - %d hours
20 |
21 |
22 |
23 | - %d minute
24 | - %d minutes
25 |
26 |
27 |
28 | - %d second
29 | - %d seconds
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
14 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 25
5 | buildToolsVersion '25.0.3'
6 | defaultConfig {
7 | applicationId "org.qap.timelineview"
8 | minSdkVersion 21
9 | targetSdkVersion 25
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(include: ['*.jar'], dir: 'libs')
24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
25 | exclude group: 'com.android.support', module: 'support-annotations'
26 | })
27 | compile 'com.android.support:appcompat-v7:25.3.1'
28 | testCompile 'junit:junit:4.12'
29 | compile project(':ctimelineview')
30 | }
31 |
--------------------------------------------------------------------------------
/ctimelineview/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'com.github.dcendents.android-maven'
3 |
4 | group='com.github.qapqap'
5 |
6 | android {
7 | compileSdkVersion 25
8 | buildToolsVersion '25.0.0'
9 |
10 | defaultConfig {
11 | minSdkVersion 16
12 | targetSdkVersion 25
13 | versionCode 1
14 | versionName "1.0"
15 |
16 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
17 |
18 | }
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 | }
26 |
27 | dependencies {
28 | compile fileTree(dir: 'libs', include: ['*.jar'])
29 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
30 | exclude group: 'com.android.support', module: 'support-annotations'
31 | })
32 | compile 'com.android.support:appcompat-v7:25.0.1'
33 | testCompile 'junit:junit:4.12'
34 | }
35 |
--------------------------------------------------------------------------------
/ctimelineview/src/main/res/values-ru/plurals.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | - %d год
4 | - %d года
5 | - %d лет
6 | - %d лет
7 |
8 |
9 |
10 | - %d месяц
11 | - %d месяца
12 | - %d месяцев
13 | - %d месяцев
14 |
15 |
16 |
17 | - %d день
18 | - %d дня
19 | - %d дней
20 | - %d дней
21 |
22 |
23 |
24 | - %d час
25 | - %d часа
26 | - %d часов
27 | - %d часов
28 |
29 |
30 |
31 | - %d минута
32 | - %d минуты
33 | - %d минут
34 | - %d минут
35 |
36 |
37 |
38 | - %d секунда
39 | - %d секунды
40 | - %d секунд
41 | - %d секунд
42 |
43 |
--------------------------------------------------------------------------------
/ctimelineview/src/main/res/values-ar/plurals.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | - %d سنوات
4 | - %d سنة
5 | - %d سنوات
6 | - %d سنوات
7 | - %d سنوات
8 | - %d سنوات
9 |
10 |
11 |
12 | - %d شهور
13 | - %d شهر
14 | - %d شهور
15 | - %d شهور
16 | - %d شهور
17 | - %d شهور
18 |
19 |
20 |
21 | - %d ايام
22 | - %d يوم
23 | - %d ايام
24 | - %d ايام
25 | - %d ايام
26 | - %d ايام
27 |
28 |
29 |
30 | - %d ساعات
31 | - %d ساعة
32 | - %d ساعات
33 | - %d ساعات
34 | - %d ساعات
35 | - %d ساعات
36 |
37 |
38 |
39 | - %d دقائق
40 | - %d دقيقة
41 | - %d دقائق
42 | - %d دقائق
43 | - %d دقائق
44 | - %d دقائق
45 |
46 |
47 |
48 | - %d ثواني
49 | - %d ثانية
50 | - %d ثواني
51 | - %d ثواني
52 | - %d ثواني
53 | - %d ثواني
54 |
55 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Customizable Timeline View for Android
2 | Customizable Timeline View for Android, Create a simple timeline list with few lines of code. You can adjust the image, image size, line color, line size, background to the image and the background size.
3 |
4 | 
5 |
6 | # Download
7 | Add it in your root `build.gradle` at the end of repositories:
8 |
9 | ``` groovy
10 | allprojects {
11 | repositories {
12 | ...
13 | maven { url 'https://jitpack.io' }
14 | }
15 | }
16 | ```
17 | Add the dependency:
18 |
19 | ``` groovy
20 | dependencies {
21 | compile 'com.github.qapqap:TimelineView:v1.6'
22 | }
23 | ```
24 |
25 | # Usage
26 |
27 | In your activity java class:
28 | ``` java
29 | // Create Timeline rows List
30 | ArrayList timelineRowsList = new ArrayList<>();
31 |
32 | // Create new timeline row (Row Id)
33 | TimelineRow myRow = new TimelineRow(0);
34 |
35 | // To set the row Date (optional)
36 | myRow.setDate(new Date());
37 | // To set the row Title (optional)
38 | myRow.setTitle("Title");
39 | // To set the row Description (optional)
40 | myRow.setDescription("Description");
41 | // To set the row bitmap image (optional)
42 | myRow.setImage(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher));
43 | // To set row Below Line Color (optional)
44 | myRow.setBellowLineColor(Color.argb(255, 0, 0, 0));
45 | // To set row Below Line Size in dp (optional)
46 | myRow.setBellowLineSize(6);
47 | // To set row Image Size in dp (optional)
48 | myRow.setImageSize(40);
49 | // To set background color of the row image (optional)
50 | myRow.setBackgroundColor(Color.argb(255, 0, 0, 0));
51 | // To set the Background Size of the row image in dp (optional)
52 | myRow.setBackgroundSize(60);
53 | // To set row Date text color (optional)
54 | myRow.setDateColor(Color.argb(255, 0, 0, 0));
55 | // To set row Title text color (optional)
56 | myRow.setTitleColor(Color.argb(255, 0, 0, 0));
57 | // To set row Description text color (optional)
58 | myRow.setDescriptionColor(Color.argb(255, 0, 0, 0));
59 |
60 | // Add the new row to the list
61 | timelineRowsList.add(myRow);
62 |
63 | // Create the Timeline Adapter
64 | ArrayAdapter myAdapter = new TimelineViewAdapter(this, 0, timelineRowsList,
65 | //if true, list will be sorted by date
66 | false);
67 |
68 | // Get the ListView and Bind it with the Timeline Adapter
69 | ListView myListView = (ListView) findViewById(R.id.timeline_listView);
70 | myListView.setAdapter(myAdapter);
71 | ```
72 |
73 | In your activity layout xml
74 | ``` xml
75 |
81 | ```
82 |
83 | License
84 | --------
85 |
86 | Copyright 2016 Abdullah Alsulaiman.
87 |
88 | Licensed under the Apache License, Version 2.0 (the "License");
89 | you may not use this file except in compliance with the License.
90 | You may obtain a copy of the License at
91 |
92 | http://www.apache.org/licenses/LICENSE-2.0
93 |
94 | Unless required by applicable law or agreed to in writing, software
95 | distributed under the License is distributed on an "AS IS" BASIS,
96 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
97 | See the License for the specific language governing permissions and
98 | limitations under the License.
99 |
--------------------------------------------------------------------------------
/ctimelineview/src/main/res/layout/ctimeline_row.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
14 |
23 |
24 |
33 |
34 |
35 |
43 |
44 |
53 |
54 |
55 |
56 |
57 |
58 |
63 |
64 |
71 |
72 |
82 |
83 |
92 |
93 |
94 |
95 |
--------------------------------------------------------------------------------
/ctimelineview/src/main/java/org/qap/ctimelineview/TimelineRow.java:
--------------------------------------------------------------------------------
1 | package org.qap.ctimelineview;
2 |
3 |
4 | import android.graphics.Bitmap;
5 |
6 | import java.util.Date;
7 |
8 |
9 | public class TimelineRow {
10 |
11 | private int id;
12 | private Date date = null;
13 | private String title = null;
14 | private String description = null;
15 | private Bitmap image = null;
16 | private int bellowLineColor = 0;
17 | private int bellowLineSize = 6;
18 | private int imageSize = 50;
19 | private int backgroundColor = 0;
20 | private int backgroundSize = 50;
21 | private int dateColor = 0;
22 | private int titleColor = 0;
23 | private int descriptionColor = 0;
24 |
25 | public TimelineRow(int id) {
26 | this.id = id;
27 | }
28 |
29 | public TimelineRow(int id, Date date) {
30 | this.id = id;
31 | this.date = date;
32 | }
33 |
34 |
35 | public TimelineRow(int id, Date date, String title, String description) {
36 | this.id = id;
37 | this.date = date;
38 | this.title = title;
39 | this.description = description;
40 | }
41 |
42 | public TimelineRow(int id, Date date, String title, String description, Bitmap image, int bellowLineColor, int bellowLineSize, int imageSize) {
43 | this.id = id;
44 | this.date = date;
45 | this.title = title;
46 | this.description = description;
47 | this.image = image;
48 | this.bellowLineColor = bellowLineColor;
49 | this.bellowLineSize = bellowLineSize;
50 | this.imageSize = imageSize;
51 | }
52 |
53 | public TimelineRow(int id, Date date, String title, String description, Bitmap image, int bellowLineColor, int bellowLineSize, int imageSize, int backgroundColor, int backgroundSize) {
54 | this.id = id;
55 | this.date = date;
56 | this.title = title;
57 | this.description = description;
58 | this.image = image;
59 | this.bellowLineColor = bellowLineColor;
60 | this.bellowLineSize = bellowLineSize;
61 | this.imageSize = imageSize;
62 | this.backgroundColor = backgroundColor;
63 | this.backgroundSize = backgroundSize;
64 | }
65 |
66 | public TimelineRow(int id, Date date, String title, String description, Bitmap image, int bellowLineColor, int bellowLineSize, int imageSize, int backgroundColor, int backgroundSize, int dateColor, int titleColor, int descriptionColor) {
67 | this.id = id;
68 | this.date = date;
69 | this.title = title;
70 | this.description = description;
71 | this.image = image;
72 | this.bellowLineColor = bellowLineColor;
73 | this.bellowLineSize = bellowLineSize;
74 | this.imageSize = imageSize;
75 | this.backgroundColor = backgroundColor;
76 | this.backgroundSize = backgroundSize;
77 | this.dateColor = dateColor;
78 | this.titleColor = titleColor;
79 | this.descriptionColor = descriptionColor;
80 | }
81 |
82 | public int getBackgroundSize() {
83 | return backgroundSize;
84 | }
85 |
86 | public void setBackgroundSize(int backgroundSize) {
87 | this.backgroundSize = backgroundSize;
88 | }
89 |
90 | public int getBackgroundColor() {
91 | return backgroundColor;
92 | }
93 |
94 | public void setBackgroundColor(int backgroundColor) {
95 | this.backgroundColor = backgroundColor;
96 | }
97 |
98 | public String getDescription() {
99 | return description;
100 | }
101 |
102 | public void setDescription(String description) {
103 | this.description = description;
104 | }
105 |
106 | public int getImageSize() {
107 | return imageSize;
108 | }
109 |
110 | public void setImageSize(int imageSize) {
111 | this.imageSize = imageSize;
112 | }
113 |
114 | public int getBellowLineSize() {
115 | return bellowLineSize;
116 | }
117 |
118 | public int getId() {
119 | return id;
120 | }
121 |
122 | public void setId(int id) {
123 | this.id = id;
124 | }
125 |
126 | public void setBellowLineSize(int bellowLineSize) {
127 | this.bellowLineSize = bellowLineSize;
128 | }
129 |
130 | public int getBellowLineColor() {
131 | return bellowLineColor;
132 | }
133 |
134 | public void setBellowLineColor(int bellowLineColor) {
135 | this.bellowLineColor = bellowLineColor;
136 | }
137 |
138 | public Bitmap getImage() {
139 | return image;
140 | }
141 |
142 | public void setImage(Bitmap image) {
143 | this.image = image;
144 | }
145 |
146 | public Date getDate() {
147 | return date;
148 | }
149 |
150 | public void setDate(Date date) {
151 | this.date = date;
152 | }
153 |
154 | public String getTitle() {
155 | return title;
156 | }
157 |
158 | public void setTitle(String title) {
159 | this.title = title;
160 | }
161 |
162 | public int getDateColor() {
163 | return dateColor;
164 | }
165 |
166 | public void setDateColor(int dateColor) {
167 | this.dateColor = dateColor;
168 | }
169 |
170 | public int getTitleColor() {
171 | return titleColor;
172 | }
173 |
174 | public void setTitleColor(int titleColor) {
175 | this.titleColor = titleColor;
176 | }
177 |
178 | public int getDescriptionColor() {
179 | return descriptionColor;
180 | }
181 |
182 | public void setDescriptionColor(int descriptionColor) {
183 | this.descriptionColor = descriptionColor;
184 | }
185 | }
186 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/app/src/main/java/org/qap/timelineviewtest/TimelineTest.java:
--------------------------------------------------------------------------------
1 | package org.qap.timelineviewtest;
2 |
3 | import android.graphics.BitmapFactory;
4 | import android.graphics.Color;
5 | import android.os.Bundle;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.view.View;
8 | import android.widget.AbsListView;
9 | import android.widget.AdapterView;
10 | import android.widget.ArrayAdapter;
11 | import android.widget.LinearLayout;
12 | import android.widget.ListView;
13 | import android.widget.Toast;
14 |
15 | import org.qap.ctimelineview.TimelineRow;
16 | import org.qap.ctimelineview.TimelineViewAdapter;
17 |
18 | import java.text.ParseException;
19 | import java.text.SimpleDateFormat;
20 | import java.util.ArrayList;
21 | import java.util.Date;
22 | import java.util.Random;
23 | import java.util.concurrent.ThreadLocalRandom;
24 |
25 | public class TimelineTest extends AppCompatActivity {
26 |
27 | //Create Timeline Rows List
28 | private ArrayList timelineRowsList = new ArrayList<>();
29 | ArrayAdapter myAdapter;
30 |
31 | @Override
32 | protected void onCreate(Bundle savedInstanceState) {
33 | super.onCreate(savedInstanceState);
34 | setContentView(R.layout.activity_timeline_test);
35 |
36 |
37 | // Add Random Rows to the List
38 | for (int i = 0; i < 15; i++) {
39 | //add the new row to the list
40 | timelineRowsList.add(createRandomTimelineRow(i));
41 | }
42 |
43 | //Create the Timeline Adapter
44 | myAdapter = new TimelineViewAdapter(this, 0, timelineRowsList,
45 | //if true, list will be sorted by date
46 | true);
47 |
48 |
49 | //Get the ListView and Bind it with the Timeline Adapter
50 | ListView myListView = (ListView) findViewById(R.id.timeline_listView);
51 | myListView.setAdapter(myAdapter);
52 |
53 |
54 | //if you wish to handle list scrolling
55 | myListView.setOnScrollListener(new AbsListView.OnScrollListener() {
56 | private int currentVisibleItemCount;
57 | private int currentScrollState;
58 | private int currentFirstVisibleItem;
59 | private int totalItem;
60 | private LinearLayout lBelow;
61 |
62 |
63 | @Override
64 | public void onScrollStateChanged(AbsListView view, int scrollState) {
65 | // TODO Auto-generated method stub
66 | this.currentScrollState = scrollState;
67 | this.isScrollCompleted();
68 | }
69 |
70 | @Override
71 | public void onScroll(AbsListView view, int firstVisibleItem,
72 | int visibleItemCount, int totalItemCount) {
73 | // TODO Auto-generated method stub
74 | this.currentFirstVisibleItem = firstVisibleItem;
75 | this.currentVisibleItemCount = visibleItemCount;
76 | this.totalItem = totalItemCount;
77 |
78 |
79 | }
80 |
81 | private void isScrollCompleted() {
82 | if (totalItem - currentFirstVisibleItem == currentVisibleItemCount
83 | && this.currentScrollState == SCROLL_STATE_IDLE) {
84 |
85 | ////on scrolling to end of the list, add new rows
86 | for (int i = 0; i < 15; i++) {
87 | myAdapter.add(createRandomTimelineRow(i));
88 | }
89 |
90 | }
91 | }
92 |
93 |
94 | });
95 |
96 | //if you wish to handle the clicks on the rows
97 | AdapterView.OnItemClickListener adapterListener = new AdapterView.OnItemClickListener() {
98 | @Override
99 | public void onItemClick(AdapterView> parent, View view, int position, long id) {
100 | TimelineRow row = timelineRowsList.get(position);
101 | Toast.makeText(TimelineTest.this, row.getTitle(), Toast.LENGTH_SHORT).show();
102 | }
103 | };
104 | myListView.setOnItemClickListener(adapterListener);
105 |
106 |
107 | }
108 |
109 | //Method to create new Timeline Row
110 | private TimelineRow createRandomTimelineRow(int id) {
111 |
112 | // Create new timeline row (pass your Id)
113 | TimelineRow myRow = new TimelineRow(id);
114 |
115 | //to set the row Date (optional)
116 | myRow.setDate(getRandomDate());
117 | //to set the row Title (optional)
118 | myRow.setTitle("Title " + id);
119 | //to set the row Description (optional)
120 | myRow.setDescription("Description " + id);
121 | //to set the row bitmap image (optional)
122 | myRow.setImage(BitmapFactory.decodeResource(getResources(), R.drawable.img_0 + getRandomNumber(0, 10)));
123 | //to set row Below Line Color (optional)
124 | myRow.setBellowLineColor(getRandomColor());
125 | //to set row Below Line Size in dp (optional)
126 | myRow.setBellowLineSize(getRandomNumber(2, 25));
127 | //to set row Image Size in dp (optional)
128 | myRow.setImageSize(getRandomNumber(25, 40));
129 | //to set background color of the row image (optional)
130 | myRow.setBackgroundColor(getRandomColor());
131 | //to set the Background Size of the row image in dp (optional)
132 | myRow.setBackgroundSize(getRandomNumber(25, 40));
133 | //to set row Date text color (optional)
134 | myRow.setDateColor(getRandomColor());
135 | //to set row Title text color (optional)
136 | myRow.setTitleColor(getRandomColor());
137 | //to set row Description text color (optional)
138 | myRow.setDescriptionColor(getRandomColor());
139 |
140 | return myRow;
141 | }
142 |
143 |
144 | //Random Methods
145 | public int getRandomColor() {
146 | Random rnd = new Random();
147 | int color = Color.argb(255, rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256));
148 | ;
149 | return color;
150 | }
151 |
152 | public int getRandomNumber(int min, int max) {
153 | return min + (int) (Math.random() * max);
154 | }
155 |
156 |
157 | public Date getRandomDate() {
158 | SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
159 | Date startDate = null;
160 | Date endDate = new Date();
161 | try {
162 | startDate = sdf.parse("02/09/2015");
163 | long random = ThreadLocalRandom.current().nextLong(startDate.getTime(), endDate.getTime());
164 | endDate = new Date(random);
165 | } catch (ParseException e) {
166 | e.printStackTrace();
167 | }
168 | return endDate;
169 | }
170 |
171 | }
172 |
--------------------------------------------------------------------------------
/ctimelineview/src/main/java/org/qap/ctimelineview/TimelineViewAdapter.java:
--------------------------------------------------------------------------------
1 | package org.qap.ctimelineview;
2 |
3 |
4 | import android.app.Activity;
5 | import android.content.Context;
6 | import android.content.res.Resources;
7 | import android.graphics.drawable.GradientDrawable;
8 | import android.view.LayoutInflater;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 | import android.widget.ArrayAdapter;
12 | import android.widget.ImageView;
13 | import android.widget.TextView;
14 | import java.util.ArrayList;
15 | import java.util.Collections;
16 | import java.util.Date;
17 | import java.util.List;
18 |
19 |
20 | public class TimelineViewAdapter extends ArrayAdapter {
21 |
22 | private Context context;
23 | private Resources res;
24 | private List RowDataList;
25 | private String AND;
26 |
27 |
28 | public TimelineViewAdapter(Context context, int resource, ArrayList objects, boolean orderTheList) {
29 | super(context, resource, objects);
30 | this.context = context;
31 | res = context.getResources();
32 | AND = res.getString(R.string.AND);
33 | if (orderTheList)
34 | this.RowDataList = rearrangeByDate(objects);
35 | else
36 | this.RowDataList = objects;
37 | }
38 |
39 |
40 | @Override
41 | public View getView(int position, View convertView, ViewGroup parent) {
42 |
43 | TimelineRow row = RowDataList.get(position);
44 |
45 | LayoutInflater inflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
46 | View view = inflater.inflate(R.layout.ctimeline_row, null);
47 |
48 | TextView rowDate = (TextView) view.findViewById(R.id.crowDate);
49 | TextView rowTitle = (TextView) view.findViewById(R.id.crowTitle);
50 | TextView rowDescription = (TextView) view.findViewById(R.id.crowDesc);
51 | ImageView rowImage = (ImageView) view.findViewById(R.id.crowImg);
52 | View rowUpperLine = (View) view.findViewById(R.id.crowUpperLine);
53 | View rowLowerLine = (View) view.findViewById(R.id.crowLowerLine);
54 |
55 |
56 | final float scale = getContext().getResources().getDisplayMetrics().density;
57 |
58 |
59 | if (position == 0 && position == RowDataList.size() - 1) {
60 | rowUpperLine.setVisibility(View.INVISIBLE);
61 | rowLowerLine.setVisibility(View.INVISIBLE);
62 | } else if (position == 0) {
63 | int pixels = (int) (row.getBellowLineSize() * scale + 0.5f);
64 |
65 | rowUpperLine.setVisibility(View.INVISIBLE);
66 | rowLowerLine.setBackgroundColor(row.getBellowLineColor());
67 | rowLowerLine.getLayoutParams().width = pixels;
68 | } else if (position == RowDataList.size() - 1) {
69 | int pixels = (int) (RowDataList.get(position - 1).getBellowLineSize() * scale + 0.5f);
70 |
71 | rowLowerLine.setVisibility(View.INVISIBLE);
72 | rowUpperLine.setBackgroundColor(RowDataList.get(position - 1).getBellowLineColor());
73 | rowUpperLine.getLayoutParams().width = pixels;
74 | } else {
75 | int pixels = (int) (row.getBellowLineSize() * scale + 0.5f);
76 | int pixels2 = (int) (RowDataList.get(position - 1).getBellowLineSize() * scale + 0.5f);
77 |
78 | rowLowerLine.setBackgroundColor(row.getBellowLineColor());
79 | rowUpperLine.setBackgroundColor(RowDataList.get(position - 1).getBellowLineColor());
80 | rowLowerLine.getLayoutParams().width = pixels;
81 | rowUpperLine.getLayoutParams().width = pixels2;
82 | }
83 |
84 |
85 | rowDate.setText(getPastTime(row.getDate()));
86 | if (row.getDateColor() != 0)
87 | rowDate.setTextColor(row.getDateColor());
88 | if (row.getTitle() == null)
89 | rowTitle.setVisibility(View.GONE);
90 | else {
91 | rowTitle.setText(row.getTitle());
92 | if (row.getTitleColor() != 0)
93 | rowTitle.setTextColor(row.getTitleColor());
94 | }
95 | if (row.getDescription() == null)
96 | rowDescription.setVisibility(View.GONE);
97 | else {
98 | rowDescription.setText(row.getDescription());
99 | if (row.getDescriptionColor() != 0)
100 | rowDescription.setTextColor(row.getDescriptionColor());
101 | }
102 |
103 |
104 | if (row.getImage() != null) {
105 | rowImage.setImageBitmap(row.getImage());
106 | }
107 |
108 | int pixels = (int) (row.getImageSize() * scale + 0.5f);
109 | rowImage.getLayoutParams().width = pixels;
110 | rowImage.getLayoutParams().height = pixels;
111 |
112 | View backgroundView = view.findViewById(R.id.crowBackground);
113 | if (row.getBackgroundColor() == 0)
114 | backgroundView.setBackground(null);
115 | else {
116 | if (row.getBackgroundSize() == -1) {
117 | backgroundView.getLayoutParams().width = pixels;
118 | backgroundView.getLayoutParams().height = pixels;
119 | } else {
120 | int BackgroundPixels = (int) (row.getBackgroundSize() * scale + 0.5f);
121 | backgroundView.getLayoutParams().width = BackgroundPixels;
122 | backgroundView.getLayoutParams().height = BackgroundPixels;
123 | }
124 | GradientDrawable background = (GradientDrawable) backgroundView.getBackground();
125 | if (background != null) {
126 | background.setColor(row.getBackgroundColor());
127 | }
128 | }
129 |
130 |
131 | ViewGroup.MarginLayoutParams marginParams = (ViewGroup.MarginLayoutParams) rowImage.getLayoutParams();
132 | marginParams.setMargins(0, (int) (pixels / 2) * -1, 0, (pixels / 2) * -1);
133 |
134 |
135 | return view;
136 | }
137 |
138 |
139 | private String getPastTime(Date date) {
140 |
141 | if (date == null) return "";
142 | StringBuilder dateText = new StringBuilder();
143 | Date today = new Date();
144 | long diff = (today.getTime() - date.getTime()) / 1000;
145 |
146 | long years = diff / (60 * 60 * 24 * 30 * 12);
147 | long months = (diff / (60 * 60 * 24 * 30)) % 12;
148 | long days = (diff / (60 * 60 * 24)) % 30;
149 | long hours = (diff / (60 * 60)) % 24;
150 | long minutes = (diff / 60) % 60;
151 | long seconds = diff % 60;
152 |
153 | if (years > 0) {
154 | appendPastTime(dateText, years, R.plurals.years, months, R.plurals.months);
155 | } else if (months > 0) {
156 | appendPastTime(dateText, months, R.plurals.months, days, R.plurals.days);
157 | } else if (days > 0) {
158 | appendPastTime(dateText, days, R.plurals.days, hours, R.plurals.hours);
159 | } else if (hours > 0) {
160 | appendPastTime(dateText, hours, R.plurals.hours, minutes, R.plurals.minutes);
161 | } else if (minutes > 0) {
162 | appendPastTime(dateText, minutes, R.plurals.minutes, seconds, R.plurals.seconds);
163 | } else if (seconds >= 0) {
164 | dateText.append(res.getQuantityString(R.plurals.seconds, (int) seconds, (int) seconds));
165 | }
166 |
167 | return dateText.toString();
168 | }
169 |
170 | private void appendPastTime(StringBuilder s,
171 | long timespan, int nameId,
172 | long timespanNext, int nameNextId) {
173 |
174 | s.append(res.getQuantityString(nameId, (int) timespan, timespan));
175 | if (timespanNext > 0) {
176 | s.append(' ').append(AND).append(' ');
177 | s.append(res.getQuantityString(nameNextId, (int) timespanNext, timespanNext));
178 | }
179 | }
180 |
181 | private ArrayList rearrangeByDate(ArrayList objects) {
182 | if (objects.get(0) == null) return objects;
183 | int size = objects.size();
184 | for (int i = 0; i < size - 1; i++) {
185 | for (int j = i + 1; j < size; j++) {
186 | if(objects.get(i).getDate()!= null && objects.get(j).getDate() != null)
187 | if (objects.get(i).getDate().compareTo(objects.get(j).getDate()) <= 0)
188 | Collections.swap(objects, i, j);
189 | }
190 |
191 | }
192 | return objects;
193 | }
194 |
195 | }
196 |
--------------------------------------------------------------------------------