cloudinary / cloudinary_android

Android client for integrating with Cloudinary
MIT License
67 stars 59 forks source link

How do you create a Transformation object in Kotlin? #139

Closed RichMBateman closed 2 years ago

RichMBateman commented 2 years ago

Bug report for Cloudinary Android SDK

I'm using the Cloudinary Android SDK in a Kotlin Android application. When I try to create a Transformation() object, I cannot because of compile-time error "Not enough information to infer type variable T". I see that Transformation is a parameterized type, but I cannot figure out how to instantiate one in Kotlin.

@SuppressWarnings({"rawtypes", "unchecked"}) public class Transformation implements Serializable {

Issue Type (Can be multiple)

[ ] Build - Can’t install or import the SDK [ ] Performance - Performance issues [x] Behaviour - Functions aren’t working as expected (Such as generate URL) [ ] Documentation - Inconsistency between the docs and behaviour [ ] Other (Specify)

Build System

[ ] Maven [x] Gradle [ ] Other (Specify)

Is the issue reproducible only on a specific device?

[x] No [ ] Yes (specify model + Android version + vendor build number, if applicable)

Versions and Libraries (fill in the version numbers)

Cloudinary Android SDK version 1.30.0 Android version 30 (Please provide exact sdk level) Kotlin version (if applicable) - 1.6.10 JVM (of the dev environment) - 0.0.0 Maven - 0.0.0 / N/A Gradle - 0.0.0 / N/A

adimiz1 commented 2 years ago

Hi RichMBateman There are multiple answers here:

  1. You can use our Kotlin SDK - the Kotlin SDK supports url generation only and not the other features implemented in the Android SDK
  2. If you need to use the Android SDK (because upload functions are required as well) here’s an example of how to use the transformation syntax: var transfromation = Transformation<Transformation<*>>().radius(50).crop("scale")
    1. And lastly you can create a Java file and use the Java syntax which will look like this: Transformation transformation = new Transformation().radius(50).crop("scale");

I am closing the issue, if you need further assistant please re-open it