Commit d77aad46eae1e111d0869d3c7ff4bdb84a058c73

Authored by 杜方
1 parent 96b488c3

畅游通核销app: 1.适配5501H读身份证 2.适配5501H扫码头显示方向

.gitignore
1   -#/CYTAndroid4.0.iml
2   -#build.gradle
3   -#local.properties
4   -#license.dat
5   -#proguard-project.txt
6   -#local.properties
7   -#gradle
8   -#.gradle
9   -#.idea
10   -#*.iml
11   -#.project
12   -#gradlew
13   -#gradlew.bat
14   -#.gitignore
15   -#build
16   -#.settings
17   -#project.properties
18   -#/release/
  1 +/CYTAndroid4.0.iml
  2 +build.gradle
  3 +local.properties
  4 +license.dat
  5 +proguard-project.txt
  6 +local.properties
  7 +gradle
  8 +.gradle
  9 +.idea
  10 +*.iml
  11 +.project
  12 +gradlew
  13 +gradlew.bat
  14 +.gitignore
  15 +build
  16 +.settings
  17 +project.properties
  18 +/release/
... ...
AndroidManifest.xml
... ... @@ -239,6 +239,13 @@
239 239 android:screenOrientation="portrait"
240 240 android:theme="@style/Theme"
241 241 android:windowSoftInputMode="adjustPan|stateHidden" />
  242 + <activity
  243 + android:name="com.ectrip.cyt.ui.BlackIdCardActivity"
  244 + android:configChanges="orientation|keyboardHidden"
  245 + android:launchMode="singleTask"
  246 + android:screenOrientation="portrait"
  247 + android:theme="@style/Theme"
  248 + android:windowSoftInputMode="adjustPan|stateHidden" />
242 249 <!-- 身份证显示列表页面 -->
243 250 <activity
244 251 android:name="com.ectrip.cyt.ui.IDOrderListActivity"
... ...
CYTAndroid4.0.iml
... ... @@ -97,6 +97,7 @@
97 97 <orderEntry type="library" name="Gradle: ./libs/zbar.jar" level="project" />
98 98 <orderEntry type="library" name="Gradle: ./libs/zxing.jar" level="project" />
99 99 <orderEntry type="library" name="Gradle: ./libs/gson-2.6.2.jar" level="project" />
  100 + <orderEntry type="library" name="Gradle: ./libs/zypos1.8.jar" level="project" />
