mirror of
https://github.com/jfoucry/Pilldroid.git
synced 2024-11-22 04:29:22 +01:00
Add start of managing buttons (cancel and keyboard)
This commit is contained in:
parent
09ec2771d2
commit
ebb40a8dde
1 changed files with 18 additions and 0 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue