From ec21007c797c692f6c87d07b1f8c21318a12b9ea Mon Sep 17 00:00:00 2001 From: Dipendra Sharma Date: Mon, 9 Sep 2024 14:49:08 +0530 Subject: [PATCH 01/17] Add CODEOWNERS file --- CODEOWNERS | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 CODEOWNERS diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000..def5910 --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1,4 @@ +Dipendra Sharma +Anitha Sangu +Gautham Prabhu +Vijay Makwana From 655210461f0d41f3d65583fda730c665a08baa0e Mon Sep 17 00:00:00 2001 From: Dipendra Sharma <17643682+dipendra-sharma@users.noreply.github.com> Date: Thu, 16 Jan 2025 14:40:31 +0530 Subject: [PATCH 02/17] Release v1.0.1 (#2) --- README.md | 243 +++++++++--------- app/build.gradle.kts | 8 +- app/src/main/AndroidManifest.xml | 16 +- .../io/pixelbin/glamar/sample/MainActivity.kt | 82 ++++-- .../java/io/pixelbin/glamar/sample/MyApp.kt | 25 ++ .../pixelbin/glamar/sample/StartActivity.kt | 36 +++ app/src/main/res/layout/activity_main.xml | 13 +- app/src/main/res/layout/activity_start.xml | 20 ++ .../main/java/io/pixelbin/glamar/GlamAr.kt | 33 ++- .../java/io/pixelbin/glamar/GlamArCallback.kt | 14 + .../java/io/pixelbin/glamar/GlamArView.kt | 181 ++----------- .../pixelbin/glamar/GlamArWebViewManager.kt | 142 ++++++++++ gradle.properties | 2 +- gradle/libs.versions.toml | 2 + 14 files changed, 508 insertions(+), 309 deletions(-) create mode 100644 app/src/main/java/io/pixelbin/glamar/sample/MyApp.kt create mode 100644 app/src/main/java/io/pixelbin/glamar/sample/StartActivity.kt create mode 100644 app/src/main/res/layout/activity_start.xml create mode 100644 glamar/src/main/java/io/pixelbin/glamar/GlamArCallback.kt create mode 100644 glamar/src/main/java/io/pixelbin/glamar/GlamArWebViewManager.kt diff --git a/README.md b/README.md index d83f94d..0e2c93a 100644 --- a/README.md +++ b/README.md @@ -1,179 +1,176 @@ -# GlamAR SDK Documentation +# GlamAR Android SDK + +[![Maven Central](https://img.shields.io/maven-central/v/io.pixelbin.glamar/glamar.svg)](https://central.sonatype.com/artifact/io.pixelbin.glamar/glamar) +[![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) ## Overview -The GlamAR SDK provides tools to integrate augmented reality (AR) features into your Android application. The SDK is distributed as a local `.aar` file. This document covers the installation, initialization, and usage of the SDK, including details about `GlamArView` API, and `GlamAr` instance API. +GlamAR is a powerful Augmented Reality SDK for Android that enables virtual try-on experiences for makeup, jewelry, and other beauty products. The SDK provides an easy-to-integrate solution with real-time AR capabilities, face detection, and product visualization features. + +## Features + +- Real-time virtual makeup try-on +- Multiple product category support +- Camera and image-based preview modes +- Real-time face tracking and analysis +- Easy integration with Android applications +- Snapshot functionality +- High-performance WebView-based rendering +- Original/Modified view comparison +- Configurable parameters ## Installation -1. **Add the `.aar` file to your project:** - - Place the `.aar` file in the `libs` directory of your project. - - Open your project's `build.gradle` file and add the following: - - Also add `okhttp` and `gson` dependencies +### Maven Central - ```groovy - dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) - implementation 'com.google.code.gson:gson:2.10.1' - implementation 'com.squareup.okhttp3:okhttp:4.11.0' - // Other dependencies - } - ``` +The GlamAR SDK is available on Maven Central. Add the following dependency to your app's `build.gradle`: -2. **Sync your project with Gradle files.** +```groovy +dependencies { + implementation 'io.pixelbin.glamar:glamar:1.0.1' +} +``` -## Initialization +### Manual Installation + +Alternatively, you can manually include the `.aar` file: + +1. Place the `.aar` file in your project's `libs` directory +2. Add the following to your app's `build.gradle`: + +```groovy +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) + implementation 'com.google.code.gson:gson:2.10.1' + implementation 'com.squareup.okhttp3:okhttp:4.11.0' +} +``` + +## Required Permissions -### Initialize SDK in Application Class +Add these permissions to your `AndroidManifest.xml`: -Initialize the SDK in your `Application` class to ensure it's set up when your app starts. By default it will be pointing to development make development parameter false for prod. +```xml + + +``` + +## Initialization + +Initialize the SDK in your Application class: ```kotlin class MyApplication : Application() { - override fun onCreate() { super.onCreate() - GlamAr.initialize(accessKey = "YOUR_ACCESS_KEY", development = false) + GlamAr.initialize( + context = this, + accessKey = "YOUR_ACCESS_KEY", + debug = BuildConfig.DEBUG, // Set to true for development environment + previewMode = PreviewMode.Camera // Or PreviewMode.Image for image-based preview + ) } } ``` -Don't forget to register your `Application` class in the `AndroidManifest.xml`: - -```xml - - -``` - -## GlamArView +## Usage -### Setup +### Basic Implementation -To use `GlamArView`, add it to your layout: +1. Add GlamArView to your layout: ```xml - + android:layout_height="match_parent" /> ``` -### Starting Preview - -Start the preview in various modes using `startPreview`: +2. Setup callbacks and handle events: ```kotlin -glamARView.startPreview(previewMode = PreviewMode.None) -glamARView.startPreview(previewMode = PreviewMode.Camera) -glamARView.startPreview(previewMode = PreviewMode.Image(imageUrl = "IMAGE_URL")) +glamARView.setCallback(object : GlamArCallback { + override fun onError(error: String) { + // Handle error + } + + override fun onSuccess(message: String) { + // Handle success + } + + override fun onSnapshotTaken(base64Image: String) { + // Handle snapshot image + } +}) ``` -### Applying SKUs +### Key Features -Apply a SKU to the `GlamArView`: +#### Preview Modes ```kotlin -glamARView.applySku(skuId = "SKU_ID", category = "CATEGORY") -``` +// Camera preview mode +glamARView.startPreview(previewMode = PreviewMode.Camera) + +// Image preview mode +glamARView.startPreview(previewMode = PreviewMode.Image(imageUrl = "IMAGE_URL")) -### Clearing View +// No preview mode +glamARView.startPreview(previewMode = PreviewMode.None) +``` -Clear the `GlamArView`: +#### Product Application ```kotlin +// Apply a specific SKU +glamARView.applySku(skuId = "SKU_ID") + +// Clear applied products glamARView.clear() ``` -### Taking Snapshot - -Take a snapshot of the current view: +#### Capture and Compare ```kotlin +// Take a snapshot glamARView.snapshot() + +// Toggle between original and modified view +glamARView.toggle(showOriginal = true) ``` -## GlamAr Instance API +#### Configuration -### Fetch SKU List +```kotlin +// Adjust various parameters +glamARView.configChange(options = "brightness", value = 1.2) +``` -Fetch a list of SKUs: +### API Integration ```kotlin -GlamAr.getInstance().api.fetchSkuList(pageNo = 1, pageSize = 100) { result -> - result.onSuccess { skuListResponse -> - // Handle success +// Fetch SKU list +GlamAr.getInstance().api.fetchSkuList(pageNo = 1, pageSize = 20) { result -> + result.onSuccess { response -> + // Handle SKU list }.onFailure { exception -> - // Handle failure + // Handle error } } -``` -### Fetch Specific SKU - -Fetch details of a specific SKU: - -```kotlin +// Fetch specific SKU details GlamAr.getInstance().api.fetchSku(id = "SKU_ID") { result -> result.onSuccess { item -> - // Handle success + // Handle SKU details }.onFailure { exception -> - // Handle failure + // Handle error } } ``` -## Example Usage - -Here's a complete example demonstrating the usage of `GlamAr` and `GlamArView`: - -```kotlin -class MainActivity : AppCompatActivity() { - - private lateinit var glamARView: GlamArView - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setContentView(R.layout.activity_main) - - glamARView = findViewById(R.id.glamARView) - val applyBtn = findViewById