From de0aa68774fafb35baabda9924a32e1156ee87bc Mon Sep 17 00:00:00 2001 From: Mateus Oliveira Date: Wed, 7 Oct 2020 22:04:07 -0300 Subject: [PATCH 01/15] Created animation and toggle functions (#31) --- .../quasar/corona/app/QuestionsActivity.java | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/app/src/main/java/org/cordova/quasar/corona/app/QuestionsActivity.java b/app/src/main/java/org/cordova/quasar/corona/app/QuestionsActivity.java index 9724329..3a49427 100644 --- a/app/src/main/java/org/cordova/quasar/corona/app/QuestionsActivity.java +++ b/app/src/main/java/org/cordova/quasar/corona/app/QuestionsActivity.java @@ -1,13 +1,26 @@ package org.cordova.quasar.corona.app; +import android.content.Context; import android.content.Intent; import android.os.Bundle; +import android.view.View; +import android.view.animation.Animation; +import android.view.animation.AnimationUtils; +import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; import com.google.android.material.bottomnavigation.BottomNavigationView; +import java.util.ArrayList; +import java.util.List; + + public class QuestionsActivity extends AppCompatActivity { + + List textViews = new ArrayList<>(); + + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -48,6 +61,10 @@ protected void onCreate(Bundle savedInstanceState) { return false; } ); + + textViews.add(0,(TextView) findViewById(R.id.txt_help_gest)); + textViews.get(0).setVisibility(View.GONE); + } @Override @@ -56,4 +73,44 @@ protected void onResume() { BottomNavigationView navigationView = findViewById(R.id.navigation); navigationView.getMenu().getItem(2).setChecked(true); } + + //TODO: refactor slide functions + void slide_down(Context ctx, View v) { + Animation a = AnimationUtils.loadAnimation(ctx, R.anim.slide_down); + if (a != null) { + a.reset(); + if (v != null) { + v.clearAnimation(); + v.startAnimation(a); + } + } + } + + void slide_up(Context ctx, View v) { + Animation a = AnimationUtils.loadAnimation(ctx, R.anim.slide_up); + if (a != null) { + a.reset(); + if (v != null) { + v.clearAnimation(); + v.startAnimation(a); + } + } + } + + + /** + * onClick handler + */ + public void toggle_contents(View v) { + TextView answerView = textViews.get(Integer.parseInt((String) v.getTag())); + + + if (answerView.isShown()) { + slide_up(this, answerView); + answerView.setVisibility(View.GONE); + } else { + answerView.setVisibility(View.VISIBLE); + slide_down(this, answerView); + } + } } From 9718a6fbed59a4a72a3813bdee5fbe0995db358e Mon Sep 17 00:00:00 2001 From: Mateus Oliveira Date: Wed, 7 Oct 2020 22:04:20 -0300 Subject: [PATCH 02/15] Slide up and down effects (#31) --- app/src/main/res/anim/slide_down.xml | 11 +++++++++++ app/src/main/res/anim/slide_up.xml | 11 +++++++++++ 2 files changed, 22 insertions(+) create mode 100644 app/src/main/res/anim/slide_down.xml create mode 100644 app/src/main/res/anim/slide_up.xml diff --git a/app/src/main/res/anim/slide_down.xml b/app/src/main/res/anim/slide_down.xml new file mode 100644 index 0000000..f6a016a --- /dev/null +++ b/app/src/main/res/anim/slide_down.xml @@ -0,0 +1,11 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/anim/slide_up.xml b/app/src/main/res/anim/slide_up.xml new file mode 100644 index 0000000..aeffb76 --- /dev/null +++ b/app/src/main/res/anim/slide_up.xml @@ -0,0 +1,11 @@ + + + + \ No newline at end of file From 58718663ff80b90454e93b738b20c0cacdd832cb Mon Sep 17 00:00:00 2001 From: Mateus Oliveira Date: Wed, 7 Oct 2020 22:05:02 -0300 Subject: [PATCH 03/15] Replaced - with _ on ids and created first expandable TextView (#31) --- .../main/res/layout/activity_questions.xml | 63 +++++++++++++------ 1 file changed, 43 insertions(+), 20 deletions(-) diff --git a/app/src/main/res/layout/activity_questions.xml b/app/src/main/res/layout/activity_questions.xml index 12b27bd..4b70ea7 100644 --- a/app/src/main/res/layout/activity_questions.xml +++ b/app/src/main/res/layout/activity_questions.xml @@ -26,19 +26,42 @@ android:paddingTop="20dp" android:paddingBottom="20dp" app:layout_constraintBottom_toTopOf="@+id/navigation" - app:layout_constraintTop_toTopOf="@id/faq"> + app:layout_constraintTop_toBottomOf="@id/faq" > + + + + + + + + + app:layout_constraintTop_toBottomOf="@+id/txt_help_gest" /> + app:layout_constraintTop_toBottomOf="@+id/sponsored_data_question" /> + app:layout_constraintTop_toBottomOf="@id/sponsored_data_answer" /> + app:layout_constraintTop_toBottomOf="@id/meet_question" /> + app:layout_constraintTop_toBottomOf="@id/meet_answer" /> + app:layout_constraintTop_toBottomOf="@id/route_question" /> From 9c619ab15a3b95ed6956b9d091d08734b46785b0 Mon Sep 17 00:00:00 2001 From: Mateus Oliveira Date: Wed, 7 Oct 2020 23:36:37 -0300 Subject: [PATCH 04/15] Vanishing all answers (#31) --- .../org/cordova/quasar/corona/app/QuestionsActivity.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/cordova/quasar/corona/app/QuestionsActivity.java b/app/src/main/java/org/cordova/quasar/corona/app/QuestionsActivity.java index 3a49427..23cb24f 100644 --- a/app/src/main/java/org/cordova/quasar/corona/app/QuestionsActivity.java +++ b/app/src/main/java/org/cordova/quasar/corona/app/QuestionsActivity.java @@ -62,9 +62,12 @@ protected void onCreate(Bundle savedInstanceState) { } ); - textViews.add(0,(TextView) findViewById(R.id.txt_help_gest)); + textViews.add(0,(TextView) findViewById(R.id.sponsored_data_answer)); textViews.get(0).setVisibility(View.GONE); - + textViews.add(1,(TextView) findViewById(R.id.meet_answer)); + textViews.get(1).setVisibility(View.GONE); + textViews.add(2,(TextView) findViewById(R.id.route_answer)); + textViews.get(2).setVisibility(View.GONE); } @Override From 0e0df8cbd6ae8c81186910735ce9ea7c244ada0c Mon Sep 17 00:00:00 2001 From: Mateus Oliveira Date: Wed, 7 Oct 2020 23:37:02 -0300 Subject: [PATCH 05/15] Refactored activity_questions.xml (#31) --- .../main/res/layout/activity_questions.xml | 112 ++++++------------ 1 file changed, 35 insertions(+), 77 deletions(-) diff --git a/app/src/main/res/layout/activity_questions.xml b/app/src/main/res/layout/activity_questions.xml index 4b70ea7..a6ebb65 100644 --- a/app/src/main/res/layout/activity_questions.xml +++ b/app/src/main/res/layout/activity_questions.xml @@ -14,9 +14,9 @@ android:text="@string/item_questions" android:textAlignment="center" android:textSize="24sp" - app:layout_constraintTop_toTopOf="parent" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" /> + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + app:layout_constrainedHeight="true" + app:layout_constraintTop_toBottomOf="@id/faq"> + - - - - - - - - + app:layout_constraintTop_toTopOf="parent" /> + + + app:layout_constraintTop_toBottomOf="@+id/divider0" /> + app:layout_constraintTop_toBottomOf="@+id/meet_question" /> + + + app:layout_constraintTop_toBottomOf="@+id/divider1" /> + app:layout_constraintTop_toBottomOf="@+id/route_question" /> + + From 884c191224412eeba4d2f86c9e21c44d4e2c748c Mon Sep 17 00:00:00 2001 From: Mateus Oliveira Date: Wed, 7 Oct 2020 23:37:23 -0300 Subject: [PATCH 06/15] Created CustomQuestion, CustomAnswer and CustomDivider (#31) --- app/src/main/res/values/questions.xml | 31 +++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/app/src/main/res/values/questions.xml b/app/src/main/res/values/questions.xml index 30c2f80..0ad36a5 100644 --- a/app/src/main/res/values/questions.xml +++ b/app/src/main/res/values/questions.xml @@ -1,3 +1,4 @@ + Os dados móveis de internet do aplicativo já estão sendo pagos pelo governo? @@ -11,4 +12,34 @@ móveis de internet serão pagos pelo governo? Não serão patrocinados (pagos) os dados móveis de internet quando roteados, ou compartilhados, com outros dispositivos e/ou computadores. + + + + + + \ No newline at end of file From 38aa7bf69ca05a8471e0ec30c3f1978ac04f837b Mon Sep 17 00:00:00 2001 From: Mateus Oliveira Date: Wed, 7 Oct 2020 23:40:01 -0300 Subject: [PATCH 07/15] Fix wrong name (#31) --- app/src/main/res/values/questions.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values/questions.xml b/app/src/main/res/values/questions.xml index 0ad36a5..e9e019a 100644 --- a/app/src/main/res/values/questions.xml +++ b/app/src/main/res/values/questions.xml @@ -40,6 +40,6 @@ match_parent 1dp ?android:attr/dividerVertical - 16dp + 16dp \ No newline at end of file From ac332b5ef7f5dc569510ac83260b691c1a9922be Mon Sep 17 00:00:00 2001 From: Mateus Oliveira Date: Wed, 7 Oct 2020 23:50:57 -0300 Subject: [PATCH 08/15] Fixed scroll with padding (#31) --- app/src/main/res/layout/activity_questions.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/src/main/res/layout/activity_questions.xml b/app/src/main/res/layout/activity_questions.xml index a6ebb65..aabca34 100644 --- a/app/src/main/res/layout/activity_questions.xml +++ b/app/src/main/res/layout/activity_questions.xml @@ -24,8 +24,7 @@ android:layout_marginTop="30dp" android:layout_marginBottom="50dp" android:paddingTop="20dp" - android:paddingBottom="20dp" - app:layout_constrainedHeight="true" + android:paddingBottom="130dp" app:layout_constraintTop_toBottomOf="@id/faq"> From fa8cf15b43d7fa855318dc1fc7ed58e9f90bb851 Mon Sep 17 00:00:00 2001 From: Mateus Oliveira Date: Wed, 7 Oct 2020 23:58:59 -0300 Subject: [PATCH 09/15] Refactored slide func (#31) --- .../quasar/corona/app/QuestionsActivity.java | 25 +++++-------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/app/src/main/java/org/cordova/quasar/corona/app/QuestionsActivity.java b/app/src/main/java/org/cordova/quasar/corona/app/QuestionsActivity.java index 23cb24f..75a6922 100644 --- a/app/src/main/java/org/cordova/quasar/corona/app/QuestionsActivity.java +++ b/app/src/main/java/org/cordova/quasar/corona/app/QuestionsActivity.java @@ -78,8 +78,10 @@ protected void onResume() { } //TODO: refactor slide functions - void slide_down(Context ctx, View v) { - Animation a = AnimationUtils.loadAnimation(ctx, R.anim.slide_down); + void slide(Context ctx, View v, Boolean down) { + Animation a; + if(down) a = AnimationUtils.loadAnimation(ctx, R.anim.slide_down); + else a = AnimationUtils.loadAnimation(ctx, R.anim.slide_up); if (a != null) { a.reset(); if (v != null) { @@ -89,31 +91,16 @@ void slide_down(Context ctx, View v) { } } - void slide_up(Context ctx, View v) { - Animation a = AnimationUtils.loadAnimation(ctx, R.anim.slide_up); - if (a != null) { - a.reset(); - if (v != null) { - v.clearAnimation(); - v.startAnimation(a); - } - } - } - - - /** - * onClick handler - */ public void toggle_contents(View v) { TextView answerView = textViews.get(Integer.parseInt((String) v.getTag())); if (answerView.isShown()) { - slide_up(this, answerView); + slide(this, answerView, false); answerView.setVisibility(View.GONE); } else { answerView.setVisibility(View.VISIBLE); - slide_down(this, answerView); + slide(this, answerView, true); } } } From 00ebaa6ba5394b2c710f650caa64741a6b044571 Mon Sep 17 00:00:00 2001 From: Mateus Oliveira Date: Thu, 8 Oct 2020 17:36:38 -0300 Subject: [PATCH 10/15] Added .idea folder to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index c700357..b0bf2cb 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ .cxx /.idea/jarRepositories.xml .vscode/* +.idea/ From b8c4fcef0a53cb19e3658e12b20a11fdbfc97ff2 Mon Sep 17 00:00:00 2001 From: Mateus Oliveira Date: Thu, 8 Oct 2020 17:45:31 -0300 Subject: [PATCH 11/15] Created logic to change icon when click (#31) --- .../cordova/quasar/corona/app/QuestionsActivity.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/cordova/quasar/corona/app/QuestionsActivity.java b/app/src/main/java/org/cordova/quasar/corona/app/QuestionsActivity.java index 75a6922..c715052 100644 --- a/app/src/main/java/org/cordova/quasar/corona/app/QuestionsActivity.java +++ b/app/src/main/java/org/cordova/quasar/corona/app/QuestionsActivity.java @@ -6,6 +6,7 @@ import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationUtils; +import android.widget.ImageView; import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; @@ -19,6 +20,7 @@ public class QuestionsActivity extends AppCompatActivity { List textViews = new ArrayList<>(); + List imageViews = new ArrayList<>(); @Override @@ -68,6 +70,10 @@ protected void onCreate(Bundle savedInstanceState) { textViews.get(1).setVisibility(View.GONE); textViews.add(2,(TextView) findViewById(R.id.route_answer)); textViews.get(2).setVisibility(View.GONE); + + imageViews.add(0, (ImageView) findViewById(R.id.sponsored_data_icon)); + imageViews.add(1, (ImageView) findViewById(R.id.meet_icon)); + imageViews.add(2, (ImageView) findViewById(R.id.route_icon)); } @Override @@ -92,15 +98,18 @@ void slide(Context ctx, View v, Boolean down) { } public void toggle_contents(View v) { - TextView answerView = textViews.get(Integer.parseInt((String) v.getTag())); + int id = Integer.parseInt((String) v.getTag()); + TextView answerView = textViews.get(id); if (answerView.isShown()) { slide(this, answerView, false); answerView.setVisibility(View.GONE); + imageViews.get(id).setImageResource(R.drawable.baseline_expand_more_24); } else { answerView.setVisibility(View.VISIBLE); slide(this, answerView, true); + imageViews.get(id).setImageResource(R.drawable.baseline_expand_less_24); } } } From 91413ffc2477f6096efc0e6dd6958ca2ac69a195 Mon Sep 17 00:00:00 2001 From: Mateus Oliveira Date: Thu, 8 Oct 2020 17:46:09 -0300 Subject: [PATCH 12/15] Added expand_less icon (#31) --- app/src/main/res/drawable/baseline_expand_less_24.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 app/src/main/res/drawable/baseline_expand_less_24.xml diff --git a/app/src/main/res/drawable/baseline_expand_less_24.xml b/app/src/main/res/drawable/baseline_expand_less_24.xml new file mode 100644 index 0000000..1550145 --- /dev/null +++ b/app/src/main/res/drawable/baseline_expand_less_24.xml @@ -0,0 +1,10 @@ + + + From 94b7fae57615d7ccc5060927024526bfe218304e Mon Sep 17 00:00:00 2001 From: Mateus Oliveira Date: Thu, 8 Oct 2020 17:46:19 -0300 Subject: [PATCH 13/15] Added expand_more icon (#31) --- app/src/main/res/drawable/baseline_expand_more_24.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 app/src/main/res/drawable/baseline_expand_more_24.xml diff --git a/app/src/main/res/drawable/baseline_expand_more_24.xml b/app/src/main/res/drawable/baseline_expand_more_24.xml new file mode 100644 index 0000000..adc215c --- /dev/null +++ b/app/src/main/res/drawable/baseline_expand_more_24.xml @@ -0,0 +1,10 @@ + + + From 25b2b521ee09ac4c78893b02f9025a0548c9c007 Mon Sep 17 00:00:00 2001 From: Mateus Oliveira Date: Thu, 8 Oct 2020 17:46:39 -0300 Subject: [PATCH 14/15] Refactored ScrollView and added Icons (#31) --- .../main/res/layout/activity_questions.xml | 40 ++++++++++++++++--- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/app/src/main/res/layout/activity_questions.xml b/app/src/main/res/layout/activity_questions.xml index aabca34..f362374 100644 --- a/app/src/main/res/layout/activity_questions.xml +++ b/app/src/main/res/layout/activity_questions.xml @@ -20,11 +20,10 @@ @@ -42,6 +41,15 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> + + + + + + + + \ No newline at end of file From 1fa25e09ed1da841b16c1ed92bab5a84c53d2f7c Mon Sep 17 00:00:00 2001 From: Mateus Oliveira Date: Thu, 8 Oct 2020 17:47:10 -0300 Subject: [PATCH 15/15] Refactored question and created expand_icon style --- app/src/main/res/values/questions.xml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/src/main/res/values/questions.xml b/app/src/main/res/values/questions.xml index e9e019a..af02aad 100644 --- a/app/src/main/res/values/questions.xml +++ b/app/src/main/res/values/questions.xml @@ -16,9 +16,9 @@ + + \ No newline at end of file