Skip to content
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
2 changes: 1 addition & 1 deletion mobile/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ android {
applicationId "ie.yesequality.yesequality"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionCode 2
versionName "1.0.0"
}

Expand Down
18 changes: 12 additions & 6 deletions mobile/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
package="ie.yesequality.yesequality"
xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ie.yesequality.yesequality">

<uses-feature android:name="android.hardware.camera"/>
<uses-feature android:name="android.hardware.camera.front"/>
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<uses-feature
android:name="android.hardware.camera.front"
android:required="false" />
<uses-feature
android:name="android.hardware.camera.autofocus"
android:required="false" />

<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.CAMERA" />

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
Expand Down
24 changes: 13 additions & 11 deletions mobile/src/main/java/ie/yesequality/yesequality/CameraFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public class CameraFragment extends Fragment implements TextureView.SurfaceTextu
private int mCameraId;



/**
* Determine the current display orientation and rotate the mCamera preview
* accordingly.
Expand Down Expand Up @@ -133,13 +132,14 @@ public void onResume() {
*/
public void takePicture() {
orientationListener.rememberOrientation();

mCamera.takePicture(null, null, this);
if (mCamera != null) {
mCamera.takePicture(null, null, this);
} else {
Toast.makeText(getActivity(), "Unable to take a picture because the camera is not connected. :(", Toast.LENGTH_LONG).show();
}
}




private Bitmap overlay(Bitmap bmp1, Bitmap bmp2, float left, float top, int parentWidth, int
parentHeight) {
//Bitmap bmOverlay = Bitmap.createBitmap(bmp1.getWidth(), bmp1.getHeight(), bmp1
Expand Down Expand Up @@ -175,10 +175,10 @@ private Bitmap bitmapScaler(Bitmap bitmap, int newWidth, int newHeight) {

Canvas canvas = new Canvas(scaledBitmap);
canvas.setMatrix(scaleMatrix);
Paint paint =new Paint(Paint.FILTER_BITMAP_FLAG);
Paint paint = new Paint(Paint.FILTER_BITMAP_FLAG);
paint.setAntiAlias(true);
canvas.drawBitmap(bitmap, middleX - bitmap.getWidth() / 2, middleY - bitmap.getHeight() /
2,paint );
2, paint);

return scaledBitmap;
}
Expand Down Expand Up @@ -306,19 +306,21 @@ public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int hei

@Override
public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
// Ignored, Camera does all the work for us
// Ignored, Camera does all the work for us
}

@Override
public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
mCamera.stopPreview();
mCamera.release();
if (mCamera != null) {
mCamera.stopPreview();
mCamera.release();
}
return true;
}

@Override
public void onSurfaceTextureUpdated(SurfaceTexture surface) {
// Invoked every time there's a new Camera preview frame
// Invoked every time there's a new Camera preview frame
}


Expand Down