Skip to content

Commit

Permalink
remove colorextractor now as this is not used anymore
Browse files Browse the repository at this point in the history
color extraction is not performed by react-native-color-thief
  • Loading branch information
kamalkishor1991 committed Aug 19, 2024
1 parent f683822 commit e59eecc
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 48 deletions.
1 change: 0 additions & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ dependencies {
implementation 'com.google.android.flexbox:flexbox:3.0.0'
implementation 'com.github.duanhong169:drawabletoolbox:1.0.7'
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
implementation 'org.numixproject.colorextractor:colorextractor:1.4'
implementation 'com.fasterxml.jackson.core:jackson-core:2.11.1'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.11.1'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.11.1'
Expand Down
46 changes: 0 additions & 46 deletions android/app/src/main/java/app/croma/CromaModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.numixproject.colorextractor.image.Color;
import org.numixproject.colorextractor.image.Image;
import org.numixproject.colorextractor.image.KMeansColorPicker;

public class CromaModule extends ReactContextBaseJavaModule implements ActivityEventListener {

Expand Down Expand Up @@ -110,30 +107,6 @@ private String mapToJsonString(List<Integer> colors) throws JSONException {
@Override
public void onNewIntent(Intent intent) {}

@ReactMethod
public void pickTopColorsFromImage(String uri, Promise promise) {
try {
long startTime = System.currentTimeMillis();
Uri imageUri = Uri.parse(uri);
Bitmap bitmap =
MediaStore.Images.Media.getBitmap(reactContext.getContentResolver(), imageUri);
Image image = new BitmapImage(bitmap);
KMeansColorPicker k = new KMeansColorPicker();
List<Color> colors = k.getUsefulColors(image, 6);
List<Integer> intColors = new ArrayList<>();
for (Color color : colors) {
intColors.add(color.getRGB());
}
Bundle params = new Bundle();
params.putLong(TIME_TAKEN_TO_PROCESS_MS, (System.currentTimeMillis() - startTime));
mFirebaseAnalytics.logEvent(FirebaseAnalyticsConstants.PICK_COLORS_FROM_IMAGE, params);
promise.resolve(mapToJsonString(intColors));
} catch (Exception e) {
e.printStackTrace();
promise.reject(e);
}
}

@ReactMethod
public void navigateToImageColorPicker(String uri, Promise promise) {
this.promise = promise;
Expand Down Expand Up @@ -183,23 +156,4 @@ public Map<String, Object> parseBundleMap(String data) {
}
}

private static class BitmapImage extends Image {
private Bitmap image;

public BitmapImage(Bitmap b) {
super(b.getWidth(), b.getHeight());
this.image = b;
}

@Override
public Color getColor(int x, int y) {
return new Color(image.getPixel(x, y));
}

@Override
public BitmapImage getScaledInstance(int width, int height) {
Bitmap resized = Bitmap.createScaledBitmap(this.image, width, height, true);
return new BitmapImage(resized);
}
}
}
1 change: 0 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ allprojects {
repositories {
mavenCentral()
mavenLocal()
jcenter() // need this because of colorextractor
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
Expand Down

0 comments on commit e59eecc

Please sign in to comment.