From 79756e2556919fbd3ac7b1cb84e7acb363b9b541 Mon Sep 17 00:00:00 2001 From: Inigo Lopez de Heredia Date: Tue, 23 Sep 2014 12:17:26 +0100 Subject: [PATCH 1/8] [#167] Add warning upon lack of responses --- .../main/java/org/akvo/flow/ui/view/SubmitTab.java | 11 +++++++---- app/src/main/res/values/strings.xml | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/akvo/flow/ui/view/SubmitTab.java b/app/src/main/java/org/akvo/flow/ui/view/SubmitTab.java index 9948552ba..5fc0caf74 100644 --- a/app/src/main/java/org/akvo/flow/ui/view/SubmitTab.java +++ b/app/src/main/java/org/akvo/flow/ui/view/SubmitTab.java @@ -66,12 +66,15 @@ public void refresh(List invalidQuestions) { QuestionListAdapter adapter = new QuestionListAdapter(invalidQuestions); setAdapter(adapter); - if (invalidQuestions.isEmpty()) { - mHeaderView.setText(R.string.submittext); - mSubmitButton.setEnabled(true); - } else { + if (!invalidQuestions.isEmpty()) { mHeaderView.setText(R.string.error_responses); mSubmitButton.setEnabled(false); + } else if (mListener.getResponses().isEmpty()) { + mHeaderView.setText(R.string.error_empty_form); + mSubmitButton.setEnabled(false); + } else { + mHeaderView.setText(R.string.submittext); + mSubmitButton.setEnabled(true); } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 1ab4048ae..6d92002cf 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -159,6 +159,7 @@ Registration Survey This Data Point already contains a response for this form. Any new responses will be used as the most recent values. Do you want to continue? Can\'t load image preview + Empty forms cannot be submitted. Please, add the corresponding responses first. CREATE NEW DATA POINT Project Stats From 3bdd41103fdf4987a8bb449f231f158140535d7a Mon Sep 17 00:00:00 2001 From: Inigo Lopez de Heredia Date: Tue, 23 Sep 2014 12:50:10 +0100 Subject: [PATCH 2/8] [#167] Save responses more efficiently * Cache and store responses as soon as we get them --- .../akvo/flow/activity/SurveyActivity.java | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/org/akvo/flow/activity/SurveyActivity.java b/app/src/main/java/org/akvo/flow/activity/SurveyActivity.java index 4dea93242..bacf6ca5f 100644 --- a/app/src/main/java/org/akvo/flow/activity/SurveyActivity.java +++ b/app/src/main/java/org/akvo/flow/activity/SurveyActivity.java @@ -240,17 +240,6 @@ private void recordDuration(boolean start) { private void saveState() { if (!mReadOnly) { - for (QuestionResponse response : mQuestionResponses.values()) { - // Store the response if it contains a value. Otherwise, delete it - if (response.hasValue()) { - response.setRespondentId(mSurveyInstanceId); - mDatabase.createOrUpdateSurveyResponse(response); - } else if (response.getId() != null && response.getId() > 0) { - // if we don't have a value BUT there is an ID, we need to - // remove it since the user blanked out their response - mDatabase.deleteResponse(mSurveyInstanceId, response.getQuestionId()); - } - } mDatabase.updateSurveyStatus(mSurveyInstanceId, SurveyInstanceStatus.SAVED); mDatabase.updateRecordModifiedDate(mRecordId, System.currentTimeMillis()); @@ -258,7 +247,6 @@ private void saveState() { if (mSurvey.getId().equals(mSurveyGroup.getRegisterSurveyId())) { saveRecordMetaData(); } - } } @@ -586,12 +574,16 @@ public void onClick(DialogInterface dialog, int id) { } else if (QuestionInteractionEvent.QUESTION_ANSWER_EVENT.equals(event.getEventType())) { String questionId = event.getSource().getQuestion().getId(); QuestionResponse response = event.getSource().getResponse(); - if (response != null) { + + // Store the response if it contains a value. Otherwise, delete it + if (response != null && response.hasValue()) { mQuestionResponses.put(questionId, response); + response.setRespondentId(mSurveyInstanceId); + mDatabase.createOrUpdateSurveyResponse(response); } else { mQuestionResponses.remove(questionId); + mDatabase.deleteResponse(mSurveyInstanceId, questionId); } - // TODO: Should we save this Response to the DB straightaway? } } From 002736cc5037f2d6b2fecb2d59e0d49eaf88f515 Mon Sep 17 00:00:00 2001 From: Inigo Lopez de Heredia Date: Wed, 24 Sep 2014 11:59:17 +0100 Subject: [PATCH 3/8] [#166] Replace default colour * Use black instead of white --- app/src/main/res/values/arrays.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index 41bc93c25..1ba5c9cd1 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -53,9 +53,9 @@ hi qu - + - white + black red blue yellow From 14c49e86c0990ece5475f1cb3c76fb77420915fa Mon Sep 17 00:00:00 2001 From: Inigo Lopez de Heredia Date: Wed, 24 Sep 2014 12:01:24 +0100 Subject: [PATCH 4/8] [#166] Avoid IndexOutOfBounds exceptions * Use modulo operator --- app/src/main/java/org/akvo/flow/ui/view/QuestionView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/org/akvo/flow/ui/view/QuestionView.java b/app/src/main/java/org/akvo/flow/ui/view/QuestionView.java index a2b2c1c02..a09a4b9d8 100644 --- a/app/src/main/java/org/akvo/flow/ui/view/QuestionView.java +++ b/app/src/main/java/org/akvo/flow/ui/view/QuestionView.java @@ -188,7 +188,7 @@ private Spanned formText() { } else { isFirst = false; } - text.append("") + text.append("") .append(txt.getText()).append(""); } } From 08616d03d518d283644384e3d920c2e0457bc626 Mon Sep 17 00:00:00 2001 From: Inigo Lopez de Heredia Date: Thu, 25 Sep 2014 12:39:18 +0100 Subject: [PATCH 5/8] [#160] Revert all-caps policy --- .../java/org/akvo/flow/activity/SurveyGroupListActivity.java | 5 +---- .../java/org/akvo/flow/ui/fragment/SurveyListFragment.java | 4 +--- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/org/akvo/flow/activity/SurveyGroupListActivity.java b/app/src/main/java/org/akvo/flow/activity/SurveyGroupListActivity.java index 1f7753dbf..763c69835 100644 --- a/app/src/main/java/org/akvo/flow/activity/SurveyGroupListActivity.java +++ b/app/src/main/java/org/akvo/flow/activity/SurveyGroupListActivity.java @@ -279,11 +279,8 @@ public View newView(Context context, Cursor cursor, ViewGroup parent) { public void bindView(View view, Context context, Cursor cursor) { final SurveyGroup surveyGroup = SurveyDbAdapter.getSurveyGroup(cursor); - String name = !TextUtils.isEmpty(surveyGroup.getName()) ? - surveyGroup.getName().toUpperCase() : null; - TextView text1 = (TextView)view.findViewById(R.id.text1); - text1.setText(name); + text1.setText(surveyGroup.getName()); text1.setTextColor(getResources().getColorStateList(mTextColor)); // Alternate background diff --git a/app/src/main/java/org/akvo/flow/ui/fragment/SurveyListFragment.java b/app/src/main/java/org/akvo/flow/ui/fragment/SurveyListFragment.java index bbf29e818..8c9ca9caa 100644 --- a/app/src/main/java/org/akvo/flow/ui/fragment/SurveyListFragment.java +++ b/app/src/main/java/org/akvo/flow/ui/fragment/SurveyListFragment.java @@ -195,9 +195,7 @@ public View getView(int position, View convertView, ViewGroup parent) { TextView lastSubmissionTitle = (TextView)listItem.findViewById(R.id.date_label); TextView lastSubmissionView = (TextView)listItem.findViewById(R.id.date); - String name = !TextUtils.isEmpty(surveyInfo.mName) ? - surveyInfo.mName.toUpperCase() : null; - surveyNameView.setText(name); + surveyNameView.setText(surveyInfo.mName); surveyVersionView.setText("v" + surveyInfo.mVersion); final boolean enabled = isEnabled(surveyInfo.mId); From 75c41e14d0330b49dd6b732d18903d7302666f21 Mon Sep 17 00:00:00 2001 From: Inigo Lopez de Heredia Date: Thu, 25 Sep 2014 12:43:05 +0100 Subject: [PATCH 6/8] [#160] Remove unused imports --- .../java/org/akvo/flow/activity/SurveyGroupListActivity.java | 1 - .../main/java/org/akvo/flow/ui/fragment/SurveyListFragment.java | 1 - 2 files changed, 2 deletions(-) diff --git a/app/src/main/java/org/akvo/flow/activity/SurveyGroupListActivity.java b/app/src/main/java/org/akvo/flow/activity/SurveyGroupListActivity.java index 763c69835..8c4c77f6a 100644 --- a/app/src/main/java/org/akvo/flow/activity/SurveyGroupListActivity.java +++ b/app/src/main/java/org/akvo/flow/activity/SurveyGroupListActivity.java @@ -28,7 +28,6 @@ import android.support.v4.content.Loader; import android.support.v4.widget.CursorAdapter; import android.support.v7.app.ActionBarActivity; -import android.text.TextUtils; import android.util.Log; import android.view.ContextMenu; import android.view.LayoutInflater; diff --git a/app/src/main/java/org/akvo/flow/ui/fragment/SurveyListFragment.java b/app/src/main/java/org/akvo/flow/ui/fragment/SurveyListFragment.java index 8c9ca9caa..b6df80c72 100644 --- a/app/src/main/java/org/akvo/flow/ui/fragment/SurveyListFragment.java +++ b/app/src/main/java/org/akvo/flow/ui/fragment/SurveyListFragment.java @@ -26,7 +26,6 @@ import android.support.v4.app.ListFragment; import android.support.v4.app.LoaderManager.LoaderCallbacks; import android.support.v4.content.Loader; -import android.text.TextUtils; import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; From 8c95f6f8c2bac851345613878c6dba0a62e170d4 Mon Sep 17 00:00:00 2001 From: Inigo Lopez de Heredia Date: Thu, 25 Sep 2014 14:58:55 +0100 Subject: [PATCH 7/8] [#171] Bump version number --- app/src/main/AndroidManifest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 47b3c5f80..c7a90e8b0 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,7 +2,7 @@ + android:versionName="2.0.3" > Date: Thu, 25 Sep 2014 15:00:28 +0100 Subject: [PATCH 8/8] [#171] Update release notes --- RELEASE_NOTES.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 947614737..b367a066f 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,5 +1,13 @@ Akvo FLOW app -Last update 19 September 2014 +Last update 25 September 2014 + +#ver 2.0.3 + +Features / Bugfixes +------------------- +* #167 - Empty forms cannot be submitted +* #166 - Font colour blends with background +* #160 - Revert all-caps policy in projects/survey titles #ver 2.0.2