diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 9ab58ab..2dd05c8 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -27,5 +27,9 @@ android:name=".activities.MenuMetroActivity" android:exported="false" android:screenOrientation="portrait" /> + + \ No newline at end of file diff --git a/app/src/main/java/com/jorgecruces/metrometro/activities/MainActivity.java b/app/src/main/java/com/jorgecruces/metrometro/activities/MainActivity.java index b1c2186..b87c51f 100644 --- a/app/src/main/java/com/jorgecruces/metrometro/activities/MainActivity.java +++ b/app/src/main/java/com/jorgecruces/metrometro/activities/MainActivity.java @@ -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(); diff --git a/app/src/main/java/com/jorgecruces/metrometro/activities/MenuMetroActivity.java b/app/src/main/java/com/jorgecruces/metrometro/activities/MenuMetroActivity.java index a1c5712..df0a56f 100644 --- a/app/src/main/java/com/jorgecruces/metrometro/activities/MenuMetroActivity.java +++ b/app/src/main/java/com/jorgecruces/metrometro/activities/MenuMetroActivity.java @@ -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); } diff --git a/app/src/main/java/com/jorgecruces/metrometro/activities/MenuMetroRecyclerViewAdapter.java b/app/src/main/java/com/jorgecruces/metrometro/activities/MenuMetroRecyclerViewAdapter.java index e53db3d..1ee2a35 100644 --- a/app/src/main/java/com/jorgecruces/metrometro/activities/MenuMetroRecyclerViewAdapter.java +++ b/app/src/main/java/com/jorgecruces/metrometro/activities/MenuMetroRecyclerViewAdapter.java @@ -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; @@ -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); @@ -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); } } @@ -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); } } diff --git a/app/src/main/java/com/jorgecruces/metrometro/activities/PlayGameActivity.java b/app/src/main/java/com/jorgecruces/metrometro/activities/PlayGameActivity.java index 33f6456..55a998b 100644 --- a/app/src/main/java/com/jorgecruces/metrometro/activities/PlayGameActivity.java +++ b/app/src/main/java/com/jorgecruces/metrometro/activities/PlayGameActivity.java @@ -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() { diff --git a/app/src/main/res/drawable-v24/another_container.png b/app/src/main/res/drawable-v24/another_container.png new file mode 100644 index 0000000..61e852a Binary files /dev/null and b/app/src/main/res/drawable-v24/another_container.png differ diff --git a/app/src/main/res/drawable-v24/background_game_line.png b/app/src/main/res/drawable-v24/background_game_line.png new file mode 100644 index 0000000..a0c0322 Binary files /dev/null and b/app/src/main/res/drawable-v24/background_game_line.png differ diff --git a/app/src/main/res/drawable-v24/button_metro_color.png b/app/src/main/res/drawable-v24/button_metro_color.png new file mode 100644 index 0000000..0dd7495 Binary files /dev/null and b/app/src/main/res/drawable-v24/button_metro_color.png differ diff --git a/app/src/main/res/drawable-v24/gameplay_button_container.png b/app/src/main/res/drawable-v24/gameplay_button_container.png new file mode 100644 index 0000000..3339d97 Binary files /dev/null and b/app/src/main/res/drawable-v24/gameplay_button_container.png differ diff --git a/app/src/main/res/drawable-v24/gameplay_container.png b/app/src/main/res/drawable-v24/gameplay_container.png new file mode 100644 index 0000000..737b210 Binary files /dev/null and b/app/src/main/res/drawable-v24/gameplay_container.png differ diff --git a/app/src/main/res/drawable-v24/gameplay_container_button_red.png b/app/src/main/res/drawable-v24/gameplay_container_button_red.png new file mode 100644 index 0000000..933c04d Binary files /dev/null and b/app/src/main/res/drawable-v24/gameplay_container_button_red.png differ diff --git a/app/src/main/res/drawable-v24/sorucefiles.png b/app/src/main/res/drawable-v24/sorucefiles.png new file mode 100644 index 0000000..94e5d6c Binary files /dev/null and b/app/src/main/res/drawable-v24/sorucefiles.png differ diff --git a/app/src/main/res/drawable-v24/trythis.png b/app/src/main/res/drawable-v24/trythis.png new file mode 100644 index 0000000..2c8624a Binary files /dev/null and b/app/src/main/res/drawable-v24/trythis.png differ diff --git a/app/src/main/res/drawable/lineas_metro_line_container.png b/app/src/main/res/drawable/lineas_metro_line_container.png new file mode 100644 index 0000000..67f8f45 Binary files /dev/null and b/app/src/main/res/drawable/lineas_metro_line_container.png differ diff --git a/app/src/main/res/drawable/lines_metro_background.png b/app/src/main/res/drawable/lines_metro_background.png new file mode 100644 index 0000000..4152840 Binary files /dev/null and b/app/src/main/res/drawable/lines_metro_background.png differ diff --git a/app/src/main/res/drawable/lines_metro_button_back.png b/app/src/main/res/drawable/lines_metro_button_back.png new file mode 100644 index 0000000..8e69c2d Binary files /dev/null and b/app/src/main/res/drawable/lines_metro_button_back.png differ diff --git a/app/src/main/res/drawable/lines_metro_star.png b/app/src/main/res/drawable/lines_metro_star.png new file mode 100644 index 0000000..851ca43 Binary files /dev/null and b/app/src/main/res/drawable/lines_metro_star.png differ diff --git a/app/src/main/res/drawable/lines_metro_title.png b/app/src/main/res/drawable/lines_metro_title.png new file mode 100644 index 0000000..42513e6 Binary files /dev/null and b/app/src/main/res/drawable/lines_metro_title.png differ diff --git a/app/src/main/res/drawable/lll.png b/app/src/main/res/drawable/lll.png new file mode 100644 index 0000000..61e852a Binary files /dev/null and b/app/src/main/res/drawable/lll.png differ diff --git a/app/src/main/res/drawable/logo.png b/app/src/main/res/drawable/logo.png new file mode 100644 index 0000000..0d0a4e7 Binary files /dev/null and b/app/src/main/res/drawable/logo.png differ diff --git a/app/src/main/res/drawable/main_menu_background.png b/app/src/main/res/drawable/main_menu_background.png new file mode 100644 index 0000000..21e836b Binary files /dev/null and b/app/src/main/res/drawable/main_menu_background.png differ diff --git a/app/src/main/res/drawable/main_menu_button_information.png b/app/src/main/res/drawable/main_menu_button_information.png new file mode 100644 index 0000000..44b9d4a Binary files /dev/null and b/app/src/main/res/drawable/main_menu_button_information.png differ diff --git a/app/src/main/res/drawable/main_menu_button_play.png b/app/src/main/res/drawable/main_menu_button_play.png new file mode 100644 index 0000000..14163b0 Binary files /dev/null and b/app/src/main/res/drawable/main_menu_button_play.png differ diff --git a/app/src/main/res/drawable/main_menu_button_reset.png b/app/src/main/res/drawable/main_menu_button_reset.png new file mode 100644 index 0000000..d6f8fd9 Binary files /dev/null and b/app/src/main/res/drawable/main_menu_button_reset.png differ diff --git a/app/src/main/res/drawable/main_menu_configuration.png b/app/src/main/res/drawable/main_menu_configuration.png new file mode 100644 index 0000000..66ca861 Binary files /dev/null and b/app/src/main/res/drawable/main_menu_configuration.png differ diff --git a/app/src/main/res/font/titillium_web_extralight.xml b/app/src/main/res/font/titillium_web_extralight.xml new file mode 100644 index 0000000..df4c0ae --- /dev/null +++ b/app/src/main/res/font/titillium_web_extralight.xml @@ -0,0 +1,7 @@ + + + diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index a24147e..879270b 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -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"> - - -