Commit 82681072 authored by Drahomír Karchňák's avatar Drahomír Karchňák

#612 Slightly refactored + comments

parent e9b557e2
...@@ -90,8 +90,8 @@ public class AndroidLauncher extends AndroidApplication { ...@@ -90,8 +90,8 @@ public class AndroidLauncher extends AndroidApplication {
@Override @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) { protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == AndroidCameraOpener.TAKE_PHOTO_CODE){ if (requestCode == AndroidCameraOpener.TAKE_PHOTO_CODE){
Log.info(getClass(), resultCode + " == " + RESULT_OK); Log.info(getClass(), "Take Photo Request Code. ResultCode == " + resultCode);
if(resultCode == RESULT_OK) { if(resultCode == RESULT_OK && cameraOpener.getPhotoPath() != null) {
String imagePath = getPath(cameraOpener.getPhotoPath()); String imagePath = getPath(cameraOpener.getPhotoPath());
Log.info(getClass(), "ImagePath: " + imagePath); Log.info(getClass(), "ImagePath: " + imagePath);
Pixmap resultPixmap = ApplicationAvatarManager.getInstance().createAvatarPixmap(new FileHandle(imagePath)); Pixmap resultPixmap = ApplicationAvatarManager.getInstance().createAvatarPixmap(new FileHandle(imagePath));
......
...@@ -23,7 +23,7 @@ import cz.nic.tablexia.loader.application.ApplicationAvatarManager; ...@@ -23,7 +23,7 @@ import cz.nic.tablexia.loader.application.ApplicationAvatarManager;
public abstract class CameraOpener { public abstract class CameraOpener {
OnPhotoTakenListener onPhotoTakenListener; private OnPhotoTakenListener onPhotoTakenListener;
public interface OnPhotoTakenListener{ public interface OnPhotoTakenListener{
void onPhotoTaken(Pixmap pixmap, boolean success); void onPhotoTaken(Pixmap pixmap, boolean success);
...@@ -51,10 +51,11 @@ public abstract class CameraOpener { ...@@ -51,10 +51,11 @@ public abstract class CameraOpener {
abstract public void deleteTemporaryFile(); abstract public void deleteTemporaryFile();
public void onPhotoTaken(Pixmap pixmap, boolean success){ public void onPhotoTaken(Pixmap pixmap, boolean success){
Pixmap resultPixmap = success ? ApplicationAvatarManager.getInstance().createAvatarPixmap(pixmap) : null;
if (onPhotoTakenListener != null){ if (onPhotoTakenListener != null){
onPhotoTakenListener.onPhotoTaken(resultPixmap, success); onPhotoTakenListener.onPhotoTaken(
success ? ApplicationAvatarManager.getInstance().createAvatarPixmap(pixmap) : null,
success
);
} }
} }
} }
...@@ -145,7 +145,5 @@ public class IOSCameraOpener extends CameraOpener { ...@@ -145,7 +145,5 @@ public class IOSCameraOpener extends CameraOpener {
} }
@Override @Override
public void deleteTemporaryFile() { public void deleteTemporaryFile() { /* No Temporary File Needed! */}
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment