Commit fe95a7d1123d750f85b09b260763a59d7e27b123

Authored by 杜方
1 parent c1300a1b

畅游通核销app:1.type为14的手持机刷身份证界面增加手动输入身份证

res/layout/activity_black_idcard.xml
... ... @@ -14,7 +14,14 @@
14 14 android:layout_weight="1"
15 15 android:orientation="vertical"
16 16 android:weightSum="5">
17   -
  17 + <TextView
  18 + android:id="@+id/tips"
  19 + android:layout_width="match_parent"
  20 + android:layout_height="@dimen/dp_48"
  21 + android:background="@color/showBlue"
  22 + android:gravity="center"
  23 + android:text="@string/induction_zone"
  24 + android:textSize="@dimen/sp_25" />
18 25 <ImageView
19 26 android:layout_width="wrap_content"
20 27 android:layout_height="wrap_content"
... ... @@ -23,13 +30,13 @@
23 30 android:src="@drawable/black_idcard" />
24 31  
25 32 <TextView
26   - android:layout_width="wrap_content"
27   - android:layout_height="wrap_content"
28   - android:layout_gravity="center_horizontal"
29   - android:layout_marginBottom="10dp"
30   - android:alpha="0.8"
31   - android:text="@string/induction_zone"
32   - android:textSize="20sp" />
  33 + android:id="@+id/tv_no_id"
  34 + android:layout_width="match_parent"
  35 + android:layout_height="@dimen/dp_68"
  36 + android:background="@color/showBlue"
  37 + android:gravity="center"
  38 + android:text=" -点击手输身份证- "
  39 + android:textSize="@dimen/sp_25" />
33 40 </LinearLayout>
34 41  
35 42 </LinearLayout>
36 43 \ No newline at end of file
... ...
src/com/ectrip/cyt/ui/BlackIdCardActivity.java
1 1 package com.ectrip.cyt.ui;
2 2  
  3 +import android.content.Context;
3 4 import android.content.Intent;
4 5 import android.media.MediaPlayer;
5 6 import android.os.Bundle;
6 7 import android.os.Handler;
7 8 import android.os.Message;
8 9 import android.text.TextUtils;
  10 +import android.view.View;
  11 +import android.widget.TextView;
9 12 import android.widget.Toast;
10 13  
11 14 import com.ectrip.cyt.config.DevicTool;
... ... @@ -27,7 +30,11 @@ import android_serialport_api.sample.SerialPortActivity;
27 30 public class BlackIdCardActivity extends SerialPortActivity {
28 31 private Integer type; // 类型
29 32 MediaPlayer player;
30   -
  33 + private TextView noId;
  34 + private TextView topBack;
  35 + private Context mContext;
  36 + private String titleName;
  37 + private TextView title;
31 38 /**
32 39 * 执行扫描,扫描后的结果会通过action为PosApi.ACTION_POS_COMM_STATUS的广播发回
33 40 */
... ... @@ -101,10 +108,30 @@ public class BlackIdCardActivity extends SerialPortActivity {
101 108 public void onCreate(Bundle savedInstanceState) {
102 109 super.onCreate(savedInstanceState);
103 110 setContentView(R.layout.activity_black_idcard);
  111 + mContext = this;
  112 + initView();
  113 + initData();
104 114 initIDRead();
  115 + ininlistener();
105 116 init();
106 117 }
107 118  
  119 + private void initView() {
  120 + title = (TextView) findViewById(R.id.title);
  121 + title.setVisibility(View.VISIBLE);
  122 + noId = (TextView) findViewById(R.id.tv_no_id);
  123 + topBack = (TextView) findViewById(R.id.topBack);
  124 + }
  125 +
  126 + private void initData() {
  127 + titleName = getIntent().getStringExtra("titleName");
  128 + if (titleName != null) {
  129 + title.setText(titleName);
  130 + } else {
  131 + title.setText(R.string.scan_id);
  132 + }
  133 + }
  134 +
108 135 @Override
109 136 protected void onDataReceived(byte[] buffer, int size) {
110 137  
... ... @@ -118,6 +145,24 @@ public class BlackIdCardActivity extends SerialPortActivity {
118 145 R.raw.beep);
119 146 }
120 147  
  148 + private void ininlistener() {
  149 + //点击头部返回键,关闭当前activity
  150 + topBack.setOnClickListener(new View.OnClickListener() {
  151 +
  152 + public void onClick(View v) {
  153 + finish();
  154 + }
  155 + });
  156 + noId.setOnClickListener(new View.OnClickListener() {
  157 + @Override
  158 + public void onClick(View v) {
  159 + Intent phone = new Intent(mContext, InputIdCardActivity.class);
  160 +// phone.putExtra("type", type);
  161 + startActivity(phone);
  162 + }
  163 + });
  164 + }
  165 +
121 166 private void initIDRead() {
122 167 new Thread(new ThreadRun()).start();
123 168 }
... ... @@ -156,7 +201,7 @@ public class BlackIdCardActivity extends SerialPortActivity {
156 201  
157 202 private void ReadCard() {
158 203 try {
159   - LogUtil.d(TAG,"mInputStream"+mInputStream+"\n"+"mOutputStream"+mOutputStream);
  204 + LogUtil.d(TAG, "mInputStream" + mInputStream + "\n" + "mOutputStream" + mOutputStream);
160 205 if ((mInputStream == null) || (mOutputStream == null)) {
161 206 Readflage = -2;// 连接异常
162 207 return;
... ...