package com.nmakademija.nmaakademija.entity;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.Date;

public class TimeUntilSession implements Parcelable {

    public static final Parcelable.Creator<TimeUntilSession> CREATOR = new Parcelable.Creator<TimeUntilSession>() {
        @Override
        public TimeUntilSession createFromParcel(Parcel source) {
            return new TimeUntilSession(source);
        }

        @Override
        public TimeUntilSession[] newArray(int size) {
            return new TimeUntilSession[size];
        }
    };
    private Date startTime;
    private Date endTime;

    public TimeUntilSession() {
    }

    protected TimeUntilSession(Parcel in) {
        long tmpStartTime = in.readLong();
        this.startTime = tmpStartTime == -1 ? null : new Date(tmpStartTime);
        long tmpEndTime = in.readLong();
        this.endTime = tmpEndTime == -1 ? null : new Date(tmpEndTime);
    }

    public Date getEndTime() {
        return endTime;
    }

    public Date getStartTime() {
        return startTime;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeLong(this.startTime != null ? this.startTime.getTime() : -1);
        dest.writeLong(this.endTime != null ? this.endTime.getTime() : -1);
    }

    public boolean isSession() {
        long now = new Date().getTime();
        return startTime.getTime() < now;
    }
}

@@ -184,114 +184,86 @@
    p
-ublic static final Parcelable.Creator%3CTimeUntilSession%3E CREATOR = new Parcelable.Creator%3CTimeUntil
+rivate Date startTime;%0A    private Date endTime;%0A%0A    public boolean is
 Session
-%3E
 () %7B
@@ -275,213 +275,117 @@
     
-@Override%0A        public TimeUntilSession createFromParcel(Parcel source) %7B%0A            return new TimeUntilSession(source);%0A        %7D%0A%0A        @Override%0A        public TimeUntilSession%5B%5D newArray(int size
+long now = new Date().getTime();%0A        return startTime.getTime() %3C now;%0A    %7D%0A%0A    public Date getEndTime(
 ) %7B%0A
@@ -396,90 +396,59 @@
     
- 
-   
 return 
-new TimeUntilSession%5Bsize%5D;%0A        %7D%0A    %7D;%0A    private
+endTime;%0A    %7D%0A%0A    public
  Date 
-s
+getS
 tartTime
 ;%0A  
@@ -447,35 +447,44 @@
 Time
-;
+() %7B
 %0A    
-private Date endTime;
+    return startTime;%0A    %7D
 %0A%0A  
@@ -807,136 +807,8 @@
  %7D%0A%0A
-    public Date getEndTime() %7B%0A        return endTime;%0A    %7D%0A%0A    public Date getStartTime() %7B%0A        return startTime;%0A    %7D%0A%0A
     
@@ -1122,33 +1122,116 @@
  public 
-boolean is
+static final Parcelable.Creator%3CTimeUntilSession%3E CREATOR = new Parcelable.Creator%3CTimeUntil
 Session
+%3E
 () %7B%0A   
@@ -1239,87 +1239,279 @@
     
-long now = new Date().getTime();%0A        return startTime.getTime() %3C now;
+@Override%0A        public TimeUntilSession createFromParcel(Parcel source) %7B%0A            return new TimeUntilSession(source);%0A        %7D%0A%0A        @Override%0A        public TimeUntilSession%5B%5D newArray(int size) %7B%0A            return new TimeUntilSession%5Bsize%5D;%0A        %7D
 %0A    %7D
+;
 %0A%7D%0A

Rearrange code.