Skip to content

Commit 1feb113

Browse files
committed
删除多余的第三方库
1 parent 38d7de5 commit 1feb113

4 files changed

Lines changed: 0 additions & 75 deletions

File tree

printlibrary/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ dependencies {
6363

6464
implementation 'androidx.appcompat:appcompat:1.3.0'
6565
implementation 'com.google.android.material:material:1.4.0'
66-
implementation files('libs\\core-3.3.0.jar')
6766
testImplementation 'junit:junit:4.13.2'
6867
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
6968
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

printlibrary/libs/core-3.3.0.jar

-528 KB
Binary file not shown.

printlibrary/src/main/java/com/sunmi/peripheral/printer/BytesUtil.java

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@
33
import android.annotation.SuppressLint;
44
import android.graphics.Bitmap;
55

6-
import com.google.zxing.BarcodeFormat;
7-
import com.google.zxing.EncodeHintType;
8-
import com.google.zxing.WriterException;
9-
import com.google.zxing.common.BitMatrix;
10-
import com.google.zxing.qrcode.QRCodeWriter;
116

127
import java.util.Hashtable;
138

@@ -145,63 +140,7 @@ public static byte[] initTable(int h, int w){
145140
return data;
146141
}
147142

148-
/**
149-
* 生成二维码字节流
150-
*
151-
* @param data
152-
* @param size
153-
* @return
154-
*/
155-
public static byte[] getZXingQRCode(String data, int size) {
156-
try {
157-
Hashtable<EncodeHintType, String> hints = new Hashtable<EncodeHintType, String>();
158-
hints.put(EncodeHintType.CHARACTER_SET, "utf-8");
159-
//图像数据转换,使用了矩阵转换
160-
BitMatrix bitMatrix = new QRCodeWriter().encode(data, BarcodeFormat.QR_CODE, size, size, hints);
161-
//System.out.println("bitmatrix height:" + bitMatrix.getHeight() + " width:" + bitMatrix.getWidth());
162-
return getBytesFromBitMatrix(bitMatrix);
163-
} catch (WriterException e) {
164-
// TODO Auto-generated catch block
165-
e.printStackTrace();
166-
}
167-
return null;
168-
}
169143

170-
public static byte[] getBytesFromBitMatrix(BitMatrix bits) {
171-
if (bits == null) return null;
172-
173-
int h = bits.getHeight();
174-
int w = (bits.getWidth() + 7) / 8;
175-
byte[] rv = new byte[h * w + 4];
176-
177-
rv[0] = (byte) w;//xL
178-
rv[1] = (byte) (w >> 8);//xH
179-
rv[2] = (byte) h;
180-
rv[3] = (byte) (h >> 8);
181-
182-
int k = 4;
183-
for (int i = 0; i < h; i++) {
184-
for (int j = 0; j < w; j++) {
185-
for (int n = 0; n < 8; n++) {
186-
byte b = getBitMatrixColor(bits, j * 8 + n, i);
187-
rv[k] += rv[k] + b;
188-
}
189-
k++;
190-
}
191-
}
192-
return rv;
193-
}
194-
195-
private static byte getBitMatrixColor(BitMatrix bits, int x, int y) {
196-
int width = bits.getWidth();
197-
int height = bits.getHeight();
198-
if (x >= width || y >= height || x < 0 || y < 0) return 0;
199-
if (bits.get(x, y)) {
200-
return 1;
201-
} else {
202-
return 0;
203-
}
204-
}
205144

206145
/**
207146
* 将bitmap图转换为头四位有宽高的光栅位图

printlibrary/src/main/java/com/sunmi/peripheral/printer/ESCUtil.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -96,19 +96,6 @@ public static byte[] getPrintDoubleQRCode(String code1, String code2, int module
9696
return buffer.toByteArray();
9797
}
9898

99-
/**
100-
* 光栅打印二维码
101-
*/
102-
public static byte[] getPrintQRCode2(String data, int size){
103-
byte[] bytes1 = new byte[4];
104-
bytes1[0] = GS;
105-
bytes1[1] = 0x76;
106-
bytes1[2] = 0x30;
107-
bytes1[3] = 0x00;
108-
109-
byte[] bytes2 = BytesUtil.getZXingQRCode(data, size);
110-
return BytesUtil.byteMerger(bytes1, bytes2);
111-
}
11299

113100
/**
114101
* 打印一维条形码

0 commit comments

Comments
 (0)