Skip to content

Commit

Permalink
优化代码
Browse files Browse the repository at this point in the history
  • Loading branch information
ailiwean committed Jul 21, 2020
1 parent 0f0d830 commit 3b4a5eb
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public void loadAble() {
ableList.clear();
// ableList.add(new XQRScanAble(handler));
ableList.add(new XQRScanZoomAble(handler));
ableList.add(new XQRScanFastAble(handler));
ableList.add(new XQRScanAbleRotate(handler));
ableList.add(new LighSolveAble(handler));
ableList.add(new RevColorSanAble(handler));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ public class XQRScanAble extends PixsValuesAble {
protected void needParseDeploy(PlanarYUVLuminanceSource source) {
if (result != null)
return;
result = toLaunchParse(source.getGlobaBinary());
if (result == null)
result = toLaunchParse(source.getHybridBinary());
result = toLaunchParse(source.getHybridBinary());
if (result != null) {
Message.obtain(handler, Config.SCAN_RESULT, covertResult(result)).sendToTarget();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.ailiwean.core.able;

import android.os.Handler;
import android.os.Message;

import com.ailiwean.core.Config;
import com.ailiwean.core.helper.ScanHelper;
import com.ailiwean.core.zxing.core.PlanarYUVLuminanceSource;
import com.ailiwean.core.zxing.core.Result;

/**
* @Package: com.ailiwean.core.able
* @ClassName: XQRScanFast
* @Description:
* @Author: SWY
* @CreateDate: 2020/7/21 2:09 PM
*/
class XQRScanFastAble extends PixsValuesAble {

protected Result result;

public XQRScanFastAble(Handler handler) {
super(handler);
}

@Override
protected void needParseDeploy(PlanarYUVLuminanceSource source) {
if (result != null)
return;
result = toLaunchParse(source.getGlobaBinary());
if (result != null) {
Message.obtain(handler, Config.SCAN_RESULT, covertResult(result)).sendToTarget();
}
}

protected com.ailiwean.core.Result covertResult(Result result) {
com.ailiwean.core.Result result_ = new com.ailiwean.core.Result();
result_.setText(result.getText());
result_.setPointF(ScanHelper.rotatePoint(result.getResultPoints()));
return result_;
}

}

0 comments on commit 3b4a5eb

Please sign in to comment.