100 101 <orderEntry type="library" name="Gradle: ./libs/bw_pos_sdk2.0.18.jar" level="project" />
101 102 </component>
102 103 </module>
103 104 \ No newline at end of file
... ...
build.gradle
... ... @@ -30,6 +30,7 @@ dependencies {
30 30 implementation files('libs/zbar.jar')
31 31 implementation files('libs/zxing.jar')
32 32 implementation files('libs/gson-2.6.2.jar')
  33 + implementation files('libs\\zypos1.8.jar')
33 34 compileOnly files('external_libs/classes_2.1.11_20160907.jar')
34 35 compileOnly files('external_libs/bw_odm_20160526.jar')
35 36 implementation files('libs/bw_pos_sdk2.0.18.jar')
... ... @@ -37,7 +38,11 @@ dependencies {
37 38  
38 39 android {
39 40 compileSdkVersion 24
40   -
  41 + defaultConfig {
  42 + ndk {
  43 + abiFilters "armeabi-v7a"//可以适当补填其他
  44 + }
  45 + }
41 46  
42 47 buildTypes {
43 48 release {
... ...
res/layout/app_settings.xml
... ... @@ -355,18 +355,17 @@
355 355  
356 356 <TextView
357 357 android:id="@+id/version"
358   - android:layout_toRightOf="@id/version_number"
359   - android:layout_centerVertical="true"
360 358 android:layout_width="wrap_content"
361 359 android:layout_height="wrap_content"
  360 + android:layout_centerVertical="true"
362 361 android:layout_marginTop="10dp"
  362 + android:layout_toRightOf="@id/version_number"
363 363 android:gravity="center|left"
364 364 android:padding="10dp"
365 365 android:singleLine="true"
366   - android:textSize="18sp"
367   - android:textColor="#333333"
368 366 android:text=""
369   - />
  367 + android:textColor="#333333"
  368 + android:textSize="18sp" />
370 369  
371 370  
372 371 <Button
... ...
src/com/ectrip/cyt/config/DevicTool.java
... ... @@ -29,6 +29,7 @@ import android.os.Message;
29 29 import android.telephony.TelephonyManager;
30 30 import android.text.TextUtils;
31 31 import android.util.DisplayMetrics;
  32 +import android.util.Log;
32 33 import android.view.Display;
33 34 import android.view.WindowManager;
34 35  
... ... @@ -480,5 +481,18 @@ public class DevicTool {
480 481 return false;
481 482 }
482 483 }
483   -
  484 + public static boolean isHiboryPos() {
  485 + try {
  486 + String sn = android.os.Build.MODEL;
  487 + Log.d("SN", sn);
  488 + if (TextUtils.equals(sn, "5501H")) {
  489 + return true;
  490 + } else {
  491 + return false;
  492 + }
  493 + } catch (Exception e) {
  494 + e.printStackTrace();
  495 + return false;
  496 + }
  497 + }
484 498 }
... ...
src/com/ectrip/cyt/config/MyApp.java
... ... @@ -629,8 +629,33 @@ public class MyApp extends BaseApplication {
629 629 }
630 630 System.exit(0);
631 631 }
  632 + private SerialPort mSerialPort = null;
  633 +
  634 + public SerialPort getSerialPort() throws SecurityException, IOException, InvalidParameterException {
  635 + if (mSerialPort == null) {
  636 + /* Read serial port parameters */
  637 + SharedPreferences sp = getSharedPreferences("android_serialport_api.sample_preferences", MODE_PRIVATE);
  638 + String path = sp.getString("DEVICE", "/dev/ttyMT2");
  639 + int baudrate = Integer.decode(sp.getString("BAUDRATE", "115200"));
  640 +
  641 + /* Check parameters */
  642 + if ( (path.length() == 0) || (baudrate == -1)) {
  643 + throw new InvalidParameterException();
  644 + }
632 645  
633   -
  646 + /* Open the serial port */
  647 + // mSerialPort = new SerialPort(new File("/dev/ttySAC1"), 9600, 0);
  648 + mSerialPort = new SerialPort(new File("/dev/ttyMT3"), 115200, 0);
  649 +// mSerialPort = new SerialPort(new File("/dev/ttyS1"), baudrate, 0);
  650 + }
  651 + return mSerialPort;
  652 + }
  653 + public void closeSerialPort() {
  654 + if (mSerialPort != null) {
  655 + mSerialPort.close();
  656 + mSerialPort = null;
  657 + }
  658 + }
634 659  
635 660  
636 661 }
... ...
src/com/ectrip/cyt/constant/DeviceType.java
... ... @@ -14,8 +14,9 @@ public enum DeviceType {
14 14 //New_IDPOS:新的身份证pos机
15 15 //New_HANDSET_POS:新版小的pos(手持pos)机
16 16 //BASEWIN_REB_POS:盛本的红色pos机
  17 + //BLACK_ID_POS:5501H手持机
17 18 ID_POS(5),GENERAL_POS(6),SMALL_POS(7),HANDSET(8),MOBILE(9),New_POS(10),
18   - New_IDPOS(11),New_HANDSET_POS(12),BASEWIN_REB_POS(13);
  19 + New_IDPOS(11),New_HANDSET_POS(12),BASEWIN_REB_POS(13),BLACK_ID_POS(14);
19 20 private int value;
20 21  
21 22 private DeviceType(int value) {
... ...
src/com/ectrip/cyt/ui/MainActivity.java
... ... @@ -37,6 +37,7 @@ import com.ectrip.cyt.base.DataTrans;
37 37 import com.ectrip.cyt.bean.ConfigBean;
38 38 import com.ectrip.cyt.bean.ImageInfo;
39 39 import com.ectrip.cyt.callback.HttpCallback;
  40 +import com.ectrip.cyt.center.PosApiHandle;
40 41 import com.ectrip.cyt.config.BindService;
41 42 import com.ectrip.cyt.config.DevicTool;
42 43 import com.ectrip.cyt.config.MyApp;
... ... @@ -91,8 +92,14 @@ public class MainActivity extends BaseActivity implements OnItemClickListener, V
91 92 initView();
92 93 regularDelecte();
93 94 typeJudgment();
  95 +// initPOsSdk(); //初始化硬件
  96 + }
  97 + private void initPOsSdk() {
  98 + if (DevicTool.isHiboryPos()) {
  99 + PosApiHandle.getInstance().initSdk(this).openScan();
  100 + PosApiHandle.getInstance().initIDread();
  101 + }
94 102 }
95   -
96 103 /**
97 104 * 删除配置文件
98 105 */
... ... @@ -137,6 +144,7 @@ public class MainActivity extends BaseActivity implements OnItemClickListener, V
137 144 // 得到存储的类型
138 145 Integer type = SharedPreferences2Obj.getInstance(MainActivity.this)
139 146 .setName("MachineType").getObject("type", Integer.class);
  147 + LogUtil.d(TAG, "type = " + type);
140 148 //如果未存储类型
141 149 if (type == null || type == 0) {
142 150 DisplayMetrics metrics = new DisplayMetrics();
... ... @@ -153,6 +161,13 @@ public class MainActivity extends BaseActivity implements OnItemClickListener, V
153 161 SharedPreferences2Obj.getInstance(MainActivity.this)
154 162 .setName("MachineType")
155 163 .setObject("type", DeviceType.New_POS.getValue());
  164 + } else if (DevicTool.getInstance().isHiboryPos()) {
  165 + LogUtil.d(TAG, "5501H手持机");
  166 + // 5501H手持机
  167 + LogUtil.i(getString(R.string.handset));
  168 + SharedPreferences2Obj.getInstance(MainActivity.this)
  169 + .setName("MachineType")
  170 + .setObject("type", DeviceType.BLACK_ID_POS.getValue());
156 171 } else if ((getSerialNumber() != null
157 172 && getSerialNumber().contains("LY") && getSerialNumber()
158 173 .substring(0, 2).equals("LY"))) {
... ... @@ -268,12 +283,12 @@ public class MainActivity extends BaseActivity implements OnItemClickListener, V
268 283 String ec_signkey = AESEncryptor.decrypt(constant.decrypt,
269 284 listConfig.get(0).getEc_signkey());
270 285 MyApp.getInstance().setSignkey(ec_signkey);
271   - LogUtil.i("MainActivity","ec_signkey = "+ ec_signkey);
  286 + LogUtil.i("MainActivity", "ec_signkey = " + ec_signkey);
272 287 } catch (Exception e) {
273 288 e.printStackTrace();
274 289 }
275 290 MyApp.getInstance().setIdentity(listConfig.get(0).getEc_identity());
276   - LogUtil.i("MainActivity", "getEc_identity = "+listConfig.get(0).getEc_identity());
  291 + LogUtil.i("MainActivity", "getEc_identity = " + listConfig.get(0).getEc_identity());
277 292 LogUtil.d(TAG, getString(R.string.current_ip)
278 293 + MyApp.getInstance().getServiceIp());
279 294 return true;
... ...
src/com/ectrip/cyt/ui/SelectActionActivity.java
1 1 package com.ectrip.cyt.ui;
2 2  
3 3 import java.util.ArrayList;
  4 +import java.util.Date;
4 5  
5 6 import android.content.Intent;
  7 +import android.media.MediaPlayer;
6 8 import android.os.Bundle;
  9 +import android.os.Handler;
  10 +import android.os.Message;
  11 +import android.posapi.PosApi;
  12 +import android.text.TextUtils;
7 13 import android.view.KeyEvent;
8 14 import android.view.View;
9 15 import android.view.View.OnClickListener;
... ... @@ -11,333 +17,434 @@ import android.widget.AdapterView;
11 17 import android.widget.AdapterView.OnItemClickListener;
12 18 import android.widget.GridView;
13 19 import android.widget.TextView;
  20 +import android.widget.Toast;
14 21  
15 22 import com.ectrip.cyt.adapter.GridDataAdapter;
16 23 import com.ectrip.cyt.bean.ImageInfo;
  24 +import com.ectrip.cyt.center.PosApiHandle;
  25 +import com.ectrip.cyt.config.DevicTool;
17 26 import com.ectrip.cyt.config.MyApp;
18 27 import com.ectrip.cyt.constant.DeviceType;
19 28 import com.ectrip.cyt.constant.Module;
20 29 import com.ectrip.cyt.constant.SelectAction;
21 30 import com.ectrip.cyt.utils.ActivitiesManager;
22 31 import com.ectrip.cyt.utils.CommetryUtils;
  32 +import com.ectrip.cyt.utils.CountDownTimer;
23 33 import com.ectrip.cyt.utils.LogUtil;
24 34 import com.ectrip.cyt.utils.SharedPreferences2Obj;
25 35 import com.ectrip.trips.check.R;
26 36 import com.fri.idcread.idcread;
27 37  
28 38 /**
29   - *
30 39 * 检票操作 选择页面,包含扫二维码 身份证 串码
31 40 *
32 41 * @author jigo
33 42 */
34 43 public class SelectActionActivity extends BaseActivity implements
35   - OnItemClickListener {
36   - public final String TAG = "MainActivity";
37   - private GridView gridView1;
38   - private GridDataAdapter adapter;
39   - private String titleName;
  44 + OnItemClickListener {
  45 + public final String TAG = "MainActivity";
  46 + private GridView gridView1;
  47 + private GridDataAdapter adapter;
  48 + private String titleName;
  49 +
  50 + private Integer Select; // 选择模式 检票 补票 查票
  51 + private Integer type; // 类型
  52 + private PosApi mPosSDK = null;
  53 + private byte mGpioTrig = 0x29;// PC9
  54 + MediaPlayer player;
  55 +
  56 + /**
  57 + * 执行扫描,扫描后的结果会通过action为PosApi.ACTION_POS_COMM_STATUS的广播发回
  58 + */
  59 + Handler handler = new Handler() {
  60 + @Override
  61 + public void handleMessage(Message msg) {
  62 + super.handleMessage(msg);
  63 +
  64 + switch (msg.what) {
  65 +
  66 + case 3:
  67 + try {
  68 + Bundle bundle = msg.getData();
  69 + String id = bundle.getString("id");
  70 + if (TextUtils.isEmpty(id)) return;
  71 + player.start();
  72 +// Toast.makeText(SelectActionActivity.this, "身份号码:" + id, Toast.LENGTH_SHORT).show();
  73 + Intent intent = new Intent(SelectActionActivity.this,
  74 + IDOrderListActivity.class);
  75 + CountDownTimer.firstTime = new Date().getTime();// 不必要的可以删除
  76 + intent.putExtra("mode", 0);
  77 + intent.putExtra("idcardNumber", id);
  78 + intent.putExtra("titleName", getString(R.string.order_list));
  79 + startActivity(intent);
  80 + } catch (IllegalStateException e) {
  81 + e.printStackTrace();
  82 + }
  83 + break;
  84 + }
  85 +
  86 +
  87 + }
  88 + };
  89 + @Override
  90 + protected void onCreate(Bundle savedInstanceState) {
  91 + super.onCreate(savedInstanceState);
  92 +
  93 + setContentView(R.layout.app_selection_action);
  94 + ActivitiesManager.getInstance().pushActivity(this);
  95 + initView();
  96 + init();
  97 +// if (DevicTool.isHiboryPos()) {
  98 +// initScan();
  99 +// }
  100 + }
  101 +
  102 + private void initView() {
  103 + if (Select == null) {
  104 + Select = SharedPreferences2Obj
  105 + .getInstance(SelectActionActivity.this)
  106 + .setName("SelectAction").getObject("Select", Integer.class);
  107 + titleName = SharedPreferences2Obj
  108 + .getInstance(SelectActionActivity.this)
  109 + .setName("SelectAction")
  110 + .getObject("titleName", String.class);
  111 + }
40 112  
41   - private Integer Select; // 选择模式 检票 补票 查票
42   - private Integer type; // 类型
  113 + if (titleName != null) {
  114 + ((TextView) findViewById(R.id.title)).setText(titleName);
  115 + } else {
  116 + ((TextView) findViewById(R.id.title)).setText(R.string.operational);
  117 + }
43 118  
44   - @Override
45   - protected void onCreate(Bundle savedInstanceState) {
46   - super.onCreate(savedInstanceState);
  119 + ((TextView) findViewById(R.id.title)).setVisibility(View.VISIBLE);
47 120  
48   - setContentView(R.layout.app_selection_action);
49   - ActivitiesManager.getInstance().pushActivity(this);
50   - initView();
51   - init();
52   - }
  121 + gridView1 = (GridView) findViewById(R.id.gridView1);
  122 + LogUtil.i(TAG, "==data==" + initData().size());
  123 + gridView1.setNumColumns(2);
  124 + adapter = new GridDataAdapter(SelectActionActivity.this, initData());
  125 + gridView1.setAdapter(adapter);
  126 + gridView1.setOnItemClickListener(this);
53 127  
54   - private void initView() {
55   - if (Select == null) {
56   - Select = SharedPreferences2Obj
57   - .getInstance(SelectActionActivity.this)
58   - .setName("SelectAction").getObject("Select", Integer.class);
59   - titleName = SharedPreferences2Obj
60   - .getInstance(SelectActionActivity.this)
61   - .setName("SelectAction")
62   - .getObject("titleName", String.class);
63   - }
  128 + findViewById(R.id.topBack).setOnClickListener(new OnClickListener() {
  129 + @Override
  130 + public void onClick(View v) {
  131 + finish();
  132 + }
  133 + });
  134 + }
64 135  
65   - if (titleName != null) {
66   - ((TextView) findViewById(R.id.title)).setText(titleName);
67   - } else {
68   - ((TextView) findViewById(R.id.title)).setText(R.string.operational);
69   - }
  136 + private void init() {
  137 + type = SharedPreferences2Obj.getInstance(SelectActionActivity.this)
  138 + .setName("MachineType").getObject("type", Integer.class);
  139 + // 扫描提示音
  140 + player = MediaPlayer.create(getApplicationContext(),
  141 + R.raw.beep);
  142 + }
70 143  
71   - ((TextView) findViewById(R.id.title)).setVisibility(View.VISIBLE);
  144 + private void initScan() {
  145 + // 获取PosApi实例
  146 + mPosSDK = PosApiHandle.getInstance().getPosApi();
  147 + }
72 148  
73   - gridView1 = (GridView) findViewById(R.id.gridView1);
74   - LogUtil.i(TAG, "==data==" + initData().size());
75   - gridView1.setNumColumns(2);
76   - adapter = new GridDataAdapter(SelectActionActivity.this, initData());
77   - gridView1.setAdapter(adapter);
78   - gridView1.setOnItemClickListener(this);
  149 + private ArrayList<ImageInfo> initData() {
  150 + ArrayList<ImageInfo> data = new ArrayList<ImageInfo>();
  151 + data.add(new ImageInfo(getString(R.string.select_action_phone),
  152 + R.drawable.phone_selector, R.drawable.icon_bg02, Module.PHONE));
  153 + data.add(new ImageInfo(getString(R.string.scan_qr_code),
  154 + R.drawable.scan_selector, R.drawable.icon_bg02, Module.SCAN_QR));
  155 + data.add(new ImageInfo(getString(R.string.id_card), R.drawable.id_selector,
  156 + R.drawable.icon_bg02, Module.IDCARD));
  157 + data.add(new ImageInfo(getString(R.string.select_action_order_id),
  158 + R.drawable.order_selector, R.drawable.icon_bg02, Module.OREDR));
  159 + return data;
  160 + }
79 161  
80   - findViewById(R.id.topBack).setOnClickListener(new OnClickListener() {
81   - @Override
82   - public void onClick(View v) {
83   - finish();
84   - }
85   - });
86   - }
87 162  
88   - private void init() {
89   - type = SharedPreferences2Obj.getInstance(SelectActionActivity.this)
90   - .setName("MachineType").getObject("type", Integer.class);
91   - }
  163 + @Override
  164 + public boolean onKeyDown(int keyCode, KeyEvent event) {
  165 + if (keyCode == KeyEvent.KEYCODE_BACK) {
  166 + try {
  167 + CommetryUtils.releaseCommery(this);
  168 + } catch (Exception e) {
  169 + e.printStackTrace();
  170 + }
  171 + finish();
  172 + }
  173 + return false;
  174 + }
92 175  
93   - private ArrayList<ImageInfo> initData() {
94   - ArrayList<ImageInfo> data = new ArrayList<ImageInfo>();
95   - data.add(new ImageInfo(getString(R.string.select_action_phone),
96   - R.drawable.phone_selector, R.drawable.icon_bg02, Module.PHONE));
97   - data.add(new ImageInfo(getString(R.string.scan_qr_code),
98   - R.drawable.scan_selector, R.drawable.icon_bg02, Module.SCAN_QR));
99   - data.add(new ImageInfo(getString(R.string.id_card), R.drawable.id_selector,
100   - R.drawable.icon_bg02, Module.IDCARD));
101   - data.add(new ImageInfo(getString(R.string.select_action_order_id),
102   - R.drawable.order_selector, R.drawable.icon_bg02, Module.OREDR));
103   - return data;
104   - }
  176 + Runnable run = new Runnable() {
  177 + @Override
  178 + public void run() {
  179 + // TODO Auto-generated method stub
  180 + // 强制关闭扫描头
  181 + mPosSDK.gpioControl(mGpioTrig, 0, 1);
  182 + isScan = false;
  183 + }
  184 + };
105 185  
  186 + boolean isScan = false;
106 187  
107   - @Override
108   - public boolean onKeyDown(int keyCode, KeyEvent event) {
109   - if (keyCode == KeyEvent.KEYCODE_BACK) {
110   - try {
111   - CommetryUtils.releaseCommery(this);
112   - } catch (Exception e) {
113   - e.printStackTrace();
114   - }
115   - finish();
116   - }
117   - return false;
118   - }
  188 + public void ScanDomn() {
  189 + if (!isScan) {
  190 + mPosSDK.gpioControl(mGpioTrig, 0, 0);
  191 + isScan = true;
  192 + handler.removeCallbacks(run);
  193 + // 3秒后还没有扫描到信息则强制关闭扫描头
  194 + handler.postDelayed(run, 3000);
  195 + } else {
  196 + mPosSDK.gpioControl(mGpioTrig, 0, 1);
  197 + mPosSDK.gpioControl(mGpioTrig, 0, 0);
  198 + isScan = true;
  199 + handler.removeCallbacks(run);
  200 + // 3秒后还没有扫描到信息则强制关闭扫描头
  201 + handler.postDelayed(run, 3000);
  202 + }
  203 + }
119 204  
120   - @Override
121   - public void onItemClick(AdapterView<?> parent, View view, int position,long id) {
122   - MyApp.getInstance().setCheckType(-1);
123   - Intent intent = null;
124   - ImageInfo obj = (ImageInfo) view.getTag(R.id.imageView1);
125   - switch (obj.getTag()) {
126   - case SCAN_QR:// 扫二维码
127   - MyApp.getInstance().setCheckType(0);
128   - if (type == DeviceType.GENERAL_POS.getValue()
129   - || type == DeviceType.ID_POS.getValue()
130   - || type == DeviceType.SMALL_POS.getValue()) {
131   - intent = new Intent(SelectActionActivity.this,
132   - ScanerOrderActivity.class);
133   - if (Select != null) {
134   - if (Select == SelectAction.Check.getValue()) {
135   - intent.putExtra("titleName",
136   - getString(R.string.check_scan_code));
137   - } else if (Select == SelectAction.Reprint.getValue()) {
138   - intent.putExtra("titleName",
139   - getString(R.string.repriint_scan_code));
140   - } else if (Select == SelectAction.Query.getValue()) {
141   - intent.putExtra("titleName",
142   - getString(R.string.query_scan_code));
143   - }
144   - } else {
145   - intent.putExtra("titleName",
146   - getString(R.string.scan_qr_code));
147   - }
148   - startActivity(intent);
149   - } else if (type == DeviceType.BASEWIN_REB_POS.getValue()) {
150   - //盛本的红色pos机
151   - Intent intent3 = new Intent(SelectActionActivity.this,
152   - PhomeScanerOrderActivity.class);
153   - if (Select != null) {
154   - if (Select == SelectAction.Check.getValue()) {
155   - intent3.putExtra("titleName",
156   - getString(R.string.check_scan_code));
157   - } else if (Select == SelectAction.Reprint.getValue()) {
158   - intent3.putExtra("titleName",
159   - getString(R.string.repriint_scan_code));
160   - } else if (Select == SelectAction.Query.getValue()) {
161   - intent3.putExtra("titleName",
162   - getString(R.string.query_scan_code));
163   - }
164   - } else {
165   - intent3.putExtra("titleName",
166   - getString(R.string.scan_qr_code));
167   - }
168   - startActivity(intent3);
  205 + @Override
  206 + public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
  207 + MyApp.getInstance().setCheckType(-1);
  208 + Intent intent = null;
  209 + ImageInfo obj = (ImageInfo) view.getTag(R.id.imageView1);
  210 + switch (obj.getTag()) {
  211 + case SCAN_QR:// 扫二维码
  212 + MyApp.getInstance().setCheckType(0);
  213 + if (type == DeviceType.GENERAL_POS.getValue()
  214 + || type == DeviceType.ID_POS.getValue()
  215 + || type == DeviceType.SMALL_POS.getValue()) {
  216 + intent = new Intent(SelectActionActivity.this,
  217 + ScanerOrderActivity.class);
  218 + if (Select != null) {
  219 + if (Select == SelectAction.Check.getValue()) {
  220 + intent.putExtra("titleName",
  221 + getString(R.string.check_scan_code));
  222 + } else if (Select == SelectAction.Reprint.getValue()) {
  223 + intent.putExtra("titleName",
  224 + getString(R.string.repriint_scan_code));
  225 + } else if (Select == SelectAction.Query.getValue()) {
  226 + intent.putExtra("titleName",
  227 + getString(R.string.query_scan_code));
  228 + }
  229 + } else {
  230 + intent.putExtra("titleName",
  231 + getString(R.string.scan_qr_code));
  232 + }
  233 + startActivity(intent);
  234 + } else if (type == DeviceType.BASEWIN_REB_POS.getValue()) {
  235 + //盛本的红色pos机
  236 + Intent intent3 = new Intent(SelectActionActivity.this,
  237 + PhomeScanerOrderActivity.class);
  238 + if (Select != null) {
  239 + if (Select == SelectAction.Check.getValue()) {
  240 + intent3.putExtra("titleName",
  241 + getString(R.string.check_scan_code));
  242 + } else if (Select == SelectAction.Reprint.getValue()) {
  243 + intent3.putExtra("titleName",
  244 + getString(R.string.repriint_scan_code));
  245 + } else if (Select == SelectAction.Query.getValue()) {
  246 + intent3.putExtra("titleName",
  247 + getString(R.string.query_scan_code));
  248 + }
  249 + } else {
  250 + intent3.putExtra("titleName",
  251 + getString(R.string.scan_qr_code));
  252 + }
  253 + startActivity(intent3);
169 254  
170   - }else if (type == DeviceType.HANDSET.getValue()) { // 手持机 二维码功能
171   - // idcread.setpower("/sys/class/gpio/gpio28/value", false);
172   - // idcread.setpower("/sys/class/gpio/gpio114/value",
173   - // true);//
174   - // 给二代证下电
175   - // MToast(SelectActionActivity.this,
176   - // "使用其他功能!",MToast.LENGTH_SHORT);
177   - Intent intent2 = new Intent(SelectActionActivity.this,
178   - NewHandleScanerActivity.class);
179   - if (Select != null) {
180   - if (Select == SelectAction.Check.getValue()) {
181   - intent2.putExtra("titleName",
182   - getString(R.string.check_scan_code));
183   - } else if (Select == SelectAction.Reprint.getValue()) {
184   - intent2.putExtra("titleName",
185   - getString(R.string.repriint_scan_code));
186   - } else if (Select == SelectAction.Query.getValue()) {
187   - intent2.putExtra("titleName",
188   - getString(R.string.query_scan_code));
189   - }
190   - } else {
191   - intent2.putExtra("titleName",
192   - getString(R.string.scan_qr_code));
193   - }
194   - startActivity(intent2);
195   - } else {
196   - intent = new Intent(SelectActionActivity.this,
197   - PhomeScanerOrderActivity.class);
198   - if (Select != null) {
199   - if (Select == SelectAction.Check.getValue()) {
200   - intent.putExtra("titleName",
201   - getString(R.string.check_scan_code));
202   - } else if (Select == SelectAction.Reprint.getValue()) {
203   - intent.putExtra("titleName",
204   - getString(R.string.repriint_scan_code));
205   - } else if (Select == SelectAction.Query.getValue()) {
206   - intent.putExtra("titleName",
207   - getString(R.string.query_scan_code));
208   - }
209   - } else {
210   - intent.putExtra("titleName",
211   - getString(R.string.scan_qr_code));
212   - }
213   - startActivity(intent);
214   - }
215   - break;
216   - case CODE:// 验证码
217   - intent = new Intent(SelectActionActivity.this,
218   - InputCodeActivity.class);
219   - if (Select != null) {
220   - if (Select == SelectAction.Check.getValue()) {
221   - intent.putExtra("titleName",
222   - getString(R.string.check_captcha));
223   - } else if (Select == SelectAction.Reprint.getValue()) {
224   - intent.putExtra("titleName",
225   - getString(R.string.reprint_captcha));
226   - } else if (Select == SelectAction.Query.getValue()) {
227   - intent.putExtra("titleName",
228   - getString(R.string.query_captcha));
229   - }
230   - } else {
231   - intent.putExtra("titleName", getString(R.string.captcha));
232   - }
233   - startActivity(intent);
234   - break;
235   - case IDCARD:// 身份证
236   - // 判断是不是039b移动POS机
237   - if (type == DeviceType.ID_POS.getValue()
238   - || type == DeviceType.New_IDPOS.getValue()) {
239   - intent = new Intent(SelectActionActivity.this,
240   - SerialIdCardPortActivity.class);
241   - if (Select != null) {
242   - if (Select == SelectAction.Check.getValue()) {
243   - intent.putExtra("titleName",
244   - getString(R.string.check_idcard));
245   - } else if (Select == SelectAction.Reprint.getValue()) {
246   - intent.putExtra("titleName",
247   - getString(R.string.reprint_idcard));
248   - } else if (Select == SelectAction.Query.getValue()) {
249   - intent.putExtra("titleName",
250   - getString(R.string.query_idcard));
251   - }
252   - } else {
253   - intent.putExtra("titleName", getString(R.string.idcard));
254   - }
255   - startActivity(intent);
256   - } else if (idcread.isIdcard("/dev/ttySAC1")) {
257   - // xxx = "打开手持机串口成功!";
258   - intent = new Intent(SelectActionActivity.this,
259   - ScanerIdCardActivity.class);
260   - if (Select != null) {
261   - if (Select == SelectAction.Check.getValue()) {
262   - intent.putExtra("titleName",
263   - getString(R.string.check_idcard));
264   - } else if (Select == SelectAction.Reprint.getValue()) {
265   - intent.putExtra("titleName",
266   - getString(R.string.reprint_idcard));
267   - } else if (Select == SelectAction.Query.getValue()) {
268   - intent.putExtra("titleName",
269   - getString(R.string.query_idcard));
270   - }
271   - } else {
272   - intent.putExtra("titleName", getString(R.string.idcard));
273   - }
274   - startActivity(intent);
275   - } else {
276   - // xxx = "打开手持机串口失败!";
277   - intent = new Intent(SelectActionActivity.this,
278   - InputIdCardActivity.class);
279   - if (Select != null) {
280   - if (Select == SelectAction.Check.getValue()) {
281   - intent.putExtra("titleName",
282   - getString(R.string.check_idcard));
283   - } else if (Select == SelectAction.Reprint.getValue()) {
284   - intent.putExtra("titleName",
285   - getString(R.string.reprint_idcard));
286   - } else if (Select == SelectAction.Query.getValue()) {
287   - intent.putExtra("titleName",
288   - getString(R.string.query_idcard));
289   - }
290   - } else {
291   - intent.putExtra("titleName", getString(R.string.idcard));
292   - }
293   - startActivity(intent);
294   - }
295   - break;
296   - case PHONE:// 手机号
297   - intent = new Intent(SelectActionActivity.this,
298   - InputPhoneActivity.class);
299   - if (Select != null) {
300   - if (Select == SelectAction.Check.getValue()) {
301   - intent.putExtra("titleName",
302   - getString(R.string.check_phone));
303   - } else if (Select == SelectAction.Reprint.getValue()) {
304   - intent.putExtra("titleName",
305   - getString(R.string.reprint_phone));
306   - } else if (Select == SelectAction.Query.getValue()) {
307   - intent.putExtra("titleName",
308   - getString(R.string.query_phone));
309   - }
310   - } else {
311   - intent.putExtra("titleName", getString(R.string.phone));
312   - }
313   - startActivity(intent);
314   - break;
315   - case OREDR:// 订单号
316   - intent = new Intent(SelectActionActivity.this,
317   - InputOridActivity.class);
318   - if (Select != null) {
319   - if (Select == SelectAction.Check.getValue()) {
320   - intent.putExtra("titleName",
321   - getString(R.string.check_order_id));
322   - } else if (Select == SelectAction.Reprint.getValue()) {
323   - intent.putExtra("titleName",
324   - getString(R.string.reprint_order_id));
325   - } else if (Select == SelectAction.Query.getValue()) {
326   - intent.putExtra("titleName",
327   - getString(R.string.query_order_id));
328   - }
329   - } else {
330   - intent.putExtra("titleName", getString(R.string.orderid));
331   - }
332   - startActivity(intent);
333   - break;
  255 + } else if (type == DeviceType.HANDSET.getValue()) { // 手持机 二维码功能
  256 + // idcread.setpower("/sys/class/gpio/gpio28/value", false);
  257 + // idcread.setpower("/sys/class/gpio/gpio114/value",
  258 + // true);//
  259 + // 给二代证下电
  260 + // MToast(SelectActionActivity.this,
  261 + // "使用其他功能!",MToast.LENGTH_SHORT);
  262 + Intent intent2 = new Intent(SelectActionActivity.this,
  263 + NewHandleScanerActivity.class);
  264 + if (Select != null) {
  265 + if (Select == SelectAction.Check.getValue()) {
  266 + intent2.putExtra("titleName",
  267 + getString(R.string.check_scan_code));
  268 + } else if (Select == SelectAction.Reprint.getValue()) {
  269 + intent2.putExtra("titleName",
  270 + getString(R.string.repriint_scan_code));
  271 + } else if (Select == SelectAction.Query.getValue()) {
  272 + intent2.putExtra("titleName",
  273 + getString(R.string.query_scan_code));
  274 + }
  275 + } else {
  276 + intent2.putExtra("titleName",
  277 + getString(R.string.scan_qr_code));
  278 + }
  279 + startActivity(intent2);
  280 + }
  281 +// else if (type == DeviceType.BLACK_ID_POS.getValue()) {
  282 +// ScanDomn();
  283 +// }
  284 + else {
  285 + intent = new Intent(SelectActionActivity.this,
  286 + PhomeScanerOrderActivity.class);
  287 + if (Select != null) {
  288 + if (Select == SelectAction.Check.getValue()) {
  289 + intent.putExtra("titleName",
  290 + getString(R.string.check_scan_code));
  291 + } else if (Select == SelectAction.Reprint.getValue()) {
  292 + intent.putExtra("titleName",
  293 + getString(R.string.repriint_scan_code));
  294 + } else if (Select == SelectAction.Query.getValue()) {
  295 + intent.putExtra("titleName",
  296 + getString(R.string.query_scan_code));
  297 + }
  298 + } else {
  299 + intent.putExtra("titleName",
  300 + getString(R.string.scan_qr_code));
  301 + }
  302 + startActivity(intent);
  303 + }
  304 + break;
  305 + case CODE:// 验证码
  306 + intent = new Intent(SelectActionActivity.this,
  307 + InputCodeActivity.class);
  308 + if (Select != null) {
  309 + if (Select == SelectAction.Check.getValue()) {
  310 + intent.putExtra("titleName",
  311 + getString(R.string.check_captcha));
  312 + } else if (Select == SelectAction.Reprint.getValue()) {
  313 + intent.putExtra("titleName",
  314 + getString(R.string.reprint_captcha));
  315 + } else if (Select == SelectAction.Query.getValue()) {
  316 + intent.putExtra("titleName",
  317 + getString(R.string.query_captcha));
  318 + }
  319 + } else {
  320 + intent.putExtra("titleName", getString(R.string.captcha));
  321 + }
  322 + startActivity(intent);
  323 + break;
  324 + case IDCARD:// 身份证
  325 + // 判断是不是039b移动POS机
  326 + if (type == DeviceType.ID_POS.getValue()
  327 + || type == DeviceType.New_IDPOS.getValue()) {
  328 + intent = new Intent(SelectActionActivity.this,
  329 + SerialIdCardPortActivity.class);
  330 + if (Select != null) {
  331 + if (Select == SelectAction.Check.getValue()) {
  332 + intent.putExtra("titleName",
  333 + getString(R.string.check_idcard));
  334 + } else if (Select == SelectAction.Reprint.getValue()) {
  335 + intent.putExtra("titleName",
  336 + getString(R.string.reprint_idcard));
  337 + } else if (Select == SelectAction.Query.getValue()) {
  338 + intent.putExtra("titleName",
  339 + getString(R.string.query_idcard));
  340 + }
  341 + } else {
  342 + intent.putExtra("titleName", getString(R.string.idcard));
  343 + }
  344 + startActivity(intent);
  345 + } else if (type == DeviceType.BLACK_ID_POS.getValue()) {
  346 + intent = new Intent(SelectActionActivity.this,
  347 + BlackIdCardActivity.class);
  348 + if (Select != null) {
  349 + if (Select == SelectAction.Check.getValue()) {
  350 + intent.putExtra("titleName",
  351 + getString(R.string.check_idcard));
  352 + } else if (Select == SelectAction.Reprint.getValue()) {
  353 + intent.putExtra("titleName",
  354 + getString(R.string.reprint_idcard));
  355 + } else if (Select == SelectAction.Query.getValue()) {
  356 + intent.putExtra("titleName",
  357 + getString(R.string.query_idcard));
  358 + }
  359 + } else {
  360 + intent.putExtra("titleName", getString(R.string.idcard));
  361 + }
  362 + startActivity(intent);
  363 + } else if (idcread.isIdcard("/dev/ttySAC1")) {
  364 + // xxx = "打开手持机串口成功!";
  365 + intent = new Intent(SelectActionActivity.this,
  366 + ScanerIdCardActivity.class);
  367 + if (Select != null) {
  368 + if (Select == SelectAction.Check.getValue()) {
  369 + intent.putExtra("titleName",
  370 + getString(R.string.check_idcard));
  371 + } else if (Select == SelectAction.Reprint.getValue()) {
  372 + intent.putExtra("titleName",
  373 + getString(R.string.reprint_idcard));
  374 + } else if (Select == SelectAction.Query.getValue()) {
  375 + intent.putExtra("titleName",
  376 + getString(R.string.query_idcard));
  377 + }
  378 + } else {
  379 + intent.putExtra("titleName", getString(R.string.idcard));
  380 + }
  381 + startActivity(intent);
  382 + } else {
  383 + // xxx = "打开手持机串口失败!";
  384 + intent = new Intent(SelectActionActivity.this,
  385 + InputIdCardActivity.class);
  386 + if (Select != null) {
  387 + if (Select == SelectAction.Check.getValue()) {
  388 + intent.putExtra("titleName",
  389 + getString(R.string.check_idcard));
  390 + } else if (Select == SelectAction.Reprint.getValue()) {
  391 + intent.putExtra("titleName",
  392 + getString(R.string.reprint_idcard));
  393 + } else if (Select == SelectAction.Query.getValue()) {
  394 + intent.putExtra("titleName",
  395 + getString(R.string.query_idcard));
  396 + }
  397 + } else {
  398 + intent.putExtra("titleName", getString(R.string.idcard));
  399 + }
  400 + startActivity(intent);
  401 + }
  402 + break;
  403 + case PHONE:// 手机号
  404 + intent = new Intent(SelectActionActivity.this,
  405 + InputPhoneActivity.class);
  406 + if (Select != null) {
  407 + if (Select == SelectAction.Check.getValue()) {
  408 + intent.putExtra("titleName",
  409 + getString(R.string.check_phone));
  410 + } else if (Select == SelectAction.Reprint.getValue()) {
  411 + intent.putExtra("titleName",
  412 + getString(R.string.reprint_phone));
  413 + } else if (Select == SelectAction.Query.getValue()) {
  414 + intent.putExtra("titleName",
  415 + getString(R.string.query_phone));
  416 + }
  417 + } else {
  418 + intent.putExtra("titleName", getString(R.string.phone));
  419 + }
  420 + startActivity(intent);
  421 + break;
  422 + case OREDR:// 订单号
  423 + intent = new Intent(SelectActionActivity.this,
  424 + InputOridActivity.class);
  425 + if (Select != null) {
  426 + if (Select == SelectAction.Check.getValue()) {
  427 + intent.putExtra("titleName",
  428 + getString(R.string.check_order_id));
  429 + } else if (Select == SelectAction.Reprint.getValue()) {
  430 + intent.putExtra("titleName",
  431 + getString(R.string.reprint_order_id));
  432 + } else if (Select == SelectAction.Query.getValue()) {
  433 + intent.putExtra("titleName",
  434 + getString(R.string.query_order_id));
  435 + }
  436 + } else {
  437 + intent.putExtra("titleName", getString(R.string.orderid));
  438 + }
  439 + startActivity(intent);
  440 + break;
334 441 // case STATISTIC:
335 442 // intent = new Intent(SelectActionActivity.this,
336 443 // StatisticsActivity.class);
337 444 // intent.putExtra("titleName", getString(R.string.statistic));
338 445 // startActivity(intent);
339 446 // break;
340   - }
341   - }
  447 + }
  448 + }
342 449  
343 450 }
... ...
src/com/ectrip/cyt/zxing/camera/CameraConfigurationManager.java
... ... @@ -84,7 +84,8 @@ final class CameraConfigurationManager {
84 84 Integer type = SharedPreferences2Obj.getInstance(context)
85 85 .setName("MachineType").getObject("type", Integer.class);
86 86 if (type == DeviceType.HANDSET.getValue()
87   - || type == DeviceType.MOBILE.getValue()||type == DeviceType.BASEWIN_REB_POS.getValue()) {
  87 + || type == DeviceType.MOBILE.getValue()||type == DeviceType.BASEWIN_REB_POS.getValue()
  88 + ||type == DeviceType.BLACK_ID_POS.getValue()) {
88 89 setDisplayOrientation(camera, 90);
89 90 }
90 91 camera.setParameters(parameters);
... ...