Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ See the official [plugin documentation](https://www.appdevforall.org/codeonthego
| [`client-time-tracker/`](client-time-tracker/) | Tracks billable coding sessions per project and generates PDF/Excel/CSV invoices. |
| [`python-tools/`](python-tools/) | Adds Python + Flask project templates, with on-device Python install and run/install/test actions. |
| [`rainbow-on-the-go/`](rainbow-on-the-go/) | Colors matching parentheses, brackets, and braces by nesting depth, with light/dark palettes. |
| [`compose-preview/`](compose-preview/) | Renders Jetpack Compose `@Preview` functions on-device — no full app build or run. |
| [`ai-literacy-course/`](ai-literacy-course/) | Bundles Learn AI Anywhere's offline "Introduction to AI" course (26 videos + interactive activities) and plays it full-screen, fully offline. |

## Building a plugin
Expand Down
102 changes: 102 additions & 0 deletions compose-preview/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("org.jetbrains.kotlin.plugin.compose")
id("com.itsaky.androidide.plugins.build")
}

pluginBuilder {
pluginName = "compose-preview"
}

android {
namespace = "org.appdevforall.composepreview"
compileSdk = 34

defaultConfig {
applicationId = "org.appdevforall.composepreview"
minSdk = 26
targetSdk = 34
versionCode = 1
versionName = "1.0.0"

ndk {
abiFilters += listOf("arm64-v8a", "armeabi-v7a")
}
}

buildTypes {
release {
isMinifyEnabled = false
isShrinkResources = false
signingConfig = signingConfigs.getByName("debug")
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

buildFeatures {
compose = true
viewBinding = true
}

// Keep the bundled on-device Compose toolchain archive uncompressed inside the .cgp.
androidResources {
noCompress += "zip"
}

packaging {
resources {
excludes += setOf(
"META-INF/DEPENDENCIES",
"META-INF/LICENSE",
"META-INF/LICENSE.txt",
"META-INF/NOTICE",
"META-INF/NOTICE.txt",
"META-INF/INDEX.LIST",
"META-INF/*.kotlin_module"
)
}
}
}

kotlin {
compilerOptions {
jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17)
}
}

dependencies {
// Host provides plugin-api implementations at runtime; the plugin links only against
// the stable plugin-api contract — never host-internal modules.
compileOnly(files("../libs/plugin-api.jar"))

// Compose is BUNDLED into the .cgp because the host no longer ships it after extraction.
val composeBom = platform("androidx.compose:compose-bom:2024.02.00")
implementation(composeBom)
implementation("androidx.compose.ui:ui")
implementation("androidx.compose.ui:ui-graphics")
implementation("androidx.compose.ui:ui-tooling-preview")
implementation("androidx.compose.foundation:foundation")
implementation("androidx.compose.material3:material3")
implementation("androidx.compose.runtime:runtime")
implementation("androidx.activity:activity-compose:1.8.2")

implementation("androidx.fragment:fragment-ktx:1.8.8")
implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.7")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.7")
implementation("androidx.lifecycle:lifecycle-runtime-compose:2.8.7")
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.8.7")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1")
implementation("com.google.android.material:material:1.10.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("org.slf4j:slf4j-nop:1.7.36")

debugImplementation(composeBom)
debugImplementation("androidx.compose.ui:ui-tooling")
}
Loading