...
|
...
|
@@ -16,11 +16,14 @@ import android.view.WindowManager; |
|
|
import android.widget.ImageButton;
|
|
|
import android.widget.Toast;
|
|
|
|
|
|
|
|
|
import com.google.zxing.BarcodeFormat;
|
|
|
import com.google.zxing.DecodeHintType;
|
|
|
import com.google.zxing.Result;
|
|
|
import com.yinhebairong.clasmanage.Config;
|
|
|
import com.yinhebairong.clasmanage.R;
|
|
|
import com.yinhebairong.clasmanage.entity.ErweimaEntity;
|
|
|
import com.yinhebairong.clasmanage.network.ApiService;
|
|
|
import com.yinhebairong.clasmanage.network.ApiStore;
|
|
|
import com.yinhebairong.clasmanage.zxing.Jifen_Activity;
|
|
|
import com.yinhebairong.clasmanage.zxing.camera.CameraManager;
|
|
|
import com.yinhebairong.clasmanage.zxing.view.ViewfinderView;
|
...
|
...
|
@@ -29,6 +32,11 @@ import java.io.IOException; |
|
|
import java.util.Collection;
|
|
|
import java.util.Map;
|
|
|
|
|
|
import io.reactivex.Observer;
|
|
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
|
|
import io.reactivex.disposables.Disposable;
|
|
|
import io.reactivex.schedulers.Schedulers;
|
|
|
|
|
|
/**
|
|
|
* 这个activity打开相机,在后台线程做常规的扫描;它绘制了一个结果view来帮助正确地显示条形码,在扫描的时候显示反馈信息,
|
|
|
* 然后在扫描成功的时候覆盖扫描结果
|
...
|
...
|
@@ -188,10 +196,40 @@ public final class CaptureActivity extends Activity implements |
|
|
Toast.makeText(this, "扫描成功", Toast.LENGTH_SHORT).show();
|
|
|
Intent intent = getIntent();
|
|
|
intent.putExtra("codedContent", rawResult.getText());
|
|
|
intent.putExtra("codedBitmap", barcode);
|
|
|
setResult(RESULT_OK, intent);
|
|
|
Log.i(TAG, "handleDecode: "+rawResult.getText());
|
|
|
ApiStore.createApi(ApiService.class)
|
|
|
.erweima(Config.Token,Config.id,rawResult.getText())
|
|
|
.subscribeOn(Schedulers.io())
|
|
|
.observeOn(AndroidSchedulers.mainThread())
|
|
|
.subscribe(new Observer<ErweimaEntity>() {
|
|
|
@Override
|
|
|
public void onSubscribe(Disposable d) {
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onNext(ErweimaEntity erweimaEntity) {
|
|
|
intent.setClass(CaptureActivity.this, Jifen_Activity.class);
|
|
|
startActivity(intent);
|
|
|
finish();
|
|
|
// if (erweimaEntity.getCode() == M.success){
|
|
|
//
|
|
|
// }else {
|
|
|
//
|
|
|
// }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onError(Throwable e) {
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onComplete() {
|
|
|
|
|
|
}
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
...
|
...
|
|