From 8433c7696961a25a1525780fa43dcd1d27ac6d89 Mon Sep 17 00:00:00 2001 From: AbdallahMehiz Date: Thu, 6 Jun 2024 21:30:13 +0100 Subject: [PATCH] feat: build and preview workflows --- .github/workflows/build.yml | 24 ++++++++++++++ .github/workflows/preview.yml | 31 +++++++++++++++++++ app/build.gradle.kts | 15 +++++++-- app/proguard-rules.pro | 4 ++- .../mehiz/mpvkt/ui/player/PlayerActivity.kt | 2 ++ gradle/libs.versions.toml | 1 + 6 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/preview.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..4760435 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,24 @@ +name: Build + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Setup JDK 17 + uses: actions/setup-java@v4 + with: + distribution: 'adopt' + java-version: 17 + cache: 'gradle' + + - name: Make gradlew executable + run: chmod +x ./gradlew + + - name: Build with Gradle + run: ./gradlew assembleDebug diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml new file mode 100644 index 0000000..e61c89f --- /dev/null +++ b/.github/workflows/preview.yml @@ -0,0 +1,31 @@ +name: Preview + +on: [workflow_dispatch] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Setup JDK 17 + uses: actions/setup-java@v4 + with: + distribution: 'adopt' + java-version: 17 + cache: 'gradle' + + - name: Make gradlew executable + run: chmod +x ./gradlew + + - name: Build with Gradle + run: ./gradlew assemblePreview + + - name: Upload the APK artifact + uses: actions/upload-artifact@v4 + with: + path: ./app/build/outputs/apk/preview/*.apk + name: packages + retention-days: 14 \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 8ef4c1b..5ad6a33 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -30,13 +30,23 @@ android { } buildTypes { - release { - isMinifyEnabled = false + named("release") { + isMinifyEnabled = true + isShrinkResources = true proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro", ) } + create("preview") { + initWith(getByName("release")) + + signingConfig = signingConfigs["debug"] + applicationIdSuffix = ".preview" + } + named("debug") { + applicationIdSuffix = ".debug" + } } compileOptions { sourceCompatibility = JavaVersion.VERSION_17 @@ -84,6 +94,7 @@ dependencies { implementation(libs.aniyomi.mpv.lib) implementation(libs.aniyomi.ffmpeg.kit) + implementation(libs.arthentica.smartexceptions) implementation(libs.seeker) implementation(libs.bundles.koin) diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 481bb43..4242213 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -18,4 +18,6 @@ # If you keep the line number information, uncomment this to # hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file +#-renamesourcefileattribute SourceFile +-keep,allowoptimization class is.xyz.mpv.** { public protected *; } +-keep,allowoptimization class com.arthenica.** { public protected *; } \ No newline at end of file diff --git a/app/src/main/java/live/mehiz/mpvkt/ui/player/PlayerActivity.kt b/app/src/main/java/live/mehiz/mpvkt/ui/player/PlayerActivity.kt index 8f9153e..d9edefc 100644 --- a/app/src/main/java/live/mehiz/mpvkt/ui/player/PlayerActivity.kt +++ b/app/src/main/java/live/mehiz/mpvkt/ui/player/PlayerActivity.kt @@ -9,6 +9,7 @@ import android.os.Bundle import android.os.ParcelFileDescriptor import android.util.Log import android.view.WindowManager +import androidx.activity.enableEdgeToEdge import androidx.appcompat.app.AppCompatActivity import androidx.core.view.WindowCompat import `is`.xyz.mpv.MPVLib @@ -36,6 +37,7 @@ class PlayerActivity : AppCompatActivity() { private val subtitlesPreferences by inject() override fun onCreate(savedInstanceState: Bundle?) { + enableEdgeToEdge() super.onCreate(savedInstanceState) window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS) window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 5f598b8..3407daa 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -35,6 +35,7 @@ androidx-compose-constraintlayout = { group = "androidx.constraintlayout", name aniyomi-mpv-lib = { module = "com.github.aniyomiorg:aniyomi-mpv-lib", version = "1.15.n" } aniyomi-ffmpeg-kit = { module = "com.github.jmir1:ffmpeg-kit", version = "1.15" } +arthentica-smartexceptions = { module = "com.arthenica:smart-exception-java", version = "0.2.1" } seeker = { module = "io.github.2307vivek:seeker", version = "1.2.2" }