modify scan title
MODIFY
bither-android/src/net/bither/qrcode/ScanActivity.java
bither-android/src/net/bither/qrcode/ScanActivity.java
@@ -45,6 +45,7 @@ import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.FrameLayout;
import android.widget.ImageButton;
+import android.widget.TextView;
import com.google.zxing.BinaryBitmap;
import com.google.zxing.ChecksumException;
@@ -61,6 +62,7 @@ import com.google.zxing.qrcode.QRCodeReader;
import net.bither.BitherSetting;
import net.bither.R;
+import net.bither.bitherj.utils.Utils;
import net.bither.camera.CameraManager;
import net.bither.ui.base.BaseActivity;
import net.bither.ui.base.DropdownMessage;
@@ -88,6 +90,9 @@ public class ScanActivity extends BaseActivity implements SurfaceHolder.Callback
private static final long VIBRATE_DURATION = 50L;
private static final long AUTO_FOCUS_INTERVAL_MS = 2500L;
+ protected TextView tv;
+ protected TextView tvTitle;
+
private final CameraManager cameraManager = new CameraManager();
protected ScannerView scannerView;
private SurfaceHolder surfaceHolder;
@@ -114,7 +119,6 @@ public class ScanActivity extends BaseActivity implements SurfaceHolder.Callback
super.onCreate(savedInstanceState);
overridePendingTransition(0, R.anim.scanner_in_exit);
vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
-
setContentView(R.layout.scan_activity);
flOverlayContainer = (FrameLayout) findViewById(R.id.fl_overlay_container);
scannerView = (ScannerView) findViewById(R.id.scan_activity_mask);
@@ -122,6 +126,12 @@ public class ScanActivity extends BaseActivity implements SurfaceHolder.Callback
ibtnGallery.setOnClickListener(galleryClick);
((CheckBox) findViewById(R.id.cbx_torch)).setOnCheckedChangeListener(this);
fromGallery = false;
+ setOverlay(R.layout.layout_scan_qr_code_transport_overlay);
+ tv = findViewById(R.id.tv);
+ tvTitle = findViewById(R.id.tv_title);
+ if (!Utils.isEmpty(getIntentTitle())) {
+ tvTitle.setText(getIntentTitle());
+ }
}
public void setOverlay(View v) {
@@ -133,6 +143,18 @@ public class ScanActivity extends BaseActivity implements SurfaceHolder.Callback
setOverlay(LayoutInflater.from(this).inflate(resource, null));
}
+ private String getIntentTitle() {
+ String title = null;
+ if (getIntent() != null
+ && getIntent().getExtras() != null
+ && getIntent().getExtras().containsKey(
+ BitherSetting.INTENT_REF.TITLE_STRING)) {
+ title = getIntent().getExtras().getString(
+ BitherSetting.INTENT_REF.TITLE_STRING);
+ }
+ return title;
+ }
+
@Override
protected void onResume() {
super.onResume();

MODIFY
bither-android/src/net/bither/qrcode/ScanQRCodeTransportActivity.java
bither-android/src/net/bither/qrcode/ScanQRCodeTransportActivity.java
@@ -37,8 +37,7 @@ import net.bither.util.PlaySound;
import java.util.ArrayList;
public class ScanQRCodeTransportActivity extends ScanActivity {
- private TextView tv;
- private TextView tvTitle;
+
private int totalPage = 1;
private ArrayList<QRCodeTransportPage> pages;
private String lastResult;
@@ -47,12 +46,8 @@ public class ScanQRCodeTransportActivity extends ScanActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ibtnGallery.setVisibility(View.GONE);
- setOverlay(R.layout.layout_scan_qr_code_transport_overlay);
- tv = (TextView) findViewById(R.id.tv);
- tvTitle = (TextView) findViewById(R.id.tv_title);
pages = new ArrayList<QRCodeTransportPage>();
tv.setText(R.string.scan_qr_transport_init_label);
- configureTitle();
flash();
PlaySound.loadSound(R.raw.qr_code_scanned);
}
@@ -114,18 +109,6 @@ public class ScanQRCodeTransportActivity extends ScanActivity {
return false;
}
- private void configureTitle() {
- String title = null;
- if (getIntent() != null
- && getIntent().getExtras() != null
- && getIntent().getExtras().containsKey(
- BitherSetting.INTENT_REF.TITLE_STRING)) {
- title = getIntent().getExtras().getString(
- BitherSetting.INTENT_REF.TITLE_STRING);
- }
- tvTitle.setText(title);
- }
-
private void flash() {
tv.clearAnimation();
tv.startAnimation(AnimationUtils.loadAnimation(this,

MODIFY
bither-android/src/net/bither/qrcode/ScanQRCodeWithOtherActivity.java
bither-android/src/net/bither/qrcode/ScanQRCodeWithOtherActivity.java
@@ -31,8 +31,7 @@ import net.bither.bitherj.utils.Utils;
import net.bither.util.PlaySound;
public class ScanQRCodeWithOtherActivity extends ScanActivity {
- private TextView tv;
- private TextView tvTitle;
+
private BitherSetting.QRCodeType qrCodeType;
private String lastResult;
@@ -46,11 +45,6 @@ public class ScanQRCodeWithOtherActivity extends ScanActivity {
if (qrCodeType == null) {
finish();
}
- setOverlay(R.layout.layout_scan_qr_code_transport_overlay);
-
- tv = (TextView) findViewById(R.id.tv);
- tvTitle = (TextView) findViewById(R.id.tv_title);
- configureTitle();
flash();
PlaySound.loadSound(R.raw.qr_code_scanned);
}
@@ -87,18 +81,6 @@ public class ScanQRCodeWithOtherActivity extends ScanActivity {
return isValid;
}
- private void configureTitle() {
- String title = null;
- if (getIntent() != null
- && getIntent().getExtras() != null
- && getIntent().getExtras().containsKey(
- BitherSetting.INTENT_REF.TITLE_STRING)) {
- title = getIntent().getExtras().getString(
- BitherSetting.INTENT_REF.TITLE_STRING);
- }
- tvTitle.setText(title);
- }
-
private void flash() {
tv.clearAnimation();
tv.startAnimation(AnimationUtils.loadAnimation(this,

modify scan title