Conflicts:
	android/ZBarScannerActivity.java
	android/res/layout/cszbarscanner.xml
	plugin.xml
This commit is contained in:
Nick German 2015-03-26 07:27:36 +10:00
commit 80a3632a15
3 changed files with 29 additions and 11 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.DS_Store
._*

View File

@ -38,6 +38,7 @@ import net.sourceforge.zbar.Config;
public class ZBarScannerActivity extends Activity public class ZBarScannerActivity extends Activity
implements SurfaceHolder.Callback { implements SurfaceHolder.Callback {
//for barcode types
private Collection<BarcodeFormat> mFormats = null; private Collection<BarcodeFormat> mFormats = null;
// Config ---------------------------------------------------------- // Config ----------------------------------------------------------
@ -109,9 +110,9 @@ implements SurfaceHolder.Callback {
setContentView(getResourceId("layout/cszbarscanner")); setContentView(getResourceId("layout/cszbarscanner"));
// Update view with customisable strings // Update view with customisable strings
//TextView view_textTitle = (TextView) findViewById(getResourceId("id/csZbarScannerTitle")); TextView view_textTitle = (TextView) findViewById(getResourceId("id/csZbarScannerTitle"));
TextView view_textInstructions = (TextView) findViewById(getResourceId("id/csZbarScannerInstructions")); TextView view_textInstructions = (TextView) findViewById(getResourceId("id/csZbarScannerInstructions"));
//view_textTitle.setText(textTitle); view_textTitle.setText(textTitle);
view_textInstructions.setText(textInstructions); view_textInstructions.setText(textInstructions);
// Draw/hide the sight // Draw/hide the sight
@ -138,7 +139,8 @@ implements SurfaceHolder.Callback {
// Add preview SurfaceView to the screen // Add preview SurfaceView to the screen
FrameLayout scannerView = (FrameLayout) findViewById(getResourceId("id/csZbarScannerView")); FrameLayout scannerView = (FrameLayout) findViewById(getResourceId("id/csZbarScannerView"));
scannerView.addView(scannerSurface); scannerView.addView(scannerSurface);
//findViewById(getResourceId("id/csZbarScannerTitle")).bringToFront();
findViewById(getResourceId("id/csZbarScannerTitle")).bringToFront();
findViewById(getResourceId("id/csZbarScannerInstructions")).bringToFront(); findViewById(getResourceId("id/csZbarScannerInstructions")).bringToFront();
findViewById(getResourceId("id/csZbarScannerSightContainer")).bringToFront(); findViewById(getResourceId("id/csZbarScannerSightContainer")).bringToFront();
findViewById(getResourceId("id/csZbarScannerSight")).bringToFront(); findViewById(getResourceId("id/csZbarScannerSight")).bringToFront();
@ -253,7 +255,7 @@ implements SurfaceHolder.Callback {
{ {
public void onAutoFocus(boolean success, Camera camera) { public void onAutoFocus(boolean success, Camera camera) {
// some devices crash without this try/catch and cancelAutoFocus()... (#9) // some devices crash without this try/catch and cancelAutoFocus()... (#9)
try { try {
camera.cancelAutoFocus(); camera.cancelAutoFocus();
autoFocusHandler.postDelayed(doAutoFocus, autoFocusInterval); autoFocusHandler.postDelayed(doAutoFocus, autoFocusInterval);
} catch (Exception e) {} } catch (Exception e) {}
@ -368,6 +370,7 @@ implements SurfaceHolder.Callback {
return mFormats; return mFormats;
} }
// Start the camera preview if possible. // Start the camera preview if possible.
// If start is attempted but fails, exit with error message. // If start is attempted but fails, exit with error message.
private void tryStartPreview () { private void tryStartPreview () {
@ -380,7 +383,7 @@ implements SurfaceHolder.Callback {
camera.setPreviewCallback(previewCb); camera.setPreviewCallback(previewCb);
camera.startPreview(); camera.startPreview();
//camera.autoFocus(autoFocusCb); // We are not using any of the //camera.autoFocus(autoFocusCb); // We are not using any of the
// continuous autofocus modes as that does not seem to work // continuous autofocus modes as that does not seem to work
// well with flash setting of "on"... At least with this // well with flash setting of "on"... At least with this
// simple and stupid focus method, we get to turn the flash // simple and stupid focus method, we get to turn the flash
// on during autofocus. // on during autofocus.

View File

@ -5,7 +5,20 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/csZbarScannerBackground" > android:background="@color/csZbarScannerBackground" >
<TextView android:id="@+id/csZbarScannerTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top|center_horizontal"
android:paddingTop="15dp"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:gravity="center"
android:text="@string/csZbarScannerTitle"
android:textColor="@color/csZbarScannerTextColor"
android:background="@color/csZbarScannerTextBackground"
android:fontFamily="sans-serif-light"
android:textSize="20pt" />
<TextView android:id="@+id/csZbarScannerInstructions" <TextView android:id="@+id/csZbarScannerInstructions"
android:layout_gravity="bottom|center_horizontal" android:layout_gravity="bottom|center_horizontal"