Commit 386fc3d0 by Kim Jinsung

#32919 バーコードリーダー

回転時、ダイヤログ非表示
2回目からバーコードリーダー不能
parent 610de350
......@@ -224,6 +224,6 @@
<activity android:name="jp.agentec.abook.abv.ui.home.activity.PairingSettingActivity"
android:theme="@style/AppTheme"/>
<activity android:name="jp.agentec.abook.abv.ui.home.activity.BarCodeReaderActivity"
android:theme="@style/AppTheme"/>
android:theme="@style/AppTheme" android:configChanges="keyboardHidden|orientation|screenSize"/>
</application>
</manifest>
\ No newline at end of file
......@@ -48,19 +48,6 @@
android:layout_height="wrap_content"
/>
<EditText
android:id="@+id/editTextDisplay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:ems="10"
android:gravity="top"
android:inputType="textMultiLine" >
<requestFocus />
</EditText>
</LinearLayout>
</LinearLayout>
</LinearLayout>
......
......@@ -9,7 +9,6 @@ import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.EditText;
import com.honeywell.barcode.HSMDecodeComponent;
import com.honeywell.barcode.HSMDecodeResult;
......@@ -36,8 +35,6 @@ import jp.agentec.abook.abv.ui.home.plugin.BarCodeReaderCustomPluginResultListen
public class BarCodeReaderActivity extends ABVUIActivity implements DecodeResultListener, BarCodeReaderCustomPluginResultListener {
public HSMDecoder hsmDecoder;
private EditText editTextDisplay;
private HSMDecodeComponent decCom;
private int scanCount = 0;
public static final String BARCODE_READING_DATA = "barcode_data";
private static final String TAG = "BarCodeReaderActivity";
......@@ -52,6 +49,7 @@ public class BarCodeReaderActivity extends ABVUIActivity implements DecodeResult
//activate the API with your license key
ActivationResult activationResult = ActivationManager.activate(this, "trial-image-areyn-12062017");
Logger.d(TAG, "activationResult = " + activationResult);
//get the singleton instance of the decoder
hsmDecoder = HSMDecoder.getInstance(this);
......@@ -71,6 +69,15 @@ public class BarCodeReaderActivity extends ABVUIActivity implements DecodeResult
e.printStackTrace();
}
}
@Override
public void onDestroy()
{
super.onDestroy();
//dispose of the decoder instance, this stops the underlying camera service and releases all associated resources
HSMDecoder.disposeInstance();
}
public static void onDisposeInstance() {
HSMDecoder.disposeInstance();
......@@ -100,21 +107,12 @@ public class BarCodeReaderActivity extends ABVUIActivity implements DecodeResult
}
private void displayBarcodeData(HSMDecodeResult[] barcodeData) {
// Toast.makeText(this, "barcodeData.length : [%d]" + barcodeData.length, Toast.LENGTH_LONG).show();
if( barcodeData.length > 0) {
HSMDecodeResult firstResult = barcodeData[0];
String msg = "Scan Count: " + ++scanCount + "\n\n" +
"onHSMDecodeResult\n" +
"Data: " + firstResult.getBarcodeData() + "\n" +
"Symbology: " + firstResult.getSymbology() + "\n" +
"Length: " + firstResult.getBarcodeDataLength() + "\n" +
"Decode Time: " + firstResult.getDecodeTime() + "ms";
if (scanCount == 1) {
Logger.d("firstResult.getBarcodeData() = " + firstResult.getBarcodeData());
if (scanCount == 0) {
scanCount = 1;
hsmDecoder.enableSound(false);
editTextDisplay.setText(msg);
// Toast.makeText(this, "Activation Result: " + msg, Toast.LENGTH_LONG).show();
final String readingBarcodeData = firstResult.getBarcodeData();
ABookAlertDialog saveDialog = AlertDialogUtil.createAlertDialog(this, getString(R.string.barcode));
......@@ -127,6 +125,9 @@ public class BarCodeReaderActivity extends ABVUIActivity implements DecodeResult
Intent intent = new Intent();
intent.putExtra(BARCODE_READING_DATA, readingBarcodeData);
setResult(Activity.RESULT_OK, intent);
scanCount = 0;
hsmDecoder.enableSound(true);
finish();
}
});
......@@ -149,14 +150,7 @@ public class BarCodeReaderActivity extends ABVUIActivity implements DecodeResult
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
this.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.barcode_reader);
decCom = (HSMDecodeComponent)findViewById(R.id.hsm_decodeComponent);
editTextDisplay = (EditText)findViewById(R.id.editTextDisplay);
editTextDisplay.setEnabled(false);
editTextDisplay.setTextColor(Color.WHITE);
}
//set all decoder related settings
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment