diff --git a/.gitignore b/.gitignore
index 9262b1e..9565669 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,3 +14,4 @@ local.properties
*.aab
*.jks
*.keystore
+.gradle-cache/
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 744d5bf..eb306ac 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -4,6 +4,7 @@
+
diff --git a/app/src/main/java/dev/itsh/tetherapi/service/TetherApiService.kt b/app/src/main/java/dev/itsh/tetherapi/service/TetherApiService.kt
index 44149c2..146c287 100644
--- a/app/src/main/java/dev/itsh/tetherapi/service/TetherApiService.kt
+++ b/app/src/main/java/dev/itsh/tetherapi/service/TetherApiService.kt
@@ -10,6 +10,7 @@ import android.content.Intent
import android.os.Binder
import android.os.Build
import android.os.IBinder
+import android.util.Log
import androidx.core.app.NotificationCompat
import dev.itsh.tetherapi.MainActivity
import dev.itsh.tetherapi.R
@@ -44,10 +45,12 @@ class TetherApiService : Service() {
private fun startServer(port: Int) {
if (apiServer?.isAlive == true) {
+ Log.d(TAG, "Server already running")
return
}
try {
+ Log.d(TAG, "Starting server on port $port")
apiServer = ApiServer(this, port).apply {
start()
}
@@ -57,7 +60,9 @@ class TetherApiService : Service() {
isRunning = true
currentPort = port
+ Log.d(TAG, "Server started successfully")
} catch (e: Exception) {
+ Log.e(TAG, "Failed to start server", e)
stopSelf()
}
}
@@ -126,6 +131,7 @@ class TetherApiService : Service() {
}
companion object {
+ private const val TAG = "TetherApiService"
const val ACTION_START = "dev.itsh.tetherapi.action.START"
const val ACTION_STOP = "dev.itsh.tetherapi.action.STOP"
const val EXTRA_PORT = "dev.itsh.tetherapi.extra.PORT"
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 417941c..c29f215 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:fitsSystemWindows="true"
android:padding="16dp"
tools:context=".MainActivity">
@@ -152,26 +153,40 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/settingsCard" />
-
-
+
-
+
+
+
+
+
+
+
+
+
diff --git a/justfile b/justfile
index 8a5038b..c0c6e47 100644
--- a/justfile
+++ b/justfile
@@ -2,7 +2,7 @@
# Docker image for Android builds
android_image := "cimg/android:2025.12"
-gradle_cache := "gradle-cache"
+gradle_cache := env_var_or_default("GRADLE_CACHE", justfile_directory() + "/.gradle-cache")
# Default task
default:
@@ -12,38 +12,41 @@ default:
build:
docker run --rm \
-v {{justfile_directory()}}:/project \
- -v {{gradle_cache}}:/home/circleci/.gradle \
+ -v {{gradle_cache}}:/gradle-cache \
+ -e GRADLE_USER_HOME=/gradle-cache \
-w /project \
{{android_image}} \
- ./gradlew assembleDebug --no-daemon
+ sh -c './gradlew assembleDebug --no-daemon && chown -R $(stat -c %u:%g /project) /project/.gradle /project/.kotlin /project/app/build 2>/dev/null || true'
@echo "APK: app/build/outputs/apk/debug/app-debug.apk"
# Build release APK (requires keystore and env vars)
release:
docker run --rm \
-v {{justfile_directory()}}:/project \
- -v {{gradle_cache}}:/home/circleci/.gradle \
- -w /project \
+ -v {{gradle_cache}}:/gradle-cache \
+ -e GRADLE_USER_HOME=/gradle-cache \
-e KEYSTORE_PASSWORD \
-e KEY_ALIAS \
-e KEY_PASSWORD \
+ -w /project \
{{android_image}} \
- ./gradlew assembleRelease --no-daemon
+ sh -c './gradlew assembleRelease --no-daemon && chown -R $(stat -c %u:%g /project) /project/.gradle /project/.kotlin /project/app/build 2>/dev/null || true'
@echo "APK: app/build/outputs/apk/release/app-release.apk"
# Clean build artifacts
clean:
- rm -rf app/build build .gradle
+ rm -rf app/build build .gradle .kotlin
@echo "Cleaned"
# Run gradle tasks
gradle *ARGS:
docker run --rm \
-v {{justfile_directory()}}:/project \
- -v {{gradle_cache}}:/home/circleci/.gradle \
+ -v {{gradle_cache}}:/gradle-cache \
+ -e GRADLE_USER_HOME=/gradle-cache \
-w /project \
{{android_image}} \
- ./gradlew {{ARGS}} --no-daemon
+ sh -c './gradlew {{ARGS}} --no-daemon && chown -R $(stat -c %u:%g /project) /project/.gradle /project/.kotlin /project/app/build 2>/dev/null || true'
# Generate icons from SVG
icons: