EvoEgg: Initial app import

* Referenced from :
https://github.com/AICP/packages_apps_Settings/blob/n7.1/src/com/android/settings/aicp/Nyandroid.java

All credits for Nyandroid.java go to the original authors.
Check the following commit for more details:
AICP/packages_apps_Settings@b16b149

Co-authored-by: oddlyspaced <oddlyspaced1@gmail.com>
Signed-off-by: AnierinB <anierin@evolution-x.org>
This commit is contained in:
LorDClockaN
2024-04-09 02:32:40 +00:00
committed by AnierinB
commit 5e3f85e9a5
29 changed files with 447 additions and 0 deletions

18
Android.bp Normal file
View File

@@ -0,0 +1,18 @@
//
// Copyright (C) 2019-2024 The Evolution X Project
// SPDX-License-Identifier: Apache-2.0
//
android_app {
name: "EvoEgg",
srcs: ["src/**/*.java"],
resource_dirs: ["res"],
certificate: "platform",
platform_apis: true,
system_ext_specific: true,
static_libs: [
"androidx.core_core",
"androidx.preference_preference",
],
}

37
AndroidManifest.xml Normal file
View File

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.evolution.easteregg"
android:sharedUserId="android.uid.system"
android:versionCode="1"
android:versionName="R">
<uses-sdk
android:minSdkVersion="28"
android:targetSdkVersion="29" />
<application
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_title"
android:theme="@style/AppTheme">
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
tools:replace="android:authorities"/>
<activity
android:name=".EasterEgg"
android:exported="true"
android:label="EvoEgg"
android:hardwareAccelerated="true"
android:launchMode="singleInstance"
android:excludeFromRecents="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>

31
res/drawable/evo.xml Normal file
View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2019-2021 The Evolution X Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="?android:attr/colorAccent"
android:fillType="evenOdd"
android:pathData="M15,24c-0.2,0 -0.5,-0.1 -0.6,-0.2L4.1,14.7c-0.3,-0.2 -0.4,-0.6 -0.3,-1l0.9,-3.4c0.1,-0.4 0.5,-0.7 0.9,-0.7h10.1c0.3,0 0.6,0.1 0.7,0.4l2.8,3.4c0.2,0.3 0.3,0.7 0.1,1c-0.2,0.3 -0.5,0.5 -0.9,0.5h-5.8l3.8,3.4c0.3,0.2 0.4,0.6 0.3,0.9l-0.9,4c-0.1,0.3 -0.3,0.6 -0.6,0.7C15.2,24 15.1,24 15,24zM5.8,13.7l8.6,7.6l0.4,-1.9l-5.3,-4.7c-0.3,-0.3 -0.4,-0.7 -0.3,-1.1c0.1,-0.4 0.5,-0.6 0.9,-0.6h6.4l-1.2,-1.5H6.4L5.8,13.7z" />
<path
android:fillColor="?android:attr/colorAccent"
android:fillType="evenOdd"
android:pathData="M17.6,7.4H8.9c-0.2,0 -0.5,-0.1 -0.7,-0.3L4.6,3.7C4.3,3.4 4.2,3 4.3,2.6C4.5,2.2 4.8,2 5.2,2h13.3c0.3,0 0.6,0.1 0.8,0.4c0.2,0.2 0.2,0.5 0.2,0.8l-0.9,3.4C18.4,7.1 18,7.4 17.6,7.4zM9.3,5.4h7.6l0.4,-1.5H7.6L9.3,5.4z" />
</vector>

10
res/drawable/evo_anim.xml Normal file
View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<animation-list android:oneshot="false"
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:duration="200" android:drawable="@drawable/star0" />
<item android:duration="200" android:drawable="@drawable/star1" />
<item android:duration="200" android:drawable="@drawable/star2" />
<item android:duration="200" android:drawable="@drawable/star3" />
<item android:duration="200" android:drawable="@drawable/star4" />
<item android:duration="200" android:drawable="@drawable/star5" />
</animation-list>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<animation-list android:oneshot="false"
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:duration="80" android:drawable="@drawable/evo" />
</animation-list>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2022 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:pathData="M0,0h108v108h-108z"
android:fillColor="#CAE1E2"/>
<path
android:pathData="M66,66m-8,0a8,8 0,1 1,16 0a8,8 0,1 1,-16 0"
android:fillColor="#85BABC"/>
<path
android:pathData="M42,66m-8,0a8,8 0,1 1,16 0a8,8 0,1 1,-16 0"
android:fillColor="#85BABC"/>
<path
android:pathData="M54,62m-8,0a8,8 0,1 1,16 0a8,8 0,1 1,-16 0"
android:fillColor="#167C80"/>
</vector>

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2022 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<group>
<clip-path
android:pathData="M0,0h108v108h-108z"/>
<path
android:pathData="M108,0H0V108H108V0ZM42,30C39.791,30 38,31.791 38,34V74C38,76.209 39.791,78 42,78H66C68.209,78 70,76.209 70,74V34C70,31.791 68.209,30 66,30H42Z"
android:fillColor="#2A3232"
android:fillType="evenOdd"/>
<path
android:pathData="M28.54,28.54m-72,0a72,72 0,1 1,144 0a72,72 0,1 1,-144 0"
android:fillAlpha="0.6">
<aapt:attr name="android:fillColor">
<gradient
android:gradientRadius="72"
android:centerX="28.54"
android:centerY="28.54"
android:type="radial">
<item android:offset="0" android:color="#19FFFFFF"/>
<item android:offset="1" android:color="#00FFFFFF"/>
</gradient>
</aapt:attr>
</path>
</group>
</vector>

View File

@@ -0,0 +1,10 @@
<!-- drawable/ic_settings_device.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="?android:attr/colorPrimary"
android:pathData="m9.7445,16.939l0,-1.5683l1.4785,0l0,-4.6992l-1.4785,0l0,-1.6006l2.9584,0l0,6.2704l1.5076,0l0,1.5683l-4.466,0l0,0.0294zM19.3734,20.8437l0,-10.206l-1.4785,0l0,8.6376l-11.8349,0l0,-12.5423l8.1504,0l0,-1.5669l-9.6303,0l0,15.6775l14.7932,0zM19.3734,9.0709l0,-2.3672l2.2337,0l0,-1.5375l-2.2337,0l0,-2.3672l-1.4785,0l0,2.3672l-2.2295,0l0,1.5669l2.2295,0l0,2.3672l1.4785,0l0,-0.0294z" />
</vector>

BIN
res/drawable/star0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 B

BIN
res/drawable/star1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

BIN
res/drawable/star2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 B

BIN
res/drawable/star3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

BIN
res/drawable/star4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 B

BIN
res/drawable/star5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<animation-list android:oneshot="false"
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:duration="200" android:drawable="@drawable/star0" />
<item android:duration="200" android:drawable="@drawable/star1" />
<item android:duration="200" android:drawable="@drawable/star2" />
<item android:duration="200" android:drawable="@drawable/star3" />
<item android:duration="200" android:drawable="@drawable/star4" />
<item android:duration="200" android:drawable="@drawable/star5" />
</animation-list>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@mipmap/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

21
res/values/strings.xml Normal file
View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2014-2016 The OmniROM Project
Copyright (C) 2021 The Evolution X Project
Copyright (C) 2018 The Xiaomi-SDM660 Project
Copyright (C) 2018-2021 crDroid Android Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources>
<string name="app_title">Evo Egg</string>
<string name="app_summary">Haha</string>
</resources>

21
res/values/styles.xml Normal file
View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015-2016 The CyanogenMod Project
Copyright (C) 2017 The LineageOS Project
Copyright (c) 2021 The Evolution X project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources>
<style name="AppTheme" parent="@android:style/Theme.DeviceDefault.Settings">
<item name="android:navigationBarColor">?android:colorPrimary</item>
</style>
</resources>

View File

