Skip to content

Commit

Permalink
抽取字符串
Browse files Browse the repository at this point in the history
  • Loading branch information
maning committed Aug 11, 2016
1 parent e3b04cf commit 7720977
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 23 deletions.
24 changes: 7 additions & 17 deletions libraryzxing/src/main/java/com/baozi/Zxing/CaptureActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ public class CaptureActivity extends Activity implements Callback, OnClickListen
private ImageView mo_scanner_light;
private boolean isShowHistory;

/**
* Called when the activity is first created.
*/

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -81,10 +79,6 @@ public void onCreate(Bundle savedInstanceState) {
hasSurface = false;
inactivityTimer = new InactivityTimer(this);

//初始化动画
initAnimation();


}

private void initAnimation() {
Expand Down Expand Up @@ -125,6 +119,9 @@ private void initView() {
mo_scanner_histroy.setVisibility(View.VISIBLE);
}

//初始化动画
initAnimation();

}

boolean flag = true;
Expand Down Expand Up @@ -187,7 +184,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {

private void analysisImage(final String photoPath) {
if (TextUtils.isEmpty(photoPath)) {
Toast.makeText(this, "获取图片失败", Toast.LENGTH_SHORT).show();
Toast.makeText(this, R.string.libraryzxing_get_pic_fail, Toast.LENGTH_SHORT).show();
return;
}
new Thread(new Runnable() {
Expand All @@ -198,7 +195,7 @@ public void run() {
@Override
public void run() {
if (TextUtils.isEmpty(result)) {
Toast.makeText(CaptureActivity.this, "图片格式错误", Toast.LENGTH_SHORT).show();
Toast.makeText(CaptureActivity.this, R.string.libraryzxing_get_pic_fail, Toast.LENGTH_SHORT).show();
} else {
// 数据返回
Intent data = new Intent();
Expand Down Expand Up @@ -298,8 +295,7 @@ public Handler getHandler() {
}

public void drawViewfinder() {
// viewfinderView.drawViewfinder();

viewfinderView.drawViewfinder();
}

public void handleDecode(final Result result, Bitmap barcode) {
Expand All @@ -315,9 +311,6 @@ public void handleDecode(final Result result, Bitmap barcode) {

private void initBeepSound() {
if (playBeep && mediaPlayer == null) {
// The volume on STREAM_SYSTEM is not adjustable, and users found it
// too loud,
// so we now play on the music stream.
setVolumeControlStream(AudioManager.STREAM_MUSIC);
mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
Expand Down Expand Up @@ -349,9 +342,6 @@ private void playBeepSoundAndVibrate() {
}
}

/**
* When the beep has finished playing, rewind to queue up another one.
*/
private final OnCompletionListener beepListener = new OnCompletionListener() {
public void onCompletion(MediaPlayer mediaPlayer) {
mediaPlayer.seekTo(0);
Expand Down
10 changes: 4 additions & 6 deletions libraryzxing/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<resources>

<string name="app_name">BaoziZxing</string>
<string name="hello_world">Hello world!</string>
<string name="action_settings">Settings</string>

<string name="app_name">libraryZxing</string>
<string name="libraryzxing_get_pic_fail">获取图片失败</string>
<string name="libraryzxing_analysis_pic_fail">图片格式错误</string>
</resources>

0 comments on commit 7720977

Please sign in to comment.