2828import java .io .File ;
2929import java .io .IOException ;
3030import java .util .ArrayList ;
31+ import java .util .Objects ;
3132
3233public class MainActivity extends AppCompatActivity {
3334
@@ -61,7 +62,7 @@ protected void onCreate(Bundle savedInstanceState) {
6162 /*DEV_HELP : assign registerForActivityResult for getting result from CameraHelper*/
6263 captureActivityResultLauncher = registerForActivityResult (
6364 new ActivityResultContracts .StartActivityForResult (),
64- result -> handleCaptureActivityResult ( result ) );
65+ this :: handleCaptureActivityResult );
6566
6667 /*DEV_HELP : Capture Document with SDK Button click handler*/
6768 findViewById (R .id .getPictureButton ).setOnClickListener (v -> {
@@ -102,11 +103,16 @@ private void SetConfig() {
102103
103104 ImageHelper .SetDPI (200 );//int dpi_val = 100, 150, 200, 300, 500, 600;
104105
106+ Config .CaptureSupport .DocumentCropping = Config .CaptureSupport .CroppingType .AssistedCapture ;
107+
108+ Config .CaptureSupport .CaptureMode = Config .CaptureSupport .CaptureModes .CAMERA_CAPTURE_REVIEW ;
109+
110+
111+ Config .CaptureSupport .ColorMode = Config .CaptureSupport .ColorModes .RBG ;
112+
105113 //can set output file path
106114 Config .CaptureSupport .OutputPath = BuildStoragePath ();
107115
108- Config .CaptureSupport .DocumentCropping = Config .CaptureSupport .CroppingType .AutoCrop ;
109-
110116 Config .CaptureSupport .EnableFlash = true ;
111117
112118 Config .CaptureSupport .CropFilter = Config .CaptureSupport .CropImageFilterType .ENHANCE ;
@@ -116,8 +122,7 @@ private void SetConfig() {
116122 /*DEV_HELP : BuildStoragePath*/
117123 private String BuildStoragePath () {
118124 ContextWrapper c = new ContextWrapper (this );
119- String path = c .getExternalFilesDir (".GoNoGoImages" ).getAbsolutePath ();
120- return path ;
125+ return Objects .requireNonNull (c .getExternalFilesDir (".GoNoGoImages" )).getAbsolutePath ();
121126 }
122127
123128 /*DEV_HELP : handleCaptureActivityResult definition*/
@@ -130,10 +135,11 @@ private void handleCaptureActivityResult(ActivityResult result){
130135 Intent data = result .getData ();
131136 Boolean Status = null ;
132137 if (data != null ) {
133- Status = (Boolean ) data .getExtras ().get ("STATUS" );
138+ Status = (Boolean ) Objects . requireNonNull ( data .getExtras () ).get ("STATUS" );
134139 }
140+ assert data != null ;
135141 String Description = (String ) data .getExtras ().get ("DESCRIPTION" );
136- if (! Status ) {
142+ if (Boolean . FALSE . equals ( Status ) ) {
137143 String imageCaptureLog = "Description : " + Description +
138144 ".Exception: " + Config .CaptureSupport .LastLogInfo ;
139145 Log .d ("INFO" , imageCaptureLog );
0 commit comments