Skip to content

Commit

Permalink
deom
Browse files Browse the repository at this point in the history
  • Loading branch information
h11g committed Sep 10, 2019
1 parent 8fc66ab commit 1dea43d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package cn.guanmai.gm_pda_scanner;

import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
Expand All @@ -18,6 +19,7 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mTextView = findViewById(R.id.result);
mTextView.setText("制造商:" + Build.MANUFACTURER);
Button clearText = findViewById(R.id.clear);
clearText.setOnClickListener(new View.OnClickListener() {
@Override
Expand All @@ -32,13 +34,15 @@ private void initScanner() {
mScannerManager = new SupporterManager(this, new SupporterManager.IScanListener() {
@Override
public void onScannerResultChange(String result) {
String s = mTextView.getText().toString() + "\n";
String s = mTextView.getText().toString() + "\n" + "扫描结果:";
mTextView.setText(s + result);
}

@Override
public void onScannerServiceConnected() {
Toast.makeText(MainActivity.this, "扫描头初始化成功", Toast.LENGTH_SHORT).show();
String s = mTextView.getText().toString() + "\n";
mTextView.setText(s + "扫描头初始化成功");
}

@Override
Expand All @@ -49,6 +53,8 @@ public void onScannerServiceDisconnected() {
@Override
public void onScannerInitFail() {
Toast.makeText(MainActivity.this, "无法获取扫描头,请重试!", Toast.LENGTH_SHORT).show();
String s = mTextView.getText().toString() + "\n";
mTextView.setText(s + "无法获取扫描头");
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<resources>
<string name="app_name">gm_pad_scanner</string>
<string name="app_name">gm_pda_scanner</string>
</resources>

0 comments on commit 1dea43d

Please sign in to comment.