aboutsummaryrefslogtreecommitdiff
path: root/shadows/framework/src/main/java/org/robolectric/shadows/ShadowNativeNativeInterpolatorFactory.java
blob: 21c80e5c19da20bfa956d6fc5f6ce95d8abad611 (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
package org.robolectric.shadows;

import static android.os.Build.VERSION_CODES.R;

import android.graphics.animation.NativeInterpolatorFactory;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
import org.robolectric.nativeruntime.DefaultNativeRuntimeLoader;
import org.robolectric.nativeruntime.NativeInterpolatorFactoryNatives;
import org.robolectric.shadows.ShadowNativeNativeInterpolatorFactory.Picker;

/** Shadow for {@link NativeInterpolatorFactory} that is backed by native code */
@Implements(
    value = NativeInterpolatorFactory.class,
    minSdk = R,
    shadowPicker = Picker.class,
    isInAndroidSdk = false)
public class ShadowNativeNativeInterpolatorFactory {

  static {
    DefaultNativeRuntimeLoader.injectAndLoad();
  }

  @Implementation
  protected static long createAccelerateDecelerateInterpolator() {
    return NativeInterpolatorFactoryNatives.createAccelerateDecelerateInterpolator();
  }

  @Implementation
  protected static long createAccelerateInterpolator(float factor) {
    return NativeInterpolatorFactoryNatives.createAccelerateInterpolator(factor);
  }

  @Implementation
  protected static long createAnticipateInterpolator(float tension) {
    return NativeInterpolatorFactoryNatives.createAnticipateInterpolator(tension);
  }

  @Implementation
  protected static long createAnticipateOvershootInterpolator(float tension) {
    return NativeInterpolatorFactoryNatives.createAnticipateOvershootInterpolator(tension);
  }

  @Implementation
  protected static long createBounceInterpolator() {
    return NativeInterpolatorFactoryNatives.createBounceInterpolator();
  }

  @Implementation
  protected static long createCycleInterpolator(float cycles) {
    return NativeInterpolatorFactoryNatives.createCycleInterpolator(cycles);
  }

  @Implementation
  protected static long createDecelerateInterpolator(float factor) {
    return NativeInterpolatorFactoryNatives.createDecelerateInterpolator(factor);
  }

  @Implementation
  protected static long createLinearInterpolator() {
    return NativeInterpolatorFactoryNatives.createLinearInterpolator();
  }

  @Implementation
  protected static long createOvershootInterpolator(float tension) {
    return NativeInterpolatorFactoryNatives.createOvershootInterpolator(tension);
  }

  @Implementation
  protected static long createPathInterpolator(float[] x, float[] y) {
    return NativeInterpolatorFactoryNatives.createPathInterpolator(x, y);
  }

  @Implementation
  protected static long createLutInterpolator(float[] values) {
    return NativeInterpolatorFactoryNatives.createLutInterpolator(values);
  }

  /** Shadow picker for {@link NativeInterpolatorFactory}. */
  public static final class Picker extends GraphicsShadowPicker<Object> {
    public Picker() {
      super(null, ShadowNativeNativeInterpolatorFactory.class);
    }
  }
}