mirror of
https://gitea.winboll.cc/ZhanGSKen/MyWinBoLL.git
synced 2026-08-14 21:47:10 +08:00
调试类型控件与应用类型控件进行分类管理。
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Sun Jul 19 05:01:46 CST 2026
|
||||
#Sun Jul 19 05:20:16 CST 2026
|
||||
stageCount=11
|
||||
libraryProject=
|
||||
baseVersion=15.20
|
||||
publishVersion=15.20.10
|
||||
buildCount=17
|
||||
buildCount=20
|
||||
baseBetaVersion=15.20.11
|
||||
|
||||
@@ -406,6 +406,21 @@ public class SettingsActivity extends WinBollActivity implements IWinBoLLActivit
|
||||
LogUtils.d(TAG, "onAddNewConnectionRule: 规则添加完成,当前共" + mRuleList.size() + "条规则");
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化测试规则
|
||||
*/
|
||||
public void onInitTestRules(View view) {
|
||||
LogUtils.d(TAG, "onInitTestRules: 初始化测试规则");
|
||||
Rules rules = Rules.getInstance(this);
|
||||
if (rules == null) {
|
||||
LogUtils.e(TAG, "onInitTestRules: Rules实例获取失败");
|
||||
return;
|
||||
}
|
||||
initTestRulesIfEmpty(rules);
|
||||
mRuleAdapter.notifyDataSetChanged();
|
||||
ToastUtils.show("测试规则初始化完成");
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转默认电话应用设置
|
||||
*/
|
||||
@@ -561,6 +576,23 @@ public class SettingsActivity extends WinBollActivity implements IWinBoLLActivit
|
||||
}
|
||||
|
||||
// ====================== 工具方法区(通用功能+权限相关) ======================
|
||||
/**
|
||||
* 规则集为空时初始化测试规则
|
||||
*/
|
||||
public static void initTestRulesIfEmpty(Rules rules) {
|
||||
if (rules.getPhoneBlacRuleBeanList().size() == 0) {
|
||||
LogUtils.d(TAG, "initTestRulesIfEmpty: 当前无规则,添加测试规则集");
|
||||
rules.add("^1[3-9]\\d{9}$", true, true);
|
||||
rules.add("^0660\\d+$", true, true);
|
||||
rules.add("^020\\d+$", true, true);
|
||||
rules.add(".*", false, true);
|
||||
rules.saveRules();
|
||||
LogUtils.d(TAG, "initTestRulesIfEmpty: 测试规则集已保存");
|
||||
} else {
|
||||
LogUtils.d(TAG, "initTestRulesIfEmpty: 当前已有规则,跳过初始化");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新音量显示文本(当前音量/最大音量)
|
||||
*/
|
||||
|
||||
@@ -5,7 +5,7 @@ import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import cc.winboll.studio.contacts.R;
|
||||
import cc.winboll.studio.contacts.activities.UnitTestActivity;
|
||||
import cc.winboll.studio.contacts.activities.SettingsActivity;
|
||||
import cc.winboll.studio.contacts.dun.Rules;
|
||||
import cc.winboll.studio.contacts.services.LimitedTimeSpecialChannelService;
|
||||
import cc.winboll.studio.contacts.utils.IntUtils;
|
||||
@@ -103,7 +103,7 @@ public class UnitTestActivity extends WinBollActivity implements IWinBoLLActivit
|
||||
// 初始化规则实例
|
||||
Rules rules = Rules.getInstance(this);
|
||||
// 无规则时添加测试规则集
|
||||
initTestRulesIfEmpty(rules);
|
||||
SettingsActivity.initTestRulesIfEmpty(rules);
|
||||
|
||||
// 预设测试号码列表
|
||||
String[] testPhones = {
|
||||
@@ -126,29 +126,5 @@ public class UnitTestActivity extends WinBollActivity implements IWinBoLLActivit
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
// ====================== 私有工具函数区 ======================
|
||||
/**
|
||||
* 规则集为空时初始化测试规则
|
||||
*/
|
||||
private void initTestRulesIfEmpty(Rules rules) {
|
||||
if (rules.getPhoneBlacRuleBeanList().size() == 0) {
|
||||
LogUtils.d(TAG, "initTestRulesIfEmpty: 当前无规则,添加测试规则集");
|
||||
// 规则1:中国手机号允许
|
||||
rules.add("^1[3-9]\\d{9}$", true, true);
|
||||
// 规则2:0660区号号码允许
|
||||
rules.add("^0660\\d+$", true, true);
|
||||
// 规则3:020区号号码允许
|
||||
rules.add("^020\\d+$", true, true);
|
||||
// 规则4:默认拒接所有号码
|
||||
rules.add(".*", false, true);
|
||||
|
||||
// 保存规则到本地
|
||||
rules.saveRules();
|
||||
LogUtils.d(TAG, "initTestRulesIfEmpty: 测试规则集已保存");
|
||||
} else {
|
||||
LogUtils.d(TAG, "initTestRulesIfEmpty: 当前已有规则,跳过初始化");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ public class DebugToolButtonsView extends LinearLayout {
|
||||
private void initButtons() {
|
||||
Button btnCrash = (Button) findViewById(R.id.btn_debug_crash);
|
||||
Button btnLayoutPreview = (Button) findViewById(R.id.btn_debug_layout_preview);
|
||||
Button btnUnitTest = (Button) findViewById(R.id.btn_debug_unit_test);
|
||||
|
||||
btnCrash.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
@@ -62,6 +63,13 @@ public class DebugToolButtonsView extends LinearLayout {
|
||||
onOpenLayoutPreview();
|
||||
}
|
||||
});
|
||||
|
||||
btnUnitTest.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
onOpenUnitTest();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void onTestCrash() {
|
||||
@@ -83,4 +91,17 @@ public class DebugToolButtonsView extends LinearLayout {
|
||||
LogUtils.e(TAG, "onOpenLayoutPreview: 跳转失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
private void onOpenUnitTest() {
|
||||
LogUtils.d(TAG, "onOpenUnitTest: 打开单元测试窗口");
|
||||
try {
|
||||
Intent intent = new Intent();
|
||||
intent.setClassName(mContext, "cc.winboll.studio.contacts.activities.UnitTestActivity");
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
mContext.startActivity(intent);
|
||||
LogUtils.d(TAG, "onOpenUnitTest: 跳转成功");
|
||||
} catch (Exception e) {
|
||||
LogUtils.e(TAG, "onOpenUnitTest: 跳转失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -325,6 +325,13 @@
|
||||
android:background="@drawable/recycler_view_border"
|
||||
android:layout_margin="5dp"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="初始化测试规则"
|
||||
android:onClick="onInitTestRules"
|
||||
android:layout_margin="5dp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@@ -40,6 +40,14 @@
|
||||
android:textSize="12sp"
|
||||
android:layout_margin="2dp"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_debug_unit_test"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="单元测试"
|
||||
android:textSize="12sp"
|
||||
android:layout_margin="2dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
Reference in New Issue
Block a user