Skip to content

Commit 54978c6

Browse files
author
Amir Tocker
committed
Fix typos
1 parent 465e6d7 commit 54978c6

File tree

3 files changed

+38
-7
lines changed

3 files changed

+38
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ The following example generates the url for accessing an uploaded `sample` image
103103

104104
CldAndroid.get().url().transformation(new Transformation().width(100).height(150).crop("fill")).generate("sample.jpg")
105105

106-
Another example, emedding a smaller version of an uploaded image while generating a 90x90 face detection based thumbnail:
106+
Another example, embedding a smaller version of an uploaded image while generating a 90x90 face detection based thumbnail:
107107

108108
CldAndroid.get().url().transformation(new Transformation().width(90).height(90).crop("thumb").gravity("face")).generate("woman.jpg")
109109

lib/src/main/java/com/cloudinary/android/CldAndroid.java

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import android.support.annotation.Nullable;
88

99
import com.cloudinary.Cloudinary;
10+
import com.cloudinary.Configuration;
1011
import com.cloudinary.Url;
1112
import com.cloudinary.android.callback.ErrorInfo;
1213
import com.cloudinary.android.callback.UploadCallback;
@@ -48,7 +49,7 @@ public class CldAndroid {
4849

4950
private GlobalUploadPolicy globalUploadPolicy = GlobalUploadPolicy.defaultPolicy();
5051

51-
private CldAndroid(@NonNull Context context, @Nullable SignatureProvider signatureProvider, @Nullable Map<String, Object> config) {
52+
private CldAndroid(@NonNull Context context, @Nullable SignatureProvider signatureProvider, @Nullable Map config) {
5253
// use context to initialize components but DO NOT store it
5354
strategy = BackgroundStrategyProvider.provideStrategy();
5455
callbackDispatcher = new DefaultCallbackDispatcher(context);
@@ -101,7 +102,7 @@ public void onReschedule(String requestId, ErrorInfo error) {
101102
* @param context Android context for initializations. Does not get cached.
102103
*/
103104
public static void init(@NonNull Context context) {
104-
init(context, null, null);
105+
init(context, null, (Map) null);
105106
}
106107

107108
/**
@@ -114,14 +115,29 @@ public static void init(@NonNull Context context, @Nullable Map config) {
114115
init(context, null, config);
115116
}
116117

118+
/**
119+
* Setup the library with the required parameters. A flavor of init() must be called once before CldAndroid can be used, preferably in an implementation of {@link Application#onCreate()}.
120+
*
121+
* @param context Android context for initializations. Does not get cached.
122+
* @param config Cloudinary configuration parameters. If not supplied a cloudinary-url metadata must exist in the manifest.
123+
*/
124+
public static void init(@NonNull Context context, @Nullable Configuration config) {
125+
Map<String, Object> map = null;
126+
if (config != null) {
127+
map = config.asMap();
128+
129+
}
130+
init(context, null, map);
131+
}
132+
117133
/**
118134
* Setup the library with the required parameters. A flavor of init() must be called once before CldAndroid can be used, preferably in an implementation of {@link Application#onCreate()}.
119135
*
120136
* @param context Android context for initializations. Does not get cached.
121137
* @param signatureProvider A signature provider. Needed if using signed uploads.
122138
*/
123139
public static void init(@NonNull Context context, @Nullable SignatureProvider signatureProvider) {
124-
init(context, signatureProvider, null);
140+
init(context, signatureProvider, (Map) null);
125141
}
126142

127143
/**
@@ -147,6 +163,21 @@ public static void init(@NonNull Context context, @Nullable SignatureProvider pr
147163
}
148164
}
149165

166+
/**
167+
* Setup the library with the required parameters. A flavor of init() must be called once before CldAndroid can be used, preferably in an implementation of {@link Application#onCreate()}.
168+
*
169+
* @param context Android context for initializations. Does not get cached.
170+
* @param provider A signature provider. Needed if using signed uploads.
171+
* @param config Cloudinary configuration parameters. If not supplied a cloudinary-url metadata must exist in the manifest.
172+
*/
173+
public static void init(@NonNull Context context, @Nullable SignatureProvider provider, @Nullable Configuration config) {
174+
Map map = null;
175+
if (config != null) {
176+
map = config.asMap();
177+
}
178+
init(context, provider, map);
179+
}
180+
150181
/**
151182
* Entry point for any operation against Cloudinary
152183
*
@@ -322,9 +353,9 @@ public UploadResult popPendingResult(String requestId) {
322353
return callbackDispatcher.popPendingResult(requestId);
323354
}
324355

325-
private UploadRequest buildUploadRequest(Payload payload) {
356+
private UploadRequest<Payload> buildUploadRequest(Payload payload) {
326357
UploadContext<Payload> payloadUploadContext = new UploadContext<>(payload, requestDispatcher);
327-
return new UploadRequest(payloadUploadContext);
358+
return new UploadRequest<>(payloadUploadContext);
328359
}
329360

330361
/**

sample-signed/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Once you clone this repository you need to open the advanced-samples folder (not
99
* Once you open the project a file named `gradle-local.properies` should be automatically created in the repository root (you can manually create it if it's not there). Note: This file is ignored by git and should never be checked in.
1010
* The file should contain a single property with your cloudinary url, stripped to cloud name only: `cloudinary.url=cloudinary://@myCloudName`
1111
* Run `./gradlew clean` (`gradlew clean` on Windows) from the repository root before proceeding.
12-
2. Configure the full credentials for the backend module. The best practice is to create an environment variable wtih your Cloudinary credentials:
12+
2. Configure the full credentials for the backend module. The best practice is to create an environment variable with your Cloudinary credentials:
1313

1414
`CLOUDINARY_URL=cloudinary://1234567890:abcdefghijklmno@myCloudName`
1515

0 commit comments

Comments
 (0)