diff --git a/.gitignore b/.gitignore index c700357..b0bf2cb 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ .cxx /.idea/jarRepositories.xml .vscode/* +.idea/ 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..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 @@ -1,13 +1,28 @@ 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.ImageView; +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<>(); + List imageViews = new ArrayList<>(); + + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -48,6 +63,17 @@ protected void onCreate(Bundle savedInstanceState) { return false; } ); + + 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); + + 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 @@ -56,4 +82,34 @@ protected void onResume() { BottomNavigationView navigationView = findViewById(R.id.navigation); navigationView.getMenu().getItem(2).setChecked(true); } + + //TODO: refactor slide functions + 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) { + v.clearAnimation(); + v.startAnimation(a); + } + } + } + + public void toggle_contents(View v) { + 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); + } + } } 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 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 @@ + + + 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 @@ + + + diff --git a/app/src/main/res/layout/activity_questions.xml b/app/src/main/res/layout/activity_questions.xml index 12b27bd..f362374 100644 --- a/app/src/main/res/layout/activity_questions.xml +++ b/app/src/main/res/layout/activity_questions.xml @@ -14,19 +14,18 @@ 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" /> + android:layout_height="0dp" + android:layout_marginBottom="55dp" + app:layout_constrainedHeight="true" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintTop_toBottomOf="@id/faq"> + + + + app:layout_constraintTop_toBottomOf="@+id/sponsored_data_question" /> + + + + 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" /> + + @@ -135,4 +144,5 @@ app:labelVisibilityMode="labeled" app:layout_constraintBottom_toBottomOf="parent" app:menu="@menu/main_menu" /> + \ No newline at end of file diff --git a/app/src/main/res/values/questions.xml b/app/src/main/res/values/questions.xml index 30c2f80..af02aad 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,40 @@ 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