|
|
@ -3,12 +3,21 @@ package com.qhclh.ytzh.work.scan; |
|
|
import android.Manifest; |
|
|
import android.Manifest; |
|
|
import android.content.Intent; |
|
|
import android.content.Intent; |
|
|
import android.support.annotation.NonNull; |
|
|
import android.support.annotation.NonNull; |
|
|
|
|
|
import android.support.v7.widget.Toolbar; |
|
|
|
|
|
import android.view.View; |
|
|
|
|
|
import android.widget.AdapterView; |
|
|
|
|
|
import android.widget.ListView; |
|
|
|
|
|
|
|
|
import com.google.zxing.integration.android.IntentIntegrator; |
|
|
import com.google.zxing.integration.android.IntentIntegrator; |
|
|
import com.google.zxing.integration.android.IntentResult; |
|
|
import com.google.zxing.integration.android.IntentResult; |
|
|
import com.qhclh.ytzh.R; |
|
|
import com.qhclh.ytzh.R; |
|
|
import com.qhclh.ytzh.base.BaseActivity; |
|
|
import com.qhclh.ytzh.base.BaseActivity; |
|
|
|
|
|
import com.qhclh.ytzh.bean.ScanBean; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
import butterknife.BindView; |
|
|
import pub.devrel.easypermissions.AfterPermissionGranted; |
|
|
import pub.devrel.easypermissions.AfterPermissionGranted; |
|
|
import pub.devrel.easypermissions.EasyPermissions; |
|
|
import pub.devrel.easypermissions.EasyPermissions; |
|
|
|
|
|
|
|
|
@ -17,9 +26,16 @@ import pub.devrel.easypermissions.EasyPermissions; |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
public class ScanResultActivity extends BaseActivity { |
|
|
public class ScanResultActivity extends BaseActivity { |
|
|
|
|
|
@BindView(R.id.toolbar) |
|
|
|
|
|
Toolbar mToolbar; |
|
|
|
|
|
@BindView(R.id.lv_infos) |
|
|
|
|
|
ListView lv_infos; |
|
|
private String scanStr = ""; |
|
|
private String scanStr = ""; |
|
|
private boolean scanf = false; |
|
|
private boolean scanf = false; |
|
|
|
|
|
|
|
|
|
|
|
private List<ScanBean> scanBeanList; |
|
|
|
|
|
private ScanAdapter scanAdapter; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
protected int setLayoutId() { |
|
|
protected int setLayoutId() { |
|
|
return R.layout.act_scanresult; |
|
|
return R.layout.act_scanresult; |
|
|
@ -27,17 +43,27 @@ public class ScanResultActivity extends BaseActivity { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
protected void initView() { |
|
|
protected void initView() { |
|
|
|
|
|
|
|
|
|
|
|
initToolbar(mToolbar, "扫码结果", new View.OnClickListener() { |
|
|
|
|
|
@Override |
|
|
|
|
|
public void onClick(View view) { |
|
|
|
|
|
finish(); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
protected void initData() { |
|
|
protected void initData() { |
|
|
|
|
|
|
|
|
|
|
|
scanBeanList = new ArrayList<>(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
protected void initOper() { |
|
|
protected void initOper() { |
|
|
|
|
|
|
|
|
|
|
|
lv_infos.setOnItemClickListener(new AdapterView.OnItemClickListener() { |
|
|
|
|
|
@Override |
|
|
|
|
|
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { |
|
|
|
|
|
showToast(l+""); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@ -88,9 +114,16 @@ public class ScanResultActivity extends BaseActivity { |
|
|
IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data); |
|
|
IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data); |
|
|
if (result != null) { |
|
|
if (result != null) { |
|
|
if (result.getContents() == null) { |
|
|
if (result.getContents() == null) { |
|
|
|
|
|
showToast("取消扫描"); |
|
|
finish(); |
|
|
finish(); |
|
|
} else { |
|
|
} else { |
|
|
scanStr = result.getContents(); |
|
|
scanStr = result.getContents(); |
|
|
|
|
|
for (int i=0;i<4;i++){ |
|
|
|
|
|
scanBeanList.add(new ScanBean(i,"车牌号"+i,"司机"+i,"联系方式"+i,"批次"+i,"厂址"+i, |
|
|
|
|
|
"时间"+i,"数量"+i,"免疫"+i,"均匀度"+i,"起始时间"+i,"到达时间"+i)); |
|
|
|
|
|
} |
|
|
|
|
|
scanAdapter = new ScanAdapter(this,scanBeanList); |
|
|
|
|
|
lv_infos.setAdapter(scanAdapter); |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
super.onActivityResult(requestCode, resultCode, data); |
|
|
super.onActivityResult(requestCode, resultCode, data); |
|
|
|