Skip to content

Commit

Permalink
Removed some unused code (#1942)
Browse files Browse the repository at this point in the history
  • Loading branch information
gpeal authored Nov 6, 2021
1 parent 06571da commit da7d284
Show file tree
Hide file tree
Showing 14 changed files with 17 additions and 186 deletions.
8 changes: 6 additions & 2 deletions lottie/src/main/java/com/airbnb/lottie/LottieComposition.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.content.res.Resources;
import android.graphics.Rect;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RawRes;
import androidx.annotation.RestrictTo;
Expand Down Expand Up @@ -217,7 +218,9 @@ public float getDurationFrames() {
}


@Override public String toString() {
@NonNull
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("LottieComposition:\n");
for (Layer layer : layers) {
sb.append(layer.toString("\t"));
Expand Down Expand Up @@ -334,6 +337,7 @@ public static LottieComposition fromInputStreamSync(InputStream stream, boolean
@WorkerThread
@Deprecated
public static LottieComposition fromJsonSync(@SuppressWarnings("unused") Resources res, JSONObject json) {
//noinspection deprecation
return LottieCompositionFactory.fromJsonSync(json, null).getValue();
}

Expand Down Expand Up @@ -378,4 +382,4 @@ private ListenerAdapter(OnCompositionLoadedListener listener) {
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,10 @@ public List<ShapeGroup> getShapes() {
return shapes;
}

double getSize() {
return size;
}

public double getWidth() {
return width;
}

String getStyle() {
return style;
}

@Override public int hashCode() {
return hashFor(character, fontFamily, style);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@

public class AnimatableFloatValue extends BaseAnimatableValue<Float, Float> {

AnimatableFloatValue() {
super(0f);
}

public AnimatableFloatValue(List<Keyframe<Float>> keyframes) {
super(keyframes);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@

public class AnimatableIntegerValue extends BaseAnimatableValue<Integer, Integer> {

public AnimatableIntegerValue() {
super(100);
}

public AnimatableIntegerValue(List<Keyframe<Integer>> keyframes) {
super(keyframes);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,11 @@
import com.airbnb.lottie.animation.keyframe.PointKeyframeAnimation;
import com.airbnb.lottie.value.Keyframe;

import java.util.Collections;
import java.util.List;

public class AnimatablePathValue implements AnimatableValue<PointF, PointF> {
private final List<Keyframe<PointF>> keyframes;

/**
* Create a default static animatable path.
*/
public AnimatablePathValue() {
keyframes = Collections.singletonList(new Keyframe<>(new PointF(0, 0)));
}

public AnimatablePathValue(List<Keyframe<PointF>> keyframes) {
this.keyframes = keyframes;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@

public class AnimatableScaleValue extends BaseAnimatableValue<ScaleXY, ScaleXY> {

AnimatableScaleValue() {
this(new ScaleXY(1f, 1f));
}

public AnimatableScaleValue(ScaleXY value) {
super(value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,6 @@ public AnimatablePointValue getEndPoint() {
return endPoint;
}

@Nullable AnimatableFloatValue getHighlightLength() {
return highlightLength;
}

@Nullable AnimatableFloatValue getHighlightAngle() {
return highlightAngle;
}

public boolean isHidden() {
return hidden;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ private String getErrorFromConnection(HttpURLConnection connection) throws IOExc
while ((line = r.readLine()) != null) {
error.append(line).append('\n');
}
} catch (Exception e) {
throw e;
} finally {
try {
r.close();
Expand Down
10 changes: 0 additions & 10 deletions lottie/src/main/java/com/airbnb/lottie/network/FileExtension.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,4 @@ public String tempExtension() {
return extension;
}

public static FileExtension forFile(String filename) {
for (FileExtension e : values()) {
if (filename.endsWith(e.extension)) {
return e;
}
}
// Default to Json.
Logger.warning("Unable to find correct extension for " + filename);
return JSON;
}
}

This file was deleted.

1 change: 1 addition & 0 deletions lottie/src/main/java/com/airbnb/lottie/utils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ public static void saveLayerCompat(Canvas canvas, RectF rect, Paint paint, int f
/**
* For testing purposes only. DO NOT USE IN PRODUCTION.
*/
@SuppressWarnings("unused")
public static Bitmap renderPath(Path path) {
RectF bounds = new RectF();
path.computeBounds(bounds, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@
import java.io.InputStream;

import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertNotSame;
import static junit.framework.Assert.assertNull;
import static okio.Okio.buffer;
import static okio.Okio.source;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;

@SuppressWarnings("ReferenceEquality")
public class LottieCompositionFactoryTest extends BaseTest {
Expand Down Expand Up @@ -120,7 +118,6 @@ public void testZeroCacheWorks() {
JsonReader reader = JsonReader.of(buffer(source(getNeverCompletingInputStream())));
LottieCompositionFactory.setMaxCacheSize(1);
LottieResult<LottieComposition> taskFoo1 = LottieCompositionFactory.fromJsonReaderSync(reader, "foo");
LottieResult<LottieComposition> taskBar = LottieCompositionFactory.fromJsonReaderSync(reader, "bar");
LottieResult<LottieComposition> taskFoo2 = LottieCompositionFactory.fromJsonReaderSync(reader, "foo");
assertNotSame(taskFoo1, taskFoo2);
}
Expand Down
12 changes: 3 additions & 9 deletions lottie/src/test/java/com/airbnb/lottie/LottieTaskTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ public void setup() {

@Test
public void testListener() {
LottieTask<Integer> task = new LottieTask<>(new Callable<LottieResult<Integer>>() {
@Override public LottieResult<Integer> call() {
return new LottieResult<>(5);
}
}, true)
new LottieTask<>(() -> new LottieResult<>(5), true)
.addListener(successListener)
.addFailureListener(failureListener);
verify(successListener, times(1)).onResult(5);
Expand All @@ -39,10 +35,8 @@ public void testListener() {
@Test
public void testException() {
final IllegalStateException exception = new IllegalStateException("foo");
LottieTask<Integer> task = new LottieTask<>(new Callable<LottieResult<Integer>>() {
@Override public LottieResult<Integer> call() {
throw exception;
}
new LottieTask<>((Callable<LottieResult<Integer>>) () -> {
throw exception;
}, true)
.addListener(successListener)
.addFailureListener(failureListener);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,14 @@ class HappoSnapshotter(
val json = JsonObject()
val snaps = JsonArray()
json.add("snaps", snaps)
snapshots.forEach {
snaps.add(it.toJson())
snapshots.forEach { s ->
snaps.add(s.toJson())
}
Log.d(L.TAG, "Finished creating snapshot report")
reportNames.forEach { reportName ->
Log.d(L.TAG, "Uploading $reportName")
upload(reportName, json)
}
reportNames.forEach { upload(it, json) }
}

private suspend fun upload(reportName: String, json: JsonElement) {
Expand Down

0 comments on commit da7d284

Please sign in to comment.