Clean code
This commit is contained in:
parent
7d07d77ecc
commit
f4f6c4e8e6
|
|
@ -41,11 +41,10 @@ android {
|
|||
|
||||
dependencies {
|
||||
implementation 'com.github.thegrizzlylabs:sardine-android:0.9'
|
||||
implementation 'com.squareup.okhttp3:okhttp:5.0.0-alpha.14'
|
||||
implementation 'wang.harlon.quickjs:wrapper-android:2.4.0'
|
||||
implementation 'com.squareup.okhttp3:okhttp:3.12.13'
|
||||
implementation 'com.google.code.gson:gson:2.11.0'
|
||||
implementation 'cn.wanghaomiao:JsoupXpath:2.5.1'
|
||||
implementation 'com.google.zxing:core:3.3.0'
|
||||
implementation 'com.orhanobut:logger:2.2.0'
|
||||
implementation 'org.jsoup:jsoup:1.15.3'
|
||||
}
|
||||
|
|
@ -1,43 +1,31 @@
|
|||
# Merge
|
||||
-flattenpackagehierarchy com.github.catvod.spider.merge
|
||||
|
||||
# slf4j
|
||||
# dontwarn
|
||||
-dontwarn org.slf4j.impl.**
|
||||
-dontwarn org.xmlpull.v1.**
|
||||
-dontwarn android.content.res.**
|
||||
|
||||
# slf4j
|
||||
-keep class org.slf4j.** { *; }
|
||||
|
||||
# AndroidX
|
||||
-keep class androidx.core.** { *; }
|
||||
|
||||
# Spider
|
||||
-keep class com.github.catvod.crawler.* { *; }
|
||||
-keep class com.github.catvod.spider.* { public <methods>; }
|
||||
|
||||
# AndroidX
|
||||
-keep class androidx.core.** { *; }
|
||||
|
||||
# Gson
|
||||
-keep class com.google.gson.** { *; }
|
||||
|
||||
# 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
|
||||
|
|
|
|||
|
|
@ -6,15 +6,12 @@ rd /s/q "%~dp0\Smali_classes"
|
|||
java -jar "%~dp0\3rd\baksmali-2.5.2.jar" d "%~dp0\..\app\build\intermediates\dex\release\minifyReleaseWithR8\classes.dex" -o "%~dp0\Smali_classes"
|
||||
|
||||
rd /s/q "%~dp0\spider.jar\smali\com\github\catvod\spider"
|
||||
rd /s/q "%~dp0\spider.jar\smali\com\google\gson"
|
||||
rd /s/q "%~dp0\spider.jar\smali\org\slf4j\"
|
||||
|
||||
if not exist "%~dp0\spider.jar\smali\com\github\catvod\" md "%~dp0\spider.jar\smali\com\github\catvod\"
|
||||
if not exist "%~dp0\spider.jar\smali\com\google\gson\" md "%~dp0\spider.jar\smali\com\google\gson\"
|
||||
if not exist "%~dp0\spider.jar\smali\org\slf4j\" md "%~dp0\spider.jar\smali\org\slf4j\"
|
||||
|
||||
move "%~dp0\Smali_classes\com\github\catvod\spider" "%~dp0\spider.jar\smali\com\github\catvod\"
|
||||
move "%~dp0\Smali_classes\com\google\gson" "%~dp0\spider.jar\smali\com\google\gson\"
|
||||
move "%~dp0\Smali_classes\org\slf4j" "%~dp0\spider.jar\smali\org\slf4j\"
|
||||
|
||||
java -jar "%~dp0\3rd\apktool_2.4.1.jar" b "%~dp0\spider.jar" -c
|
||||
|
|
|
|||
Loading…
Reference in New Issue