Giter Site home page Giter Site logo

vipulasri / timeline-view Goto Github PK

View Code? Open in Web Editor NEW
3.8K 97.0 640.0 20.34 MB

Android Timeline View is used to display views like Tracking of shipment/order, steppers etc.

License: Apache License 2.0

Java 34.74% Kotlin 65.26%
android timeline ui recyclerview timelineview android-timeline

timeline-view's Introduction

Timeline-View

Android Timeline View Library (Using RecyclerView) is simple implementation used to display view like Tracking of shipment/order, steppers etc.

Specs

Maven Central License

Badges/Featured In

Timeline View Android Arsenal AndroidWeekly AndroidDev Digest

showcase

Sample Project

For information : checkout Example Screen Code in repository.

Download

TimelineView on Google Play

Quick Setup

1. Include library

Using Gradle

dependencies {
    implementation 'com.github.vipulasri:timelineview:1.1.5'
}

What's New

See the project's Releases page for a list of versions with their change logs.

If you Watch this repository, GitHub will send you an email every time I publish an update.

2. Usage

  • In XML Layout :
<com.github.vipulasri.timelineview.TimelineView
    android:id="@+id/timeline"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    app:markerSize="20dp"
    app:lineWidth="2dp"
    app:startLineColor="@color/colorPrimary"
    app:endLineColor="@color/colorPrimary"/>
Line Padding around marker
<com.github.vipulasri.timelineview.TimelineView
    android:id="@+id/timeline"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    app:markerSize="20dp"
    app:lineWidth="2dp"
    app:startLineColor="@color/colorPrimary"
    app:endLineColor="@color/colorPrimary"
    app:linePadding="5dp"/>
  • Configure using xml attributes or setters in code:

    Attribute Name Default Value Description
    app:marker="@drawable/marker" Green Colored Oval Drawable sets marker drawable
    app:markerSize="25dp" 25dp sets marker size
    app:markerInCenter="false" true sets the marker in center of line if `true`
    app:markerPaddingLeft="0dp" 0dp sets the marker left padding, applicable only with horizontal orientation
    app:markerPaddingTop="0dp" 0dp sets the marker top padding, applicable only with vertical orientation
    app:markerPaddingRight="0dp" 0dp sets the marker right padding, applicable only with horizontal orientation
    app:markerPaddingBottom="0dp" 0dp sets the marker bottom padding, applicable only with vertical orientation
    app:startLineColor="@color/primarColor" Dark Grey Line sets start line color
    app:endLineColor="@color/primarColor" Dark Grey Line sets end line color
    app:lineWidth="2dp" 2dp sets line width
    app:lineOrientation="horizontal" vertical sets orientation of line ie `horizontal` or `vertical`
    app:linePadding="5dp" 0dp sets line padding around marker
    app:lineStyle="dash" normal sets line style ie `normal` or `dashed`
    app:lineStyleDashGap="4dp" 4dp sets line dash gap
    app:lineStyleDashLength="8dp" 8dp sets line dash length
  • RecyclerView Holder : Your RecyclerViewHolder should have an extra parameter 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.timeline);
            mTimelineView.initLine(viewType);
        }
    }
  • RecyclerView Adapter : override 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);
    }

Apps that use this library

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

License

Copyright 2018 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.

timeline-view's People

Contributors

dexpota avatar henriquenfaria avatar inviatravel avatar pcansubi avatar tcqq avatar vidia avatar vipulasri avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

timeline-view's Issues

giving error invalid root mapping... Invalid VCS root mapping The directory <Project> is registered as a Git root, but no Git repositories were found there. Configure

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Smartphone (please complete the following information):

  • Device: [e.g. Pixel 2XL]
  • OS: [e.g. Android 9.0]
  • Version [e.g. 28]

add marker on the top

how do I add the marker on the top of the line which is now appearing in the center of the line?

Timeline-View requires that my adapter can't have two or more item view types.

The sample source, as follows:

