diff --git a/SWADroid/gen/es/ugr/swad/swadroid/R.java b/SWADroid/gen/es/ugr/swad/swadroid/R.java index 1be7c003..72fcd516 100644 --- a/SWADroid/gen/es/ugr/swad/swadroid/R.java +++ b/SWADroid/gen/es/ugr/swad/swadroid/R.java @@ -148,21 +148,21 @@ public final class R { public static final int coursesProgressDescription=0x7f07001e; public static final int coursesProgressTitle=0x7f07001d; public static final int dateMsg=0x7f070031; - public static final int errorBadLoginMsg=0x7f070050; - public static final int errorConnectionMsg=0x7f070052; + public static final int errorBadLoginMsg=0x7f070051; + public static final int errorConnectionMsg=0x7f070053; public static final int errorCopyMsg_DB=0x7f070021; public static final int errorMsgLaunchingActivity=0x7f07001f; public static final int errorMsgNoConnection=0x7f070022; public static final int errorMsgWorkaroundEmulator=0x7f070020; - public static final int errorServerResponseMsg=0x7f070051; - public static final int errorTimeoutMsg=0x7f070053; + public static final int errorServerResponseMsg=0x7f070052; + public static final int errorTimeoutMsg=0x7f070054; public static final int evaluation=0x7f07002c; public static final int examAnnouncement=0x7f070025; public static final int falseMsg=0x7f070037; - public static final int firstRunMsg=0x7f07004e; + public static final int firstRunMsg=0x7f07004f; public static final int forumReply=0x7f070029; public static final int fromMsg=0x7f070030; - public static final int initialDialogTitle=0x7f07004d; + public static final int initialDialogTitle=0x7f07004e; public static final int loginModuleLabel=0x7f070001; public static final int loginProgressDescription=0x7f070017; public static final int loginProgressTitle=0x7f070016; @@ -190,26 +190,27 @@ public final class R { public static final int selectCourseTitle=0x7f07003b; public static final int set_preferences=0x7f070007; public static final int survey=0x7f07002e; - public static final int testAnswerTypesMsg=0x7f070045; - public static final int testEvaluateMsg=0x7f070047; - public static final int testNoAnswerTypesSelectedMsg=0x7f070046; - public static final int testNoDetailsMsg=0x7f07004b; + public static final int testAnswerTypesMsg=0x7f070046; + public static final int testEvaluateMsg=0x7f070048; + public static final int testNoAnswerTypesSelectedMsg=0x7f070047; + public static final int testNoDetailsMsg=0x7f07004c; public static final int testNoQuestionsCourseMsg=0x7f070040; + public static final int testNoQuestionsMeetsSpecifiedCriteriaMsg=0x7f070042; public static final int testNoQuestionsMsg=0x7f070041; - public static final int testNoResultsMsg=0x7f07004c; - public static final int testNoTagsSelectedMsg=0x7f070044; - public static final int testNumQuestionsMsg=0x7f070042; - public static final int testResultsTextMsg=0x7f070048; - public static final int testShowResultsDetailsMsg=0x7f07004a; - public static final int testShowResultsMsg=0x7f070049; - public static final int testTagsMsg=0x7f070043; + public static final int testNoResultsMsg=0x7f07004d; + public static final int testNoTagsSelectedMsg=0x7f070045; + public static final int testNumQuestionsMsg=0x7f070043; + public static final int testResultsTextMsg=0x7f070049; + public static final int testShowResultsDetailsMsg=0x7f07004b; + public static final int testShowResultsMsg=0x7f07004a; + public static final int testTagsMsg=0x7f070044; public static final int testsDownloadProgressDescription=0x7f07001c; public static final int testsDownloadProgressTitle=0x7f07001b; public static final int testsModuleLabel=0x7f070004; public static final int title_error_dialog=0x7f070005; public static final int trueMsg=0x7f070036; public static final int unknownNotification=0x7f07002f; - public static final int upgradeMsg=0x7f07004f; + public static final int upgradeMsg=0x7f070050; public static final int upgradeMsg_DB=0x7f070023; public static final int userIDName_preferences=0x7f070009; public static final int userIDSummary_preferences=0x7f07000a; diff --git a/SWADroid/libs/ksoap2-android-assembly-2.5.5-jar-with-dependencies.jar b/SWADroid/libs/ksoap2-android-assembly-2.5.5-jar-with-dependencies.jar new file mode 100644 index 00000000..9b927711 Binary files /dev/null and b/SWADroid/libs/ksoap2-android-assembly-2.5.5-jar-with-dependencies.jar differ diff --git a/SWADroid/res/layout/tests_make_results.xml b/SWADroid/res/layout/tests_make_results.xml index a5741d3c..b7b95517 100644 --- a/SWADroid/res/layout/tests_make_results.xml +++ b/SWADroid/res/layout/tests_make_results.xml @@ -10,6 +10,7 @@ android:id="@+id/testResultsText" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_below="@+id/actionBarLayout" android:layout_above="@+id/testResultsScore" android:gravity="center" android:padding="20dip" diff --git a/SWADroid/res/values-es/strings.xml b/SWADroid/res/values-es/strings.xml index 86cf37ce..60c85b5b 100644 --- a/SWADroid/res/values-es/strings.xml +++ b/SWADroid/res/values-es/strings.xml @@ -71,6 +71,8 @@ No se ha descargado ninguna pregunta de test para esta asignatura Antes de realizar un test debe descargar las preguntas de test de al menos una asignatura + No hay ninguna pregunta que se ajuste a los criterios + especificados Indique el número de preguntas del test Seleccione los descriptores que desea incluir en el test Debe seleccionar al menos un descriptor @@ -78,7 +80,7 @@ Debe seleccionar al menos un tipo de respuesta Corregir Puntuación - Ver resultados + Ver totales Ver detalles El profesor no permite ver los detalles El profesor no permite ver los resultados del test diff --git a/SWADroid/res/values/strings.xml b/SWADroid/res/values/strings.xml index 54d14dae..4b637188 100644 --- a/SWADroid/res/values/strings.xml +++ b/SWADroid/res/values/strings.xml @@ -70,6 +70,8 @@ Not downloaded any test question for this course Before performing a test you should download the test questions for at least one course + There is no question that meets the specified + criteria Indicate the number of test questions Select the tags that will be included in the test You must select at least one tag @@ -77,7 +79,7 @@ You must select at least one answer type Evaluate Score - Show results + Show totals Show details The teacher does not allow to see the details The teacher does not allow to see the results diff --git a/SWADroid/src/es/ugr/swad/swadroid/model/Test.java b/SWADroid/src/es/ugr/swad/swadroid/model/Test.java index ebb9482a..1fcef390 100644 --- a/SWADroid/src/es/ugr/swad/swadroid/model/Test.java +++ b/SWADroid/src/es/ugr/swad/swadroid/model/Test.java @@ -352,7 +352,7 @@ public class Test extends Model { a = la.get(0); userAnswerText = a.getUserAnswer(); - if(userAnswerText == "") { + if(userAnswerText.equals("")) { a.setCorrectAnswered(false); } else { userFloatAnswer = new Float(userAnswerText); @@ -372,7 +372,7 @@ public class Test extends Model { a = la.get(0); userAnswerText = a.getUserAnswer(); - if(userAnswerText == "") { + if(userAnswerText.equals("")) { a.setCorrectAnswered(false); } else { a.setCorrectAnswered(a.getAnswer().equals(a.getUserAnswer())); @@ -387,7 +387,7 @@ public class Test extends Model { score = (float) (correctUserAnswers-errors); } else if(answerType.equals("int")) { a = la.get(0);userAnswerText = a.getUserAnswer(); - if(userAnswerText == "") { + if(userAnswerText.equals("")) { a.setCorrectAnswered(false); } else { a.setCorrectAnswered(a.getAnswer().equals(a.getUserAnswer())); diff --git a/SWADroid/src/es/ugr/swad/swadroid/modules/Courses.java b/SWADroid/src/es/ugr/swad/swadroid/modules/Courses.java index 36448d93..38375924 100644 --- a/SWADroid/src/es/ugr/swad/swadroid/modules/Courses.java +++ b/SWADroid/src/es/ugr/swad/swadroid/modules/Courses.java @@ -49,6 +49,15 @@ public class Courses extends Module { */ public static final String TAG = Global.APP_TAG + " Courses"; + @Override + protected void runConnection() { + super.runConnection(); + if (!isConnected) { + setResult(RESULT_CANCELED); + finish(); + } + } + /* (non-Javadoc) * @see android.app.Activity#onCreate() */ diff --git a/SWADroid/src/es/ugr/swad/swadroid/modules/Module.java b/SWADroid/src/es/ugr/swad/swadroid/modules/Module.java index 2d34723a..d2e902a4 100644 --- a/SWADroid/src/es/ugr/swad/swadroid/modules/Module.java +++ b/SWADroid/src/es/ugr/swad/swadroid/modules/Module.java @@ -252,7 +252,7 @@ public abstract class Module extends Activity { { isConnected = connectionAvailable(this); if (!isConnected) { - Toast.makeText(this, R.string.errorMsgNoConnection, Toast.LENGTH_SHORT).show(); + Toast.makeText(this, R.string.errorMsgNoConnection, Toast.LENGTH_SHORT).show(); } else { //If this is not the Login module, launch login check if(!(this instanceof Login)) { diff --git a/SWADroid/src/es/ugr/swad/swadroid/modules/tests/CheckedAnswersArrayAdapter.java b/SWADroid/src/es/ugr/swad/swadroid/modules/tests/CheckedAnswersArrayAdapter.java index 7222b838..b4491cf4 100644 --- a/SWADroid/src/es/ugr/swad/swadroid/modules/tests/CheckedAnswersArrayAdapter.java +++ b/SWADroid/src/es/ugr/swad/swadroid/modules/tests/CheckedAnswersArrayAdapter.java @@ -64,7 +64,9 @@ public class CheckedAnswersArrayAdapter extends ArrayAdapter { tt.setText(Html.fromHtml(a.getAnswer())); if(evaluated && feedback.equals("eachGoodBad") && a.getCorrect()) { - tt.setTextColor(Color.BLUE); + tt.setTextColor(Color.BLUE); + } else { + tt.setTextColor(Color.BLACK); } return convertView; diff --git a/SWADroid/src/es/ugr/swad/swadroid/modules/tests/TestsMake.java b/SWADroid/src/es/ugr/swad/swadroid/modules/tests/TestsMake.java index e8461975..b8446690 100644 --- a/SWADroid/src/es/ugr/swad/swadroid/modules/tests/TestsMake.java +++ b/SWADroid/src/es/ugr/swad/swadroid/modules/tests/TestsMake.java @@ -339,10 +339,14 @@ public class TestsMake extends Module { a = answers.get(0); sp.setAdapter(tfAdapter); - if(a.getUserAnswer().equals("T")) { - sp.setSelection(0); - } else { + if(a.getUserAnswer().equals("F")) { sp.setSelection(1); + } else { + sp.setSelection(0); + } + + if(a.getUserAnswer().equals("")) { + a.setUserAnswer(a.getAnswer()); } sp.setVisibility(View.VISIBLE); @@ -372,6 +376,11 @@ public class TestsMake extends Module { } } + a = answers.get(0); + if(a.getUserAnswer().equals("")) { + a.setUserAnswer(a.getAnswer()); + } + sp.setAdapter(uniqueChoiceAdapter); sp.setSelection(selectedChoice); sp.setVisibility(View.VISIBLE); @@ -533,23 +542,28 @@ public class TestsMake extends Module { //Generates the test questions = dbHelper.getCourseQuestionsByTagAndAnswerType(selectedCourseCode, tagsList, answerTypesList); - Collections.shuffle(questions); - - if(questions.size() > numQuestions) { - questions = questions.subList(0, numQuestions); - } - - test.setQuestions(questions); - - //Shuffles related answers in a question if necessary - for(TestQuestion q : questions) { - if(q.getShuffle()) { - q.shuffleAnswers(); + if(!questions.isEmpty()) { + Collections.shuffle(questions); + + if(questions.size() > numQuestions) { + questions = questions.subList(0, numQuestions); } + + test.setQuestions(questions); + + //Shuffles related answers in a question if necessary + for(TestQuestion q : questions) { + if(q.getShuffle()) { + q.shuffleAnswers(); + } + } + + //Shows the test + showTest(); + } else { + Toast.makeText(this, R.string.testNoQuestionsMeetsSpecifiedCriteriaMsg, Toast.LENGTH_LONG); + finish(); } - - //Shows the test - showTest(); } /** @@ -584,7 +598,7 @@ public class TestsMake extends Module { textView.setText(df.format(score) + "/" + test.getQuestions().size() + "\n" + df.format(scoreDec) + "/10"); - if(score < 5) { + if(scoreDec < 5) { textView.setTextColor(Color.RED); }