-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
05d0dd2
commit b1e1f2f
Showing
15 changed files
with
230 additions
and
68 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":64},"path":"app-release.apk","properties":{"packageId":"javinator9889.bitcoinpools","split":"","minSdkVersion":"21"}}] | ||
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":66},"path":"app-release.apk","properties":{"packageId":"javinator9889.bitcoinpools","split":"","minSdkVersion":"21"}}] |
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
103 changes: 103 additions & 0 deletions
103
app/src/main/java/javinator9889/bitcoinpools/EasterEgg.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,103 @@ | ||
package javinator9889.bitcoinpools; | ||
|
||
import android.app.Activity; | ||
import android.content.Context; | ||
import android.content.res.Resources; | ||
import android.media.MediaMetadataRetriever; | ||
import android.net.Uri; | ||
import android.os.Bundle; | ||
import android.support.annotation.NonNull; | ||
import android.support.annotation.Nullable; | ||
import android.widget.MediaController; | ||
import android.widget.Toast; | ||
import android.widget.VideoView; | ||
|
||
/** | ||
* Created by Javinator9889 on 10/03/2018. | ||
* Easter Egg :D | ||
*/ | ||
|
||
public class EasterEgg extends Activity { | ||
private String[] positivePhrases; | ||
private VideoView easterEggVideo; | ||
private String[] negativePhrases; | ||
private boolean isEasterEggCompleted = false; | ||
private int actualStepCount = 0; | ||
|
||
@Override | ||
public void onCreate(@Nullable Bundle savedInstanceState) { | ||
System.out.println("Creating activity"); | ||
setContentView(R.layout.easter_egg); | ||
easterEggVideo = findViewById(R.id.easteregg_video); | ||
super.onCreate(savedInstanceState); | ||
} | ||
|
||
@Override | ||
protected void onPostCreate(@Nullable Bundle savedInstanceState) { | ||
System.out.println("Activity created"); | ||
|
||
String videoPath = "android.resource://" + getPackageName() + "/" + R.raw.easteregg; | ||
Uri videoUri = Uri.parse(videoPath); | ||
int videoMetadata[] = getVideoMeasurements(videoUri); | ||
int widthMeasureSpec = videoMetadata[0]; | ||
int heightMeasureSpec = videoMetadata[1]; | ||
MediaController mediaController = new MediaController(this); | ||
mediaController.setAnchorView(easterEggVideo); | ||
|
||
easterEggVideo.setVideoURI(videoUri); | ||
easterEggVideo.requestFocus(); | ||
easterEggVideo.setMediaController(mediaController); | ||
easterEggVideo.measure(widthMeasureSpec, heightMeasureSpec); | ||
easterEggVideo.start(); | ||
super.onPostCreate(savedInstanceState); | ||
} | ||
|
||
@NonNull | ||
private int[] getVideoMeasurements(Uri videoUri) { | ||
MediaMetadataRetriever metadataRetriever = new MediaMetadataRetriever(); | ||
metadataRetriever.setDataSource(this, videoUri); | ||
return new int[] { | ||
Integer.parseInt(metadataRetriever | ||
.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH)), | ||
Integer.parseInt(metadataRetriever | ||
.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT)) | ||
}; | ||
} | ||
|
||
public EasterEgg() { | ||
super(); | ||
} | ||
|
||
private EasterEgg(Resources stringArrayResources) { | ||
this.positivePhrases = stringArrayResources.getStringArray(R.array.positivePhrases); | ||
//this.negativePhrases = stringArrayResources.getStringArray(R.array.negativePhrases); | ||
} | ||
|
||
public static EasterEgg newInstance(Resources applicationResources) { | ||
return new EasterEgg(applicationResources); | ||
} | ||
|
||
public boolean addStep(Context context) { | ||
++actualStepCount; | ||
compareSteps(context); | ||
return isEasterEggCompleted; | ||
} | ||
|
||
public void resetSteps() { | ||
actualStepCount = 0; | ||
} | ||
|
||
private void compareSteps(Context context) { | ||
int phraseNumber = (int) (Math.random() * 4); | ||
Toast.makeText(context, positivePhrases[phraseNumber], Toast.LENGTH_SHORT).show(); | ||
if (actualStepCount >= 5) { | ||
isEasterEggCompleted = true; | ||
} | ||
} | ||
|
||
@Override | ||
public void onBackPressed() { | ||
super.onBackPressed(); | ||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out); | ||
} | ||
} |
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
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
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
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
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
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,18 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<android.support.constraint.ConstraintLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<VideoView | ||
android:id="@+id/easteregg_video" | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
</android.support.constraint.ConstraintLayout> |
Oops, something went wrong.