Skip to content

Commit

Permalink
For testing purposes, now sends a TRIAL action from the practice mode…
Browse files Browse the repository at this point in the history
… list, with mostly hardcoded parameters.
  • Loading branch information
0queue committed Apr 27, 2017
1 parent f5c275a commit 23fa258
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 5 deletions.
30 changes: 28 additions & 2 deletions app/src/main/java/edu/umd/cmsc436/mstestsuite/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
import java.util.Arrays;
import java.util.Comparator;

import edu.umd.cmsc436.frontendhelper.TrialMode;
import edu.umd.cmsc436.mstestsuite.data.ActionsAdapter;
import edu.umd.cmsc436.mstestsuite.model.UserManager;
import edu.umd.cmsc436.sheets.Sheets;

public class MainActivity extends AppCompatActivity implements MainContract.View {

Expand Down Expand Up @@ -192,9 +194,33 @@ public void showToast(String message) {
}

@Override
public void startPracticeMode(String packageName) throws ActivityNotFoundException {
Intent i = new Intent(packageName + ".action.PRACTICE");
public void startPracticeMode(String packageName, String patient_id) throws ActivityNotFoundException {
Intent i = new Intent(packageName + ".action.TRIAL");
i.addCategory(Intent.CATEGORY_DEFAULT);

if (packageName.endsWith("tap")) {
i.putExtra(TrialMode.KEY_APPENDAGE, Sheets.TestType.RH_TAP.ordinal());
} else if (packageName.endsWith("spiral")) {
i.putExtra(TrialMode.KEY_APPENDAGE, Sheets.TestType.RH_SPIRAL.ordinal());
} else if (packageName.endsWith("balance")) {
i.putExtra(TrialMode.KEY_APPENDAGE, Sheets.TestType.SWAY_CLOSED.ordinal());
} else if (packageName.endsWith("level")) {
i.putExtra(TrialMode.KEY_APPENDAGE, Sheets.TestType.RH_LEVEL.ordinal());
} else if (packageName.endsWith("pop")) {
i.putExtra(TrialMode.KEY_APPENDAGE, Sheets.TestType.RH_POP.ordinal());
} else if (packageName.endsWith("flex")) {
i.putExtra(TrialMode.KEY_APPENDAGE, Sheets.TestType.RH_CURL.ordinal());
} else if (packageName.endsWith("walk.indoors")) {
i.putExtra(TrialMode.KEY_APPENDAGE, Sheets.TestType.INDOOR_WALKING.ordinal());
} else if (packageName.endsWith("walk.outdoors")) {
i.putExtra(TrialMode.KEY_APPENDAGE, Sheets.TestType.OUTDOOR_WALKING.ordinal());
}

i.putExtra(TrialMode.KEY_TRIAL_NUM, 1);
i.putExtra(TrialMode.KEY_TRIAL_OUT_OF, 3);
i.putExtra(TrialMode.KEY_DIFFICULTY, 1);
i.putExtra(TrialMode.KEY_PATIENT_ID, patient_id);

startActivity(i);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface View {
void hideBottomSheet ();
void loadActions(ActionsAdapter adapter);
void showToast (String message);
void startPracticeMode(String packageName) throws ActivityNotFoundException;
void startPracticeMode(String packageName, String patient_id) throws ActivityNotFoundException;
Context getContext ();
void showUserSwitcher (String[] users);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public void onReceive(Context context, Intent intent) {
@Override
public void onAppSelected(TestApp app) {
try {
mView.startPracticeMode(app.getPackageName());
mView.startPracticeMode(app.getPackageName(), mUserManager.getCurUserID());
} catch (ActivityNotFoundException anfe) {
mView.showToast(app.getDisplayName() + " not found");
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/tests.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<item>"edu.umd.cmsc436.level"</item>
<item>"edu.umd.cmsc436.pop"</item>
<item>"edu.umd.cmsc436.flex"</item>
<item>"edu.umd.cmsc436.walk.outdoors"</item>
<item>"edu.umd.cmsc436.walk.indoors"</item>
<item>"edu.umd.cmsc436.walk.outdoors"</item>
</array>

<array name="display_names">
Expand Down

0 comments on commit 23fa258

Please sign in to comment.