public class TimeLineAdapter extends RecyclerView.Adapter<TimeLineViewHolder> {
    ... ...
    @Override
    public int getItemViewType(int position) {
        return TimelineView.getTimeLineViewType(position,getItemCount());
    }

And check the TimelineView.getTimeLineViewType(...) function, as follows:

 public class TimelineView extends View {
     public static int getTimeLineViewType(int position, int total_size) {
         if(total_size == 1) {
             return LineType.ONLYONE;
         } else if(position == 0) {
             return LineType.BEGIN;
         } else if(position == total_size - 1) {
             return LineType.END;
         } else {
             return LineType.NORMAL;
         }
     }

As mentioned above, if use Timeline-View, then the adapter just have 4 item view types(They are : LineType.ONLYONE, LineType.BEGIN, LineType.END and LineType.NORMAL).
That is to say that Timeline-View assume that the developer defines only ONE type of item view. If defines two or more item view types, there is a conflict with the item view types defined by Timeline-View.

Fix this issue, there is a solution: it is similar to View.MeasureSpec.
The higher 2-bits is used to define TimelineView types, and the lower 30-bits is used to define user's types.

small bug in TimelineView.getTimelineViewType?

I think the only-one check should happen first, otherwise you get a dangling line.

public static int getTimeLineViewType(int position, int total_size) {
if(total_size == 1) {
return LineType.ONLYONE;
} else if(position == 0) {
return LineType.BEGIN;
} else if(position == total_size - 1) {
return LineType.END;
} else {
return LineType.NORMAL;
}
}

Line is broken

Hey lines those connect icons (markers) are not painted correctly.
zrzut ekranu 2017-11-27 o 13 09 02

After I scroll down, and then scroll up (recycle mechinism) line move to the correct place

Height of my element on the list is not constans ( sometimes more text in many lines)
Item of recycle View adapter looks like

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:app="http://schemas.android.com/apk/res-auto"
              xmlns:tools="http://schemas.android.com/tools"
              android:orientation="horizontal"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
    android:paddingLeft="8dp"
    android:paddingRight="8dp">

    <com.github.vipulasri.timelineview.TimelineView
        android:id="@+id/timeline_marker"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        app:markerSize="36dp"
        app:lineSize="2dp"
        app:line="@color/teal"
        app:linePadding="0dp"
        app:markerInCenter="true"
        app:marker="@drawable/ic_service_history_tire"
        android:layout_marginLeft="8dp"
        android:layout_gravity="center_vertical"/>

<OtherView....>
</LinearLayout>

How can I add sections?

Any tip to how do I implement Sectioned Timeline.
for eg,
Each day becomes section and timeline as hours of a day, If day changes, new section with timeline will be created

Any help with this usecase

issue with vector drawable below sdk version less than 21

I am getting a crash because of following exception:

android.content.res.Resources$NotFoundException: File res/drawable-xxhdpi-v4/ic_marker_active.png from xml type xml resource ID #0x7f020071. If the resource you are trying to use is a vector resource, you may be referencing it in an unsupported way. See AppCompatDelegate.setCompatVectorFromResourcesEnabled() for more info.

any idead what might be the issue?

Drawable Marker doesn't support SVG drawables

It's common issue that in order to use SVG on pre-KitKat you have to use in ImageView
app:srcCompat instead of android:src.

The same situation here, but not handled. It throws exception.

the line does not show

the line does not show up when i use your view by gradle, my code is below, can you help me find the problem?

<!-- left = timeline view -->
<com.github.vipulasri.timelineview.TimelineView
    android:id="@+id/tlv_a_timeline"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_marginTop="@dimen/dimen_10"
    app:markerSize="20dp"
    app:lineSize="3dp"
    app:line="@color/black"
    app:linePadding="5dp"
    />

<!-- right = detail -->
<RelativeLayout
    android:id="@+id/ll_adapter_rv_a_timeline_right"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="@dimen/dimen_5"
    android:layout_marginLeft="@dimen/dimen_10"
    android:layout_marginRight="@dimen/dimen_10"
    android:layout_marginTop="@dimen/dimen_5"
    android:layout_toRightOf="@id/tlv_a_timeline"
    android:background="@drawable/shape_c_rect_3_bg_white">

