Skip to content

Commit

Permalink
Merge branch 'feature/media-gui'
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrucesdeveloper committed Feb 19, 2023
2 parents 2a44947 + 79b05cc commit 0ce34f2
Show file tree
Hide file tree
Showing 50 changed files with 268 additions and 213 deletions.
4 changes: 4 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,9 @@
android:name=".activities.MenuMetroActivity"
android:exported="false"
android:screenOrientation="portrait" />

<meta-data
android:name="preloaded_fonts"
android:resource="@array/preloaded_fonts" />
</application>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ public class MainActivity extends AppCompatActivity {
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
}

public void goNextActivity(View view) {
public void goToLinesMenuActivity(View view) {
Intent intent = new Intent(this, MenuMetroActivity.class);
startActivity(intent);
}

public void resetButton(View view) {
public void resetSharedPreferences(View view) {
// TODO - Add a prompt before deleting
SharedPreferences sharedPref = this.getSharedPreferences(
String.valueOf(R.string.app_name), Context.MODE_PRIVATE);
sharedPref.edit().clear().commit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private boolean getLevelStarSharedPreferences(String lineName) {
return sharedPref.getBoolean(lineName,false);
}

public void goBackMainActivity(View view) {
public void goToMainActivity(View view) {
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import androidx.annotation.NonNull;
import androidx.cardview.widget.CardView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.recyclerview.widget.RecyclerView;

import com.jorgecruces.metrometro.R;
Expand Down Expand Up @@ -50,7 +51,7 @@ public void onBindViewHolder(@NonNull MenuMetroRecyclerViewAdapter.MyViewHolder

holder.lineaMetroName.setText(lineName);
holder.backgroundMetroMenu.setColorFilter(color);
holder.cardView.setOnClickListener(view -> {
holder.constraintLayoutContainer.setOnClickListener(view -> {
Intent intent = new Intent(this.context.getApplicationContext(), PlayGameActivity.class);
intent.putExtra("LINEA", lineName);
this.context.startActivity(intent);
Expand All @@ -60,7 +61,7 @@ public void onBindViewHolder(@NonNull MenuMetroRecyclerViewAdapter.MyViewHolder
SharedPreferences sharedPref = this.context.getSharedPreferences(
String.valueOf(R.string.app_name),Context.MODE_PRIVATE);
if (sharedPref.getBoolean(lineName, false)) {
holder.starView.setImageResource(R.drawable.ic_mediamodifier_design_2_);
holder.starView.setImageTintList(null);
}
}

Expand All @@ -73,12 +74,13 @@ public static class MyViewHolder extends RecyclerView.ViewHolder {
// On createMethod
TextView lineaMetroName;
ImageView backgroundMetroMenu, starView;
CardView cardView;
ConstraintLayout constraintLayoutContainer;
public MyViewHolder(@NonNull View itemView) {
super(itemView);
lineaMetroName = itemView.findViewById(R.id.lineaName);
backgroundMetroMenu = itemView.findViewById(R.id.backgroundMetroMenu);
cardView = itemView.findViewById(R.id.cardViewMenu);
constraintLayoutContainer = itemView.findViewById(R.id.contraintLayoutViewContainer);

starView = itemView.findViewById(R.id.starView);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,16 +284,17 @@ private void updateProgressInfo() {
String.valueOf(R.string.app_name),Context.MODE_PRIVATE);

SharedPreferences.Editor editor = sharedPref.edit();
int lastScore = sharedPref.getInt("score", 0);

// Score
if (lastScore < 6) {
editor.putInt("score",lastScore + 1);
// Check if we have updated this level before
if(!sharedPref.getBoolean(lineName, false)) {
int lastScore = sharedPref.getInt("score", 0);
// Score
if (lastScore < 6) {
editor.putInt("score",lastScore + 1);
}
// Star
editor.putBoolean(this.lineName,true);
editor.commit();
}
// Star
editor.putBoolean(this.lineName,true);

editor.commit();
}

private void showWinningDialog() {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-v24/sorucefiles.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-v24/trythis.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/lines_metro_star.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/lines_metro_title.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/lll.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions app/src/main/res/font/titillium_web_extralight.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:app="http://schemas.android.com/apk/res-auto"
app:fontProviderAuthority="com.google.android.gms.fonts"
app:fontProviderPackage="com.google.android.gms"
app:fontProviderQuery="name=Titillium Web&amp;weight=200"
app:fontProviderCerts="@array/com_google_android_gms_fonts_certs">
</font-family>
85 changes: 51 additions & 34 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,63 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/main_menu_background"
tools:context=".activities.MainActivity">

<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="168dp"
android:layout_marginEnd="149dp"
android:layout_marginBottom="272dp"
android:onClick="goNextActivity"
android:text="Button"
app:layout_constraintBottom_toBottomOf="parent"
<ImageView
android:id="@+id/imageViewLogo"
android:layout_width="253dp"
android:layout_height="202dp"
android:layout_marginTop="76dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView" />
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/logo" />

<Button
android:id="@+id/resetButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="168dp"
android:layout_marginEnd="149dp"
android:layout_marginBottom="16dp"
android:onClick="resetButton"
android:text="Button"
app:layout_constraintBottom_toBottomOf="parent"
<ImageView
android:id="@+id/imageViewButtonPlay"
android:layout_width="300dp"
android:layout_height="130dp"
android:layout_marginTop="2dp"
android:onClick="goToLinesMenuActivity"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView"
app:layout_constraintVertical_bias="1.0" />
app:layout_constraintTop_toBottomOf="@+id/imageViewLogo"
app:srcCompat="@drawable/main_menu_button_play" />

<ImageView
android:id="@+id/imageViewButtonInformation"
android:layout_width="104dp"
android:layout_height="97dp"
android:layout_marginStart="48dp"
android:layout_marginTop="-16dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageViewButtonPlay"
app:srcCompat="@drawable/main_menu_button_information" />

<ImageView
android:id="@+id/imageViewButtonReset"
android:layout_width="95dp"
android:layout_height="95dp"
android:layout_marginStart="8dp"
android:layout_marginTop="-16dp"
android:layout_marginEnd="8dp"
android:onClick="resetSharedPreferences"
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" />

<ImageView
android:id="@+id/imageViewButtonConfiguration"
android:layout_width="95dp"
android:layout_height="95dp"
android:layout_marginTop="-16dp"
android:layout_marginEnd="48dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageViewButtonReset"
app:layout_constraintTop_toBottomOf="@+id/imageViewButtonPlay"
app:srcCompat="@drawable/main_menu_configuration" />

</androidx.constraintlayout.widget.ConstraintLayout>
80 changes: 32 additions & 48 deletions app/src/main/res/layout/activity_menu_metro.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,9 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/lines_metro_background"
tools:context=".activities.MenuMetroActivity">

<ImageView
android:id="@+id/imageView"
android:layout_width="63dp"
android:layout_height="58dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="42dp"
android:layout_marginBottom="9dp"
android:onClick="goBackMainActivity"
app:layout_constraintBottom_toTopOf="@+id/menuMetroRecyclerView"
app:layout_constraintEnd_toStartOf="@+id/textViewAlternative2"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@android:drawable/ic_menu_revert" />

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/menuMetroRecyclerView"
android:layout_width="0dp"
Expand All @@ -29,53 +15,51 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewAlternative2">
app:layout_constraintTop_toBottomOf="@+id/imageViewLineMenuTitle">

</androidx.recyclerview.widget.RecyclerView>

<TextView
android:id="@+id/textViewAlternative2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:layout_marginEnd="16dp"
android:fontFamily="sans-serif-light"
android:text="Lineas Metro"
android:textSize="36sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.414"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/scoreStarView"
android:layout_width="35dp"
android:layout_height="49dp"
android:layout_width="80dp"
android:layout_height="73dp"
android:layout_marginTop="28dp"
android:layout_marginEnd="12dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="27dp"
android:fontFamily="sans-serif-light"
android:background="@drawable/lines_metro_star"
android:elevation="3dp"
android:fontFamily="@font/titiliumweb_bold"
android:gravity="center_horizontal|center_vertical"
android:text="0"
android:textAlignment="center"
android:textSize="38sp"
android:textColor="#000000"
android:textSize="34sp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/menuMetroRecyclerView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageView3"
app:layout_constraintTop_toTopOf="parent" />

<ImageView
android:id="@+id/imageView3"
android:layout_width="63dp"
android:layout_height="56dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toTopOf="@+id/menuMetroRecyclerView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.06"
app:layout_constraintStart_toEndOf="@+id/textViewAlternative2"
android:id="@+id/imageViewLineMenuTitle"
android:layout_width="216dp"
android:layout_height="42dp"
android:layout_marginTop="44dp"
android:layout_marginEnd="8dp"
app:layout_constraintEnd_toStartOf="@+id/scoreStarView"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@android:drawable/btn_star_big_on" />
app:srcCompat="@drawable/lines_metro_title" />

<ImageView
android:id="@+id/imageViewButtonBack"
android:layout_width="56dp"
android:layout_height="42dp"
android:layout_marginStart="32dp"
android:layout_marginTop="44dp"
android:layout_marginEnd="19dp"
android:onClick="goToMainActivity"
app:layout_constraintEnd_toStartOf="@+id/imageViewLineMenuTitle"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/lines_metro_button_back" />

</androidx.constraintlayout.widget.ConstraintLayout>
Loading

0 comments on commit 0ce34f2

Please sign in to comment.