-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
251 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
MentalBlocks2/app/src/main/java/com/ivanloy/mentalblocks/MainMenuActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.ivanloy.mentalblocks | ||
|
||
import android.content.Intent | ||
import android.net.Uri | ||
import androidx.appcompat.app.AppCompatActivity | ||
import android.os.Bundle | ||
import android.view.View | ||
import android.widget.Toast | ||
import kotlinx.android.synthetic.main.activity_main_menu.* | ||
|
||
class MainMenuActivity : AppCompatActivity(), View.OnClickListener { | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_main_menu) | ||
|
||
btn_levels.setOnClickListener(this) | ||
btn_credits.setOnClickListener(this) | ||
btn_donations.setOnClickListener(this) | ||
} | ||
|
||
override fun onClick(v: View?) { | ||
when(v!!.id){ | ||
R.id.btn_levels -> { | ||
val intent = Intent(this, LevelListActivity::class.java) | ||
startActivity(intent) | ||
} | ||
R.id.btn_donations -> { | ||
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse("https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=nachovanle@gmail.com&lc=US&item_name=YOUR+PURPOSE+HERE&no_note=0&cn=&curency_code=USD&bn=PP-DonationsBF:btn_donateCC_LG.gif:NonHosted")) | ||
startActivity(browserIntent) | ||
} | ||
else -> { | ||
Toast.makeText(this, "WIP :(", Toast.LENGTH_SHORT).show() | ||
} | ||
} | ||
} | ||
} |
78 changes: 78 additions & 0 deletions
78
MentalBlocks2/app/src/main/java/com/ivanloy/mentalblocks/SerializableManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package com.ivanloy.mentalblocks; | ||
|
||
import android.content.Context; | ||
|
||
import java.io.FileInputStream; | ||
import java.io.FileOutputStream; | ||
import java.io.IOException; | ||
import java.io.ObjectInputStream; | ||
import java.io.ObjectOutputStream; | ||
import java.io.Serializable; | ||
|
||
/** | ||
* @author Sandro Machado | ||
*/ | ||
public class SerializableManager { | ||
|
||
/** | ||
* Saves a serializable object. | ||
* | ||
* @param context The application context. | ||
* @param objectToSave The object to save. | ||
* @param fileName The name of the file. | ||
* @param <T> The type of the object. | ||
*/ | ||
|
||
public static <T extends Serializable> void saveSerializable(Context context, T objectToSave, String fileName) { | ||
try { | ||
FileOutputStream fileOutputStream = context.openFileOutput(fileName, Context.MODE_PRIVATE); | ||
ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream); | ||
|
||
objectOutputStream.writeObject(objectToSave); | ||
|
||
objectOutputStream.close(); | ||
fileOutputStream.close(); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
/** | ||
* Loads a serializable object. | ||
* | ||
* @param context The application context. | ||
* @param fileName The filename. | ||
* @param <T> The object type. | ||
* | ||
* @return the serializable object. | ||
*/ | ||
|
||
public static<T extends Serializable> T readSerializable(Context context, String fileName) { | ||
T objectToReturn = null; | ||
|
||
try { | ||
FileInputStream fileInputStream = context.openFileInput(fileName); | ||
ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream); | ||
objectToReturn = (T) objectInputStream.readObject(); | ||
|
||
objectInputStream.close(); | ||
fileInputStream.close(); | ||
} catch (IOException | ClassNotFoundException e) { | ||
e.printStackTrace(); | ||
} | ||
|
||
return objectToReturn; | ||
} | ||
|
||
/** | ||
* Removes a specified file. | ||
* | ||
* @param context The application context. | ||
* @param filename The name of the file. | ||
*/ | ||
|
||
public static void removeSerializable(Context context, String filename) { | ||
context.deleteFile(filename); | ||
} | ||
|
||
} |
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.
10 changes: 5 additions & 5 deletions
10
MentalBlocks2/app/src/main/res/drawable/ic_launcher_background.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
MentalBlocks2/app/src/main/res/layout/activity_main_menu.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:background="@drawable/background" | ||
tools:context=".MainMenuActivity"> | ||
|
||
|
||
<ImageView | ||
android:layout_width="213dp" | ||
android:layout_height="333dp" app:srcCompat="@drawable/logo" | ||
android:id="@+id/imageView" android:layout_marginTop="32dp" | ||
app:layout_constraintTop_toTopOf="parent" app:layout_constraintStart_toStartOf="parent" | ||
android:layout_marginStart="8dp" app:layout_constraintEnd_toEndOf="parent" android:layout_marginEnd="8dp"/> | ||
<ImageView | ||
android:layout_width="336dp" | ||
app:srcCompat="@drawable/levels" | ||
android:id="@+id/btn_levels" | ||
android:clickable="true" | ||
android:layout_height="70dp" | ||
app:layout_constraintTop_toBottomOf="@+id/imageView" | ||
app:layout_constraintBottom_toTopOf="@+id/btn_donations" | ||
app:layout_constraintVertical_chainStyle="packed" app:layout_constraintEnd_toEndOf="parent" | ||
android:layout_marginEnd="8dp" app:layout_constraintStart_toStartOf="parent" | ||
android:layout_marginStart="8dp"/> | ||
<ImageView | ||
android:layout_width="336dp" | ||
android:layout_height="70dp" app:srcCompat="@drawable/donations" | ||
android:id="@+id/btn_donations" | ||
app:layout_constraintTop_toBottomOf="@+id/btn_levels" | ||
app:layout_constraintBottom_toTopOf="@+id/btn_credits" app:layout_constraintEnd_toEndOf="parent" | ||
android:layout_marginEnd="8dp" app:layout_constraintStart_toStartOf="parent" | ||
android:layout_marginStart="8dp"/> | ||
<ImageView | ||
android:layout_width="336dp" | ||
android:layout_height="67dp" app:srcCompat="@drawable/credits" | ||
android:id="@+id/btn_credits" | ||
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintTop_toBottomOf="@+id/btn_donations" | ||
app:layout_constraintStart_toStartOf="parent" android:layout_marginStart="8dp" | ||
app:layout_constraintEnd_toEndOf="parent" android:layout_marginEnd="8dp"/> | ||
</androidx.constraintlayout.widget.ConstraintLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
MentalBlocks2/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<background android:drawable="@drawable/ic_launcher_background"/> | ||
<foreground android:drawable="@drawable/ic_launcher_foreground"/> | ||
<background android:drawable="@color/ic_launcher_background"/> | ||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/> | ||
</adaptive-icon> |
4 changes: 2 additions & 2 deletions
4
MentalBlocks2/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<background android:drawable="@drawable/ic_launcher_background"/> | ||
<foreground android:drawable="@drawable/ic_launcher_foreground"/> | ||
<background android:drawable="@color/ic_launcher_background"/> | ||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/> | ||
</adaptive-icon> |
Binary file modified
BIN
-767 Bytes
(74%)
MentalBlocks2/app/src/main/res/mipmap-hdpi/ic_launcher.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
BIN
+2.87 KB
MentalBlocks2/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.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 modified
BIN
-563 Bytes
(89%)
MentalBlocks2/app/src/main/res/mipmap-hdpi/ic_launcher_round.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 modified
BIN
-345 Bytes
(83%)
MentalBlocks2/app/src/main/res/mipmap-mdpi/ic_launcher.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
BIN
+1.73 KB
MentalBlocks2/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.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 modified
BIN
-29 Bytes
(99%)
MentalBlocks2/app/src/main/res/mipmap-mdpi/ic_launcher_round.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.
Binary file added
BIN
+4.17 KB
MentalBlocks2/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.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 modified
BIN
-733 Bytes
(89%)
MentalBlocks2/app/src/main/res/mipmap-xhdpi/ic_launcher_round.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 modified
BIN
-1.56 KB
(75%)
MentalBlocks2/app/src/main/res/mipmap-xxhdpi/ic_launcher.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
BIN
+7.53 KB
MentalBlocks2/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.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 modified
BIN
-821 Bytes
(92%)
MentalBlocks2/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.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 modified
BIN
-2.32 KB
(74%)
MentalBlocks2/app/src/main/res/mipmap-xxxhdpi/ic_launcher.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
BIN
+11.3 KB
MentalBlocks2/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.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 modified
BIN
-1.24 KB
(92%)
MentalBlocks2/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions
4
MentalBlocks2/app/src/main/res/values/ic_launcher_background.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<color name="ic_launcher_background">#FFFFFF</color> | ||
</resources> |