    <!-- date -->
    <TextView
        android:id="@+id/tv_adapter_rv_a_timeline_date"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="@dimen/dimen_5"
        android:layout_marginRight="@dimen/dimen_5"
        android:ellipsize="end"
        android:gravity="left|center_vertical"
        android:maxEms="20"
        android:singleLine="true"
        android:text="2017-12-11 12:50:23"
        android:textColor="@color/black"
        android:textSize="@dimen/font_12" />

    <View
        android:id="@+id/view_adapter_rv_a_timeline_1"
        android:layout_width="match_parent"
        android:layout_height="@dimen/dimen_1"
        android:layout_below="@id/tv_adapter_rv_a_timeline_date"
        android:layout_centerInParent="true"
        android:background="@color/bg_line_lightgray" />

    <!-- title -->
    <TextView
        android:id="@+id/tv_adapter_rv_a_timeline_title"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/view_adapter_rv_a_timeline_1"
        android:layout_marginLeft="@dimen/dimen_5"
        android:layout_marginRight="@dimen/dimen_5"
        android:ellipsize="end"
        android:gravity="left|center_vertical"
        android:maxEms="20"
        android:singleLine="true"
        android:text="timeline标题"
        android:textColor="@color/black"
        android:textSize="@dimen/font_16" />

    <View
        android:id="@+id/view_adapter_rv_a_timeline_2"
        android:layout_width="match_parent"
        android:layout_height="@dimen/dimen_1"
        android:layout_below="@id/tv_adapter_rv_a_timeline_title"
        android:background="@color/bg_line_lightgray" />

    <!-- title -->
    <TextView
        android:id="@+id/tv_adapter_rv_a_timeline_detail"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/view_adapter_rv_a_timeline_2"
        android:layout_marginLeft="@dimen/dimen_5"
        android:layout_marginRight="@dimen/dimen_5"
        android:ellipsize="end"
        android:gravity="left|center_vertical"
        android:maxEms="20"
        android:singleLine="true"
        android:text="timeline详情"
        android:textColor="@color/black"
        android:textSize="@dimen/font_12" />

</RelativeLayout>

public class MyViewHolder extends RecyclerView.ViewHolder {

    private TimelineView tlv;
    private TextView tvTitle;
    private TextView tvDetail;
    private TextView tvDate;

    public MyViewHolder(View view, int viewType) {
        super(view);
        tlv = view.findViewById(R.id.tlv_a_timeline);
        tlv.initLine(viewType);
        tvTitle = view.findViewById(R.id.tv_adapter_rv_a_timeline_title);
        tvDetail = view.findViewById(R.id.tv_adapter_rv_a_timeline_detail);
        tvDate = view.findViewById(R.id.tv_adapter_rv_a_timeline_date);
    }
}

default

Large Card

So with a larger card the line is not connected.
alt text

Any idea why

Change icon / setMarker

How to setMarker or change the icon

<com.vipul.hp_hp.timelineview.TimelineView
android:id="@+id/red_marker"
android:layout_width="wrap_content"
android:layout_height="match_parent"
app:marker_size="35dp"
app:marker="@drawable/ic_timeline_red"
app:line_size="2dp"
app:line="@android:color/black"/>

I use app:marker to change icon from xml

how to change the icon or marker from java code?

I got some error when I change it
java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.drawable.Drawable android.content.Context.getDrawable(int)' on a null object reference

this is my java code

Drawable res = ContextCompat.getDrawable(context, R.drawable.ic_timeline_blue);

