From b97001dc1667cae75eafb88fb673b7aa57b2d7ac Mon Sep 17 00:00:00 2001 From: Thomas Harris Date: Mon, 1 May 2017 20:49:30 -0400 Subject: [PATCH] Hacks to enable easier TRIAL testing --- .../umd/cmsc436/mstestsuite/MainPresenter.java | 15 +++++++++++++-- .../mstestsuite/ui/CoordinatorActivity.java | 9 ++++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/edu/umd/cmsc436/mstestsuite/MainPresenter.java b/app/src/main/java/edu/umd/cmsc436/mstestsuite/MainPresenter.java index 6a9835f..2e19531 100644 --- a/app/src/main/java/edu/umd/cmsc436/mstestsuite/MainPresenter.java +++ b/app/src/main/java/edu/umd/cmsc436/mstestsuite/MainPresenter.java @@ -95,7 +95,8 @@ public void run() { mView.getContext().getString(R.string.app_name), mView.getContext().getString(R.string.prescription_spreadsheet_id), mView.getContext().getString(R.string.prescription_spreadsheet_id)); - mSheet.fetchPrescription(mUserManager.getCurUserID(), this); + + mMainAdapter.setEnabled(0, true); } @Override @@ -164,7 +165,17 @@ public void onPackageInstalled() { @Override public void onAppSelected(TestApp app) { try { - mView.startPracticeMode(app.getPackageName()); + + int[] difficulties = new int[mAllApps.length]; + for (int i = 0; i < mAllApps.length; i++) { + if (mAllApps[i].getPackageName().equals(app.getPackageName())) { + difficulties[i] = 1; + } else { + difficulties[i] = 0; + } + } + + CoordinatorActivity.start(mView.getContext(), mUserManager.getCurUserID(), difficulties, 3); } catch (ActivityNotFoundException anfe) { mView.showToast(app.getDisplayName() + " not found"); } diff --git a/app/src/main/java/edu/umd/cmsc436/mstestsuite/ui/CoordinatorActivity.java b/app/src/main/java/edu/umd/cmsc436/mstestsuite/ui/CoordinatorActivity.java index 1ac697f..225f805 100644 --- a/app/src/main/java/edu/umd/cmsc436/mstestsuite/ui/CoordinatorActivity.java +++ b/app/src/main/java/edu/umd/cmsc436/mstestsuite/ui/CoordinatorActivity.java @@ -1,6 +1,7 @@ package edu.umd.cmsc436.mstestsuite.ui; import android.annotation.SuppressLint; +import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; import android.os.Bundle; @@ -140,7 +141,13 @@ private void popLaunchIntent () { toaster.setText(text); toaster.show(); - startActivityForResult(mLastIntent, 3000 + mLaunchIntents.size()); + try { + startActivityForResult(mLastIntent, 3000 + mLaunchIntents.size()); + } catch (ActivityNotFoundException anfe) { + toaster.setText((appendage == null ? "null" : appendage.toId()) + " not found"); + toaster.show(); + finish(); + } } else { // TODO report finished/completed/whatever finish();