cocos_android/app/src/com/cege/games/release/activity/CustomCaptureActivity.java
2023-09-15 11:45:09 +08:00

48 lines
1.2 KiB
Java

package com.cege.games.release.activity;
import static com.cege.games.release.ui.UIManager.JUMP_CODE_PHOTO;
import static com.cege.games.release.ui.UIManager.KEY_TITLE;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;
import com.cege.games.release.R;
import com.king.zxing.CaptureActivity;
public class CustomCaptureActivity extends CaptureActivity {
private static final String TAG = CustomCaptureActivity.class.getSimpleName();
@Override
public int getLayoutId() {
return R.layout.custom_capture_activity;
}
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
Intent in = getIntent();
String title = in.getStringExtra(KEY_TITLE);
Button localBtn = findViewById(R.id.qrLocalBtn);
localBtn.setOnClickListener(v -> onClickLocalImg());
TextView titleLabel = findViewById(R.id.scanQrTitleLabel);
titleLabel.setText(title);
}
@Override
public void initCameraScan() {
super.initCameraScan();
getCameraScan()
.setPlayBeep(true)
.setVibrate(true);
}
protected void onClickLocalImg(){
Intent ins=new Intent();
setResult(JUMP_CODE_PHOTO, ins);
finish();
}
}