    if(timeLineModel.getJenis().equalsIgnoreCase("1")){ 
        holder.mTimelineView.setMarker(res);
    }

can you help me please

thank you so much

In api<21 getting error: Error inflating class com.github.vipulasri.timelineview.TimelineView

Getting an app crash while testing library in api 16

E/AndroidRuntime: FATAL EXCEPTION: main android.view.InflateException: Binary XML file line #0: Error inflating class com.github.vipulasri.timelineview.TimelineView at android.view.LayoutInflater.createView(LayoutInflater.java:613) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687) at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) at android.view.LayoutInflater.inflate(LayoutInflater.java:489) at android.view.LayoutInflater.inflate(LayoutInflater.java:396) at com.adapter.MyAdapter.onCreateViewHolder(MyAdapter.java:48) at com.adapter.MyAdapter.onCreateViewHolder(MyAdapter.java:35) at jp.wasabeef.recyclerview.adapters.AnimationAdapter.onCreateViewHolder(AnimationAdapter.java:40) at jp.wasabeef.recyclerview.adapters.AnimationAdapter.onCreateViewHolder(AnimationAdapter.java:40) at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6519) at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5706) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5589) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5585) at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2231) at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1558) at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1518) at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:610) at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3719) at android.support.v7.widget.RecyclerView.onMeasure(RecyclerView.java:3135) at android.view.View.measure(View.java:15172) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4816) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1390) at android.widget.LinearLayout.measureVertical(LinearLayout.java:681) at android.widget.LinearLayout.onMeasure(LinearLayout.java:574) at android.view.View.measure(View.java:15172) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4816) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1390) at android.widget.LinearLayout.measureVertical(LinearLayout.java:681) at android.widget.LinearLayout.onMeasure(LinearLayout.java:574) at android.view.View.measure(View.java:15172) at android.support.v4.widget.NestedScrollView.measureChildWithMargins(NestedScrollView.java:1449) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at android.support.v4.widget.NestedScrollView.onMeasure(NestedScrollView.java:515) at android.view.View.measure(View.java:15172) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4816) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:139) at android.view.View.measure(View.java:15172) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4816) at android.support.v7.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:400) at android.view.View.measure(View.java:15172) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4816) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at android.view.View.measure(View.java:15172) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4816) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1390) at android.widget.LinearLayout.measureVertical(LinearLayout.java:681) at android.widget.LinearLayout.onMeasure(LinearLayout.java:574) at android.view.View.measure(View.java:15172) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4816) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2148) at android.view.Vi

Change marker color after a click

I am trying to change the marker color after an item click. However, it seems setMarkerColor() only works on the onBindViewHolder(). Is this true?

How to set horizontal fit screen

I would like to set horizontal *<android.support.v7.widget.CardView *

android:layout_width="50dp"
android:layout_height="300dp"

I use match_parent for layout_width & wrap_content for layout_height. It doesn't change match_parent. It doesn't set fix match_parent on my phone.

Position of marker

I want to change to postion of the marker on the top of the line and not in the center of the line in a particular view . Is that possible ? Please Help.

Change Line position

Hi, thanks for the lib thats cool.

Can we change line position for example center or right aligned?

Thank you

App crashed on pre lollipop device

Device details
Samsung galaxy S3 SGH-T999, Android 4.3
Lava irisX8, Android 4.4

compileSdkVersion 25
buildToolsVersion "25.0.2"
i am using 'com.github.vipulasri:timelineview:1.0.6'

System log is as follows
FATAL EXCEPTION: main
java.lang.IllegalArgumentException: radius must be > 0
at android.graphics.RadialGradient.(RadialGradient.java:53)
at android.support.v7.widget.RoundRectDrawableWithShadow.buildShadowCorners(RoundRectDrawableWithShadow.java:323)
at android.support.v7.widget.RoundRectDrawableWithShadow.buildComponents(RoundRectDrawableWithShadow.java:345)
at android.support.v7.widget.RoundRectDrawableWithShadow.draw(RoundRectDrawableWithShadow.java:247)
at android.view.View.draw(View.java:14721)
at android.widget.FrameLayout.draw(FrameLayout.java:534)
at android.view.View.getDisplayList(View.java:13602)
at android.view.View.getDisplayList(View.java:13649)
at android.view.View.draw(View.java:14444)
at android.view.ViewGroup.drawChild(ViewGroup.java:3252)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3070)
at android.view.View.getDisplayList(View.java:13594)
at android.view.View.getDisplayList(View.java:13649)
at android.view.View.draw(View.java:14444)
at android.view.ViewGroup.drawChild(ViewGroup.java:3252)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3070)
at android.view.View.getDisplayList(View.java:13594)
at android.view.View.getDisplayList(View.java:13649)
at android.view.View.draw(View.java:14444)
at android.view.ViewGroup.drawChild(ViewGroup.java:3252)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3070)
at android.view.View.draw(View.java:14753)
at android.widget.FrameLayout.draw(FrameLayout.java:534)
at android.view.View.getDisplayList(View.java:13602)
at android.view.View.getDisplayList(View.java:13649)
at android.view.View.draw(View.java:14444)
at android.view.ViewGroup.drawChild(ViewGroup.java:3252)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3070)
at android.view.View.getDisplayList(View.java:13594)
at android.view.View.getDisplayList(View.java:13649)
at android.view.View.draw(View.java:14444)
at android.view.ViewGroup.drawChild(ViewGroup.java:3252)
at android.support.v7.widget.RecyclerView.drawChild(RecyclerView.java:4477)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3070)
at android.view.View.draw(View.java:14753)
at android.support.v7.widget.RecyclerView.draw(RecyclerView.java:3869)
at android.view.View.getDisplayList(View.java:13602)
at android.view.View.getDisplayList(View.java:13649)
at android.view.View.draw(View.java:14444)
at android.view.ViewGroup.drawChild(ViewGroup.java:3252)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3070)
at android.view.View.getDisplayList(View.java:13594)
at android.view.View.getDisplayList(View.java:13649)
at android.view.View.draw(View.java:14444)
at android.view.ViewGroup.drawChild(ViewGroup.java:3252)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3070)
at android.view.View.getDisplayList(View.java:13594)
at android.view.View.getDisplayList(View.java:13649)
at android.view.View.draw(View.java:14444)
at android.view.ViewGroup.drawChild(ViewGroup.java:3252)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3070)
at android.view.View.getDisplayList(View.java:13594)
at android.view.View.getDisplayList(View.java:13649)
at android.view.View.draw(View.java:14444)
at android.view.ViewGroup.drawChild(ViewGroup.java:3252)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3070)
at android.view.View.getDisplayList(View.java:13594)
at android.view.View.getDisplayList(View.java:13649)
at android.view.View.draw(View.java:14444)
at android.view.ViewGroup.drawChild(ViewGroup.java:3252)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3070)
at android.view.View.getDisplayList(View.java:13594)
at android.view.View.getDisplayList(View.java:13649)
at android.view.View.draw(View.java:14444)
at android.view.ViewGroup.drawChild(ViewGroup.java:3252)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3090)
at android.view.View.draw(View.java:14753)
at android.view.View.getDisplayList(View.java:13602)
at android.view.View.getDisplayList(View.java:13649)
at android.view.

