Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUESTIONS] Remodel FAQ #37

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
.cxx
/.idea/jarRepositories.xml
.vscode/*
.idea/
Original file line number Diff line number Diff line change
@@ -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<TextView> textViews = new ArrayList<>();
List<ImageView> imageViews = new ArrayList<>();


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down Expand Up @@ -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
Expand All @@ -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);
}
}
}
11 changes: 11 additions & 0 deletions app/src/main/res/anim/slide_down.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true">
<scale
android:duration="200"
android:fromXScale="1.0"
android:fromYScale="0.0"
android:interpolator="@android:anim/linear_interpolator"
android:toXScale="1.0"
android:toYScale="1.0" />
</set>
11 changes: 11 additions & 0 deletions app/src/main/res/anim/slide_up.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true">
<scale
android:duration="200"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:interpolator="@android:anim/linear_interpolator"
android:toXScale="1.0"
android:toYScale="0.0" />
</set>
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/baseline_expand_less_24.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M12,8l-6,6 1.41,1.41L12,10.83l4.59,4.58L18,14z"/>
</vector>
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/baseline_expand_more_24.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M16.59,8.59L12,13.17 7.41,8.59 6,10l6,6 6,-6z"/>
</vector>
140 changes: 75 additions & 65 deletions app/src/main/res/layout/activity_questions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,111 +14,120 @@
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" />

<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:layout_marginBottom="50dp"
android:paddingTop="20dp"
android:paddingBottom="20dp"
app:layout_constraintBottom_toTopOf="@+id/navigation"
app:layout_constraintTop_toTopOf="@id/faq">
android:layout_height="0dp"
android:layout_marginBottom="55dp"
app:layout_constrainedHeight="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/faq">


<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent">

<TextView
android:id="@+id/sponsored-data-question"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginLeft="15dp"
android:paddingLeft="14dp"
android:paddingRight="14dp"
android:id="@+id/sponsored_data_question"
style="@style/CustomQuestion"
android:tag="0"
android:text="@string/sponsored_data_question"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<ImageView
android:id="@+id/sponsored_data_icon"
style="@style/ExpandIcon"
android:contentDescription="@string/sponsored_data_question"
app:layout_constraintBottom_toBottomOf="@+id/sponsored_data_question"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/sponsored_data_question"
app:srcCompat="@drawable/baseline_expand_more_24" />

<TextView
android:id="@+id/sponsored-data-answer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginLeft="30dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:id="@+id/sponsored_data_answer"
style="@style/CustomAnswer"
android:text="@string/sponsored_data_answer"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/sponsored-data-question" />
app:layout_constraintTop_toBottomOf="@+id/sponsored_data_question" />


<View
android:id="@+id/divider0"
style="@style/CustomDivider"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/sponsored_data_answer" />

<TextView
android:id="@+id/meet-question"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginLeft="15dp"
android:paddingLeft="14dp"
android:paddingRight="14dp"
android:id="@+id/meet_question"
style="@style/CustomQuestion"
android:tag="1"
android:text="@string/meet_question"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/sponsored-data-answer" />
app:layout_constraintTop_toBottomOf="@+id/divider0" />

<ImageView
android:id="@+id/meet_icon"
style="@style/ExpandIcon"
android:contentDescription="@string/sponsored_data_question"
app:layout_constraintBottom_toBottomOf="@+id/meet_question"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/divider0"
app:layout_constraintVertical_bias="0.518"
app:srcCompat="@drawable/baseline_expand_more_24" />

<TextView
android:id="@+id/meet-answer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginLeft="30dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:id="@+id/meet_answer"
style="@style/CustomAnswer"
android:text="@string/meet_answer"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/meet-question" />
app:layout_constraintTop_toBottomOf="@+id/meet_question" />

<View
android:id="@+id/divider1"
style="@style/CustomDivider"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/meet_answer" />

<TextView
android:id="@+id/route-question"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginLeft="15dp"
android:paddingLeft="14dp"
android:paddingRight="14dp"
android:id="@+id/route_question"
style="@style/CustomQuestion"
android:tag="2"
android:text="@string/route_question"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/meet-answer" />
app:layout_constraintTop_toBottomOf="@+id/divider1" />

<ImageView
android:id="@+id/route_icon"
style="@style/ExpandIcon"
android:contentDescription="@string/sponsored_data_question"
app:layout_constraintBottom_toBottomOf="@+id/route_question"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/divider1"
app:layout_constraintVertical_bias="0.518"
app:srcCompat="@drawable/baseline_expand_more_24" />

<TextView
android:id="@+id/route-answer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginLeft="30dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:id="@+id/route_answer"
style="@style/CustomAnswer"
android:text="@string/route_answer"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/route-question" />
app:layout_constraintTop_toBottomOf="@+id/route_question" />


</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>

Expand All @@ -135,4 +144,5 @@
app:labelVisibilityMode="labeled"
app:layout_constraintBottom_toBottomOf="parent"
app:menu="@menu/main_menu" />

</androidx.constraintlayout.widget.ConstraintLayout>
37 changes: 37 additions & 0 deletions app/src/main/res/values/questions.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="sponsored_data_question">Os dados móveis de internet do aplicativo já estão
sendo pagos pelo governo?</string>
Expand All @@ -11,4 +12,40 @@
móveis de internet serão pagos pelo governo?</string>
<string name="route_answer">Não serão patrocinados (pagos) os dados móveis de internet quando
roteados, ou compartilhados, com outros dispositivos e/ou computadores.</string>

<style name="CustomQuestion">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginTop">16dp</item>
<item name="android:paddingLeft">30dp</item>
<item name="android:paddingRight">30dp</item>
<item name="android:textSize">20sp</item>
<item name="android:textStyle">bold</item>
<item name="android:clickable">true</item>
<item name="android:focusable">true</item>
<item name="android:onClick">toggle_contents</item>
</style>

<style name="CustomAnswer">
<item name="android:layout_marginTop">10dp</item>
<item name="android:layout_marginStart">30dp</item>
<item name="android:paddingLeft">16dp</item>
<item name="android:paddingRight">16dp</item>
<item name="android:textSize">16sp</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item>
</style>

<style name="CustomDivider">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">1dp</item>
<item name="android:background">?android:attr/dividerVertical</item>
<item name="android:layout_margin">16dp</item>
</style>

<style name="ExpandIcon">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginEnd">8dp</item>
</style>
</resources>