From 04043191bcb89bac0894fcf7f10e828ce47556c2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Jun 2025 14:37:45 +0000 Subject: [PATCH 1/4] Initial plan for issue From 453c955252446f5a934723834f5d3006164fda46 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Jun 2025 14:45:39 +0000 Subject: [PATCH 2/4] Add Jetpack Compose dependencies and SyntaxHighlighter composable Co-authored-by: hossain-khan <99822+hossain-khan@users.noreply.github.com> --- build.gradle | 7 +- example/build.gradle | 12 ++ example/src/main/AndroidManifest.xml | 3 + .../hossain/ynaash/example/ui/MainActivity.kt | 5 + .../demoprismjs/PrismJsComposeDemoActivity.kt | 119 ++++++++++++++++++ example/src/main/res/layout/activity_main.xml | 6 + highlighter/build.gradle | 12 ++ .../compose/SyntaxHighlighterComposable.kt | 55 ++++++++ 8 files changed, 218 insertions(+), 1 deletion(-) create mode 100644 example/src/main/java/dev/hossain/ynaash/example/ui/demoprismjs/PrismJsComposeDemoActivity.kt create mode 100644 highlighter/src/main/java/dev/hossain/ynaash/compose/SyntaxHighlighterComposable.kt diff --git a/build.gradle b/build.gradle index 7c43e03..b03e75a 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:8.7.2' + classpath 'com.android.tools.build:gradle:8.5.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong @@ -47,6 +47,11 @@ ext { // https://developer.android.com/jetpack/androidx/releases/lifecycle archComponentVersion = '2.8.7' + // Jetpack Compose dependencies + // -------------------------------------------------- + // https://developer.android.com/jetpack/compose/bom + composeBomVersion = '2024.12.01' + composeCompilerVersion = '1.5.15' // Unit test dependencies // -------------------------------------------------- diff --git a/example/build.gradle b/example/build.gradle index 17c0740..6db819d 100644 --- a/example/build.gradle +++ b/example/build.gradle @@ -9,6 +9,11 @@ android { buildFeatures { viewBinding true buildConfig true + compose true + } + + composeOptions { + kotlinCompilerExtensionVersion rootProject.ext.composeCompilerVersion } defaultConfig { @@ -56,6 +61,13 @@ dependencies { // - https://developer.android.com/jetpack/androidx/releases/recyclerview implementation "androidx.recyclerview:recyclerview:1.3.2" + // Jetpack Compose BOM + implementation platform("androidx.compose:compose-bom:${rootProject.ext.composeBomVersion}") + implementation 'androidx.compose.ui:ui' + implementation 'androidx.compose.ui:ui-tooling-preview' + implementation 'androidx.compose.material3:material3' + implementation 'androidx.activity:activity-compose:1.9.3' + // Timber for logging implementation "com.jakewharton.timber:timber:5.0.1" diff --git a/example/src/main/AndroidManifest.xml b/example/src/main/AndroidManifest.xml index c64c3e2..1cce606 100644 --- a/example/src/main/AndroidManifest.xml +++ b/example/src/main/AndroidManifest.xml @@ -23,6 +23,9 @@ + \ No newline at end of file diff --git a/example/src/main/java/dev/hossain/ynaash/example/ui/MainActivity.kt b/example/src/main/java/dev/hossain/ynaash/example/ui/MainActivity.kt index 59edae2..c6b0c26 100644 --- a/example/src/main/java/dev/hossain/ynaash/example/ui/MainActivity.kt +++ b/example/src/main/java/dev/hossain/ynaash/example/ui/MainActivity.kt @@ -7,6 +7,7 @@ import androidx.appcompat.app.AppCompatActivity import dev.hossain.ynaash.example.R import dev.hossain.ynaash.example.ui.demohighlightjs.HighlightJsDemoActivity import dev.hossain.ynaash.example.ui.demoprismjs.PrismJsDemoActivity +import dev.hossain.ynaash.example.ui.demoprismjs.PrismJsComposeDemoActivity /** * Main activity to showcase both fragment based and custom view based syntax highlighting. @@ -23,5 +24,9 @@ class MainActivity : AppCompatActivity() { findViewById