Skip to content

Commit

Permalink
Merge pull request ResearchKit#29 from liujoshua/feature/code-style
Browse files Browse the repository at this point in the history
Apply auto format
  • Loading branch information
liujoshua committed Jun 25, 2018
2 parents 41f6142 + 254ada5 commit 07de111
Show file tree
Hide file tree
Showing 306 changed files with 3,623 additions and 3,467 deletions.
2 changes: 1 addition & 1 deletion .idea/encodings.xml

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

2 changes: 1 addition & 1 deletion app/build.gradle
Expand Up @@ -93,7 +93,7 @@ dependencies {

implementation "android.arch.lifecycle:extensions:1.1.1"
implementation 'com.google.code.findbugs:jsr305:2.0.1'

annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
implementation 'com.android.support:appcompat-v7:27.1.1'

Expand Down
Expand Up @@ -32,23 +32,24 @@

package org.sagebionetworks.research.app;

import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withText;

import android.content.Intent;
import android.support.test.InstrumentationRegistry;
import android.support.test.filters.LargeTest;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;

import org.junit.*;
import org.junit.runner.*;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.sagebionetworks.research.presentation.model.TaskView;

import java.util.UUID;

import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withText;

@RunWith(AndroidJUnit4.class)
@LargeTest
public class PerformFooTaskTest {
Expand Down
16 changes: 9 additions & 7 deletions app/src/main/assets/task/foo.json
Expand Up @@ -3,7 +3,7 @@
"asyncActions": [],
"actions": {
"cancel": {
"type":"base",
"type": "base",
"iconName": "closeActivity"
}
},
Expand All @@ -21,7 +21,7 @@
"image": "before",
"actions": {
"goForward": {
"type":"base",
"type": "base",
"buttonTitle": "Go, Dogs!"
}
}
Expand Down Expand Up @@ -109,13 +109,13 @@
"text": "This is the second step in the Foo task.",
"detail": "On this screen you should see an image below the text with a picture of a phone in a pocket. The next step after this one is an active step. When it starts, you should hear voice commands.",
"image": {
"type":"fetchable",
"type": "fetchable",
"imageName": "phoneinpocketIllustration",
"placementType": "iconAfter"
},
"actions": {
"goForward": {
"type":"base",
"type": "base",
"buttonTitle": "Start"
}
}
Expand All @@ -138,9 +138,11 @@
}
},
{
"identifier":"left",
"type":"transform",
"resourceTransformer": { "resourceName": "TremorSectionStep.json"}
"identifier": "left",
"type": "transform",
"resourceTransformer": {
"resourceName": "TremorSectionStep.json"
}
}
]
}
2 changes: 1 addition & 1 deletion app/src/main/assets/task/instructionStepTest.json
Expand Up @@ -6,7 +6,7 @@
"detail": "On this screen you should see an image below the text with a picture of a phone in a pocket. The next step after this one is an active step. When it starts, you should hear voice commands.",
"actions": {
"goForward": {
"type":"base",
"type": "base",
"buttonTitle": "Start"
}
}
Expand Down
81 changes: 43 additions & 38 deletions app/src/main/assets/task/transformer/TremorSectionStep.json
@@ -1,62 +1,67 @@
{
"identifier":"tremor",
"type":"section",
"steps":[
"identifier": "tremor",
"type": "section",
"steps": [
{
"identifier":"instruction",
"type":"instruction",
"title":"Hold the phone with your %@ hand",
"text":"With your hand in your lap, hold your phone still with the screen facing up.",
"image":{
"type":"fetchable",
"imageName":"HoldPhone-Left",
"placementType":"topMarginBackground"
"identifier": "instruction",
"type": "instruction",
"title": "Hold the phone with your %@ hand",
"text": "With your hand in your lap, hold your phone still with the screen facing up.",
"image": {
"type": "fetchable",
"imageName": "HoldPhone-Left",
"placementType": "topMarginBackground"
},
"colorTheme":{
"colorTheme": {
"colorStyle": {
"header": "darkBackground",
"body": "lightBackground",
"footer": "lightBackground"
}
},
"viewTheme":{
"viewIdentifier":"Instruction",
"storyboardIdentifier":"ActiveTaskSteps"
"viewTheme": {
"viewIdentifier": "Instruction",
"storyboardIdentifier": "ActiveTaskSteps"
},
"actions":{
"goForward":{
"type":"base",
"buttonTitle":"Hold phone"
"actions": {
"goForward": {
"type": "base",
"buttonTitle": "Hold phone"
}
}
},
{
"identifier":"tremor",
"type":"active",
"duration":30,
"image":{
"imageName":"HoldPhone-Left",
"placementType":"fullsizeBackground"
"identifier": "tremor",
"type": "active",
"duration": 30,
"image": {
"imageName": "HoldPhone-Left",
"placementType": "fullsizeBackground"
},
"colorTheme":{
"usesLightStyle":true
"colorTheme": {
"usesLightStyle": true
},
"viewTheme":{
"viewIdentifier":"Action",
"storyboardIdentifier":"ActiveTaskSteps"
"viewTheme": {
"viewIdentifier": "Action",
"storyboardIdentifier": "ActiveTaskSteps"
},
"commands":["transitionAutomatically", "shouldDisableIdleTimer", "vibrate", "playSound"],
"actions":{
"skip":{
"skipToIdentifier":"countdown",
"commands": [
"transitionAutomatically",
"shouldDisableIdleTimer",
"vibrate",
"playSound"
],
"actions": {
"skip": {
"skipToIdentifier": "countdown",
"buttonTitle": "Restart test"
}
},
"title": "Hold the phone still in your %@ hand.",
"spokenInstructions":{
"start":"With your %@ hand in your lap, keep holding your phone with the screen facing up for 30 seconds.",
"halfway":"Halfway done.",
"23":"Almost done."
"spokenInstructions": {
"start": "With your %@ hand in your lap, keep holding your phone with the screen facing up for 30 seconds.",
"halfway": "Halfway done.",
"23": "Almost done."
}
}
]
Expand Down
Expand Up @@ -59,31 +59,31 @@ public abstract static class Builder {
public abstract Builder setActions(@NonNull Map<String, Action> actions);

@NonNull
public abstract Builder setDetail(@Nullable String detail);
public abstract Builder setBackgroundAudioRequired(boolean isBackgroundAudioRequired);

@NonNull
public abstract Builder setFootnote(@Nullable String footnote);
public abstract Builder setColorTheme(@Nullable ColorTheme colorTheme);

@NonNull
public abstract Builder setIdentifier(@NonNull String identifier);
public abstract Builder setDetail(@Nullable String detail);

@NonNull
public abstract Builder setText(@Nullable String text);
public abstract Builder setDuration(@Nullable Double duration);

@NonNull
public abstract Builder setTitle(@Nullable String title);
public abstract Builder setFootnote(@Nullable String footnote);

@NonNull
public abstract Builder setImageTheme(@Nullable ImageTheme imageTheme);
public abstract Builder setIdentifier(@NonNull String identifier);

@NonNull
public abstract Builder setColorTheme(@Nullable ColorTheme colorTheme);
public abstract Builder setImageTheme(@Nullable ImageTheme imageTheme);

@NonNull
public abstract Builder setDuration(@Nullable Double duration);
public abstract Builder setText(@Nullable String text);

@NonNull
public abstract Builder setBackgroundAudioRequired(boolean isBackgroundAudioRequired);
public abstract Builder setTitle(@Nullable String title);
}

public static final String TYPE_KEY = "instruction";
Expand Down
Expand Up @@ -43,9 +43,10 @@

import java.util.UUID;

import javax.inject.Inject;

import dagger.android.AndroidInjection;
import io.reactivex.disposables.CompositeDisposable;
import javax.inject.Inject;

public class MainActivity extends AppCompatActivity {
private static final Logger LOGGER = LoggerFactory.getLogger(MainActivity.class);
Expand Down
Expand Up @@ -32,6 +32,8 @@

package org.sagebionetworks.research.app;

import static com.google.common.base.Preconditions.checkNotNull;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
Expand All @@ -47,8 +49,6 @@

import java.util.UUID;

import static com.google.common.base.Preconditions.checkNotNull;

public class PerformTaskActivity extends AppCompatActivity {
private static final Logger LOGGER = LoggerFactory.getLogger(PerformTaskActivity.class);

Expand Down
Expand Up @@ -38,11 +38,12 @@

import org.sagebionetworks.research.app.inject.DaggerResearchStackDemoApplicationComponent;

import javax.inject.Inject;

import dagger.android.AndroidInjector;
import dagger.android.DispatchingAndroidInjector;
import dagger.android.HasActivityInjector;
import dagger.android.support.HasSupportFragmentInjector;
import javax.inject.Inject;

public class ResearchStackDemoApplication extends MultiDexApplication implements HasSupportFragmentInjector,
HasActivityInjector {
Expand Down
Expand Up @@ -48,6 +48,7 @@
public class AppStepModule {
/**
* Returns ClassInfo for InstructionStep.class.
*
* @return ClassInfo for InstructionStep.class.
*/
@Provides
Expand Down
Expand Up @@ -34,9 +34,10 @@

import org.sagebionetworks.research.app.ResearchStackDemoApplication;

import javax.inject.Singleton;

import dagger.BindsInstance;
import dagger.Component;
import javax.inject.Singleton;

@Component(modules = {ResearchStackDemoApplicationModule.class})
@Singleton
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/res/values/id.xml
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ BSD 3-Clause License
~
~ Copyright 2018 Sage Bionetworks. All rights reserved.
Expand Down
Expand Up @@ -36,9 +36,10 @@

import org.sagebionetworks.research.app.inject.ResearchStackDemoApplicationModule;

import dagger.Component;
import javax.inject.Singleton;

import dagger.Component;

@Component(modules = ResearchStackDemoApplicationModule.class)
@Singleton
public interface AppTestComponent {
Expand Down
Expand Up @@ -33,9 +33,14 @@
package org.sagebionetworks.research.app;


import static org.hamcrest.CoreMatchers.instanceOf;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;

import com.google.common.collect.ImmutableMap;

import org.junit.*;
import org.junit.Test;
import org.sagebionetworks.research.domain.step.interfaces.ActiveUIStep;
import org.sagebionetworks.research.domain.step.interfaces.FormUIStep;
import org.sagebionetworks.research.domain.step.interfaces.Step;
Expand All @@ -45,9 +50,6 @@
import java.io.IOException;
import java.util.List;

import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;

public class FooTaskDeserializeTest extends JsonDeserializationTestBase {
@Test
public void testDeserializeFooTask() throws IOException {
Expand Down
Expand Up @@ -32,17 +32,17 @@

package org.sagebionetworks.research.app;

import static java.nio.charset.StandardCharsets.UTF_8;

import com.google.gson.Gson;

import org.junit.*;
import org.junit.Before;

import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.nio.file.Files;

import static java.nio.charset.StandardCharsets.UTF_8;

class JsonDeserializationTestBase {
protected Gson gson;

Expand Down

0 comments on commit 07de111

Please sign in to comment.