summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/TransitionOptions.java
blob: 2a25302aed63f344abd5479de3759621d9564aec (plain)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package com.mapbox.mapboxsdk.style.layers;

import android.support.annotation.Keep;

/**
 * Resembles transition property from the style specification.
 *
 * @see <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#transition">Transition documentation</a>
 */
public class TransitionOptions {

  private long duration;
  private long delay;

  /**
   * Create a transition property based on duration and a delay.
   *
   * @param duration the duration of the transition
   * @param delay    the delay to start the transition
   */
  public TransitionOptions(long duration, long delay) {
    this.duration = duration;
    this.delay = delay;
  }

  /**
   * Create a transition property based on duration and a delay.
   *
   * @param duration the duration of the transition
   * @param delay    the delay to start the transition
   * @return a new transition property object
   */
  @Keep
  public static TransitionOptions fromTransitionOptions(long duration, long delay) {
    return new TransitionOptions(duration, delay);
  }

  /**
   * Get the transition duration.
   *
   * @return the transition duration
   */
  public long getDuration() {
    return duration;
  }

  /**
   * Get the transition delay.
   *
   * @return the transition delay
   */
  public long getDelay() {
    return delay;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }

    TransitionOptions that = (TransitionOptions) o;

    if (duration != that.duration) {
      return false;
    }
    return delay == that.delay;
  }

  @Override
  public int hashCode() {
    int result = (int) (duration ^ (duration >>> 32));
    result = 31 * result + (int) (delay ^ (delay >>> 32));
    return result;
  }

  @Override
  public String toString() {
    return "TransitionOptions{"
      + "duration=" + duration
      + ", delay=" + delay
      + '}';
  }
}