Skip to content

Commit

Permalink
feat(animation and contentDescription): animation added and content d…
Browse files Browse the repository at this point in the history
…escription to images and elements
  • Loading branch information
jcrucesdeveloper committed Mar 9, 2023
1 parent becb28b commit c3adcd8
Show file tree
Hide file tree
Showing 14 changed files with 193 additions and 76 deletions.
17 changes: 17 additions & 0 deletions .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import android.util.Log;
import android.util.TypedValue;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.HorizontalScrollView;
import android.widget.ImageView;
Expand Down Expand Up @@ -320,12 +322,20 @@ private void setCurrentAlternativesViews() {
currentTextView.setText(currentStation.getName());
}

Animation scaleAnimation = AnimationUtils.loadAnimation(this,R.anim.scale);


// OnClickListener
for (TextView textView: alternativesTextView) {
String lineName = textView.getText().toString();
textView.setOnClickListener(view -> this.checkAlternative(lineName));
textView.setOnClickListener(view -> {
view.startAnimation(scaleAnimation);
this.checkAlternative(lineName);
});
}



}

private void setCurrentStationData(int position) {
Expand Down
15 changes: 15 additions & 0 deletions app/src/main/res/anim/scale.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale
android:fromXScale="1.0"
android:fromYScale="1.0"
android:toXScale="0.97"
android:toYScale="0.97"
android:pivotX="50%"
android:pivotY="50%"
android:duration="100"
android:repeatMode="reverse"
android:repeatCount="1">
</scale>

</set>
21 changes: 15 additions & 6 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/logo" />
app:srcCompat="@drawable/logo"
android:contentDescription="@string/content_description_menu_logo"
/>

<ImageView
android:id="@+id/imageViewButtonPlay"
Expand All @@ -27,7 +29,9 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageViewLogo"
app:srcCompat="@drawable/main_menu_button_play" />
app:srcCompat="@drawable/main_menu_button_play"
android:contentDescription="@string/content_description_button_play"
/>

<ImageView
android:id="@+id/imageViewButtonInformation"
Expand All @@ -39,7 +43,8 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageViewButtonPlay"
app:srcCompat="@drawable/main_menu_button_information"
tools:ignore="UsingOnClickInXml" />
android:contentDescription="@string/content_description_button_information"
/>

<ImageView
android:id="@+id/imageViewButtonReset"
Expand All @@ -52,7 +57,9 @@
app:layout_constraintEnd_toStartOf="@+id/imageViewButtonConfiguration"
app:layout_constraintStart_toEndOf="@+id/imageViewButtonInformation"
app:layout_constraintTop_toBottomOf="@+id/imageViewButtonPlay"
app:srcCompat="@drawable/main_menu_button_reset" />
app:srcCompat="@drawable/main_menu_button_reset"
android:contentDescription="@string/content_description_button_reset"
/>

<ImageView
android:id="@+id/imageViewButtonConfiguration"
Expand All @@ -64,7 +71,9 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageViewButtonReset"
app:layout_constraintTop_toBottomOf="@+id/imageViewButtonPlay"
app:srcCompat="@drawable/main_menu_configuration" />
app:srcCompat="@drawable/main_menu_configuration"
android:contentDescription="@string/content_description_button_configuration"
/>

<com.google.android.gms.ads.AdView
android:id="@+id/adView"
Expand All @@ -77,5 +86,5 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:ignore="MissingConstraints"></com.google.android.gms.ads.AdView>
tools:ignore="MissingConstraints" />
</androidx.constraintlayout.widget.ConstraintLayout>
18 changes: 11 additions & 7 deletions app/src/main/res/layout/activity_menu_metro.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:ignore="MissingConstraints"></com.google.android.gms.ads.AdView>
tools:ignore="MissingConstraints" />

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/menuMetroRecyclerView"
Expand All @@ -28,8 +28,8 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageViewLineMenuTitle">

app:layout_constraintTop_toBottomOf="@+id/imageViewLineMenuTitle"
>
</androidx.recyclerview.widget.RecyclerView>

<TextView
Expand All @@ -44,9 +44,9 @@
android:elevation="3dp"
android:fontFamily="@font/titiliumweb_bold"
android:gravity="center_horizontal|center_vertical"
android:text="0"
android:text="@string/default_value_score_star_view"
android:textAlignment="center"
android:textColor="#000000"
android:textColor="#6D4C41"
android:textSize="34sp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/menuMetroRecyclerView"
Expand All @@ -62,7 +62,9 @@
app:layout_constraintEnd_toStartOf="@+id/scoreStarView"
app:layout_constraintStart_toEndOf="@+id/imageViewButtonBack"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/lines_metro_title" />
app:srcCompat="@drawable/lines_metro_title"
android:contentDescription="@string/content_description_title_menu"
/>

<ImageView
android:id="@+id/imageViewButtonBack"
Expand All @@ -75,6 +77,8 @@
app:layout_constraintEnd_toStartOf="@+id/imageViewLineMenuTitle"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/lines_metro_button_back" />
app:srcCompat="@drawable/lines_metro_button_back"
android:contentDescription="@string/content_description_go_back_button"
/>

</androidx.constraintlayout.widget.ConstraintLayout>
30 changes: 12 additions & 18 deletions app/src/main/res/layout/activity_metro_information.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,12 @@
android:background="@drawable/lines_metro_background"
tools:context=".activities.MetroInformationActivity">

<com.google.android.gms.ads.AdView
android:id="@+id/adView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
app:adSize="BANNER"
app:adUnitId="ca-app-pub-3940256099942544/6300978111"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:ignore="MissingConstraints"></com.google.android.gms.ads.AdView>

<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">

android:layout_height="match_parent"
android:contentDescription="@string/description_metro_information_scroll"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand All @@ -36,7 +25,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:fontFamily="@font/titiliumweb_bold"
android:text="Mapa del metro (Se puede hacer Zoom)"
android:text="@string/description_metro_information"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand All @@ -51,7 +40,9 @@
android:onClick="goToMainActivity"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/lines_metro_button_back" />
app:srcCompat="@drawable/lines_metro_button_back"
android:contentDescription="@string/content_description_go_back_button"
/>

<com.jorgecruces.metrometro.customViews.ZoomableImageView
android:id="@+id/metroMap"
Expand All @@ -65,7 +56,10 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewTitle2"
app:layout_constraintVertical_bias="0.064"
app:srcCompat="@drawable/info_metro_image_map" />
app:srcCompat="@drawable/info_metro_image_map"
tools:ignore="ImageContrastCheck"
android:contentDescription="@string/image_metro_santiago"
/>

<TextView
android:id="@+id/textViewTitle2"
Expand All @@ -77,7 +71,7 @@
android:background="@drawable/gameplay_background_game_line"
android:fontFamily="@font/titiliumweb_bold"
android:gravity="center_horizontal|center_vertical"
android:text="Lineas Metro"
android:text="@string/metro_lines"
android:textAlignment="center"
android:textColor="#FFFFFF"
android:textSize="34sp"
Expand Down
27 changes: 15 additions & 12 deletions app/src/main/res/layout/activity_play_game.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
app:adUnitId="ca-app-pub-8814283715092277/7449171029"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"></com.google.android.gms.ads.AdView>
app:layout_constraintTop_toTopOf="parent" />


<ImageView
Expand All @@ -27,7 +27,7 @@
android:layout_height="61dp"
android:layout_marginStart="16dp"
android:layout_marginTop="54dp"
android:contentDescription="Button"
android:contentDescription="@string/content_description_go_back_button"
android:onClick="goBackToMenu"
app:layout_constraintEnd_toStartOf="@+id/textViewTitle"
app:layout_constraintStart_toStartOf="parent"
Expand All @@ -43,7 +43,7 @@
android:background="@drawable/gameplay_background_game_line"
android:fontFamily="@font/titiliumweb_bold"
android:gravity="center_horizontal|center_vertical"
android:text="Lineas Metro"
android:text="@string/metro_lines"
android:textAlignment="center"
android:textColor="#FFFFFF"
android:textSize="34sp"
Expand All @@ -61,7 +61,7 @@
android:background="@drawable/gameplay_button_metro_station"
android:fontFamily="@font/titiliumweb_regular"
android:gravity="center_horizontal|center_vertical"
android:text="SAN PEDRO"
android:text="@string/alternative2"
android:textSize="20sp"
app:layout_constraintBottom_toTopOf="@+id/textViewAlternative3"
app:layout_constraintEnd_toStartOf="@+id/textViewAlternative1"
Expand All @@ -77,7 +77,7 @@
android:background="@drawable/gameplay_button_metro_station"
android:fontFamily="@font/titiliumweb_regular"
android:gravity="center_horizontal|center_vertical"
android:text="SAN PEDRO"
android:text="@string/alternative1"
android:textSize="20sp"
app:layout_constraintBottom_toTopOf="@+id/textViewAlternative4"
app:layout_constraintEnd_toEndOf="parent"
Expand All @@ -93,7 +93,7 @@
android:background="@drawable/gameplay_button_metro_station"
android:fontFamily="@font/titiliumweb_regular"
android:gravity="center_horizontal|center_vertical"
android:text="SAN PEDRO"
android:text="@string/alternative4"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
Expand All @@ -109,7 +109,7 @@
android:background="@drawable/gameplay_button_metro_station"
android:fontFamily="@font/titiliumweb_regular"
android:gravity="center_horizontal|center_vertical"
android:text="SAN PEDRO"
android:text="@string/alternative3"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/textViewAlternative4"
Expand All @@ -134,23 +134,24 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/titiliumweb_bold"
android:text="0"
android:text="@string/default_value_current_number_question"
android:textSize="30sp" />

<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/titiliumweb_bold"
android:text="/"
android:textSize="30sp" />
android:text="@string/separator_current_number_question"
android:textSize="30sp"
tools:ignore="TextContrastCheck" />

<TextView
android:id="@+id/textViewMaxPosition"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/titiliumweb_bold"
android:text="20"
android:text="@string/default_max_number_current_number_question"
android:textSize="30sp" />
</LinearLayout>

Expand All @@ -167,7 +168,9 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewTitle">
app:layout_constraintTop_toBottomOf="@+id/textViewTitle"
android:contentDescription="@string/description_scroll_view_gameplay"
>

<LinearLayout
android:layout_width="wrap_content"
Expand Down
Loading

0 comments on commit c3adcd8

Please sign in to comment.