two or more activities for the same date

Awesome project Vipul.

I have a use case where I want to show two or more activities for the same date/day and hence I do not want the marker to be shown but instead just a straight blue line in the timeline. Is this possible? If not, can you share a drawable XML for the same?

Change Line Color Dynamically As Per Position

Hi there,

Is there any way to change line color dynamically as per position? I mean to say that initially lines are drawn with gray color. Now as position gets changed based on button click, upto that position line's color changes to red. For example, I have 5 markers. All makers color are gray initially along with lines. Now I press button so my current position is 1. Now I want to change color of marker at 0 and 1 position and line between 0 and 1 to red.

Please refer below image.
required

How can I achieve this?

unable to use it programtically

i am not getting line between markes. i am using this programmatically my code is

TimelineView clTimelineView=new TimelineView(context,null);
           LinearLayout.LayoutParams timeliLayoutParams=new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT);
           clTimelineView.setLayoutParams(timeliLayoutParams);
           clTimelineView.setId(R.id.rv_result_line_marker);
           clTimelineView.setMarkerSize(20);
           clTimelineView.setLineSize( 50);
          /* clTimelineView.setStartLine(new ColorDrawable(this.getResources().getColor(android.R.color.darker_gray)));
           clTimelineView.setEndLine(new ColorDrawable(this.getResources().getColor(R.color.green_primary)));*/

