use of im.actor.core.js.images.JsResizeListener in project actor-platform by actorapp.
the class JsMessenger method sendAnimation.
public void sendAnimation(final Peer peer, final JsFile file) {
Log.d(TAG, "Resizing animation");
JsImageResize.resize(file, new JsResizeListener() {
@Override
public void onResized(String thumb, int thumbW, int thumbH, int fullW, int fullH) {
Log.d(TAG, "Animation resized");
int index = thumb.indexOf("base64,");
if (index < 0) {
Log.d(TAG, "Unable to find base64");
return;
}
String rawData = thumb.substring(index + "base64,".length());
byte[] thumbData = Base64Utils.fromBase64(rawData);
String descriptor = fileSystemProvider.registerUploadFile(file);
sendAnimation(peer, file.getName(), fullW, fullH, new FastThumb(thumbW, thumbH, thumbData), descriptor);
}
});
}
use of im.actor.core.js.images.JsResizeListener in project actor-platform by actorapp.
the class JsMessenger method sendPhoto.
public void sendPhoto(final Peer peer, final String fileName, final JsBlob blob) {
Log.d(TAG, "Resizing photo");
JsImageResize.resize(blob, new JsResizeListener() {
@Override
public void onResized(String thumb, int thumbW, int thumbH, int fullW, int fullH) {
Log.d(TAG, "Photo resized");
int index = thumb.indexOf("base64,");
if (index < 0) {
Log.d(TAG, "Unable to find base64");
return;
}
String rawData = thumb.substring(index + "base64,".length());
byte[] thumbData = Base64Utils.fromBase64(rawData);
String descriptor = fileSystemProvider.registerUploadFile(blob);
sendPhoto(peer, fileName, fullW, fullH, new FastThumb(thumbW, thumbH, thumbData), descriptor);
}
});
}
Aggregations