Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/clothparency/android-widgets

Clear Fashion native android SDK for the widgets
https://github.com/clothparency/android-widgets

android android-library jetpack-compose kotlin mit-license widget

Last synced: 22 days ago
JSON representation

Clear Fashion native android SDK for the widgets

Awesome Lists containing this project

README

        




Logo Clear Fashion



Clear Fashion widgets for Android


Display your Clear Fashion widgets on your native android app.

Check the latest release here:

https://github.com/Clothparency/android-widgets/releases/latest

[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/Clothparency/ios-widgets/main/LICENSE.md)

## Installation



Using Gradle


**Step 1.** Add the JitPack repository to your build file

Add it in your root `build.gradle` at the end of repositories:

```groovy
allprojects {
repositories {
// ...
maven { url 'https://jitpack.io' }
}
}
```

**Step 2.** Add the dependency

```groovy
dependencies {
implementation 'com.github.Clothparency:android-widgets:1.0.0'
}
```



Using Maven


**Step 1.** Add the JitPack repository to your build file

```xml


jitpack.io
https://jitpack.io


```

**Step 2.** Add the dependency

```xml

com.github.Clothparency
android-widgets
1.0.0

```



Using SBT




**Step 1.** Add the JitPack repository to your build file

Add it in your `build.sbt` at the end of resolvers:

```
resolvers += "jitpack" at "https://jitpack.io"
```

**Step 2.** Add the dependency

```
libraryDependencies += "com.github.Clothparency" % "android-widgets" % "1.0.0"
```



Using Leiningen




**Step 1.** Add the JitPack repository to your build file

Add it in your `project.clj` at the end of repositories:

```
:repositories [["jitpack" "https://jitpack.io"]]
```

**Step 2.** Add the dependency

```
:dependencies [[com.github.Clothparency/android-widgets "1.0.0"]]
```

## Implementation

This package exposes a composable function: `ClearFashionWidget`

If your application uses [Jetpack Compose](https://developer.android.com/jetpack/compose) you can simply add it inside any composable scopes as so:

```kotlin
// ...

import com.clearfashion.sdk.widgets.ClearFashionWidget
import com.clearfashion.sdk.widgets.type.ClearFashionWidgetLanguage

// ...

ClearFashionWidget(
brandId = "The id of your brand as given by Clear Fashion",
productId = "The identifier of your product as given by Clear Fashion",
lang = ClearFashionWidgetLanguage.EN // The widget also supports `ClearFashionWidgetLanguage.FR` which is the default value
)
```

### Using Views

If your application is view based, you can add the widget in the activity where you want it to be displayed:

```kotlin
// ...

import com.clearfashion.sdk.widgets.ClearFashionWidget
import com.clearfashion.sdk.widgets.type.ClearFashionWidgetLanguage

// ...

ClearFashionWidget(
activity = this,
brandId = "The id of your brand as given by Clear Fashion",
productId = "The identifier of your product as given by Clear Fashion",
lang = ClearFashionWidgetLanguage.EN // The widget also supports `ClearFashionWidgetLanguage.FR` which is the default value
)
```

### Using Fragments

If your application is fragment based, in the fragment XML file where you want to put the widget, add a compose view for the widget to live in:

```xml

```

And then in the `onCreateView` method, add the following:

```kotlin
// ...

import com.clearfashion.sdk.widgets.ClearFashionWidget
import com.clearfashion.sdk.widgets.type.ClearFashionWidgetLanguage

// ...

override fun onCreate(savedInstanceState: Bundle?) {

// ...

ClearFashionWidget(
composeView = binding.cfWidgetComposeView,
brandId = "The id of your brand as given by Clear Fashion",
productId = "The identifier of your product as given by Clear Fashion",
lang = ClearFashionWidgetLanguage.EN // The widget also supports `ClearFashionWidgetLanguage.FR` which is the default value
)

// ...

}
```

For more informations on how to integrate a composable function in your code, please read: https://developer.android.com/jetpack/compose/interop/interop-apis






Logo Clear Fashion