Commit 386fc3d0 by Kim Jinsung

#32919 バーコードリーダー

回転時、ダイヤログ非表示
2回目からバーコードリーダー不能
parent 610de350
...@@ -224,6 +224,6 @@ ...@@ -224,6 +224,6 @@
<activity android:name="jp.agentec.abook.abv.ui.home.activity.PairingSettingActivity" <activity android:name="jp.agentec.abook.abv.ui.home.activity.PairingSettingActivity"
android:theme="@style/AppTheme"/> android:theme="@style/AppTheme"/>
<activity android:name="jp.agentec.abook.abv.ui.home.activity.BarCodeReaderActivity" <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> </application>
</manifest> </manifest>
\ No newline at end of file
...@@ -48,19 +48,6 @@ ...@@ -48,19 +48,6 @@
android:layout_height="wrap_content" 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> </LinearLayout>
</LinearLayout> </LinearLayout>
......
...@@ -9,7 +9,6 @@ import android.view.KeyEvent; ...@@ -9,7 +9,6 @@ import android.view.KeyEvent;
import android.view.View; import android.view.View;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.EditText;
import com.honeywell.barcode.HSMDecodeComponent; import com.honeywell.barcode.HSMDecodeComponent;
import com.honeywell.barcode.HSMDecodeResult; import com.honeywell.barcode.HSMDecodeResult;
...@@ -36,8 +35,6 @@ import jp.agentec.abook.abv.ui.home.plugin.BarCodeReaderCustomPluginResultListen ...@@ -36,8 +35,6 @@ import jp.agentec.abook.abv.ui.home.plugin.BarCodeReaderCustomPluginResultListen
public class BarCodeReaderActivity extends ABVUIActivity implements DecodeResultListener, BarCodeReaderCustomPluginResultListener { public class BarCodeReaderActivity extends ABVUIActivity implements DecodeResultListener, BarCodeReaderCustomPluginResultListener {
public HSMDecoder hsmDecoder; public HSMDecoder hsmDecoder;
private EditText editTextDisplay;
private HSMDecodeComponent decCom;
private int scanCount = 0; private int scanCount = 0;
public static final String BARCODE_READING_DATA = "barcode_data"; public static final String BARCODE_READING_DATA = "barcode_data";
private static final String TAG = "BarCodeReaderActivity"; private static final String TAG = "BarCodeReaderActivity";
...@@ -52,6 +49,7 @@ public class BarCodeReaderActivity extends ABVUIActivity implements DecodeResult ...@@ -52,6 +49,7 @@ public class BarCodeReaderActivity extends ABVUIActivity implements DecodeResult
//activate the API with your license key //activate the API with your license key
ActivationResult activationResult = ActivationManager.activate(this, "trial-image-areyn-12062017"); ActivationResult activationResult = ActivationManager.activate(this, "trial-image-areyn-12062017");
Logger.d(TAG, "activationResult = " + activationResult);
//get the singleton instance of the decoder //get the singleton instance of the decoder
hsmDecoder = HSMDecoder.getInstance(this); hsmDecoder = HSMDecoder.getInstance(this);
...@@ -71,6 +69,15 @@ public class BarCodeReaderActivity extends ABVUIActivity implements DecodeResult ...@@ -71,6 +69,15 @@ public class BarCodeReaderActivity extends ABVUIActivity implements DecodeResult
e.printStackTrace(); 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() { public static void onDisposeInstance() {
HSMDecoder.disposeInstance(); HSMDecoder.disposeInstance();
...@@ -100,21 +107,12 @@ public class BarCodeReaderActivity extends ABVUIActivity implements DecodeResult ...@@ -100,21 +107,12 @@ public class BarCodeReaderActivity extends ABVUIActivity implements DecodeResult
} }
private void displayBarcodeData(HSMDecodeResult[] barcodeData) { private void displayBarcodeData(HSMDecodeResult[] barcodeData) {
// Toast.makeText(this, "barcodeData.length : [%d]" + barcodeData.length, Toast.LENGTH_LONG).show();
if( barcodeData.length > 0) { if( barcodeData.length > 0) {
HSMDecodeResult firstResult = barcodeData[0]; HSMDecodeResult firstResult = barcodeData[0];
Logger.d("firstResult.getBarcodeData() = " + firstResult.getBarcodeData());
String msg = "Scan Count: " + ++scanCount + "\n\n" + if (scanCount == 0) {
"onHSMDecodeResult\n" + scanCount = 1;
"Data: " + firstResult.getBarcodeData() + "\n" +
"Symbology: " + firstResult.getSymbology() + "\n" +
"Length: " + firstResult.getBarcodeDataLength() + "\n" +
"Decode Time: " + firstResult.getDecodeTime() + "ms";
if (scanCount == 1) {
hsmDecoder.enableSound(false); hsmDecoder.enableSound(false);
editTextDisplay.setText(msg);
// Toast.makeText(this, "Activation Result: " + msg, Toast.LENGTH_LONG).show();
final String readingBarcodeData = firstResult.getBarcodeData(); final String readingBarcodeData = firstResult.getBarcodeData();
ABookAlertDialog saveDialog = AlertDialogUtil.createAlertDialog(this, getString(R.string.barcode)); ABookAlertDialog saveDialog = AlertDialogUtil.createAlertDialog(this, getString(R.string.barcode));
...@@ -127,6 +125,9 @@ public class BarCodeReaderActivity extends ABVUIActivity implements DecodeResult ...@@ -127,6 +125,9 @@ public class BarCodeReaderActivity extends ABVUIActivity implements DecodeResult
Intent intent = new Intent(); Intent intent = new Intent();
intent.putExtra(BARCODE_READING_DATA, readingBarcodeData); intent.putExtra(BARCODE_READING_DATA, readingBarcodeData);
setResult(Activity.RESULT_OK, intent); setResult(Activity.RESULT_OK, intent);
scanCount = 0;
hsmDecoder.enableSound(true);
finish(); finish();
} }
}); });
...@@ -149,14 +150,7 @@ public class BarCodeReaderActivity extends ABVUIActivity implements DecodeResult ...@@ -149,14 +150,7 @@ public class BarCodeReaderActivity extends ABVUIActivity implements DecodeResult
this.requestWindowFeature(Window.FEATURE_NO_TITLE); this.requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
this.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); this.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.barcode_reader); 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 //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