Debloat any Android or Google TV over Wi-Fi and get an Apple TV-style home.
Python adbadblockandroid-tvandroid-tv-launcherapple-tvbloatware-removalclaude-codedebloatfire-tvgoogle-tvlauncherprivacysmart-tvsony-braviatclvibe-codingxiaomi
addons/haunted: Halloween screensaver with the theme's night photos, bats, a ghost, a jack-o'-lantern glow and a clock
Gathin233b401f46352f
diff --git a/addons/README.md b/addons/README.mdindex a8d2f1260..58243b73c 100644--- a/addons/README.md+++ b/addons/README.md@@ -38,6 +38,7 @@ the core bigger or change how it behaves. You install an add-on only if you want| [Bluetooth Toggle](bluetooth-toggle/) | For Android 12 and older (13 and newer do not let apps switch Bluetooth). A one-press Bluetooth switch: the tile turns Bluetooth off or on, a small panel says which, and Pair accessory is one press away | [@justin-newman](https://github.com/justin-newman) | Hisense 75U75N (hengshan), Google TV 12 | Bluetooth (`BLUETOOTH_CONNECT`) | <img src="bluetooth-toggle/screenshot.jpg" width="240" alt="Bluetooth Toggle on a TV"> || [TV Inspector](tv-inspector/) | What the remote sends (key name, key code, scan code, device) and what the TV can play: display modes, HDR, video decoders, audio outputs and formats, input devices; every line also in logcat for a `tv.json` or a bug report | [@shaharukhs](https://github.com/shaharukhs) | Sansui TV (Skyworth eleonas, MediaTek MT9676), Android TV 14 | None | <img src="tv-inspector/screenshot.jpg" width="240" alt="TV Inspector on a TV"> || [Game Day](game-day/) | Each team's next game on Home, counted down ("Puck drop in 2h 18m", then "Live now"), from calendar links you add: any team, any sport, no scores; one turn per team, rotating, with the theme's F1 weekend | [@justin-newman](https://github.com/justin-newman) | Hisense 75U75N (hengshan), Google TV 12 | `INTERNET` (your calendar links only) | <img src="game-day/screenshot.jpg" width="240" alt="Game Day on a TV"> |+| [Haunted](haunted/) | A Halloween screensaver (and a card that starts it): the theme's night photos crossfading, bats drifting across, a ghost floating up, a flickering jack-o'-lantern glow and a small clock, drawn on the TV with no network | CleanYourTV contributors | Not yet tested on a real TV | None | <img src="haunted/screenshot.jpg" width="240" alt="Haunted on a TV"> |A widget, an info tile, a storage or smart-home card: if it can live as its own small app, it can livehere. See the rules below.diff --git a/addons/haunted/.gitignore b/addons/haunted/.gitignorenew file mode 100644index 000000000..a7e04a21b--- /dev/null+++ b/addons/haunted/.gitignore@@ -0,0 +1,4 @@+.gradle/+build/+app/build/+local.propertiesdiff --git a/addons/haunted/README.md b/addons/haunted/README.mdnew file mode 100644index 000000000..262e6c4a9--- /dev/null+++ b/addons/haunted/README.md@@ -0,0 +1,82 @@+# Haunted++A Halloween screensaver for the TV: the night photos of the Halloween theme, slowly crossfading (14 s each), with a+few bats drifting across now and then, a ghost that fades in and floats up every half minute or so, a jack-o'-lantern+glow flickering in the bottom-right corner and a small clock. The photos are in the app (seven, 1280x720, about+1 MB together) and everything is drawn on one Canvas at about 20 frames a second, so it is light enough for a 1 GB TV.++On cleanyourtv's Home it is also a module card, **Haunted**: press OK on it to start it at once, and Back to leave.++- Package: `com.gathin.haunted`+- Author: CleanYourTV contributors+- Tested on: not yet on a real TV++## Permissions++None. No network access (no `INTERNET` permission): nothing leaves the TV. No background service: it runs only+while the screensaver or the card's screen is showing.++## Build and install++JDK 17 and Android SDK 34, as for the launcher. From the repo root, build, install and make it the screensaver+in one go:++```bash+TV_HOST=<tv ip> addons/haunted/build-and-install.sh+```++On Windows: `addons\haunted\build-and-install.ps1 -TvHost <tv ip>`. Add `START=1` (or `-Start`) to see it now. The+script keeps the screensaver the TV had before, in `/data/local/tmp/cyt-haunted-before`.++Or by hand, as for any add-on:++```bash+cd addons/haunted && ./gradlew assembleRelease && cd ../..+TV_HOST=<tv ip> tools/venv/bin/python -I tools/tv.py --push addons/haunted/app/build/outputs/apk/release/app-release.apk /data/local/tmp/addon.apk+TV_HOST=<tv ip> tools/venv/bin/python -I tools/tv.py 'pm install -r /data/local/tmp/addon.apk; rm -f /data/local/tmp/addon.apk'+```++then Settings > Device Preferences > Screen saver > **Haunted** (the menu's name depends on the TV).++## Undo++```bash+TV_HOST=<tv ip> addons/haunted/build-and-install.sh --uninstall+```++puts the previous screensaver back and removes the app. Without the script: pick another screensaver in Settings, then+`TV_HOST=<tv ip> tools/venv/bin/python -I tools/tv.py 'pm uninstall com.gathin.haunted'`.++## Change the look++The constants at the top of `HauntedView.java`: `PHOTO_MS` and `FADE_MS` for how long a photo stays and how slowly it+crossfades, `FRAME_MS` for the frame rate, and the numbers in `drawBats` and `drawGhost` for how often they appear+(`nextBat`, `nextGhost`).++## Photo credits++The photos are the Halloween theme's wallpapers (`themes/halloween/`), cropped, colour-graded toward night and+darkened toward the edges (see the theme's [CREDITS.md](../../themes/halloween/CREDITS.md)), here scaled to 1280x720.+Each keeps its own licence, not the repository's MIT licence, and its name, author and licence show at the bottom left+while it is on screen. Adaptations of the CC BY-SA pictures stay under CC BY-SA.++- "Jack-O-Lantern at night.jpg" by Alabama Extension, CC0 1.0+ https://commons.wikimedia.org/wiki/File:Jack-O-Lantern_at_night.jpg+- "Lit by the Moon SQF A1 -1619-Edit (52321356482).jpg" by the USDA Forest Service, Pacific Southwest Region, public+ domain (a work of the US federal government)+ https://commons.wikimedia.org/wiki/File:Lit_by_the_Moon_SQF_A1_-1619-Edit_(52321356482).jpg+- "Chorzów St Hedwig cemetery chapel in fog 2021.jpg" by Adrian Tync, CC BY-SA 4.0+ https://commons.wikimedia.org/wiki/File:Chorz%C3%B3w_St_Hedwig_cemetery_chapel_in_fog_2021.jpg+- "Jack-o-lantern 2.jpg" by Douglaspperkins, CC BY 4.0+ https://commons.wikimedia.org/wiki/File:Jack-o-lantern_2.jpg+- "Horizonte lunar.jpg" by Halleyuncometafotografo, CC BY-SA 4.0+ https://commons.wikimedia.org/wiki/File:Horizonte_lunar.jpg+- "Great Cemetery in the fog 03.jpg" by Андрей Романенко (Andrey Romanenko), CC BY-SA 4.0+ https://commons.wikimedia.org/wiki/File:Great_Cemetery_in_the_fog_03.jpg+- "Full moon over Gullmarn fjord at Holma Marina 2.jpg" by W.carter, CC BY-SA 4.0+ https://commons.wikimedia.org/wiki/File:Full_moon_over_Gullmarn_fjord_at_Holma_Marina_2.jpg++Licences: CC0 1.0 https://creativecommons.org/publicdomain/zero/1.0/ · CC BY 4.0+https://creativecommons.org/licenses/by/4.0/ · CC BY-SA 4.0 https://creativecommons.org/licenses/by-sa/4.0/++The bats, the ghost, the icon and the banner are drawn for this add-on.diff --git a/addons/haunted/app/build.gradle b/addons/haunted/app/build.gradlenew file mode 100644index 000000000..290e4adc8--- /dev/null+++ b/addons/haunted/app/build.gradle@@ -0,0 +1,31 @@+plugins {+ id 'com.android.application'+}++android {+ namespace 'com.gathin.haunted'+ compileSdk 34++ defaultConfig {+ applicationId 'com.gathin.haunted'+ minSdk 26+ targetSdk 34+ versionCode 1+ versionName '1.0'+ }++ buildTypes {+ release {+ minifyEnabled true+ shrinkResources true+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt')+ // Sideloaded over ADB like the launcher: signed with the debug key.+ signingConfig signingConfigs.debug+ }+ }++ compileOptions {+ sourceCompatibility JavaVersion.VERSION_17+ targetCompatibility JavaVersion.VERSION_17+ }+}diff --git a/addons/haunted/app/src/main/AndroidManifest.xml b/addons/haunted/app/src/main/AndroidManifest.xmlnew file mode 100644index 000000000..9e350805d--- /dev/null+++ b/addons/haunted/app/src/main/AndroidManifest.xml@@ -0,0 +1,43 @@+<?xml version="1.0" encoding="utf-8"?>+<!-- No permissions: everything is drawn on the box, nothing goes over the network. -->+<manifest xmlns:android="http://schemas.android.com/apk/res/android">++ <uses-feature android:name="android.software.leanback" android:required="false" />+ <uses-feature android:name="android.hardware.touchscreen" android:required="false" />++ <application+ android:allowBackup="false"+ android:banner="@drawable/banner"+ android:icon="@drawable/icon"+ android:label="@string/app_name"+ android:supportsRtl="false">++ <!-- The tile, and the card on cleanyourtv's Home (docs/modules.md): the screensaver, at once, until Back. -->+ <activity+ android:name=".HauntedActivity"+ android:exported="true"+ android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen">+ <intent-filter>+ <action android:name="android.intent.action.MAIN" />+ <category android:name="android.intent.category.LEANBACK_LAUNCHER" />+ </intent-filter>+ <intent-filter>+ <action android:name="android.intent.action.MAIN" />+ <category android:name="com.gathin.tvhome.category.DOCK_CARD" />+ </intent-filter>+ <meta-data android:name="com.gathin.tvhome.card" android:resource="@xml/module_card" />+ </activity>++ <!-- The screensaver: Settings > Device Preferences > Screen saver > Haunted. -->+ <service+ android:name=".HauntedDream"+ android:exported="true"+ android:label="@string/app_name"+ android:permission="android.permission.BIND_DREAM_SERVICE">+ <intent-filter>+ <action android:name="android.service.dreams.DreamService" />+ <category android:name="android.intent.category.DEFAULT" />+ </intent-filter>+ </service>+ </application>+</manifest>diff --git a/addons/haunted/app/src/main/assets/photos/001.jpg b/addons/haunted/app/src/main/assets/photos/001.jpgnew file mode 100644index 000000000..bfa666c95Binary files /dev/null and b/addons/haunted/app/src/main/assets/photos/001.jpg differdiff --git a/addons/haunted/app/src/main/assets/photos/002.jpg b/addons/haunted/app/src/main/assets/photos/002.jpgnew file mode 100644index 000000000..24a049e63Binary files /dev/null and b/addons/haunted/app/src/main/assets/photos/002.jpg differdiff --git a/addons/haunted/app/src/main/assets/photos/003.jpg b/addons/haunted/app/src/main/assets/photos/003.jpgnew file mode 100644index 000000000..deedb0f66Binary files /dev/null and b/addons/haunted/app/src/main/assets/photos/003.jpg differdiff --git a/addons/haunted/app/src/main/assets/photos/004.jpg b/addons/haunted/app/src/main/assets/photos/004.jpgnew file mode 100644index 000000000..1dc6d2b53Binary files /dev/null and b/addons/haunted/app/src/main/assets/photos/004.jpg differdiff --git a/addons/haunted/app/src/main/assets/photos/005.jpg b/addons/haunted/app/src/main/assets/photos/005.jpgnew file mode 100644index 000000000..31d1b6ff4Binary files /dev/null and b/addons/haunted/app/src/main/assets/photos/005.jpg differdiff --git a/addons/haunted/app/src/main/assets/photos/006.jpg b/addons/haunted/app/src/main/assets/photos/006.jpgnew file mode 100644index 000000000..7936b3ca0Binary files /dev/null and b/addons/haunted/app/src/main/assets/photos/006.jpg differdiff --git a/addons/haunted/app/src/main/assets/photos/007.jpg b/addons/haunted/app/src/main/assets/photos/007.jpgnew file mode 100644index 000000000..78b88fa4dBinary files /dev/null and b/addons/haunted/app/src/main/assets/photos/007.jpg differdiff --git a/addons/haunted/app/src/main/assets/photos/captions.txt b/addons/haunted/app/src/main/assets/photos/captions.txtnew file mode 100644index 000000000..d3e8915e2--- /dev/null+++ b/addons/haunted/app/src/main/assets/photos/captions.txt@@ -0,0 +1,7 @@+001.jpg Jack-o'-lantern on the steps · Alabama Extension, CC0+002.jpg Full moon behind a sequoia grove, California · US Forest Service, public domain+003.jpg Cemetery chapel in the fog, Chorzów, Poland · Adrian Tync, CC BY-SA 4.0+004.jpg A jack-o'-lantern by candlelight · Douglaspperkins, CC BY 4.0+005.jpg The moon rising behind the trees · Halleyuncometafotografo, CC BY-SA 4.0+006.jpg Old cemetery in the fog · Андрей Романенко, CC BY-SA 4.0+007.jpg Full moon over the Gullmarn fjord, Sweden · W.carter, CC BY-SA 4.0diff --git a/addons/haunted/app/src/main/java/com/gathin/haunted/HauntedActivity.java b/addons/haunted/app/src/main/java/com/gathin/haunted/HauntedActivity.javanew file mode 100644index 000000000..c288ced93--- /dev/null+++ b/addons/haunted/app/src/main/java/com/gathin/haunted/HauntedActivity.java@@ -0,0 +1,31 @@+package com.gathin.haunted;++import android.app.Activity;+import android.os.Bundle;+import android.view.WindowManager;++/** The tile and the card: the same screen as the screensaver, at once, until Back. */+public class HauntedActivity extends Activity {++ private HauntedView view;++ @Override+ protected void onCreate(Bundle state) {+ super.onCreate(state);+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);+ view = new HauntedView(this);+ setContentView(view);+ }++ @Override+ protected void onResume() {+ super.onResume();+ view.start();+ }++ @Override+ protected void onPause() {+ view.stop();+ super.onPause();+ }+}diff --git a/addons/haunted/app/src/main/java/com/gathin/haunted/HauntedDream.java b/addons/haunted/app/src/main/java/com/gathin/haunted/HauntedDream.javanew file mode 100644index 000000000..9888763fd--- /dev/null+++ b/addons/haunted/app/src/main/java/com/gathin/haunted/HauntedDream.java@@ -0,0 +1,31 @@+package com.gathin.haunted;++import android.service.dreams.DreamService;++/** The screensaver: night photos, bats, a ghost and a clock until any key wakes the box. */+public class HauntedDream extends DreamService {++ private HauntedView view;++ @Override+ public void onAttachedToWindow() {+ super.onAttachedToWindow();+ setInteractive(false);+ setFullscreen(true);+ setScreenBright(false);+ view = new HauntedView(this);+ setContentView(view);+ }++ @Override+ public void onDreamingStarted() {+ super.onDreamingStarted();+ view.start();+ }++ @Override+ public void onDreamingStopped() {+ view.stop();+ super.onDreamingStopped();+ }+}diff --git a/addons/haunted/app/src/main/java/com/gathin/haunted/HauntedView.java b/addons/haunted/app/src/main/java/com/gathin/haunted/HauntedView.javanew file mode 100644index 000000000..be943357a--- /dev/null+++ b/addons/haunted/app/src/main/java/com/gathin/haunted/HauntedView.java@@ -0,0 +1,284 @@+package com.gathin.haunted;++import android.content.Context;+import android.graphics.Bitmap;+import android.graphics.BitmapFactory;+import android.graphics.Canvas;+import android.graphics.Color;+import android.graphics.Paint;+import android.graphics.Path;+import android.graphics.RadialGradient;+import android.graphics.Rect;+import android.graphics.RectF;+import android.graphics.Shader;+import android.graphics.Typeface;+import android.text.format.DateFormat;+import android.view.View;++import java.io.BufferedReader;+import java.io.InputStream;+import java.io.InputStreamReader;+import java.util.ArrayList;+import java.util.Date;+import java.util.List;+import java.util.Random;++/**+ * Night photos crossfading slowly, a few bats now and then, a ghost that floats up now and then, a flickering+ * jack-o'-lantern glow in the bottom-right corner and a small clock. One Canvas, no libraries, about 20 frames+ * a second, and only two photos in memory at a time.+ */+public class HauntedView extends View {++ private static final long FRAME_MS = 50;+ private static final long PHOTO_MS = 14_000;+ private static final long FADE_MS = 3_500;+ private static final int ORANGE = 0xFFFF7A1A;++ private final Random rng = new Random();+ private final List<String> files = new ArrayList<>();+ private final List<String> credits = new ArrayList<>();+ private final Paint photoPaint = new Paint(Paint.FILTER_BITMAP_FLAG);+ private final Paint fill = new Paint(Paint.ANTI_ALIAS_FLAG);+ private final Paint text = new Paint(Paint.ANTI_ALIAS_FLAG);+ private final Path path = new Path();+ private final Rect src = new Rect();+ private final RectF dst = new RectF();+ private final float dp;++ private Bitmap current, next;+ private int index = -1;+ private long photoSince, fadeStart;++ private Bat[] bats = new Bat[3];+ private long nextBat;+ private float ghostX, ghostY, ghostSize, ghostAge = -1;+ private long nextGhost;+ private long clockMinute = -1;+ private String clockText = "";+ private java.text.DateFormat clockFormat;+ private RadialGradient glowShader;+ private float glowR;++ private boolean running;+ private long lastFrame, t0;++ private final Runnable tick = new Runnable() {+ @Override public void run() {+ if (!running) return;+ invalidate();+ postDelayed(this, FRAME_MS);+ }+ };++ private static final class Bat { float x, y, v, size, bob, phase; boolean on; }++ public HauntedView(Context c) {+ super(c);+ dp = c.getResources().getDisplayMetrics().density;+ setBackgroundColor(0xFF07050B);+ text.setTypeface(Typeface.create("sans-serif-light", Typeface.NORMAL));+ text.setShadowLayer(4 * dp, 0, 0, 0xFF000000);+ clockFormat = DateFormat.getTimeFormat(c);+ try {+ String[] names = c.getAssets().list("photos");+ if (names != null) for (String n : names) if (n.endsWith(".jpg")) files.add(n);+ java.util.Collections.sort(files);+ try (BufferedReader r = new BufferedReader(new InputStreamReader(c.getAssets().open("photos/captions.txt"), "UTF-8"))) {+ for (String line; (line = r.readLine()) != null; ) credits.add(line);+ }+ } catch (Exception ignored) {+ // No photos or captions: the screen stays night-black with the bats and the ghost.+ }+ for (int i = 0; i < bats.length; i++) bats[i] = new Bat();+ }++ public void start() {+ if (running) return;+ running = true;+ t0 = System.currentTimeMillis();+ nextBat = t0 + 4_000;+ nextGhost = t0 + 12_000;+ if (current == null) { index = rng.nextInt(Math.max(1, files.size())) - 1; current = load(1); photoSince = t0; }+ post(tick);+ }++ public void stop() {+ running = false;+ removeCallbacks(tick);+ current = null;+ next = null;+ }++ /** Photo number index + step, decoded as is (1280x720). */+ private Bitmap load(int step) {+ if (files.isEmpty()) return null;+ index = (index + step) % files.size();+ try (InputStream in = getContext().getAssets().open("photos/" + files.get(index))) {+ return BitmapFactory.decodeStream(in);+ } catch (Exception e) {+ return null;+ }+ }++ @Override+ protected void onSizeChanged(int w, int h, int ow, int oh) {+ glowR = Math.min(w, h) * 0.55f;+ glowShader = new RadialGradient(0, 0, glowR, new int[]{0xAAFF8A20, 0x44FF5A10, 0x00FF5A10},+ new float[]{0f, 0.45f, 1f}, Shader.TileMode.CLAMP);+ ghostAge = -1;+ }++ @Override+ protected void onDraw(Canvas canvas) {+ long now = System.currentTimeMillis();+ float dt = lastFrame == 0 ? 0.05f : Math.min(0.2f, (now - lastFrame) / 1000f);+ lastFrame = now;+ int w = getWidth(), h = getHeight();++ drawPhotos(canvas, now, w, h);+ drawGlow(canvas, now, w, h);+ drawGhost(canvas, now, dt, w, h);+ drawBats(canvas, now, dt, w, h);+ drawClockAndCredit(canvas, now, w, h);+ }++ private void drawPhotos(Canvas c, long now, int w, int h) {+ if (next == null && current != null && files.size() > 1 && now - photoSince > PHOTO_MS) {+ next = load(1);+ fadeStart = now;+ }+ if (next != null) {+ float f = Math.min(1f, (now - fadeStart) / (float) FADE_MS);+ photoPaint.setAlpha(255);+ blit(c, current, w, h);+ photoPaint.setAlpha((int) (255 * f));+ blit(c, next, w, h);+ if (f >= 1f) { current = next; next = null; photoSince = now; }+ } else {+ photoPaint.setAlpha(255);+ blit(c, current, w, h);+ }+ }++ private void blit(Canvas c, Bitmap b, int w, int h) {+ if (b == null) return;+ src.set(0, 0, b.getWidth(), b.getHeight());+ dst.set(0, 0, w, h);+ c.drawBitmap(b, src, dst, photoPaint);+ }++ /** A jack-o'-lantern flicker: a few sines at odd rates plus a little noise, in the bottom-right corner. */+ private void drawGlow(Canvas c, long now, int w, int h) {+ double t = (now - t0) / 1000.0;+ float k = (float) (0.72 + 0.12 * Math.sin(t * 7.3) + 0.08 * Math.sin(t * 13.1 + 1) + 0.04 * Math.sin(t * 2.1))+ + (rng.nextFloat() - 0.5f) * 0.06f;+ fill.setShader(glowShader);+ fill.setAlpha((int) (255 * Math.max(0.3f, Math.min(1f, k))));+ c.save();+ c.translate(w, h);+ c.drawCircle(0, 0, glowR, fill);+ c.restore();+ fill.setShader(null);+ fill.setAlpha(255);+ }++ private void drawGhost(Canvas c, long now, float dt, int w, int h) {+ if (ghostAge < 0) {+ if (now < nextGhost) return;+ ghostSize = h * 0.16f;+ ghostX = w * (0.15f + 0.5f * rng.nextFloat());+ ghostY = h * 0.85f;+ ghostAge = 0;+ }+ ghostAge += dt;+ float life = 9f;+ if (ghostAge > life) {+ ghostAge = -1;+ nextGhost = now + 25_000 + rng.nextInt(25_000);+ return;+ }+ float p = ghostAge / life;+ float a = (float) Math.sin(Math.PI * p);+ float x = ghostX + (float) Math.sin(ghostAge * 1.3) * ghostSize * 0.5f;+ float y = ghostY - p * h * 0.55f;+ float s = ghostSize;+ path.reset();+ path.moveTo(x - s * 0.5f, y + s * 0.5f);+ path.lineTo(x - s * 0.5f, y - s * 0.1f);+ path.cubicTo(x - s * 0.5f, y - s * 0.75f, x + s * 0.5f, y - s * 0.75f, x + s * 0.5f, y - s * 0.1f);+ path.lineTo(x + s * 0.5f, y + s * 0.5f);+ for (int i = 0; i < 4; i++) {+ float x1 = x + s * 0.5f - s * (i + 0.5f) / 4f, x2 = x + s * 0.5f - s * (i + 1f) / 4f;+ path.quadTo(x1, y + s * (i % 2 == 0 ? 0.3f : 0.7f), x2, y + s * 0.5f);+ }+ path.close();+ fill.setColor(Color.argb((int) (150 * a), 237, 231, 246));+ c.drawPath(path, fill);+ fill.setColor(Color.argb((int) (220 * a), 7, 5, 11));+ c.drawOval(x - s * 0.28f, y - s * 0.22f, x - s * 0.1f, y + s * 0.06f, fill);+ c.drawOval(x + s * 0.1f, y - s * 0.22f, x + s * 0.28f, y + s * 0.06f, fill);+ c.drawOval(x - s * 0.08f, y + s * 0.14f, x + s * 0.08f, y + s * 0.3f, fill);+ }++ private void drawBats(Canvas c, long now, float dt, int w, int h) {+ if (now >= nextBat) {+ for (Bat b : bats) {+ if (b.on) continue;+ boolean ltr = rng.nextBoolean();+ b.size = (22 + rng.nextInt(26)) * dp;+ b.v = (ltr ? 1 : -1) * w * (0.08f + 0.06f * rng.nextFloat());+ b.x = ltr ? -b.size : w + b.size;+ b.y = h * (0.1f + 0.45f * rng.nextFloat());+ b.bob = h * 0.03f * (0.5f + rng.nextFloat());+ b.phase = rng.nextFloat() * 6.28f;+ b.on = true;+ break;+ }+ nextBat = now + 5_000 + rng.nextInt(12_000);+ }+ fill.setColor(0xF0100A16);+ for (Bat b : bats) {+ if (!b.on) continue;+ b.x += b.v * dt;+ if (b.x < -2 * b.size || b.x > w + 2 * b.size) { b.on = false; continue; }+ float t = now / 1000f;+ float y = b.y + (float) Math.sin(t * 1.7 + b.phase) * b.bob;+ float flap = (float) Math.sin(t * 11 + b.phase);+ float s = b.size;+ float tip = -s * 0.3f * flap;+ path.reset();+ path.moveTo(b.x, y - s * 0.12f);+ path.quadTo(b.x - s * 0.5f, y - s * 0.55f + tip, b.x - s, y - s * 0.1f + tip * 1.4f);+ path.quadTo(b.x - s * 0.7f, y + s * 0.05f, b.x - s * 0.5f, y + s * 0.02f);+ path.quadTo(b.x - s * 0.3f, y + s * 0.2f, b.x, y + s * 0.2f);+ path.quadTo(b.x + s * 0.3f, y + s * 0.2f, b.x + s * 0.5f, y + s * 0.02f);+ path.quadTo(b.x + s * 0.7f, y + s * 0.05f, b.x + s, y - s * 0.1f + tip * 1.4f);+ path.quadTo(b.x + s * 0.5f, y - s * 0.55f + tip, b.x, y - s * 0.12f);+ path.close();+ c.drawPath(path, fill);+ c.drawCircle(b.x, y, s * 0.12f, fill);+ }+ }++ private void drawClockAndCredit(Canvas c, long now, int w, int h) {+ long minute = now / 60_000;+ if (minute != clockMinute) {+ clockMinute = minute;+ clockText = clockFormat.format(new Date(now));+ }+ text.setColor(0xCCFFFFFF);+ text.setTextAlign(Paint.Align.RIGHT);+ text.setTextSize(30 * dp);+ c.drawText(clockText, w - 36 * dp, 56 * dp, text);+ if (index >= 0 && index < credits.size()) {+ String line = credits.get(index);+ int tab = line.indexOf('\t');+ if (tab >= 0) line = line.substring(tab + 1);+ text.setColor(0x99FFFFFF);+ text.setTextAlign(Paint.Align.LEFT);+ text.setTextSize(13 * dp);+ c.drawText(line, 36 * dp, h - 30 * dp, text);+ }+ }+}diff --git a/addons/haunted/app/src/main/res/drawable/banner.xml b/addons/haunted/app/src/main/res/drawable/banner.xmlnew file mode 100644index 000000000..20c65294b--- /dev/null+++ b/addons/haunted/app/src/main/res/drawable/banner.xml@@ -0,0 +1,10 @@+<?xml version="1.0" encoding="utf-8"?>+<!-- The TV banner: a ghost under an orange moon on night. Drawn for this add-on. -->+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="320dp" android:height="180dp"+ android:viewportWidth="320" android:viewportHeight="180">+ <path android:fillColor="#FF07050B" android:pathData="M0,0h320v180h-320z" />+ <path android:fillColor="#FFFF7A1A" android:pathData="M250,50a22,22 0 1,0 0.1,0z" />+ <path android:fillColor="#FFEDE7F6" android:pathData="M130,150L130,86a30,30 0 0,1 60,0L190,150L180,140L170,150L160,140L150,150L140,140z" />+ <path android:fillColor="#FF07050B" android:pathData="M143,84a5,6 0 1,0 10,0a5,6 0 1,0 -10,0zM167,84a5,6 0 1,0 10,0a5,6 0 1,0 -10,0z" />+</vector>diff --git a/addons/haunted/app/src/main/res/drawable/icon.xml b/addons/haunted/app/src/main/res/drawable/icon.xmlnew file mode 100644index 000000000..f0f4ad9d5--- /dev/null+++ b/addons/haunted/app/src/main/res/drawable/icon.xml@@ -0,0 +1,10 @@+<?xml version="1.0" encoding="utf-8"?>+<!-- The app icon: the banner's ghost on night, square. -->+<vector xmlns:android="http://schemas.android.com/apk/res/android"+ android:width="48dp" android:height="48dp"+ android:viewportWidth="108" android:viewportHeight="108">+ <path android:fillColor="#FF07050B" android:pathData="M0,0h108v108h-108z" />+ <path android:fillColor="#FFFF7A1A" android:pathData="M54,16a8,8 0 1,0 0.1,0z" />+ <path android:fillColor="#FFEDE7F6" android:pathData="M30,84L30,50a24,24 0 0,1 48,0L78,84L70,76L62,84L54,76L46,84L38,76z" />+ <path android:fillColor="#FF07050B" android:pathData="M42,48a4,5 0 1,0 8,0a4,5 0 1,0 -8,0zM58,48a4,5 0 1,0 8,0a4,5 0 1,0 -8,0z" />+</vector>diff --git a/addons/haunted/app/src/main/res/values/strings.xml b/addons/haunted/app/src/main/res/values/strings.xmlnew file mode 100644index 000000000..74cea5dd4--- /dev/null+++ b/addons/haunted/app/src/main/res/values/strings.xml@@ -0,0 +1,4 @@+<?xml version="1.0" encoding="utf-8"?>+<resources>+ <string name="app_name">Haunted</string>+</resources>diff --git a/addons/haunted/app/src/main/res/xml/module_card.xml b/addons/haunted/app/src/main/res/xml/module_card.xmlnew file mode 100644index 000000000..638677692--- /dev/null+++ b/addons/haunted/app/src/main/res/xml/module_card.xml@@ -0,0 +1,2 @@+<?xml version="1.0" encoding="utf-8"?>+<card spec="1" label="Haunted" caption="Halloween screensaver" accent="#FF7A1A" />diff --git a/addons/haunted/build-and-install.ps1 b/addons/haunted/build-and-install.ps1new file mode 100644index 000000000..9b7e61d5e--- /dev/null+++ b/addons/haunted/build-and-install.ps1@@ -0,0 +1,40 @@+# Windows version of build-and-install.sh: build Haunted, install it on the TV and make it the screensaver.+#+# Usage: addons\haunted\build-and-install.ps1 -TvHost 192.168.1.50+# addons\haunted\build-and-install.ps1 -TvHost 192.168.1.50 -Start+# addons\haunted\build-and-install.ps1 -TvHost 192.168.1.50 -Uninstall+param(+ [string]$TvHost = $env:TV_HOST,+ [switch]$Uninstall,+ [switch]$Start+)+$ErrorActionPreference = 'Stop'+if (-not $TvHost) { throw 'pass -TvHost <tv ip> or set $env:TV_HOST' }+$env:TV_HOST = $TvHost+$here = $PSScriptRoot+$tools = Join-Path (Split-Path (Split-Path $here -Parent) -Parent) 'tools'+$py = Join-Path $tools 'venv\Scripts\python.exe'+if (-not (Test-Path $py)) { throw 'run: python -m venv tools\venv; tools\venv\Scripts\python.exe -m pip install -r tools\requirements.txt' }+$pkg = 'com.gathin.haunted'+$dream = "$pkg/.HauntedDream"+$before = '/data/local/tmp/cyt-haunted-before'+function Tv([string]$cmd) { & $py -I (Join-Path $tools 'tv.py') $cmd; if ($LASTEXITCODE) { throw "tv.py failed: $cmd" } }++if ($Uninstall) {+ # Put the screensaver from before the first run back, then remove the app.+ Tv "if [ -f $before ]; then { read c; read e; } < $before; if [ `"`$c`" = null ]; then settings delete secure screensaver_components >/dev/null; else settings put secure screensaver_components `"`$c`"; fi; [ `"`$e`" = null ] || settings put secure screensaver_enabled `"`$e`"; rm -f $before; fi; pm uninstall $pkg"+ exit 0+}++Push-Location $here+try {+ & .\gradlew.bat assembleRelease -q+ if ($LASTEXITCODE) { throw 'build failed (JDK 17 and Android SDK 34 needed; see launcher\README)' }+} finally { Pop-Location }+$apk = Join-Path $here 'app\build\outputs\apk\release\app-release.apk'+& $py -I (Join-Path $tools 'b64push.py') $apk /data/local/tmp/haunted.apk | Out-Null+if ($LASTEXITCODE) { throw 'sending the APK failed' }+Tv 'pm install -r /data/local/tmp/haunted.apk; rm -f /data/local/tmp/haunted.apk'+Tv "[ -f $before ] || { settings get secure screensaver_components; settings get secure screensaver_enabled; } > $before; settings put secure screensaver_components $dream; settings put secure screensaver_enabled 1"+Write-Host 'Installed: Haunted is the screensaver. Undo with: addons\haunted\build-and-install.ps1 -Uninstall'+if ($Start) { Tv 'am start -n com.android.systemui/.Somnambulator' }diff --git a/addons/haunted/build-and-install.sh b/addons/haunted/build-and-install.shnew file mode 100755index 000000000..bce9b48a1--- /dev/null+++ b/addons/haunted/build-and-install.sh@@ -0,0 +1,31 @@+#!/usr/bin/env bash+# Build Haunted, install it on the TV and make it the TV's screensaver.+#+# Usage: TV_HOST=192.168.1.50 addons/haunted/build-and-install.sh+# TV_HOST=192.168.1.50 START=1 addons/haunted/build-and-install.sh # and show it now+# TV_HOST=192.168.1.50 addons/haunted/build-and-install.sh --uninstall # previous screensaver back, app removed+set -euo pipefail+HERE="$(cd "$(dirname "$0")" && (pwd -W 2>/dev/null || pwd))"+TOOLS="$HERE/../../tools"+: "${TV_HOST:?set TV_HOST to the TV IP address, e.g. TV_HOST=192.168.1.50 $0}"+PY="$TOOLS/venv/bin/python"+[ -x "$PY" ] || PY="$TOOLS/venv/Scripts/python.exe"+[ -x "$PY" ] || { echo "run: python3 -m venv tools/venv && tools/venv/bin/pip install -r tools/requirements.txt" >&2; exit 1; }+export MSYS_NO_PATHCONV=1+PKG=com.gathin.haunted+DREAM=$PKG/.HauntedDream+# The screensaver the TV had before the first run, so --uninstall can put it back.+BEFORE=/data/local/tmp/cyt-haunted-before+tv() { "$PY" -I "$TOOLS/tv.py" "$@"; }++if [ "${1:-}" = --uninstall ]; then+ tv "if [ -f $BEFORE ]; then { read c; read e; } < $BEFORE; if [ \"\$c\" = null ]; then settings delete secure screensaver_components >/dev/null; else settings put secure screensaver_components \"\$c\"; fi; [ \"\$e\" = null ] || settings put secure screensaver_enabled \"\$e\"; rm -f $BEFORE; fi; pm uninstall $PKG; echo screensaver: \$(settings get secure screensaver_components)"+ exit 0+fi++(cd "$HERE" && ./gradlew assembleRelease -q) || { echo "build failed (JDK 17 and Android SDK 34 needed; see launcher/README)" >&2; exit 1; }+"$PY" -I "$TOOLS/b64push.py" "$HERE/app/build/outputs/apk/release/app-release.apk" /data/local/tmp/haunted.apk >/dev/null+tv "pm install -r /data/local/tmp/haunted.apk; rm -f /data/local/tmp/haunted.apk"+tv "[ -f $BEFORE ] || { settings get secure screensaver_components; settings get secure screensaver_enabled; } > $BEFORE; settings put secure screensaver_components $DREAM; settings put secure screensaver_enabled 1" >/dev/null+echo "Installed: Haunted is the screensaver. Undo with: addons/haunted/build-and-install.sh --uninstall"+[ -z "${START:-}" ] || tv "am start -n com.android.systemui/.Somnambulator >/dev/null; sleep 3; dumpsys dreams | grep mCurrentDreamName"diff --git a/addons/haunted/build.gradle b/addons/haunted/build.gradlenew file mode 100644index 000000000..48978475f--- /dev/null+++ b/addons/haunted/build.gradle@@ -0,0 +1,3 @@+plugins {+ id 'com.android.application' version '8.5.2' apply false+}diff --git a/addons/haunted/gradle.properties b/addons/haunted/gradle.propertiesnew file mode 100644index 000000000..1edaf2baa--- /dev/null+++ b/addons/haunted/gradle.properties@@ -0,0 +1 @@+org.gradle.jvmargs=-Xmx2g -Dfile.encoding=UTF-8diff --git a/addons/haunted/gradle/wrapper/gradle-wrapper.jar b/addons/haunted/gradle/wrapper/gradle-wrapper.jarnew file mode 100644index 000000000..2c3521197Binary files /dev/null and b/addons/haunted/gradle/wrapper/gradle-wrapper.jar differdiff --git a/addons/haunted/gradle/wrapper/gradle-wrapper.properties b/addons/haunted/gradle/wrapper/gradle-wrapper.propertiesnew file mode 100644index 000000000..77f5d0ba6--- /dev/null+++ b/addons/haunted/gradle/wrapper/gradle-wrapper.properties@@ -0,0 +1,8 @@+distributionBase=GRADLE_USER_HOME+distributionPath=wrapper/dists+distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip+distributionSha256Sum=d725d707bfabd4dfdc958c624003b3c80accc03f7037b5122c4b1d0ef15cecab+networkTimeout=10000+validateDistributionUrl=true+zipStoreBase=GRADLE_USER_HOME+zipStorePath=wrapper/distsdiff --git a/addons/haunted/gradlew b/addons/haunted/gradlewnew file mode 100755index 000000000..f5feea6d6--- /dev/null+++ b/addons/haunted/gradlew@@ -0,0 +1,252 @@+#!/bin/sh++#+# Copyright © 2015-2021 the original authors.+#+# 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+#+# https://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.+#+# SPDX-License-Identifier: Apache-2.0+#++##############################################################################+#+# Gradle start up script for POSIX generated by Gradle.+#+# Important for running:+#+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is+# noncompliant, but you have some other compliant shell such as ksh or+# bash, then to run this script, type that shell name before the whole+# command line, like:+#+# ksh Gradle+#+# Busybox and similar reduced shells will NOT work, because this script+# requires all of these POSIX shell features:+# * functions;+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;+# * compound commands having a testable exit status, especially «case»;+# * various built-in commands including «command», «set», and «ulimit».+#+# Important for patching:+#+# (2) This script targets any POSIX shell, so it avoids extensions provided+# by Bash, Ksh, etc; in particular arrays are avoided.+#+# The "traditional" practice of packing multiple parameters into a+# space-separated string is a well documented source of bugs and security+# problems, so this is (mostly) avoided, by progressively accumulating+# options in "$@", and eventually passing that to Java.+#+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;+# see the in-line comments for details.+#+# There are tweaks for specific operating systems such as AIX, CygWin,+# Darwin, MinGW, and NonStop.+#+# (3) This script is generated from the Groovy template+# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt+# within the Gradle project.+#+# You can find Gradle at https://github.com/gradle/gradle/.+#+##############################################################################++# Attempt to set APP_HOME++# Resolve links: $0 may be a link+app_path=$0++# Need this for daisy-chained symlinks.+while+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path+ [ -h "$app_path" ]+do+ ls=$( ls -ld "$app_path" )+ link=${ls#*' -> '}+ case $link in #(+ /*) app_path=$link ;; #(+ *) app_path=$APP_HOME$link ;;+ esac+done++# This is normally unused+# shellcheck disable=SC2034+APP_BASE_NAME=${0##*/}+# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)+APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s+' "$PWD" ) || exit++# Use the maximum available, or set MAX_FD != -1 to use that value.+MAX_FD=maximum++warn () {+ echo "$*"+} >&2++die () {+ echo+ echo "$*"+ echo+ exit 1+} >&2++# OS specific support (must be 'true' or 'false').+cygwin=false+msys=false+darwin=false+nonstop=false+case "$( uname )" in #(+ CYGWIN* ) cygwin=true ;; #(+ Darwin* ) darwin=true ;; #(+ MSYS* | MINGW* ) msys=true ;; #(+ NONSTOP* ) nonstop=true ;;+esac++CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar+++# Determine the Java command to use to start the JVM.+if [ -n "$JAVA_HOME" ] ; then+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then+ # IBM's JDK on AIX uses strange locations for the executables+ JAVACMD=$JAVA_HOME/jre/sh/java+ else+ JAVACMD=$JAVA_HOME/bin/java+ fi+ if [ ! -x "$JAVACMD" ] ; then+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME++Please set the JAVA_HOME variable in your environment to match the+location of your Java installation."+ fi+else+ JAVACMD=java+ if ! command -v java >/dev/null 2>&1+ then+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.++Please set the JAVA_HOME variable in your environment to match the+location of your Java installation."+ fi+fi++# Increase the maximum file descriptors if we can.+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then+ case $MAX_FD in #(+ max*)+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.+ # shellcheck disable=SC2039,SC3045+ MAX_FD=$( ulimit -H -n ) ||+ warn "Could not query maximum file descriptor limit"+ esac+ case $MAX_FD in #(+ '' | soft) :;; #(+ *)+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.+ # shellcheck disable=SC2039,SC3045+ ulimit -n "$MAX_FD" ||+ warn "Could not set maximum file descriptor limit to $MAX_FD"+ esac+fi++# Collect all arguments for the java command, stacking in reverse order:+# * args from the command line+# * the main class name+# * -classpath+# * -D...appname settings+# * --module-path (only if needed)+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.++# For Cygwin or MSYS, switch paths to Windows format before running java+if "$cygwin" || "$msys" ; then+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )++ JAVACMD=$( cygpath --unix "$JAVACMD" )++ # Now convert the arguments - kludge to limit ourselves to /bin/sh+ for arg do+ if+ case $arg in #(+ -*) false ;; # don't mess with options #(+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath+ [ -e "$t" ] ;; #(+ *) false ;;+ esac+ then+ arg=$( cygpath --path --ignore --mixed "$arg" )+ fi+ # Roll the args list around exactly as many times as the number of+ # args, so each arg winds up back in the position where it started, but+ # possibly modified.+ #+ # NB: a `for` loop captures its iteration list before it begins, so+ # changing the positional parameters here affects neither the number of+ # iterations, nor the values presented in `arg`.+ shift # remove old arg+ set -- "$@" "$arg" # push replacement arg+ done+fi+++# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'++# Collect all arguments for the java command:+# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,+# and any embedded shellness will be escaped.+# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be+# treated as '${Hostname}' itself on the command line.++set -- \+ "-Dorg.gradle.appname=$APP_BASE_NAME" \+ -classpath "$CLASSPATH" \+ org.gradle.wrapper.GradleWrapperMain \+ "$@"++# Stop when "xargs" is not available.+if ! command -v xargs >/dev/null 2>&1+then+ die "xargs is not available"+fi++# Use "xargs" to parse quoted args.+#+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.+#+# In Bash we could simply go:+#+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&+# set -- "${ARGS[@]}" "$@"+#+# but POSIX shell has neither arrays nor command substitution, so instead we+# post-process each arg (as a line of input to sed) to backslash-escape any+# character that might be a shell metacharacter, then use eval to reverse+# that process (while maintaining the separation between arguments), and wrap+# the whole thing up as a single "set" statement.+#+# This will of course break if any of these variables contains a newline or+# an unmatched quote.+#++eval "set -- $(+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |+ xargs -n1 |+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |+ tr '\n' ' '+ )" '"$@"'++exec "$JAVACMD" "$@"diff --git a/addons/haunted/gradlew.bat b/addons/haunted/gradlew.batnew file mode 100644index 000000000..9d21a2183--- /dev/null+++ b/addons/haunted/gradlew.bat@@ -0,0 +1,94 @@+@rem+@rem Copyright 2015 the original author or authors.+@rem+@rem Licensed under the Apache License, Version 2.0 (the "License");+@rem you may not use this file except in compliance with the License.+@rem You may obtain a copy of the License at+@rem+@rem https://www.apache.org/licenses/LICENSE-2.0+@rem+@rem Unless required by applicable law or agreed to in writing, software+@rem distributed under the License is distributed on an "AS IS" BASIS,+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+@rem See the License for the specific language governing permissions and+@rem limitations under the License.+@rem+@rem SPDX-License-Identifier: Apache-2.0+@rem++@if "%DEBUG%"=="" @echo off+@rem ##########################################################################+@rem+@rem Gradle startup script for Windows+@rem+@rem ##########################################################################++@rem Set local scope for the variables with windows NT shell+if "%OS%"=="Windows_NT" setlocal++set DIRNAME=%~dp0+if "%DIRNAME%"=="" set DIRNAME=.+@rem This is normally unused+set APP_BASE_NAME=%~n0+set APP_HOME=%DIRNAME%++@rem Resolve any "." and ".." in APP_HOME to make it shorter.+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi++@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"++@rem Find java.exe+if defined JAVA_HOME goto findJavaFromJavaHome++set JAVA_EXE=java.exe+%JAVA_EXE% -version >NUL 2>&1+if %ERRORLEVEL% equ 0 goto execute++echo. 1>&2+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2+echo. 1>&2+echo Please set the JAVA_HOME variable in your environment to match the 1>&2+echo location of your Java installation. 1>&2++goto fail++:findJavaFromJavaHome+set JAVA_HOME=%JAVA_HOME:"=%+set JAVA_EXE=%JAVA_HOME%/bin/java.exe++if exist "%JAVA_EXE%" goto execute++echo. 1>&2+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2+echo. 1>&2+echo Please set the JAVA_HOME variable in your environment to match the 1>&2+echo location of your Java installation. 1>&2++goto fail++:execute+@rem Setup the command line++set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar+++@rem Execute Gradle+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*++:end+@rem End local scope for the variables with windows NT shell+if %ERRORLEVEL% equ 0 goto mainEnd++:fail+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of+rem the _cmd.exe /c_ return code!+set EXIT_CODE=%ERRORLEVEL%+if %EXIT_CODE% equ 0 set EXIT_CODE=1+if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%+exit /b %EXIT_CODE%++:mainEnd+if "%OS%"=="Windows_NT" endlocal++:omegadiff --git a/addons/haunted/screenshot.jpg b/addons/haunted/screenshot.jpgnew file mode 100644index 000000000..f92b22020Binary files /dev/null and b/addons/haunted/screenshot.jpg differdiff --git a/addons/haunted/settings.gradle b/addons/haunted/settings.gradlenew file mode 100644index 000000000..d27f6891e--- /dev/null+++ b/addons/haunted/settings.gradle@@ -0,0 +1,16 @@+pluginManagement {+ repositories {+ google()+ mavenCentral()+ gradlePluginPortal()+ }+}+dependencyResolutionManagement {+ repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)+ repositories {+ google()+ mavenCentral()+ }+}+rootProject.name = "haunted"+include ':app'