Skip to content

Commit

Permalink
Reformatted code to follow Airbnb's styleguide (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
gpeal authored Feb 3, 2017
1 parent cb0e48a commit d8ff4b9
Show file tree
Hide file tree
Showing 64 changed files with 5,269 additions and 5,006 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.gradle
/local.properties
/.idea/*
!.idea/codeStyleSettings.xml
.DS_Store
/build
/captures
Expand Down
244 changes: 244 additions & 0 deletions .idea/codeStyleSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,25 @@
*/
public class LottieTest extends ActivityInstrumentationTestCase2<MainActivity> {

public LottieTest() {
super(MainActivity.class);
}
public LottieTest() {
super(MainActivity.class);
}

@Test
public void testAll() {
TestRobot.testAnimation(getActivity(), "9squares-AlBoardman.json");
TestRobot.testAnimation(getActivity(), "EmptyState.json");
TestRobot.testAnimation(getActivity(), "HamburgerArrow.json");
TestRobot.testAnimation(getActivity(), "LottieLogo1.json");
TestRobot.testAnimation(getActivity(), "LottieLogo2.json");
TestRobot.testAnimation(getActivity(), "MotionCorpse-Jrcanest.json");
TestRobot.testAnimation(getActivity(), "PinJump.json");
TestRobot.testAnimation(getActivity(), "TwitterHeart.json");
TestRobot.testAnimation(getActivity(), "Tests/Hosts.json");
TestRobot.testAnimation(getActivity(), "Tests/LightBulb.json", new float[] {0f, 0.05f, 0.10f, 0.2f, 0.3f, 0.4f, 0.5f, 1f});
TestRobot.testAnimation(getActivity(), "Tests/LoopPlayOnce.json");
TestRobot.testAnimation(getActivity(), "Tests/Alarm.json");
TestRobot.testAnimation(getActivity(), "Tests/CheckSwitch.json");
TestRobot.testAnimation(getActivity(), "Tests/EllipseTrimPath.json");
}
@Test
public void testAll() {
TestRobot.testAnimation(getActivity(), "9squares-AlBoardman.json");
TestRobot.testAnimation(getActivity(), "EmptyState.json");
TestRobot.testAnimation(getActivity(), "HamburgerArrow.json");
TestRobot.testAnimation(getActivity(), "LottieLogo1.json");
TestRobot.testAnimation(getActivity(), "LottieLogo2.json");
TestRobot.testAnimation(getActivity(), "MotionCorpse-Jrcanest.json");
TestRobot.testAnimation(getActivity(), "PinJump.json");
TestRobot.testAnimation(getActivity(), "TwitterHeart.json");
TestRobot.testAnimation(getActivity(), "Tests/Hosts.json");
TestRobot.testAnimation(getActivity(), "Tests/LightBulb.json", new float[]{0f, 0.05f, 0.10f, 0.2f, 0.3f, 0.4f, 0.5f, 1f});
TestRobot.testAnimation(getActivity(), "Tests/LoopPlayOnce.json");
TestRobot.testAnimation(getActivity(), "Tests/Alarm.json");
TestRobot.testAnimation(getActivity(), "Tests/CheckSwitch.json");
TestRobot.testAnimation(getActivity(), "Tests/EllipseTrimPath.json");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,29 @@
import java.util.Locale;

class TestRobot {
private static final float[] DEFAULT_ANIMATED_PROGRESS = {0f, 0.05f, 0.10f, 0.2f, 0.5f, 1f};
private static final float[] DEFAULT_STATIC_PROGRESS = {0f};
private static final float[] DEFAULT_ANIMATED_PROGRESS = {0f, 0.05f, 0.10f, 0.2f, 0.5f, 1f};
private static final float[] DEFAULT_STATIC_PROGRESS = {0f};

static void testAnimation(MainActivity activity, String fileName) {
testAnimation(activity, fileName, DEFAULT_ANIMATED_PROGRESS);
}
static void testAnimation(MainActivity activity, String fileName) {
testAnimation(activity, fileName, DEFAULT_ANIMATED_PROGRESS);
}

static void testAnimation(MainActivity activity, String fileName, float[] progress) {
LottieAnimationView view = new LottieAnimationView(activity);
view.setComposition(LottieComposition.fromFileSync(activity, fileName));
ViewHelpers.setupView(view)
.layout();
static void testAnimation(MainActivity activity, String fileName, float[] progress) {
LottieAnimationView view = new LottieAnimationView(activity);
view.setComposition(LottieComposition.fromFileSync(activity, fileName));
ViewHelpers.setupView(view)
.layout();

String nameWithoutExtension = fileName
.substring(0, fileName.indexOf('.'))
.replace("/", "_");
for (float p : progress) {
view.setProgress(p);
Screenshot.snap(view)
.setGroup(fileName)
.setName(String.format(Locale.US, "%s %d", nameWithoutExtension, (int) (p * 100)))
.record();
}
view.recycleBitmaps();
String nameWithoutExtension = fileName
.substring(0, fileName.indexOf('.'))
.replace("/", "_");
for (float p : progress) {
view.setProgress(p);
Screenshot.snap(view)
.setGroup(fileName)
.setName(String.format(Locale.US, "%s %d", nameWithoutExtension, (int) (p * 100)))
.record();
}
view.recycleBitmaps();
}
}
Loading

0 comments on commit d8ff4b9

Please sign in to comment.