diff --git a/app/src/main/java/net/foucry/pilldroid/CustomScannerActivity.java b/app/src/main/java/net/foucry/pilldroid/CustomScannerActivity.java index 0370192..b23f4e4 100644 --- a/app/src/main/java/net/foucry/pilldroid/CustomScannerActivity.java +++ b/app/src/main/java/net/foucry/pilldroid/CustomScannerActivity.java @@ -7,6 +7,7 @@ import android.os.Bundle; import android.view.KeyEvent; import android.view.View; import android.widget.Button; +import android.widget.ImageButton; import androidx.annotation.NonNull; @@ -26,6 +27,8 @@ public class CustomScannerActivity extends Activity implements private DecoratedBarcodeView barcodeScannerView; private Button switchFlashlightButton; private ViewfinderView viewfinderView; + private ImageButton cancelButton; + private ImageButton keyboardButton; @Override protected void onCreate(Bundle savedInstanceState) { @@ -35,6 +38,9 @@ public class CustomScannerActivity extends Activity implements barcodeScannerView = findViewById(R.id.zxing_barcode_scanner); barcodeScannerView.setTorchListener(this); + cancelButton = findViewById(R.id.cancel_button); + keyboardButton = findViewById(R.id.keyboard_button); + switchFlashlightButton = findViewById(R.id.switch_flashlight); viewfinderView = findViewById(R.id.zxing_viewfinder_view); @@ -124,4 +130,16 @@ public class CustomScannerActivity extends Activity implements public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { capture.onRequestPermissionsResult(requestCode, permissions, grantResults); } + + public void onCancel() + { + setResult(2); + finish(); + } + + public void onKeyboard() + { + setResult(3); + finish(); + } }