parent
7d07d77ecc
commit
f4f6c4e8e6
@ -1,43 +1,31 @@ |
||||
# Merge |
||||
-flattenpackagehierarchy com.github.catvod.spider.merge |
||||
|
||||
# slf4j |
||||
# dontwarn |
||||
-dontwarn org.slf4j.impl.** |
||||
-keep class org.slf4j.** { *; } |
||||
-dontwarn org.xmlpull.v1.** |
||||
-dontwarn android.content.res.** |
||||
|
||||
# Spider |
||||
-keep class com.github.catvod.crawler.* { *; } |
||||
-keep class com.github.catvod.spider.* { public <methods>; } |
||||
# slf4j |
||||
-keep class org.slf4j.** { *; } |
||||
|
||||
# AndroidX |
||||
-keep class androidx.core.** { *; } |
||||
|
||||
# Gson |
||||
-keep class com.google.gson.** { *; } |
||||
# Spider |
||||
-keep class com.github.catvod.crawler.* { *; } |
||||
-keep class com.github.catvod.spider.* { public <methods>; } |
||||
|
||||
# OkHttp |
||||
-dontwarn okhttp3.** |
||||
-keep class okio.** { *; } |
||||
-keep class okhttp3.** { *; } |
||||
|
||||
# Logger |
||||
-keep class com.orhanobut.logger.** { *; } |
||||
|
||||
# QuickJS |
||||
-keep class com.whl.quickjs.** { *; } |
||||
|
||||
# Sardine |
||||
-keep class com.thegrizzlylabs.sardineandroid.** { *; } |
||||
|
||||
# Smbj |
||||
-dontwarn org.xmlpull.v1.** |
||||
-dontwarn android.content.res.** |
||||
-keep class com.hierynomus.** { *; } |
||||
-keep class net.engio.mbassy.** { *; } |
||||
|
||||
# Zxing |
||||
-keep class com.google.zxing.** { *; } |
||||
-keepclassmembers enum * { |
||||
public static **[] values(); |
||||
public static ** valueOf(java.lang.String); |
||||
} |
||||
# Logger |
||||
-keep class com.orhanobut.logger.** { *; } |
||||
@ -1,44 +0,0 @@ |
||||
package com.github.catvod.utils; |
||||
|
||||
import android.graphics.Bitmap; |
||||
|
||||
import com.google.zxing.BarcodeFormat; |
||||
import com.google.zxing.EncodeHintType; |
||||
import com.google.zxing.MultiFormatWriter; |
||||
import com.google.zxing.common.BitMatrix; |
||||
|
||||
import java.util.EnumMap; |
||||
import java.util.Map; |
||||
|
||||
public class QRCode { |
||||
|
||||
private static final int WHITE = 0xFFFFFFFF; |
||||
private static final int BLACK = 0xFF000000; |
||||
|
||||
public static Bitmap createBitmap(BitMatrix matrix) { |
||||
int width = matrix.getWidth(); |
||||
int height = matrix.getHeight(); |
||||
int[] pixels = new int[width * height]; |
||||
for (int y = 0; y < height; y++) { |
||||
int offset = y * width; |
||||
for (int x = 0; x < width; x++) { |
||||
pixels[offset + x] = matrix.get(x, y) ? BLACK : WHITE; |
||||
} |
||||
} |
||||
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); |
||||
bitmap.setPixels(pixels, 0, width, 0, 0, width, height); |
||||
return bitmap; |
||||
} |
||||
|
||||
public static Bitmap getBitmap(String contents, int size, int margin) { |
||||
try { |
||||
Map<EncodeHintType, Object> hints = new EnumMap<>(EncodeHintType.class); |
||||
hints.put(EncodeHintType.CHARACTER_SET, "UTF-8"); |
||||
hints.put(EncodeHintType.MARGIN, margin); |
||||
return createBitmap(new MultiFormatWriter().encode(contents, BarcodeFormat.QR_CODE, size, size, hints)); |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
return null; |
||||
} |
||||
} |
||||
} |
||||
Binary file not shown.
@ -1 +1 @@ |
||||
6a70384ac5ab9316a6d924eb6f79a5e7 |
||||
707f0db5d14e50ee046fc2c8a7a11383 |
||||
|
||||
Loading…
Reference in new issue