Skip to content

Commit

Permalink
- Exception handling for autofocus
Browse files Browse the repository at this point in the history
  • Loading branch information
PavlosIsaris committed Oct 8, 2022
1 parent 8eb0656 commit 3302667
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ android {
applicationId "gr.scify.icsee"
minSdkVersion 16
targetSdkVersion 32
versionCode 39
versionCode 41
versionName "5.0.0"
}

Expand Down
10 changes: 6 additions & 4 deletions app/src/main/java/gr/scify/icsee/ICSeeRealtimeActivity.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package gr.scify.icsee;

import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
Expand Down Expand Up @@ -41,7 +40,7 @@
import gr.scify.icsee.filters.opencv.matfilters.MatWhiteRedFilter;
import gr.scify.icsee.sounds.SoundPlayer;

public class ICSeeRealtimeActivity extends Activity implements OnGesturePerformedListener {
public class ICSeeRealtimeActivity extends LocalizedActivity implements OnGesturePerformedListener {
private GestureLibrary gestureLib;
public RealtimeFilterView mView = null;
public static Context mContext;
Expand Down Expand Up @@ -77,7 +76,11 @@ public void onCreate(Bundle savedInstanceState) {

inflate.setOnLongClickListener(arg0 -> {
//perform auto focus and take picture
focusAndTakePhoto();
try {
focusAndTakePhoto();
} catch (RuntimeException e) {
e.printStackTrace();
}
return true;
});

Expand All @@ -92,7 +95,6 @@ public void run() {
};

public void focusAndTakePhoto() {

mView.mCamera.autoFocus((success, camera) -> {
currentFilter = mView.curFilterSubset();
if (currentFilter.equals("")) {
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/java/gr/scify/icsee/camera/ImageView.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class ImageView extends LocalizedActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mContext = this;
setContentView(R.layout.activity_image_edit2);
img = new TouchImageView(this);
Bundle extras = getIntent().getExtras();
Expand All @@ -41,13 +42,11 @@ protected void onCreate(Bundle savedInstanceState) {
e.printStackTrace();
}
}
mContext = this;
}

@Override
protected void onResume() {
super.onResume();
Log.i(TAG, "playSound");
ICSeeTutorial.playAdjustZoom(mContext);
}

Expand Down

0 comments on commit 3302667

Please sign in to comment.