Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: make utility classes proper utilities #177

Merged
merged 2 commits into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
import java.lang.reflect.Field;
import java.util.Map;

public class TestUtils {
public final class TestUtils {
private TestUtils() {}

public static AbstractUploaderStrategy replaceWithTimeoutStrategy(Cloudinary cloudinary) throws NoSuchFieldException, IllegalAccessException, IOException {
return TestUtils.replaceStrategyForIntsance(cloudinary, new AbstractUploaderStrategy() {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.cloudinary.android;

class BackgroundStrategyProvider {
final class BackgroundStrategyProvider {
private BackgroundStrategyProvider() {}

static BackgroundRequestStrategy provideStrategy(){
return new AndroidJobStrategy();
}
Expand Down
4 changes: 3 additions & 1 deletion core/src/main/java/com/cloudinary/android/Logger.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import android.util.Log;

public class Logger {
public final class Logger {
private Logger() {}

static LogLevel logLevel = LogLevel.ERROR;

public static void i(String tag, String message) {
Expand Down
4 changes: 3 additions & 1 deletion core/src/main/java/com/cloudinary/android/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;

public class Utils {
public final class Utils {
private Utils() {}

public static String cloudinaryUrlFromContext(Context context) {
String url = "";
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
/**
* This class is used to construct Payload instances from URIs.
*/
public class PayloadFactory {
public final class PayloadFactory {
private PayloadFactory() {}

private static final String TAG = PayloadFactory.class.getSimpleName();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
import java.util.HashMap;
import java.util.Map;

public class CloudinaryHelper {
public final class CloudinaryHelper {
private CloudinaryHelper() {}

public static void setMediaManager(Context context, String cloudName) {
Map config = new HashMap();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.cloudinary.sample.helpers;

public class StringHelper {
public final class StringHelper {
private StringHelper() {}

public static String captialLetter(String input) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;

public class Utils {
public final class Utils {
private Utils() {}

public static String UPLOAD_PRESET = "android_sample";
public static String getImageWidhtAndHeightString(Drawable drawable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
/**
* Helper class to start the UploadWidget and preprocess its results.
*/
public class UploadWidget {
public final class UploadWidget {
private UploadWidget() {}

/**
* The key used to pass upload widget result data back from {@link UploadWidgetActivity}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
import com.cloudinary.android.uploadwidget.utils.MediaType;
import com.cloudinary.android.uploadwidget.utils.UriUtils;

class UploadWidgetResultProcessor {
final class UploadWidgetResultProcessor {
private UploadWidgetResultProcessor() {}

static UploadRequest process(Context context, UploadWidget.Result result) {
UploadRequest uploadRequest = MediaManager.get().upload(result.uri);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
import java.io.IOException;
import java.io.InputStream;

public class BitmapUtils {
public final class BitmapUtils {
private BitmapUtils() {}

/**
* Decode a sampled bitmap to the required width and height.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import androidx.annotation.NonNull;
import android.webkit.MimeTypeMap;

public class UriUtils {
public final class UriUtils {
private UriUtils() {}

/**
* Get the media type of the Uri.
Expand Down
Loading