@@ -0,0 +1,222 @@
/*
* Copyright (C) 2019-2021 The Evolution X Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Referenced from https://github.com/AICP/packages_apps_Settings/blob/n7.1/src/com/android/settings/aicp/Nyandroid.java
package org.evolution.easteregg;
import android.animation.AnimatorSet;
import android.animation.PropertyValuesHolder;
import android.animation.ObjectAnimator;
import android.animation.TimeAnimator;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.AnimationDrawable;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.RectF;
import android.os.Handler;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Pair;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.ImageView;
import java.util.HashMap;
import java.util.Random;
import org.evolution.easteregg.R;
public class EasterEgg extends Activity {
final static boolean DEBUG = false;
public static class Board extends FrameLayout {
public static final boolean FIXED_STARS = true;
public static final int NUM_CATS = 20;
static Random sRNG = new Random();
static float lerp(float a, float b, float f) {
return (b - a) * f + a;
}
static float randfrange(float a, float b) {
return lerp(a, b, sRNG.nextFloat());
}
public class FlyingCat extends ImageView {
public static final float VMAX = 1000.0f;
public static final float VMIN = 100.0f;
public float v;
public float dist;
public float z;
public FlyingCat(Context context, AttributeSet as) {
super(context, as);
setImageResource(R.drawable.evoandroid_anim); // @@@
if (DEBUG) setBackgroundColor(0x80FF0000);
}
public void reset() {
final float scale = lerp(0.1f, 2f, z);
setScaleX(scale);
setScaleY(scale);
setX(-scale * getWidth() + 1);
setY(randfrange(0, Board.this.getHeight() - scale * getHeight()));
v = lerp(VMIN, VMAX, z);
dist = 0;
}
public void update(float dt) {
dist += v * dt;
setX(getX() + v * dt);
}
}
TimeAnimator mAnim;
public Board(Context context, AttributeSet as) {
super(context, as);
setLayerType(View.LAYER_TYPE_HARDWARE, null);
setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
// setBackgroundColor(0xFFFFFFF);
}
private void reset() {
removeAllViews();
final ViewGroup.LayoutParams wrap = new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
if (FIXED_STARS) {
for (int i = 0; i < 20; i++) {
ImageView fixedStar = new ImageView(getContext(), null);
if (DEBUG) fixedStar.setBackgroundColor(0x8000FF80);
fixedStar.setImageResource(R.drawable.star_anim); // @@@
fixedStar.setColorFilter(Color.parseColor("#005eff"));
fixedStar.setAlpha(0.5F);
addView(fixedStar, wrap);
final float scale = randfrange(0.1f, 1f);
fixedStar.setScaleX(scale);
fixedStar.setScaleY(scale);
fixedStar.setX(randfrange(0, getWidth()));
fixedStar.setY(randfrange(0, getHeight()));
final AnimationDrawable anim = (AnimationDrawable) fixedStar.getDrawable();
postDelayed(anim::start, (int) randfrange(0, 1000));
}
}
for (int i = 0; i < NUM_CATS; i++) {
FlyingCat nv = new FlyingCat(getContext(), null);
addView(nv, wrap);
nv.z = ((float) i / NUM_CATS);
nv.z *= nv.z;
nv.reset();
nv.setX(randfrange(0, Board.this.getWidth()));
final AnimationDrawable anim = (AnimationDrawable) nv.getDrawable();
postDelayed(anim::start, (int) randfrange(0, 1000));
}
if (mAnim != null) {
mAnim.cancel();
}
mAnim = new TimeAnimator();
mAnim.setTimeListener((animation, totalTime, deltaTime) -> {
for (int i = 0; i < getChildCount(); i++) {
View v = getChildAt(i);
if (!(v instanceof FlyingCat)) continue;
FlyingCat nv = (FlyingCat) v;
nv.update(deltaTime / 1000f);
final float catWidth = nv.getWidth() * nv.getScaleX();
final float catHeight = nv.getHeight() * nv.getScaleY();
if (nv.getX() + catWidth < -2
|| nv.getX() > getWidth() + 2
|| nv.getY() + catHeight < -2
|| nv.getY() > getHeight() + 2) {
nv.reset();
}
}
});
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
post(() -> {
reset();
mAnim.start();
});
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
mAnim.cancel();
}
@Override
public boolean isOpaque() {
return true;
}
}
@Override
public void onStart() {
super.onStart();
try {
getActionBar().hide();
}
catch (Exception e) {}
getWindow().addFlags(WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
}
@Override
public void onResume() {
super.onResume();
Board mBoard = new Board(this, null);
setContentView(mBoard);
mBoard.setOnSystemUiVisibilityChangeListener(vis -> {
if (0 == (vis & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION)) {
// EasterEgg.this.finish();
}
});
}
@Override
public void onUserInteraction() {
// finish();
}
}