├── .gitignore
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── lin
│ │ └── timeline
│ │ └── example
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── lin
│ │ │ └── timeline
│ │ │ └── example
│ │ │ ├── AbsOrderDelegate.java
│ │ │ ├── Analog.java
│ │ │ ├── AnalogAdapter.java
│ │ │ ├── BaseViewHolder.java
│ │ │ ├── ButtonDelegate.java
│ │ │ ├── ImageDelegate.java
│ │ │ ├── InfoOrder.java
│ │ │ ├── InfoOrderDelegate.java
│ │ │ ├── LocationOrder.java
│ │ │ ├── LocationOrderDelegate.java
│ │ │ ├── MainActivity.java
│ │ │ ├── MarkerDelegate.java
│ │ │ ├── Order.java
│ │ │ ├── OrderActivity.java
│ │ │ ├── OrderAdapter.java
│ │ │ ├── Picture.java
│ │ │ ├── RatingDelegate.java
│ │ │ ├── TextDelegate.java
│ │ │ ├── TextOrder.java
│ │ │ ├── TextOrderDelegate.java
│ │ │ ├── TimeDelegate.java
│ │ │ ├── TimeLineActivity.java
│ │ │ ├── Trace.java
│ │ │ ├── TraceActivity.java
│ │ │ └── TraceAdapter.java
│ └── res
│ │ ├── drawable
│ │ ├── begin_marker.xml
│ │ ├── begin_up.xml
│ │ ├── marker.xml
│ │ ├── up.xml
│ │ └── vector_default_image.xml
│ │ ├── layout
│ │ ├── activity_main.xml
│ │ ├── activity_timeline.xml
│ │ ├── activity_trace.xml
│ │ ├── analog_item.xml
│ │ ├── order_info.xml
│ │ ├── order_location.xml
│ │ ├── order_text.xml
│ │ ├── trace_button.xml
│ │ ├── trace_image.xml
│ │ ├── trace_marker_text.xml
│ │ ├── trace_rating.xml
│ │ ├── trace_text.xml
│ │ └── trace_time.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── lin
│ └── timeline
│ └── example
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ └── gradle-wrapper.jar
├── gradlew
├── gradlew.bat
├── library
├── .gitignore
├── bintray.gradle
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ └── java
│ └── com
│ └── lin
│ └── timeline
│ └── TimeLineDecoration.java
├── screenshots
├── 20170821160031.png
├── 20170821160048.png
└── 20170821160103.png
└── settings.gradle
/.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 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # TimeLine
2 | Android Timeline View is used to display views like Tracking of shipment/order, steppers etc.
3 |
4 |

5 | 
6 | 
7 |
8 | # Use
9 | ```gradle
10 | compile 'com.lin:timeline:1.1@aar'
11 | ```
12 |
13 | ``` Java
14 | final TimeLineDecoration decoration = new TimeLineDecoration(this)
15 | .setLineColor(android.R.color.black)
16 | .setLineWidth(1)
17 | .setLeftDistance(16)
18 | .setTopDistance(16)
19 | .setBeginMarker(R.drawable.begin_marker)
20 | .setMarkerRadius(4)
21 | .setMarkerColor(R.color.colorAccent)
22 | .setCallback(new TimeLineDecoration.TimeLineAdapter() {//or new TimeLineDecoration.TimeLineCallback
23 | @Override
24 | public int getTimeLineType(int position) {
25 | if (position == 0) return BEGIN;
26 | else if (position == adapter.getItemCount() - 1) return END_FULL;
27 | else return NORMAL;
28 | }
29 | });
30 | recyclerView.addItemDecoration(decoration);
31 | ```
32 |
如果要把时间轴写到item中,建议使用
33 |
[Timeline-View](https://github.com/vipulasri/Timeline-View)
34 |
瀑布流可以使用
35 |
[TimeLine](https://github.com/vivian8725118/TimeLine)
36 |
37 |
ps:demo中adpter使用的库来自[PowerAdapter](https://github.com/lin18/PowerAdapter)
38 |
39 | # License
40 | ```
41 | Copyright 2017 lin18
42 |
43 | Licensed under the Apache License, Version 2.0 (the "License");
44 | you may not use this file except in compliance with the License.
45 | You may obtain a copy of the License at
46 |
47 | http://www.apache.org/licenses/LICENSE-2.0
48 |
49 | Unless required by applicable law or agreed to in writing, software
50 | distributed under the License is distributed on an "AS IS" BASIS,
51 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
52 | See the License for the specific language governing permissions and
53 | limitations under the License.
54 | ```
55 |
56 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'com.jakewharton.butterknife'
3 |
4 | android {
5 | compileSdkVersion rootProject.ext.compileSdkVersion
6 | buildToolsVersion rootProject.ext.buildToolsVersion
7 | defaultConfig {
8 | applicationId "com.lin.timeline.example"
9 | minSdkVersion rootProject.ext.minSdk
10 | targetSdkVersion rootProject.ext.targetSdk
11 | versionCode 1
12 | versionName "1.0"
13 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
14 | vectorDrawables.useSupportLibrary = true
15 | }
16 | buildTypes {
17 | release {
18 | minifyEnabled false
19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
20 | }
21 | }
22 | }
23 |
24 | dependencies {
25 | compile fileTree(dir: 'libs', include: ['*.jar'])
26 | compile project(':library')
27 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
28 | exclude group: 'com.android.support', module: 'support-annotations'
29 | })
30 | testCompile 'junit:junit:4.12'
31 |
32 | compile supportDependencies.appcompat
33 | compile supportDependencies.design
34 | compile supportDependencies.cardview
35 |
36 | compile 'com.android.support.constraint:constraint-layout:1.0.2'
37 |
38 | compile "com.jakewharton:butterknife:$rootProject.butterknifeVersion"
39 | annotationProcessor "com.jakewharton:butterknife-compiler:$rootProject.butterknifeVersion"
40 |
41 | compile 'com.google.code.gson:gson:2.8.1'
42 |
43 | compile 'com.lin:poweradapter:1.3@aar'
44 |
45 | compile 'com.github.bumptech.glide:glide:4.0.0'
46 | annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0'
47 | }
48 |
--------------------------------------------------------------------------------
/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 D:\soft\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 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/lin/timeline/example/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.lin.timeline.example;
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("com.lin.timeline.example", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lin/timeline/example/AbsOrderDelegate.java:
--------------------------------------------------------------------------------
1 | package com.lin.timeline.example;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.CallSuper;
5 | import android.support.annotation.LayoutRes;
6 | import android.support.annotation.NonNull;
7 | import android.support.v4.content.ContextCompat;
8 | import android.text.TextUtils;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 | import android.widget.TextView;
12 |
13 | import com.lin.poweradapter.AdapterDelegate;
14 | import com.lin.poweradapter.PowerViewHolder;
15 |
16 | import java.util.List;
17 |
18 | import butterknife.BindView;
19 |
20 | /**
21 | *
22 | * Created by lin18 on 2017/8/23.
23 | */
24 |
25 | public abstract class AbsOrderDelegate extends AdapterDelegate {
26 |
27 | @CallSuper
28 | @Override
29 | protected void onBindViewHolder(@NonNull Order item, int position, @NonNull PowerViewHolder holder, @NonNull List