feat:删除无关紧要的代码

This commit is contained in:
Max
2023-11-23 18:44:33 +08:00
parent 45ab9ac463
commit c7ff6f0524
27 changed files with 3 additions and 1563 deletions

View File

@@ -3,19 +3,16 @@ apply plugin: 'kotlin-android'
apply plugin: 'com.tencent.vasdolly'
apply from: '../project.gradle'
def onlyArm64 = Boolean.parseBoolean(only_arm64)
android {
compileSdkVersion COMPILE_SDK_VERSION.toInteger()
defaultConfig {
applicationId isolationMode ? 'com.aaa.bbb' : 'com.example.live'
applicationId isolationMode ? 'com.example.gogo' : 'com.example.live'
minSdkVersion MIN_SDK_VERSION.toInteger()
targetSdkVersion TARGET_SDK_VERSION.toInteger()
versionCode Integer.valueOf(version_code)
versionName version_name
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
flavorDimensions 'default'
@@ -214,8 +211,6 @@ dependencies {
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.2'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
api 'androidx.multidex:multidex:2.0.1'
@@ -310,8 +305,7 @@ channel {
//多渠道包的输出目录默认为new File(project.buildDir,"channel")
outputDir = new File(project.buildDir, "channelapk")
//多渠道包的命名规则,默认为:${appName}-${versionName}-${versionCode}-${flavorName}-${buildType}-${buildTime}
def only64 = onlyArm64 ? "-only64" : ""
apkNameFormat = 'habu-${buildType}only64-${flavorName}-v${versionName}-${buildTime}'.replace("only64", only64)
apkNameFormat = 'habu-${buildType}-${flavorName}-v${versionName}-${buildTime}'
//快速模式生成渠道包时不进行校验速度可以提升10倍以上默认为false
fastMode = false
//buildTime的时间格式默认格式yyyyMMdd-HHmmss

View File

@@ -1,28 +0,0 @@
package com.chwl.app;
import static org.junit.Assert.assertEquals;
import android.content.Context;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.platform.app.InstrumentationRegistry;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.chwl.app_android_client", appContext.getPackageName());
}
}

View File

@@ -1,253 +0,0 @@
package com.chwl.app;
import static org.junit.Assert.assertEquals;
import com.chwl.library.utils.ResUtil;
import org.junit.Test;
import java.io.UnsupportedEncodingException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import io.reactivex.Single;
import io.reactivex.SingleEmitter;
import io.reactivex.SingleObserver;
import io.reactivex.SingleOnSubscribe;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Action;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
@Test
public void test_do_on() throws Exception {
Single.create(new SingleOnSubscribe<String>() {
@Override
public void subscribe(SingleEmitter<String> e) throws Exception {
System.out.println(ResUtil.getString(R.string.yizhuan_erban_exampleunittest_01) + " thread:" +Thread.currentThread().getName());
e.onSuccess(ResUtil.getString(R.string.yizhuan_erban_exampleunittest_02));
}
})
.subscribeOn(Schedulers.io())
.observeOn(Schedulers.newThread())
.doOnSubscribe(new Consumer<Disposable>() {
@Override
public void accept(Disposable disposable) throws Exception {
System.out.println("doOnSubscribe"+ " thread:" +Thread.currentThread().getName());
}
})
.doAfterTerminate(new Action() {
@Override
public void run() throws Exception {
System.out.println("doAfterTerminate"+ " thread:" +Thread.currentThread().getName());
}
})
.subscribe(new SingleObserver<String>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onSuccess(String s) {
System.out.println(ResUtil.getString(R.string.yizhuan_erban_exampleunittest_03)+s + " thread:" +Thread.currentThread().getName());
}
@Override
public void onError(Throwable e) {
}
});
}
@Test
public void test_list_to_string() throws Exception {
String[] str = new String[]{"1","2","3"};
List<String> stringList = Arrays.asList(str);
System.out.println(stringList.toString());
System.out.println(String.format("%1$02d:%2$02d", 3, 5));
}
@Test
public void test_set() {
Set<String> stringSet = new HashSet<>();
stringSet.add("1");
stringSet.add("2");
stringSet.add("1");
stringSet.add("2");
stringSet.add("3");
stringSet.add("4");
System.out.println("stringSet.size():" + stringSet.size());
if (stringSet.size() > 3) {
Iterator<String> iterator = stringSet.iterator();
if (iterator.hasNext()) {
stringSet.remove(iterator.next());
}
}
System.out.println("stringSet.size():" + stringSet.size());
Iterator<String> iterator = stringSet.iterator();
while (iterator.hasNext()) {
System.out.println("iterator.next():" + iterator.next());
}
}
@Test
public void test_emoji() {
print(ResUtil.getString(R.string.yizhuan_erban_exampleunittest_04));
// for (int i = 0; i < emoji.length(); i++) {
// print(i + "");
// char indexC = emoji.charAt(i);
// print("" + indexC);
// int indexI = (int) indexC;
// print("" + indexI);
// String indexS = Integer.toHexString(indexI);
// print(indexS);
// }
}
public boolean isTutuAppEmojiPwd(String emojiText) {
String oneEmojiP = "([\ud83c\udc00-\ud83c\udfff]|[\ud83d\udc00-\ud83d\udfff]|[\ud83e\udc00-\ud83e\udfff]" +
"|[\u2100-\u32ff]|[\u0030-\u007f][\u20d0-\u20ff]|[\u0080-\u00ff])";
String regx = oneEmojiP + "{3}";
Pattern p = Pattern.compile(regx);
Matcher matcher = p.matcher(emojiText);
print(ResUtil.getString(R.string.yizhuan_erban_exampleunittest_05));
try {
boolean flag = matcher.find();
int i = 0;
while (flag) {
String emoji = matcher.group();
flag = matcher.find();
print(i + ResUtil.getString(R.string.yizhuan_erban_exampleunittest_06) + emoji);
i++;
}
} catch (Exception ex) {
ex.printStackTrace();
print(ResUtil.getString(R.string.yizhuan_erban_exampleunittest_07));
}
print(ResUtil.getString(R.string.yizhuan_erban_exampleunittest_08));
return false;
}
private void unicodeToUtf16Fun2() {
print(ResUtil.getString(R.string.yizhuan_erban_exampleunittest_09));
String emojiUnico = "1F601ResUtil.getString(R.string.yizhuan_erban_exampleunittest_010)\uD83D\uDE01"
int hexVaild = 0x1f601;
printBinaryString(Integer.toBinaryString(hexVaild));
hexVaild = hexVaild - 0x10000;
print(hexVaild + "");
String binaryString = Integer.toBinaryString(hexVaild);
printBinaryString(binaryString);
print(ResUtil.getString(R.string.yizhuan_erban_exampleunittest_011));
printBinaryString(Integer.toBinaryString(0xd800 - 0xd7c0));
String highString = binaryString.substring(0, binaryString.length() - 10);
String lowString = binaryString.substring(binaryString.length() - 10, binaryString.length());
print(ResUtil.getString(R.string.yizhuan_erban_exampleunittest_012));
printBinaryString(highString);
print(ResUtil.getString(R.string.yizhuan_erban_exampleunittest_013));
printBinaryString(lowString);
int highOffset = 0xd800;
int lowOffset = 0xdc00;
print(Integer.toHexString(Integer.valueOf(highString, 2) + highOffset));
print(Integer.toHexString(Integer.valueOf(lowString, 2) + lowOffset));
}
private void printBinaryString(String binaryString) {
if (binaryString == null || binaryString.length() == 0) {
return;
}
int start = binaryString.length() - 4;
int end = binaryString.length();
String result = "";
while (true) {
result = binaryString.substring(Math.max(0, start), end) + " " + result;
if (start < 0) {
break;
}
start -= 4;
end -= 4;
}
print(result);
}
private void unicodeToUtf16Fun1() {
String emoji = "\uD83D\uDE01";
// high offset
final int HighOffset = Integer.valueOf("D7C0", 16);
// low offset
final int LowOffset = Integer.valueOf("DC00", 16);
String emojiUnico = "1F601ResUtil.getString(R.string.yizhuan_erban_exampleunittest_014)\uD83D\uDE01"
int value = Integer.valueOf(emojiUnico, 16);
print(ResUtil.getString(R.string.yizhuan_erban_exampleunittest_015) + value);
String binaryString = Integer.toBinaryString(value);
print(ResUtil.getString(R.string.yizhuan_erban_exampleunittest_016) + binaryString);
StringBuilder builder = new StringBuilder();
String high10 = binaryString.substring(0, binaryString.length() - 10);
String low10 = binaryString.substring(binaryString.length() - 10, binaryString.length());
print(ResUtil.getString(R.string.yizhuan_erban_exampleunittest_017) + high10);
print(ResUtil.getString(R.string.yizhuan_erban_exampleunittest_018) + low10);
//高10位+高位偏移量,转成十六进制,得到高位
int highI = Integer.valueOf(high10, 2) + HighOffset;
String highHex = Integer.toHexString(highI);
print(ResUtil.getString(R.string.yizhuan_erban_exampleunittest_019) + highHex);//d83d
//低字节同理
int lowI = Integer.valueOf(low10, 2) + LowOffset;
String lowHex = Integer.toHexString(lowI);
print(ResUtil.getString(R.string.yizhuan_erban_exampleunittest_020) + lowHex);//de01
try {
byte[] uft8Bytes = emoji.getBytes("UTF-8");
for (int i = 0; i < uft8Bytes.length; i++) {
int index = uft8Bytes[i];
String index2String = Integer.toBinaryString(index);
print(index2String);
//取低8位
String low8 = index2String.substring(index2String.length() - 8,
index2String.length());
String valueHex = Integer.toHexString(Integer.valueOf(low8, 2));
print(valueHex);
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
private void print(String msg) {
System.out.println(msg);
}
}