Problem in dynamic rows

I used your library to a dynamic list - a list where the content can be with/without image. But there is some problem on row with images, you can see the problem below:

timelineview-dynamiclist

I have applied match parent on timeline view and it doesn't help me at all.

For the dynamic view, I used View.VISIBLE to show and View.GONE on the onBindViewHolder method.

I don't know whether this is a bug on the library or is it just me wrong in implementing it.

Your help will be really appreciated.

Extra line in First and last items

Hey, I have gone over the sample app provided and the methods available. But I cannot seem to remove the extra line spacing. I mean I have an Adapter, an item view and a recycler view, where I am loading the item views with the help of adapter.
How can I disable that extra line on the first and last items.
I maybe missing something simple and I am sorry that I am posting this as an issues but I could not find resources on other places.

How to implement Timeline in a Fragment with ViewPager

public class IslemlerFragment extends Fragment {

private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;

private RecyclerView mRecyclerView;
private TimeLineAdapter mTimeLineAdapter;
private List<TimeLineModel> mDataList = new ArrayList<>();
private Orientation mOrientation;
private boolean mWithLinePadding;

public IslemlerFragment() {
    // Required empty public constructor
}

/**
 * Use this factory method to create a new instance of
 * this fragment using the provided parameters.
 *
 * @param param1 Parameter 1.
 * @param param2 Parameter 2.
 * @return A new instance of fragment IslemlerFragment.
 */
// TODO: Rename and change types and number of parameters
public static IslemlerFragment newInstance(String param1, String param2) {
    IslemlerFragment fragment = new IslemlerFragment();
    Bundle args = new Bundle();
    args.putString(ARG_PARAM1, param1);
    args.putString(ARG_PARAM2, param2);
    fragment.setArguments(args);
    return fragment;
}

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (getArguments() != null) {
        mParam1 = getArguments().getString(ARG_PARAM1);
        mParam2 = getArguments().getString(ARG_PARAM2);

        mDataList.add(new TimeLineModel("Item successfully delivered", "", OrderStatus.INACTIVE));
        mDataList.add(new TimeLineModel("Courier is out to delivery your order", "2017-02-12 08:00", OrderStatus.ACTIVE));
        mDataList.add(new TimeLineModel("Item has reached courier facility at New Delhi", "2017-02-11 21:00", OrderStatus.COMPLETED));
        mDataList.add(new TimeLineModel("Item has been given to the courier", "2017-02-11 18:00", OrderStatus.COMPLETED));
        mDataList.add(new TimeLineModel("Item is packed and will dispatch soon", "2017-02-11 09:30", OrderStatus.COMPLETED));
        mDataList.add(new TimeLineModel("Order is being readied for dispatch", "2017-02-11 08:00", OrderStatus.COMPLETED));
        mDataList.add(new TimeLineModel("Order processing initiated", "2017-02-10 15:00", OrderStatus.COMPLETED));
        mDataList.add(new TimeLineModel("Order confirmed by seller", "2017-02-10 14:30", OrderStatus.COMPLETED));
        mDataList.add(new TimeLineModel("Order placed successfully", "2017-02-10 14:00", OrderStatus.COMPLETED));
    }
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_islemler, container, false);

    mOrientation = Orientation.VERTICAL;
    mWithLinePadding = true;

    mRecyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
    LinearLayoutManager llm = new LinearLayoutManager(getActivity());

    mRecyclerView.setLayoutManager(llm);
    mRecyclerView.setHasFixedSize(true);

    mTimeLineAdapter = new TimeLineAdapter(mDataList, mOrientation, mWithLinePadding);

    mRecyclerView.setAdapter(mTimeLineAdapter);
    //Application crash
    return  view;
}
}`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.