Compare commits

...

25 Commits

Author SHA1 Message Date
ZhanGSKen 3fde2551f9 源码整理 2026-07-21 11:43:45 +08:00
MiMo 3a8d509f4e 忽略其他开发端源码修改,先以本机版本为基础,再另行调整。 2026-07-21 11:33:37 +08:00
MiMo da529c737b refactor(views): DunTemperatureView 颜色值提取为静态常量
- 新增 COLOR_GRADIENT_LOW/MID/HIGH 渐变颜色常量
- 新增 COLOR_BORDER 边框颜色常量
- 新增 COLOR_TEXT 文本颜色常量
- 替换 mGradientColors、mBorderColor、mTextColor 为常量引用
2026-07-21 11:25:55 +08:00
ZhanGSKen b1be995092 源码整理 2026-07-21 11:03:50 +08:00
ZhanGSKen 4247934a20 设置应用开发版本命名标准与APPBase分支对齐。 2026-07-21 10:56:44 +08:00
ZhanGSKen bf5fe296ff 切换应用基准开发航线 2026-07-21 10:52:37 +08:00
MiMo f6bc48d5d2 feat: 添加绿色通道悬浮窗调试入口
- 新增 GreenChannelFloatingWindow 悬浮窗管理类,支持 API26+ 窗口类型适配
- 新增 view_green_channel_floating.xml 悬浮窗布局,LimitedTimeGreenChannelView 占满全屏无边距
- DebugToolButtonsView 调试工具按钮组添加绿色通道按钮,点击打开悬浮窗
2026-07-20 20:47:34 +08:00
MiMo e2c9f362fc feat: 绿色通道状态广播通信机制
- 新增绿色通道状态变更本地广播 Action 和参数常量
- 新增 sendGreenChannelStateChangedBroadcast() 静态方法
- 开关切换时发送状态广播通知 Activity 更新状态栏
- 服务销毁时发送关闭广播确保状态同步
2026-07-20 14:51:55 +08:00
MiMo 7f53355005 fix: 绿色通道关闭时状态栏颜色恢复修复
- 修复状态栏默认颜色为0(透明)时无法恢复的问题
- 从主题中获取默认状态栏颜色作为fallback
- 广播接收器统一调用updateStatusBarForGreenChannel()方法
- 消除重复代码,提高可维护性
2026-07-20 14:30:39 +08:00
MiMo f09ab4036f feat: 为绿色通道开关添加持久化存储
- SettingsBean新增isEnableGreenChannel属性及JSON序列化支持
- LimitedTimeGreenChannelView新增loadSavedGreenChannelState()加载持久状态
- LimitedTimeGreenChannelView新增saveGreenChannelState()保存开关状态
- App重启后绿色通道开关状态自动恢复
2026-07-20 13:46:14 +08:00
MiMo 405ebe41db refactor: 将'特殊通道'重命名为'绿色通道'
- 重命名 LimitedTimeSpecialChannelService → LimitedTimeGreenChannelService
- 重命名 LimitedTimeSpecialChannelView → LimitedTimeGreenChannelView
- 重命名 view_limitedtimespecialchannel.xml → view_limitedtimegreenchannel.xml
- 更新 activity_settings.xml 显示文本和控件引用
- 更新 AndroidManifest.xml Service 注册
- 更新 Rules.java 和 UnitTestActivity.java 引用
- 更新所有日志和注释中的'特殊'为'绿色'

BREAKING CHANGE: 类名和布局文件名已变更,外部引用需同步更新
2026-07-20 13:22:09 +08:00
ZhanGSKen 54497d8adb 设置动态更新最新版类库的Gradle配置。 2026-07-20 12:47:24 +08:00
ZhanGSKen b50de904f2 <contacts>APK 15.20.11 release Publish. 2026-07-19 06:16:39 +08:00
ZhanGSKen 18e41a7a8d 云盾Buff加成。 2026-07-19 06:12:57 +08:00
ZhanGSKen 8713872d62 UI调整 2026-07-19 05:59:34 +08:00
ZhanGSKen b16f29a43f 把应用日志窗口调整为应用调试资源 2026-07-19 05:51:13 +08:00
MiMo ebaf487d0a 调试类型控件与应用类型控件进行分类管理。 2026-07-19 05:29:41 +08:00
MiMo d5d230c1bb feat: 新增云盾查询Fragment替换日志Fragment
- 新增 DunQueryFragment 和 DunQueryView 控件
- 主界面第三个标签页从应用日志改为云盾查询
- 移除 LogFragment 及相关布局文件
- 移除 SettingsActivity 中的 DunQueryView 控件
2026-07-19 05:07:03 +08:00
MiMo 1d0322252e refactor: 精简调试工具按钮组
移除冗余按钮,仅保留测试崩溃和布局草稿两个功能:
- 移除:清除数据、查看SP、查看日志、重启服务、应用信息
- 测试崩溃改为getString循环触发崩溃
2026-07-19 04:17:39 +08:00
MiMo 22f9eff429 feat: LayoutDraftPreViewActivity添加工具栏
仿照MainActivity为布局草稿预览窗口添加工具栏:
- 继承改为AppCompatActivity以支持Toolbar
- 添加返回按钮和页面标题
- 点击返回按钮关闭页面
2026-07-18 20:12:34 +08:00
MiMo c8e55730f3 feat: 调试工具按钮组添加布局草稿预览入口
在DebugToolButtonsView中新增布局草稿按钮,
点击后跳转LayoutDraftPreViewActivity窗口。
2026-07-18 20:05:42 +08:00
MiMo 5d73960a54 feat: 添加SettingsActivity调试工具按钮组
新增调试工具按钮组控件,仅在调试模式下动态加载:
- view_debug_tool_buttons.xml: 按钮组布局文件
- DebugToolButtonsView.java: 自定义View控件
- SettingsActivity: isDebugging()时加载调试面板

功能按钮:清除数据、查看SP、测试崩溃、查看日志、重启服务、应用信息
2026-07-18 19:58:25 +08:00
ZhanGSKen 2661bd1d5f 添加Http登录验证按钮图片资源 2026-07-18 19:38:33 +08:00
ZhanGSKen 3aaa7ab4fb 把原草稿布局文件方式改为调试预览窗口方式的类源码与资源 2026-07-18 19:37:38 +08:00
ZhanGSKen c75344c238 添加项目开发时,xml布局文件设计的辅助草稿文件。方便快捷调整视图控件属性。 2026-07-18 19:23:38 +08:00
26 changed files with 1331 additions and 401 deletions
+5 -3
View File
@@ -34,7 +34,7 @@ android {
// versionName 更新后需要手动设置
// .winboll/winbollBuildProps.properties 文件的 stageCount=0
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
versionName "15.20"
versionName "15.21"
if(true) {
versionName = genVersionName("${versionName}")
}
@@ -75,8 +75,10 @@ dependencies {
//annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
// WinBoLL库 nexus.winboll.cc 地址
api 'cc.winboll.studio:libaes:15.20.21'
api 'cc.winboll.studio:libappbase:15.20.34'
//api 'cc.winboll.studio:libaes:15.20.21'
//api 'cc.winboll.studio:libappbase:15.20.34'
api 'cc.winboll.studio:libaes:15.21.+'
api 'cc.winboll.studio:libappbase:15.21.+'
api fileTree(dir: 'libs', include: ['*.jar'])
}
+16 -6
View File
@@ -1,8 +1,18 @@
#Created by .winboll/winboll_app_build.gradle
#Sat Jul 18 18:56:11 HKT 2026
stageCount=11
<<<<<<< HEAD
#Tue Jul 21 11:13:12 CST 2026
stageCount=12
libraryProject=
baseVersion=15.20
publishVersion=15.20.10
buildCount=0
baseBetaVersion=15.20.11
baseVersion=15.21
publishVersion=15.20.11
buildCount=22
baseBetaVersion=15.20.12
=======
#Tue Jul 21 02:54:31 GMT 2026
stageCount=0
libraryProject=
baseVersion=15.21
publishVersion=15.21.0
buildCount=1
baseBetaVersion=15.21.1
>>>>>>> origin/contacts
+6 -4
View File
@@ -3,9 +3,9 @@
xmlns:android="http://schemas.android.com/apk/res/android"
package="cc.winboll.studio.contacts">
<!-- 网络访问权限 -->
<!-- 拥有完全的网络访问权限 -->
<uses-permission android:name="android.permission.INTERNET"/>
<!-- BIND_AUTOFILL_SERVICE -->
<uses-permission android:name="android.permission.BIND_AUTOFILL_SERVICE"/>
@@ -254,8 +254,10 @@
<activity android:name="cc.winboll.studio.contacts.activities.AboutActivity"/>
<service android:name="cc.winboll.studio.contacts.services.LimitedTimeSpecialChannelService"/>
<service android:name="cc.winboll.studio.contacts.services.LimitedTimeGreenChannelService"/>
<activity android:name="cc.winboll.studio.contacts.unittest.LayoutDraftPreViewActivity"/>
</application>
</manifest>
</manifest>
@@ -31,14 +31,13 @@ import cc.winboll.studio.contacts.activities.WinBollActivity;
import cc.winboll.studio.contacts.dun.Rules;
import cc.winboll.studio.contacts.fragments.CallLogFragment;
import cc.winboll.studio.contacts.fragments.ContactsFragment;
import cc.winboll.studio.contacts.fragments.LogFragment;
import cc.winboll.studio.contacts.fragments.DunQueryFragment;
import cc.winboll.studio.contacts.model.MainServiceBean;
import cc.winboll.studio.contacts.services.MainService;
import cc.winboll.studio.contacts.utils.PermissionUtils;
import cc.winboll.studio.contacts.views.DunTemperatureView;
import cc.winboll.studio.libaes.interfaces.IWinBoLLActivity;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.LogView;
import com.google.android.material.tabs.TabLayout;
import java.util.ArrayList;
import java.util.List;
@@ -75,7 +74,6 @@ public final class MainActivity extends WinBollActivity implements IWinBoLLActiv
private final String[] REQUIRED_PERMISSIONS = PermissionUtils.BASE_PERMISSIONS;
// ====================== 4. UI控件成员区 ======================
private LogView mLogView;
private Toolbar mToolbar;
private CheckBox cbMainService;
private TabLayout tabLayout;
@@ -320,10 +318,10 @@ public final class MainActivity extends WinBollActivity implements IWinBoLLActiv
// 添加Fragment实例(仅创建对象,不初始化业务逻辑)
fragmentList.add(CallLogFragment.newInstance(0));
fragmentList.add(ContactsFragment.newInstance(1));
fragmentList.add(LogFragment.newInstance(2));
fragmentList.add(DunQueryFragment.newInstance(2));
tabTitleList.add("通话记录");
tabTitleList.add("联系人");
tabTitleList.add("应用日志");
tabTitleList.add("云盾查询");
// 初始化懒加载标记数组(默认均未初始化)
int fragmentCount = fragmentList.size();
@@ -367,8 +365,8 @@ public final class MainActivity extends WinBollActivity implements IWinBoLLActiv
((CallLogFragment) targetFragment).initData();
} else if (targetFragment instanceof ContactsFragment) {
((ContactsFragment) targetFragment).initData();
} else if (targetFragment instanceof LogFragment) {
((LogFragment) targetFragment).initData();
} else if (targetFragment instanceof DunQueryFragment) {
((DunQueryFragment) targetFragment).initData();
}
// 标记为已初始化
isFragmentInit[position] = true;
@@ -29,6 +29,7 @@ import cc.winboll.studio.contacts.model.PhoneConnectRuleBean;
import cc.winboll.studio.contacts.model.RingTongBean;
import cc.winboll.studio.contacts.model.SettingsBean;
import cc.winboll.studio.contacts.services.MainService;
import cc.winboll.studio.contacts.views.DebugToolButtonsView;
import cc.winboll.studio.contacts.views.DuInfoTextView;
import cc.winboll.studio.libaes.interfaces.IWinBoLLActivity;
import cc.winboll.studio.libaes.utils.WinBoLLActivityManager;
@@ -98,6 +99,9 @@ public class SettingsActivity extends WinBollActivity implements IWinBoLLActivit
initDunSettings(); // 云盾设置初始化
initBoBullToonViews(); // BoBullToon功能初始化
// 调试模式下加载调试工具按钮组
initDebugTools();
LogUtils.d(TAG, "onCreate: 设置页面初始化完成");
}
@@ -300,6 +304,26 @@ public class SettingsActivity extends WinBollActivity implements IWinBoLLActivit
}
}
/**
* 初始化调试工具按钮组(仅在调试模式下加载)
*/
private void initDebugTools() {
LogUtils.d(TAG, "initDebugTools: 检查调试模式状态");
if (cc.winboll.studio.libappbase.GlobalApplication.isDebugging()) {
LogUtils.d(TAG, "initDebugTools: 调试模式已开启,加载调试工具按钮组");
android.widget.LinearLayout contentLayout = (android.widget.LinearLayout) findViewById(R.id.activity_settings_content);
if (contentLayout != null) {
DebugToolButtonsView debugView = new DebugToolButtonsView(this);
contentLayout.addView(debugView);
LogUtils.d(TAG, "initDebugTools: 调试工具按钮组加载完成");
} else {
LogUtils.e(TAG, "initDebugTools: 内容布局未找到,加载失败");
}
} else {
LogUtils.d(TAG, "initDebugTools: 调试模式未开启,跳过加载");
}
}
// ====================== 点击事件回调区(按功能模块归类) ======================
/**
* 云盾开关点击事件(联动参数编辑权限+配置保存)
@@ -382,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("测试规则初始化完成");
}
/**
* 跳转默认电话应用设置
*/
@@ -528,15 +567,24 @@ public class SettingsActivity extends WinBollActivity implements IWinBoLLActivit
WinBoLLActivityManager.getInstance().startWinBoLLActivity(this, AboutActivity.class);
}
// ====================== 工具方法区(通用功能+权限相关) ======================
/**
* 跳转日志查看页面
* 规则集为空时初始化测试规则
*/
public void onLogView(View view) {
LogUtils.d(TAG, "onLogView: 跳转日志页面");
WinBoLLActivityManager.getInstance().startLogActivity(this);
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,9 +5,9 @@ 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.services.LimitedTimeGreenChannelService;
import cc.winboll.studio.contacts.utils.IntUtils;
import cc.winboll.studio.libaes.interfaces.IWinBoLLActivity;
import cc.winboll.studio.libappbase.LogUtils;
@@ -103,7 +103,7 @@ public class UnitTestActivity extends WinBollActivity implements IWinBoLLActivit
// 初始化规则实例
Rules rules = Rules.getInstance(this);
// 无规则时添加测试规则集
initTestRulesIfEmpty(rules);
SettingsActivity.initTestRulesIfEmpty(rules);
// 预设测试号码列表
String[] testPhones = {
@@ -122,33 +122,9 @@ public class UnitTestActivity extends WinBollActivity implements IWinBoLLActivit
new Thread(new Runnable(){
@Override
public void run() {
LimitedTimeSpecialChannelService.unitTest(UnitTestActivity.this);
LimitedTimeGreenChannelService.unitTest(UnitTestActivity.this);
}
}).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);
// 规则20660区号号码允许
rules.add("^0660\\d+$", true, true);
// 规则3020区号号码允许
rules.add("^020\\d+$", true, true);
// 规则4:默认拒接所有号码
rules.add(".*", false, true);
// 保存规则到本地
rules.saveRules();
LogUtils.d(TAG, "initTestRulesIfEmpty: 测试规则集已保存");
} else {
LogUtils.d(TAG, "initTestRulesIfEmpty: 当前已有规则,跳过初始化");
}
}
}
@@ -1,9 +1,16 @@
package cc.winboll.studio.contacts.activities;
import android.app.Activity;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Build;
import android.os.Bundle;
import android.view.MenuItem;
import androidx.appcompat.app.AppCompatActivity;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import cc.winboll.studio.contacts.dun.Rules;
import cc.winboll.studio.contacts.model.SettingsBean;
import cc.winboll.studio.contacts.services.LimitedTimeGreenChannelService;
import cc.winboll.studio.libaes.interfaces.IWinBoLLActivity;
import cc.winboll.studio.libaes.models.AESThemeBean;
import cc.winboll.studio.libaes.utils.AESThemeUtil;
@@ -21,6 +28,8 @@ public class WinBollActivity extends AppCompatActivity implements IWinBoLLActivi
// ====================== 成员变量区 ======================
protected volatile AESThemeBean.ThemeType mThemeType;
private android.content.BroadcastReceiver mGreenChannelReceiver;
private int mDefaultStatusBarColor = 0; // 默认状态栏颜色
// ====================== 接口实现区 ======================
@Override
@@ -42,6 +51,114 @@ public class WinBollActivity extends AppCompatActivity implements IWinBoLLActivi
// setThemeStyle();
super.onCreate(savedInstanceState);
//LogUtils.d(TAG, "onCreate: 基类主题设置完成,当前主题类型=" + mThemeType);
// 保存默认状态栏颜色
saveDefaultStatusBarColor();
// 检测绿色通道状态,设置顶部状态栏背景色
updateStatusBarForGreenChannel();
// 注册绿色通道状态变更广播接收器
registerGreenChannelReceiver();
}
@Override
protected void onDestroy() {
super.onDestroy();
// 反注册绿色通道状态变更广播接收器
unregisterGreenChannelReceiver();
}
/**
* 根据绿色通道状态更新顶部状态栏背景色
* 绿色通道开启时状态栏背景为绿色,其他情况不改变
*/
private void updateStatusBarForGreenChannel() {
// API 21+ 才支持设置状态栏颜色
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
boolean isGreenChannelEnabled = false;
Rules rules = Rules.getInstance(getApplicationContext());
if (rules != null) {
SettingsBean settings = rules.getSettingsModel();
if (settings != null) {
isGreenChannelEnabled = settings.isEnableGreenChannel();
}
}
if (isGreenChannelEnabled) {
// 绿色通道开启,设置状态栏为绿色
getWindow().setStatusBarColor(android.graphics.Color.GREEN);
LogUtils.d(TAG, "updateStatusBarForGreenChannel: 绿色通道已开启,状态栏背景设为绿色");
} else {
// 绿色通道关闭,恢复默认状态栏颜色
// 如果默认颜色为0(透明),则获取主题默认颜色
int restoreColor = mDefaultStatusBarColor;
if (restoreColor == 0) {
// 从主题中获取默认状态栏颜色
android.util.TypedValue typedValue = new android.util.TypedValue();
if (getTheme().resolveAttribute(android.R.attr.statusBarColor, typedValue, true)) {
restoreColor = typedValue.data;
}
}
getWindow().setStatusBarColor(restoreColor);
LogUtils.d(TAG, "updateStatusBarForGreenChannel: 绿色通道已关闭,状态栏背景已恢复, color=0x" + Integer.toHexString(restoreColor));
}
}
}
/**
* 保存默认状态栏颜色(在设置绿色通道颜色之前调用)
*/
private void saveDefaultStatusBarColor() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mDefaultStatusBarColor = getWindow().getStatusBarColor();
// 如果获取到的颜色为0(透明),尝试从主题获取默认颜色
if (mDefaultStatusBarColor == 0) {
android.util.TypedValue typedValue = new android.util.TypedValue();
if (getTheme().resolveAttribute(android.R.attr.statusBarColor, typedValue, true)) {
mDefaultStatusBarColor = typedValue.data;
}
}
LogUtils.d(TAG, "saveDefaultStatusBarColor: 保存默认状态栏颜色=0x" + Integer.toHexString(mDefaultStatusBarColor));
}
}
/**
* 注册绿色通道状态变更本地广播接收器
*/
private void registerGreenChannelReceiver() {
LogUtils.d(TAG, "registerGreenChannelReceiver: 注册绿色通道状态变更广播接收器");
mGreenChannelReceiver = new android.content.BroadcastReceiver() {
@Override
public void onReceive(android.content.Context context, Intent intent) {
if (LimitedTimeGreenChannelService.ACTION_GREEN_CHANNEL_STATE_CHANGED.equals(intent.getAction())) {
boolean isEnabled = intent.getBooleanExtra(LimitedTimeGreenChannelService.EXTRA_GREEN_CHANNEL_ENABLED, false);
LogUtils.d(TAG, "registerGreenChannelReceiver: 收到绿色通道状态变更广播, isEnabled=" + isEnabled);
// 调用统一方法更新状态栏颜色
updateStatusBarForGreenChannel();
}
}
};
IntentFilter filter = new IntentFilter(LimitedTimeGreenChannelService.ACTION_GREEN_CHANNEL_STATE_CHANGED);
LocalBroadcastManager.getInstance(this).registerReceiver(mGreenChannelReceiver, filter);
LogUtils.d(TAG, "registerGreenChannelReceiver: 广播接收器注册完成");
}
/**
* 反注册绿色通道状态变更本地广播接收器
*/
private void unregisterGreenChannelReceiver() {
if (mGreenChannelReceiver != null) {
LogUtils.d(TAG, "unregisterGreenChannelReceiver: 反注册绿色通道状态变更广播接收器");
LocalBroadcastManager.getInstance(this).unregisterReceiver(mGreenChannelReceiver);
mGreenChannelReceiver = null;
LogUtils.d(TAG, "unregisterGreenChannelReceiver: 反注册完成");
}
}
// ====================== 主题相关函数区 ======================
@@ -5,7 +5,7 @@ import cc.winboll.studio.contacts.activities.SettingsActivity;
import cc.winboll.studio.contacts.bobulltoon.TomCat;
import cc.winboll.studio.contacts.model.PhoneConnectRuleBean;
import cc.winboll.studio.contacts.model.SettingsBean;
import cc.winboll.studio.contacts.services.LimitedTimeSpecialChannelService;
import cc.winboll.studio.contacts.services.LimitedTimeGreenChannelService;
import cc.winboll.studio.contacts.services.MainService;
import cc.winboll.studio.contacts.utils.ContactUtils;
import cc.winboll.studio.contacts.utils.IntUtils;
@@ -172,9 +172,9 @@ public class Rules {
LogUtils.d(TAG, String.format("isDefend == %s\nisConnect == %s", isDefend, isConnect));
}
// 限时特殊通道打开时返回连接
if (!isDefend && LimitedTimeSpecialChannelService.isServiceRunning()) {
LogUtils.d(TAG, String.format("PhoneNumber %s\n and Limited Time Special Channel Service Is Running.", phoneNumber));
// 限时绿色通道打开时返回连接
if (!isDefend && LimitedTimeGreenChannelService.isServiceRunning()) {
LogUtils.d(TAG, String.format("PhoneNumber %s\n and Limited Time Green Channel Service Is Running.", phoneNumber));
isDefend = true;
isConnect = true;
LogUtils.d(TAG, String.format("isDefend == %s\nisConnect == %s", isDefend, isConnect));
@@ -0,0 +1,284 @@
package cc.winboll.studio.contacts.floatingwindow;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.PixelFormat;
import android.os.Build;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.FrameLayout;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import cc.winboll.studio.contacts.R;
import cc.winboll.studio.contacts.services.LimitedTimeGreenChannelService;
import cc.winboll.studio.contacts.utils.PermissionUtils;
import cc.winboll.studio.libappbase.LogUtils;
/**
* @Author ZhanGSKen&豆包大模型<zhangsken@qq.com>
* @Date 2026/07/20 15:00:00
* @Describe 绿色通道悬浮窗管理类
* 负责悬浮窗的创建、显示、隐藏和销毁
* 适配 Android API 26+ Java 7 语法规范
*/
public class GreenChannelFloatingWindow {
// ====================== 常量定义区 ======================
public static final String TAG = "GreenChannelFloatingWindow";
// Android版本常量(适配Java7
private static final int ANDROID_8_API = 26;
private static final int ANDROID_10_API = 29;
private static final int ANDROID_19_API = 19;
// ====================== 成员变量区 ======================
private Context mContext;
private WindowManager mWindowManager;
private WindowManager.LayoutParams mWindowParams;
private View mFloatingView;
private boolean mIsShowing;
private android.content.BroadcastReceiver mGreenChannelReceiver;
// ====================== 构造函数区 ======================
/**
* 构造函数
* @param context 上下文
*/
public GreenChannelFloatingWindow(Context context) {
this.mContext = context;
this.mIsShowing = false;
LogUtils.d(TAG, "GreenChannelFloatingWindow: 构造函数调用完成");
}
// ====================== 公共方法区 ======================
/**
* 显示悬浮窗
* @return true=显示成功,false=显示失败(权限不足或已显示)
*/
public boolean show() {
LogUtils.d(TAG, "show: 尝试显示悬浮窗");
// 检查是否已显示
if (mIsShowing) {
LogUtils.w(TAG, "show: 悬浮窗已显示,跳过重复显示");
return true;
}
// 检查悬浮窗权限
if (!PermissionUtils.isOverlayPermissionGranted(mContext)) {
LogUtils.e(TAG, "show: 悬浮窗权限未授予,无法显示");
return false;
}
// 初始化窗口管理器
if (!initWindowManager()) {
LogUtils.e(TAG, "show: 窗口管理器初始化失败");
return false;
}
// 初始化悬浮窗视图
if (!initFloatingView()) {
LogUtils.e(TAG, "show: 悬浮窗视图初始化失败");
return false;
}
// 显示悬浮窗
try {
mWindowManager.addView(mFloatingView, mWindowParams);
mIsShowing = true;
// 注册绿色通道状态变更广播接收器
registerGreenChannelReceiver();
LogUtils.d(TAG, "show: 悬浮窗显示成功");
return true;
} catch (SecurityException e) {
LogUtils.e(TAG, "show: 悬浮窗显示失败(安全异常)", e);
return false;
} catch (Exception e) {
LogUtils.e(TAG, "show: 悬浮窗显示异常", e);
return false;
}
}
/**
* 隐藏悬浮窗
*/
public void dismiss() {
LogUtils.d(TAG, "dismiss: 尝试隐藏悬浮窗");
if (!mIsShowing) {
LogUtils.d(TAG, "dismiss: 悬浮窗未显示,跳过隐藏操作");
return;
}
// 反注册绿色通道状态变更广播接收器
unregisterGreenChannelReceiver();
if (mFloatingView != null && mWindowManager != null) {
try {
mWindowManager.removeView(mFloatingView);
mIsShowing = false;
LogUtils.d(TAG, "dismiss: 悬浮窗隐藏成功");
} catch (Exception e) {
LogUtils.e(TAG, "dismiss: 悬浮窗隐藏异常", e);
}
}
}
/**
* 检查悬浮窗是否正在显示
* @return true=正在显示,false=未显示
*/
public boolean isShowing() {
return mIsShowing;
}
/**
* 获取悬浮窗视图
* @return 悬浮窗视图,未初始化时返回null
*/
public View getFloatingView() {
return mFloatingView;
}
// ====================== 私有方法区 ======================
/**
* 初始化窗口管理器
* @return true=初始化成功,false=初始化失败
*/
private boolean initWindowManager() {
if (mWindowManager == null) {
mWindowManager = (WindowManager) mContext.getApplicationContext()
.getSystemService(Context.WINDOW_SERVICE);
if (mWindowManager == null) {
LogUtils.e(TAG, "initWindowManager: WindowManager获取失败");
return false;
}
LogUtils.d(TAG, "initWindowManager: WindowManager初始化成功");
}
// 初始化窗口参数
initWindowParams();
return true;
}
/**
* 初始化窗口参数(适配API26+窗口类型)
*/
private void initWindowParams() {
mWindowParams = new WindowManager.LayoutParams();
// 窗口位置:顶部居中
mWindowParams.gravity = Gravity.CENTER_HORIZONTAL | Gravity.TOP;
// 窗口大小:宽度全屏,高度自适应
mWindowParams.width = WindowManager.LayoutParams.MATCH_PARENT;
mWindowParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
// 窗口格式:半透明
mWindowParams.format = PixelFormat.TRANSLUCENT;
// 窗口类型(适配API26+
if (Build.VERSION.SDK_INT >= ANDROID_10_API) {
mWindowParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
LogUtils.d(TAG, "initWindowParams: API29+ 悬浮窗类型=TYPE_APPLICATION_OVERLAY");
} else if (Build.VERSION.SDK_INT >= ANDROID_8_API) {
mWindowParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
LogUtils.d(TAG, "initWindowParams: API26-28 悬浮窗类型=TYPE_APPLICATION_OVERLAY");
} else {
mWindowParams.type = WindowManager.LayoutParams.TYPE_PHONE;
LogUtils.d(TAG, "initWindowParams: API26以下 悬浮窗类型=TYPE_PHONE");
}
// 窗口标志:无焦点(不抢占输入)、全屏布局
mWindowParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
// API19+ 添加透明状态栏/导航栏标志
if (Build.VERSION.SDK_INT >= ANDROID_19_API) {
mWindowParams.flags |= WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION;
}
LogUtils.d(TAG, "initWindowParams: 窗口参数初始化完成");
}
/**
* 初始化悬浮窗视图
* @return true=初始化成功,false=初始化失败
*/
private boolean initFloatingView() {
if (mFloatingView != null) {
LogUtils.d(TAG, "initFloatingView: 视图已初始化,跳过重复创建");
return true;
}
try {
// 创建FrameLayout拦截返回键
FrameLayout keyInterceptorLayout = new FrameLayout(mContext) {
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
// 拦截返回键,避免误关闭悬浮窗
if (event.getAction() == KeyEvent.ACTION_DOWN
&& event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
LogUtils.d(TAG, "dispatchKeyEvent: 拦截悬浮窗返回键事件");
return true;
}
return super.dispatchKeyEvent(event);
}
};
// 加载悬浮窗布局
mFloatingView = LayoutInflater.from(mContext)
.inflate(R.layout.view_green_channel_floating, keyInterceptorLayout);
LogUtils.d(TAG, "initFloatingView: 悬浮窗视图初始化完成");
return true;
} catch (Exception e) {
LogUtils.e(TAG, "initFloatingView: 悬浮窗视图初始化异常", e);
return false;
}
}
/**
* 注册绿色通道状态变更广播接收器
* 接收 LimitedTimeGreenChannelView 发出的通道开启与关闭消息
*/
private void registerGreenChannelReceiver() {
LogUtils.d(TAG, "registerGreenChannelReceiver: 注册绿色通道状态变更广播接收器");
mGreenChannelReceiver = new android.content.BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (LimitedTimeGreenChannelService.ACTION_GREEN_CHANNEL_STATE_CHANGED.equals(intent.getAction())) {
boolean isEnabled = intent.getBooleanExtra(
LimitedTimeGreenChannelService.EXTRA_GREEN_CHANNEL_ENABLED, false);
LogUtils.d(TAG, "registerGreenChannelReceiver: 收到绿色通道状态变更广播, isEnabled=" + isEnabled);
// 如果绿色通道关闭,关闭悬浮窗
if (!isEnabled) {
LogUtils.d(TAG, "registerGreenChannelReceiver: 绿色通道已关闭,准备关闭悬浮窗");
dismiss();
}
}
}
};
IntentFilter filter = new IntentFilter(LimitedTimeGreenChannelService.ACTION_GREEN_CHANNEL_STATE_CHANGED);
LocalBroadcastManager.getInstance(mContext).registerReceiver(mGreenChannelReceiver, filter);
LogUtils.d(TAG, "registerGreenChannelReceiver: 广播接收器注册完成");
}
/**
* 反注册绿色通道状态变更广播接收器
*/
private void unregisterGreenChannelReceiver() {
if (mGreenChannelReceiver != null) {
LogUtils.d(TAG, "unregisterGreenChannelReceiver: 反注册绿色通道状态变更广播接收器");
LocalBroadcastManager.getInstance(mContext).unregisterReceiver(mGreenChannelReceiver);
mGreenChannelReceiver = null;
LogUtils.d(TAG, "unregisterGreenChannelReceiver: 反注册完成");
}
}
}
@@ -0,0 +1,76 @@
package cc.winboll.studio.contacts.fragments;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import cc.winboll.studio.contacts.R;
import cc.winboll.studio.libappbase.LogUtils;
/**
* @Author ZhanGSKen<zhangsken@qq.com>
* @Date 2026/07/19
* @Describe 云盾查询区域视图(支持懒加载,仅切换到当前页才加载)
*/
public class DunQueryFragment extends Fragment {
public static final String TAG = "DunQueryFragment";
private static final String ARG_PAGE = "ARG_PAGE";
private int mPage;
private boolean isViewInitialized = false;
private boolean isLazyInitCompleted = false;
public static DunQueryFragment newInstance(int page) {
LogUtils.d(TAG, "newInstance: 创建云盾查询Fragment实例,页码=" + page);
Bundle args = new Bundle();
args.putInt(ARG_PAGE, page);
DunQueryFragment fragment = new DunQueryFragment();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LogUtils.d(TAG, "onCreate: Fragment创建开始");
if (getArguments() != null) {
mPage = getArguments().getInt(ARG_PAGE);
LogUtils.d(TAG, "onCreate: 读取页面参数,mPage=" + mPage);
}
LogUtils.d(TAG, "onCreate: Fragment创建完成");
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
LogUtils.d(TAG, "onCreateView: 加载Fragment布局");
View view = inflater.inflate(R.layout.fragment_dun_query, container, false);
isViewInitialized = true;
LogUtils.d(TAG, "onCreateView: Fragment布局加载完成");
return view;
}
@Override
public void onDestroy() {
super.onDestroy();
LogUtils.d(TAG, "onDestroy: Fragment开始销毁");
isViewInitialized = false;
isLazyInitCompleted = false;
LogUtils.d(TAG, "onDestroy: Fragment销毁完成");
}
public void initData() {
if (isLazyInitCompleted || !isViewInitialized || getContext() == null) {
LogUtils.d(TAG, "initData: 懒加载已完成/视图未就绪,跳过");
return;
}
LogUtils.d(TAG, "initData: 开始懒加载初始化");
isLazyInitCompleted = true;
LogUtils.d(TAG, "initData: 懒加载初始化完成");
}
}
@@ -1,118 +0,0 @@
package cc.winboll.studio.contacts.fragments;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import cc.winboll.studio.contacts.R;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.LogView;
/**
* @Author ZhanGSKen&豆包大模型<zhangsken@qq.com>
* @Date 2025/02/20 12:58:15
* @Describe 应用日志区域视图(支持懒加载,仅切换到当前页才启动日志)
*/
public class LogFragment extends Fragment {
// ====================== 常量定义区 ======================
public static final String TAG = "LogFragment";
private static final String ARG_PAGE = "ARG_PAGE";
// ====================== 页面参数区 ======================
private int mPage;
// ====================== UI控件区 ======================
private LogView mLogView;
// ====================== 懒加载标记区 ======================
private boolean isViewInitialized = false; // 视图控件绑定完成标记
private boolean isLazyInitCompleted = false; // 懒加载总流程完成标记
private boolean isLogViewStarted = false; // LogView启动状态标记
// ====================== 实例化函数区 ======================
public static LogFragment newInstance(int page) {
LogUtils.d(TAG, "newInstance: 创建日志Fragment实例,页码=" + page);
Bundle args = new Bundle();
args.putInt(ARG_PAGE, page);
LogFragment fragment = new LogFragment();
fragment.setArguments(args);
return fragment;
}
// ====================== 生命周期函数区 ======================
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LogUtils.d(TAG, "onCreate: Fragment创建开始");
if (getArguments() != null) {
mPage = getArguments().getInt(ARG_PAGE);
LogUtils.d(TAG, "onCreate: 读取页面参数,mPage=" + mPage);
}
LogUtils.d(TAG, "onCreate: Fragment创建完成");
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
LogUtils.d(TAG, "onCreateView: 加载Fragment布局");
View view = inflater.inflate(R.layout.fragment_log, container, false);
// Java7 适配:添加强制类型转换,仅初始化LogView控件(不启动)
mLogView = (LogView) view.findViewById(R.id.logview);
LogUtils.d(TAG, "onCreateView: LogView控件初始化完成(未启动)");
// 标记视图控件绑定完成
isViewInitialized = true;
return view;
}
@Override
public void onResume() {
super.onResume();
LogUtils.d(TAG, "onResume: Fragment进入前台");
// 已完成懒加载 → 仅重启LogView(切回页面时恢复日志显示)
if (isLazyInitCompleted && mLogView != null && !isLogViewStarted) {
mLogView.start();
isLogViewStarted = true;
LogUtils.d(TAG, "onResume: LogView已重启,恢复日志显示");
}
// 未完成懒加载 → 不操作(等待MainActivity调用initData触发)
}
@Override
public void onDestroy() {
super.onDestroy();
LogUtils.d(TAG, "onDestroy: Fragment开始销毁");
if (mLogView != null) {
// 若LogView有停止方法,必须调用(避免后台持续占用资源,根据实际API调整)
// mLogView.stop(); // 关键:释放LogView资源,防止内存泄漏
LogUtils.d(TAG, "onDestroy: LogView资源已释放");
}
// 重置所有标记,避免重建时状态异常
mLogView = null;
isViewInitialized = false;
isLazyInitCompleted = false;
isLogViewStarted = false;
LogUtils.d(TAG, "onDestroy: Fragment销毁完成");
}
// ====================== 懒加载核心方法(供MainActivity调用) ======================
public void initData() {
// 双重防护:避免重复初始化(标记+视图就绪+控件非空)
if (isLazyInitCompleted || !isViewInitialized || mLogView == null || getContext() == null) {
LogUtils.d(TAG, "initData: 懒加载已完成/视图未就绪,跳过");
return;
}
LogUtils.d(TAG, "initData: 开始懒加载初始化,启动LogView");
// 核心:启动LogView(原onCreateView中的start逻辑迁移至此)
mLogView.start();
isLogViewStarted = true;
// 标记懒加载总流程完成(仅执行一次)
isLazyInitCompleted = true;
LogUtils.d(TAG, "initData: 懒加载初始化完成,LogView正常启动");
}
}
@@ -28,6 +28,7 @@ public class SettingsBean extends BaseBean {
private static final String JSON_KEY_DUN_RESUME_COUNT = "dunResumeCount";
private static final String JSON_KEY_DUN_ENABLE = "isEnableDun";
private static final String JSON_KEY_URL = "szBoBullToon_URL";
private static final String JSON_KEY_GREEN_CHANNEL_ENABLE = "isEnableGreenChannel";
// ====================== 成员变量区 ======================
// 云盾防御层数量
@@ -40,6 +41,8 @@ public class SettingsBean extends BaseBean {
private int dunResumeCount;
// 是否启用云盾
private boolean isEnableDun;
// 是否启用绿色通道
private boolean isEnableGreenChannel;
// BoBullToon 应用模块数据请求地址
private String szBoBullToon_URL;
@@ -53,6 +56,7 @@ public class SettingsBean extends BaseBean {
this.dunResumeSecondCount = 60;
this.dunResumeCount = 1;
this.isEnableDun = false;
this.isEnableGreenChannel = false;
this.szBoBullToon_URL = "";
LogUtils.d(TAG, "SettingsModel: 默认构造初始化完成 | 云盾默认配置加载完毕");
}
@@ -61,17 +65,20 @@ public class SettingsBean extends BaseBean {
* 带参构造,初始化自定义配置并校验数值范围
*/
public SettingsBean(int dunTotalCount, int dunCurrentCount, int dunResumeSecondCount,
int dunResumeCount, boolean isEnableDun, String szBoBullToon_URL) {
int dunResumeCount, boolean isEnableDun, boolean isEnableGreenChannel,
String szBoBullToon_URL) {
this.dunTotalCount = getSettingsModelRangeInt(dunTotalCount);
this.dunCurrentCount = getSettingsModelRangeInt(dunCurrentCount);
this.dunResumeSecondCount = getSettingsModelRangeInt(dunResumeSecondCount);
this.dunResumeCount = getSettingsModelRangeInt(dunResumeCount);
this.isEnableDun = isEnableDun;
this.isEnableGreenChannel = isEnableGreenChannel;
this.szBoBullToon_URL = szBoBullToon_URL == null ? "" : szBoBullToon_URL;
LogUtils.d(TAG, "SettingsModel: 带参构造初始化完成 | 总层数=" + this.dunTotalCount
+ " | 当前层数=" + this.dunCurrentCount + " | 恢复间隔=" + this.dunResumeSecondCount
+ " | 恢复层数=" + this.dunResumeCount + " | 云盾启用=" + this.isEnableDun);
+ " | 恢复层数=" + this.dunResumeCount + " | 云盾启用=" + this.isEnableDun
+ " | 绿色通道启用=" + this.isEnableGreenChannel);
}
// ====================== 私有工具方法区 ======================
@@ -136,6 +143,15 @@ public class SettingsBean extends BaseBean {
this.isEnableDun = isEnableDun;
}
public boolean isEnableGreenChannel() {
return isEnableGreenChannel;
}
public void setIsEnableGreenChannel(boolean isEnableGreenChannel) {
LogUtils.d(TAG, "setIsEnableGreenChannel: 绿色通道启用状态更新为" + isEnableGreenChannel);
this.isEnableGreenChannel = isEnableGreenChannel;
}
public String getBoBullToon_URL() {
return szBoBullToon_URL;
}
@@ -164,6 +180,7 @@ public class SettingsBean extends BaseBean {
jsonWriter.name(JSON_KEY_DUN_RESUME_SECOND).value(getDunResumeSecondCount());
jsonWriter.name(JSON_KEY_DUN_RESUME_COUNT).value(getDunResumeCount());
jsonWriter.name(JSON_KEY_DUN_ENABLE).value(isEnableDun());
jsonWriter.name(JSON_KEY_GREEN_CHANNEL_ENABLE).value(isEnableGreenChannel());
jsonWriter.name(JSON_KEY_URL).value(getBoBullToon_URL());
LogUtils.d(TAG, "writeThisToJsonWriter: JSON序列化完成");
}
@@ -187,6 +204,8 @@ public class SettingsBean extends BaseBean {
setDunResumeCount(getSettingsModelRangeInt(jsonReader.nextInt()));
} else if (JSON_KEY_DUN_ENABLE.equals(name)) {
setIsEnableDun(jsonReader.nextBoolean());
} else if (JSON_KEY_GREEN_CHANNEL_ENABLE.equals(name)) {
setIsEnableGreenChannel(jsonReader.nextBoolean());
} else if (JSON_KEY_URL.equals(name)) {
setBoBullToon_URL(jsonReader.nextString());
} else {
@@ -13,17 +13,17 @@ import cc.winboll.studio.libappbase.LogUtils;
* @Author 豆包&ZhanGSKen<zhangsken@qq.com>
* @Date 2026/04/18 15:00:00 (GMT+8)
* @LastEditTime 2026/04/22 17:20:00 (GMT+8)
* @Describe 限时特殊通道服务
* @Describe 限时绿色通道服务
* 提供安全的服务启动令牌校验及循环任务管理
* 新增功能
* 1. 计时过程中实时输出剩余秒数
* 2. 服务销毁前发送本地广播通知应用内其他组件并携带剩余秒数信息
* 3. 每秒发送一次倒计时状态的本地广播
*/
public class LimitedTimeSpecialChannelService extends Service {
public class LimitedTimeGreenChannelService extends Service {
// ========================= 常量定义 =========================
public static final String TAG = "LimitedTimeSpecialChannelService";
public static final String TAG = "LimitedTimeGreenChannelService";
public static final String EXTRA_DELAY_MILLIS = "EXTRA_DELAY_MILLIS";
private static final String EXTRA_SECURITY_TOKEN = "EXTRA_SECURITY_TOKEN";
@@ -32,6 +32,10 @@ public class LimitedTimeSpecialChannelService extends Service {
// 倒计时心跳广播 Action
public static final String ACTION_COUNTDOWN_TICK = "cc.winboll.studio.contacts.services.ACTION_COUNTDOWN_TICK";
// 绿色通道状态变更广播 Action
public static final String ACTION_GREEN_CHANNEL_STATE_CHANGED = "cc.winboll.studio.contacts.services.ACTION_GREEN_CHANNEL_STATE_CHANGED";
// 广播携带的额外参数绿色通道是否开启
public static final String EXTRA_GREEN_CHANNEL_ENABLED = "EXTRA_GREEN_CHANNEL_ENABLED";
// 广播携带的额外参数剩余秒数
public static final String EXTRA_REMAINING_SECONDS = "EXTRA_REMAINING_SECONDS";
// 广播携带的额外参数总定时秒数
@@ -44,7 +48,7 @@ public class LimitedTimeSpecialChannelService extends Service {
*/
public static final String mValidToken = "VALID_TOKEN_" + System.currentTimeMillis();
private static volatile LimitedTimeSpecialChannelService sInstance = null;
private static volatile LimitedTimeGreenChannelService sInstance = null;
private static volatile boolean sIsServiceRunning = false;
// ========================= 成员变量 =========================
@@ -73,7 +77,7 @@ public class LimitedTimeSpecialChannelService extends Service {
}
// 构建Intent传递参数
Intent intent = new Intent(context, LimitedTimeSpecialChannelService.class);
Intent intent = new Intent(context, LimitedTimeGreenChannelService.class);
intent.putExtra(EXTRA_SECURITY_TOKEN, mValidToken);
intent.putExtra(EXTRA_DELAY_MILLIS, delayMillis);
@@ -93,7 +97,7 @@ public class LimitedTimeSpecialChannelService extends Service {
LogUtils.w(TAG, "停止失败,上下文为null");
return;
}
Intent intent = new Intent(context, LimitedTimeSpecialChannelService.class);
Intent intent = new Intent(context, LimitedTimeGreenChannelService.class);
context.stopService(intent);
LogUtils.i(TAG, "服务停止命令已发出");
}
@@ -106,6 +110,18 @@ public class LimitedTimeSpecialChannelService extends Service {
return sIsServiceRunning;
}
/**
* 公共静态方法发送绿色通道状态变更广播
* @param context 上下文
* @param isEnabled 绿色通道是否开启
*/
public static void sendGreenChannelStateChangedBroadcast(Context context, boolean isEnabled) {
LogUtils.i(TAG, "sendGreenChannelStateChangedBroadcast: 发送绿色通道状态变更广播, isEnabled=" + isEnabled);
Intent intent = new Intent(ACTION_GREEN_CHANNEL_STATE_CHANGED);
intent.putExtra(EXTRA_GREEN_CHANNEL_ENABLED, isEnabled);
LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
}
/**
* 核心单元测试方法
* 执行完整的单元测试流程
@@ -0,0 +1,47 @@
package cc.winboll.studio.contacts.unittest;
import android.os.Bundle;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import cc.winboll.studio.contacts.R;
import cc.winboll.studio.libappbase.LogUtils;
/**
* @Author 豆包&BigPickle&ZhanGSKen<zhangsken@qq.com>
* @Date 2026/07/18 19:35
* @Describe 布局控件快速便捷辅助草稿
*/
public class LayoutDraftPreViewActivity extends AppCompatActivity {
public static final String TAG = "LayoutDraftPreViewActivity";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LogUtils.d(TAG, "onCreate: 布局草稿预览窗口启动");
setContentView(R.layout.activity_layoutdraft_preview);
initToolbar();
LogUtils.d(TAG, "onCreate: 初始化完成");
}
private void initToolbar() {
LogUtils.d(TAG, "initToolbar: 初始化工具栏");
Toolbar toolbar = (Toolbar) findViewById(R.id.activity_layoutdraft_preview_toolbar);
setSupportActionBar(toolbar);
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setTitle(TAG);
}
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LogUtils.d(TAG, "initToolbar: 点击后退按钮,关闭页面");
finish();
}
});
LogUtils.d(TAG, "initToolbar: 工具栏初始化完成");
}
}
@@ -0,0 +1,154 @@
package cc.winboll.studio.contacts.views;
import android.content.Context;
import android.content.Intent;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import cc.winboll.studio.contacts.R;
import cc.winboll.studio.contacts.floatingwindow.GreenChannelFloatingWindow;
import cc.winboll.studio.libappbase.LogActivity;
import cc.winboll.studio.libappbase.LogUtils;
/**
* @Author ZhanGSKen<zhangsken@qq.com>
* @Date 2026/07/18
* @Describe 调试工具按钮组控件:提供常用调试功能快捷入口,仅在调试模式下显示
*/
public class DebugToolButtonsView extends LinearLayout {
private static final String TAG = "DebugToolButtonsView";
private Context mContext;
private GreenChannelFloatingWindow mGreenChannelFloatingWindow;
public DebugToolButtonsView(Context context) {
super(context);
initView(context);
}
public DebugToolButtonsView(Context context, AttributeSet attrs) {
super(context, attrs);
initView(context);
}
public DebugToolButtonsView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initView(context);
}
private void initView(Context context) {
LogUtils.d(TAG, "initView: 初始化调试工具按钮组");
this.mContext = context;
setOrientation(VERTICAL);
LayoutInflater.from(context).inflate(R.layout.view_debug_tool_buttons, this, true);
initButtons();
LogUtils.d(TAG, "initView: 调试工具按钮组初始化完成");
}
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);
Button btnLogView = (Button) findViewById(R.id.btn_debug_logview);
Button btnGreenChannel = (Button) findViewById(R.id.btn_debug_green_channel);
btnCrash.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
onTestCrash();
}
});
btnLayoutPreview.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
onOpenLayoutPreview();
}
});
btnUnitTest.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
onOpenUnitTest();
}
});
btnLogView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
onLogView();
}
});
btnGreenChannel.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
onOpenGreenChannel();
}
});
}
private void onTestCrash() {
LogUtils.d(TAG, "onTestCrash: 触发测试崩溃");
for (int i = Integer.MIN_VALUE; i < Integer.MAX_VALUE; i++) {
((android.app.Activity) mContext).getString(i);
}
}
private void onOpenLayoutPreview() {
LogUtils.d(TAG, "onOpenLayoutPreview: 打开布局草稿预览窗口");
try {
Intent intent = new Intent();
intent.setClassName(mContext, "cc.winboll.studio.contacts.unittest.LayoutDraftPreViewActivity");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivity(intent);
LogUtils.d(TAG, "onOpenLayoutPreview: 跳转成功");
} catch (Exception e) {
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);
}
}
/**
* 跳转日志查看页面
*/
private void onLogView() {
LogUtils.d(TAG, "onLogView: 打开日志窗口");
LogActivity.startLogActivity(getContext(), true);
}
/**
* 打开绿色通道悬浮窗
*/
private void onOpenGreenChannel() {
LogUtils.d(TAG, "onOpenGreenChannel: 打开绿色通道悬浮窗");
if (mGreenChannelFloatingWindow == null) {
mGreenChannelFloatingWindow = new GreenChannelFloatingWindow(mContext);
}
if (mGreenChannelFloatingWindow.isShowing()) {
LogUtils.d(TAG, "onOpenGreenChannel: 悬浮窗已显示,跳过");
return;
}
boolean result = mGreenChannelFloatingWindow.show();
if (result) {
LogUtils.d(TAG, "onOpenGreenChannel: 悬浮窗显示成功");
} else {
LogUtils.e(TAG, "onOpenGreenChannel: 悬浮窗显示失败,可能缺少悬浮窗权限");
}
}
}
@@ -0,0 +1,103 @@
package cc.winboll.studio.contacts.views;
import android.content.Context;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import cc.winboll.studio.contacts.R;
import cc.winboll.studio.contacts.dun.Rules;
import cc.winboll.studio.libappbase.LogUtils;
/**
* @Author ZhanGSKen<zhangsken@qq.com>
* @Date 2026/07/19
* @Describe 云盾拦截查询视图控件:实时查询电话号码的云盾拦截状态
*/
public class DunQueryView extends LinearLayout {
private static final String TAG = "DunQueryView";
private Context mContext;
private EditText mEtPhone;
private TextView mTvResult;
public DunQueryView(Context context) {
super(context);
initView(context);
}
public DunQueryView(Context context, AttributeSet attrs) {
super(context, attrs);
initView(context);
}
public DunQueryView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initView(context);
}
private void initView(Context context) {
LogUtils.d(TAG, "initView: 初始化云盾查询视图");
this.mContext = context;
setOrientation(VERTICAL);
LayoutInflater.from(context).inflate(R.layout.view_dun_query, this, true);
initViews();
initListeners();
LogUtils.d(TAG, "initView: 云盾查询视图初始化完成");
}
private void initViews() {
mEtPhone = (EditText) findViewById(R.id.et_dun_query_phone);
mTvResult = (TextView) findViewById(R.id.tv_dun_query_result);
}
private void initListeners() {
mEtPhone.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
queryDunStatus(s.toString().trim());
}
});
}
private void queryDunStatus(String phoneNumber) {
if (phoneNumber.isEmpty()) {
mTvResult.setText("请输入电话号码");
mTvResult.setTextColor(mContext.getResources().getColor(R.color.gray_500));
LogUtils.d(TAG, "queryDunStatus: 输入为空,显示默认提示");
return;
}
Rules rules = Rules.getInstance(mContext);
if (rules == null) {
mTvResult.setText("云盾规则未初始化");
mTvResult.setTextColor(mContext.getResources().getColor(R.color.gray_500));
LogUtils.e(TAG, "queryDunStatus: Rules实例获取失败");
return;
}
boolean isAllowed = rules.isAllowed(phoneNumber, true);
if (isAllowed) {
mTvResult.setText("这个号码很新,什么防御都不会启动。");
mTvResult.setTextColor(mContext.getResources().getColor(R.color.green_normal));
LogUtils.d(TAG, "queryDunStatus: 号码" + phoneNumber + " 允许接通");
} else {
mTvResult.setText("你说我像云像雾像雨又像风~~~ 怎么来来去去,怎么也又播不通~~~");
mTvResult.setTextColor(mContext.getResources().getColor(R.color.red_normal));
LogUtils.d(TAG, "queryDunStatus: 号码" + phoneNumber + " 被拦截");
}
}
}
@@ -13,79 +13,79 @@ import android.os.Message;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.View;
import cc.winboll.studio.libappbase.LogUtils;
import java.util.WeakHashMap;
/**
* @Author ZhanGSKen&豆包大模型<zhangsken@qq.com>
* @Date 2025/03/19 14:04:20
* @Author 豆包&Big Pickle&MiMo&ZhanGSKen<zhangsken@qq.com>
* @CreateDate 2025/03/19 14:04:20
* @LastEdit 2026/07/21 11:40:00
* @Describe 云盾华氏度热力视图,垂直盾值温度视图控件(带颜色渐变+静态Handler更新)
* 采用绘图方式展示盾值温度,填充色随盾值比例渐变,支持设置文本在温度条左侧/右侧,底部对齐竖排显示
* 温度条宽度=5dp,文本区宽度固定=5dp,整体左右边距=0,无任何多余空白间距
* 1. 原生Canvas绘图渲染盾值温度,填充色随盾值比例动态渐变
* 2. 支持竖排数值文本切换至温度条左侧/右侧,文本底部对齐展示
* 3. 固定尺寸规范:温度条宽度5dp、文本区域宽度5dp,控件左右无外边距
* 4. 全局静态Handler统一分发盾值更新,WeakHashMap弱引用缓存控件防止内存泄漏
* 5. 代码完全兼容Java7语法,无Lambda、无try-with-resources、无高版本API
*/
public class DunTemperatureView extends View {
// ====================== 常量定义区 ======================
public static final String TAG = "DunTemperatureView";
// 控件默认高度
private static final int DEFAULT_HEIGHT = 200;
// 温度条宽度(5dp)、文本区宽度(固定5dp)
private static final int THERMOMETER_WIDTH_DP = 5;
private static final int TEXT_AREA_WIDTH_DP = 5;
// 填充区域内边距(左右=0,上下=2避免贴边)
private static final int FILL_PADDING_HORIZONTAL = 0;
private static final int FILL_PADDING_VERTICAL = 2;
// 竖排文本字间距
private static final float TEXT_CHAR_SPACING = 8f;
// Handler消息标识
public static final int MSG_UPDATE_DUN_VALUE = 0x01;
// 消息参数Key
public static final String KEY_MAX_VALUE = "max_value";
public static final String KEY_CURRENT_VALUE = "current_value";
private static final int DEFAULT_HEIGHT = 200;
private static final int THERMOMETER_WIDTH_DP = 5;
private static final int TEXT_AREA_WIDTH_DP = 5;
private static final int FILL_PADDING_HORIZONTAL = 0;
private static final int FILL_PADDING_VERTICAL = 2;
private static final float TEXT_CHAR_SPACING = 8f;
private static final int COLOR_GRADIENT_LOW = Color.GREEN;
private static final int COLOR_GRADIENT_MID = Color.YELLOW;
private static final int COLOR_GRADIENT_HIGH = Color.RED;
private static final int COLOR_BORDER = Color.parseColor("#FF444444");
private static final int COLOR_TEXT = Color.parseColor("#FF000000");
// ====================== 静态成员区 ======================
// 弱引用缓存控件实例,避免内存泄漏
private static WeakHashMap<DunTemperatureView, Object> sViewCache = new WeakHashMap<>();
// 静态Handler,处理跨线程更新消息
private static final WeakHashMap<DunTemperatureView, Object> sViewCache = new WeakHashMap<DunTemperatureView, Object>();
private static Handler sStaticHandler;
// ====================== 成员变量区 ======================
// 画笔相关
// ====================== 实例成员变量区 ======================
private Paint mThermometerPaint;
private Paint mFillPaint;
private Paint mTextPaint;
// 尺寸参数(dp转px后的值)
private int mThermometerWidth;
private int mTextAreaWidth;
private int mMaxValue = 100; // 最高盾值
private int mCurrentValue = 0; // 当前盾值
private RectF mThermometerRect; // 温度条矩形区域
// 渐变颜色配置(低→中→高 对应绿→黄→红)
private int[] mGradientColors = {Color.GREEN, Color.YELLOW, Color.RED};
private float[] mGradientPositions = {0.0f, 0.5f, 1.0f};
// 布局配置:true=文本在温度条右侧(默认),false=文本在温度条左侧
private int mMaxValue = 100;
private int mCurrentValue = 0;
private RectF mThermometerRect;
private int[] mGradientColors = new int[]{COLOR_GRADIENT_LOW, COLOR_GRADIENT_MID, COLOR_GRADIENT_HIGH};
private float[] mGradientPositions = new float[]{0.0f, 0.5f, 1.0f};
private boolean isTextOnRight = true;
// 其他颜色配置
private int mBorderColor = Color.parseColor("#FF444444");
private int mTextColor = Color.parseColor("#FF000000");
private int mBorderColor = COLOR_BORDER;
private int mTextColor = COLOR_TEXT;
// ====================== 静态代码块 ======================
static {
// 初始化静态Handler,绑定主线程Looper
sStaticHandler = new Handler(Looper.getMainLooper()) {
@Override
public void handleMessage(Message msg) {
public void handleMessage(final Message msg) {
super.handleMessage(msg);
if (msg.what == MSG_UPDATE_DUN_VALUE) {
// 获取消息中的盾值参数
int maxValue = msg.getData().getInt(KEY_MAX_VALUE, 100);
int currentValue = msg.getData().getInt(KEY_CURRENT_VALUE, 0);
LogUtils.d(TAG, "sStaticHandler: 收到更新消息,max=" + maxValue + ", current=" + currentValue);
final int targetMsgWhat = msg.what;
if (targetMsgWhat == MSG_UPDATE_DUN_VALUE) {
final int maxValue = msg.getData().getInt(KEY_MAX_VALUE, 100);
final int currentValue = msg.getData().getInt(KEY_CURRENT_VALUE, 0);
LogUtils.d(TAG, "handleMessage receive update params, max=" + maxValue + ", current=" + currentValue);
// 遍历缓存的控件实例,更新所有实例
for (DunTemperatureView view : sViewCache.keySet()) {
if (view != null && view.isShown()) {
view.setMaxValue(maxValue);
view.setCurrentValue(currentValue);
final DunTemperatureView targetView = view;
if (targetView != null && targetView.isShown()) {
targetView.setMaxValue(maxValue);
targetView.setCurrentValue(currentValue);
}
}
}
@@ -94,203 +94,194 @@ public class DunTemperatureView extends View {
}
// ====================== 构造函数区 ======================
public DunTemperatureView(Context context) {
public DunTemperatureView(final Context context) {
super(context);
init();
}
public DunTemperatureView(Context context, AttributeSet attrs) {
public DunTemperatureView(final Context context, final AttributeSet attrs) {
super(context, attrs);
init();
}
public DunTemperatureView(Context context, AttributeSet attrs, int defStyleAttr) {
public DunTemperatureView(final Context context, final AttributeSet attrs, final int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
// ====================== 初始化方法 ======================
// ====================== 初始化私有方法 ======================
/**
* 初始化画笔和参数
* 初始化画笔、尺寸参数并将实例存入全局缓存
*/
private void init() {
LogUtils.d(TAG, "init: 开始初始化云盾温度视图控件");
// dp转px(适配不同分辨率)
mThermometerWidth = dp2px(getContext(), THERMOMETER_WIDTH_DP);
mTextAreaWidth = dp2px(getContext(), TEXT_AREA_WIDTH_DP);
LogUtils.d(TAG, "init: 温度条宽度5dp转px=" + mThermometerWidth + ",文本区宽度5dp转px=" + mTextAreaWidth);
final Context context = getContext();
LogUtils.d(TAG, "init start");
mThermometerWidth = dp2px(context, THERMOMETER_WIDTH_DP);
mTextAreaWidth = dp2px(context, TEXT_AREA_WIDTH_DP);
LogUtils.d(TAG, "init dp convert result, thermometerWidth=" + mThermometerWidth + ", textAreaWidth=" + mTextAreaWidth);
// 温度条边框画笔(宽度1px,适配5dp宽度)
mThermometerPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mThermometerPaint.setColor(mBorderColor);
mThermometerPaint.setStyle(Paint.Style.STROKE);
mThermometerPaint.setStrokeWidth(1);
// 温度条填充画笔(支持渐变)
mFillPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mFillPaint.setStyle(Paint.Style.FILL);
// 文本画笔(适配5dp窄文本区,文字居中绘制)
mTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mTextPaint.setColor(mTextColor);
mTextPaint.setTextSize(18); // 缩小字号适配5dp窄文本区(避免文字超出)
mTextPaint.setTextSize(18);
mTextPaint.setTextAlign(Paint.Align.CENTER);
mTextPaint.setFakeBoldText(true); // 文字加粗,提升窄区域可读性
mTextPaint.setFakeBoldText(true);
// 初始化温度条矩形
mThermometerRect = new RectF();
// 将当前实例加入静态缓存
sViewCache.put(this, null);
LogUtils.d(TAG, "init: 云盾温度视图控件初始化完成,实例已加入缓存");
LogUtils.d(TAG, "init complete, add view to static cache");
}
// ====================== 工具方法区 ======================
/**
* dp 转 px(适配不同屏幕分辨率)
* dp单位转换px,多分辨率屏幕适配
* @param context 上下文
* @param dpValue dp数值
* @return 对应px像素值
*/
private int dp2px(Context context, float dpValue) {
return (int) TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP,
dpValue,
context.getResources().getDisplayMetrics()
);
private int dp2px(final Context context, final float dpValue) {
final float density = context.getResources().getDisplayMetrics().density;
return (int) (dpValue * density + 0.5f);
}
// ====================== 对外控制方法 ======================
// ====================== UI布局控制方法 ======================
/**
* 设置文本相对于温度条的位置
* @param isOnRight true=文本在温度条右侧(默认)false=文本在温度条左侧
* 设置文本温度条的左右位置
* @param isOnRight true=右侧false=左侧
*/
public void setTextPosition(boolean isOnRight) {
public void setTextPosition(final boolean isOnRight) {
this.isTextOnRight = isOnRight;
invalidate(); // 刷新布局绘制
LogUtils.d(TAG, "setTextPosition input param=" + isOnRight);
invalidate();
}
/**
* 获取当前文本位置配置
* @return true=右侧,false=左侧
*/
public boolean isTextOnRight() {
return isTextOnRight;
}
// ====================== 对外静态方法区 ======================
// ====================== 全局静态更新入口 ======================
/**
* 静态外部方法:发送消息更新所有 DunTemperatureView 实例的盾值
* 可在子线程中调用
* @param maxValue 最高盾值
* 全局静态方法,统一更新所有控件盾值,支持子线程调用
* @param maxValue 最大盾值
* @param currentValue 当前盾值
*/
public static void updateDunValue(int maxValue, int currentValue) {
public static void updateDunValue(final int maxValue, final int currentValue) {
if (sStaticHandler == null) {
LogUtils.w(TAG, "updateDunValue: 静态Handler未初始化");
LogUtils.w(TAG, "updateDunValue static handler uninitialized");
return;
}
// 封装参数到消息
Message msg = sStaticHandler.obtainMessage(MSG_UPDATE_DUN_VALUE);
LogUtils.d(TAG, "static updateDunValue call, input max=" + maxValue + ", current=" + currentValue);
final Message msg = sStaticHandler.obtainMessage(MSG_UPDATE_DUN_VALUE);
msg.getData().putInt(KEY_MAX_VALUE, maxValue);
msg.getData().putInt(KEY_CURRENT_VALUE, currentValue);
// 发送消息
sStaticHandler.sendMessage(msg);
}
// ====================== 对外实例方法 ======================
// ====================== 盾值读写实例方法 ======================
/**
* 设置最盾值
* @param maxValue 最高盾值(需大于0
* 设置最盾值,非法值会拦截并打印日志
* @param maxValue 目标最大值,必须大于0
*/
public void setMaxValue(int maxValue) {
public void setMaxValue(final int maxValue) {
if (maxValue <= 0) {
LogUtils.w(TAG, "setMaxValue: 最高盾值必须大于0,当前值=" + maxValue);
LogUtils.w(TAG, "setMaxValue invalid input value=" + maxValue);
return;
}
this.mMaxValue = maxValue;
// 限制当前值不超过最大值
mCurrentValue = Math.min(mCurrentValue, maxValue);
invalidate(); // 重绘控件
LogUtils.d(TAG, "setMaxValue update max=" + maxValue + ", clamp current=" + mCurrentValue);
invalidate();
}
/**
* 设置当前盾值
* @param currentValue 当前盾值(范围 0~maxValue
* 设置当前盾值,自动限制0~maxValue区间
* @param currentValue 目标当前盾值
*/
public void setCurrentValue(int currentValue) {
int oldValue = this.mCurrentValue;
public void setCurrentValue(final int currentValue) {
final int oldVal = this.mCurrentValue;
this.mCurrentValue = Math.max(0, Math.min(currentValue, mMaxValue));
if (oldValue != this.mCurrentValue) {
LogUtils.d(TAG, "setCurrentValue: 当前盾值从" + oldValue + "更新为" + mCurrentValue);
invalidate(); // 重绘控件
if (oldVal != this.mCurrentValue) {
LogUtils.d(TAG, "setCurrentValue change value from " + oldVal + " to " + mCurrentValue);
invalidate();
}
}
/**
* 获取当前盾值
*/
public int getCurrentValue() {
return mCurrentValue;
}
/**
* 获取最高盾值
*/
public int getMaxValue() {
return mMaxValue;
}
// ====================== 渐变、颜色自定义配置 ======================
/**
* 设置自定义渐变颜色
* @param colors 渐变颜色数组(至少2种颜色)
* @param positions 颜色位置数组(与colors长度一致,0.0~1.0
* 自定义渐变颜色数组与位置节点
* @param colors 颜色数组,长度≥2
* @param positions 渐变节点数组,长度与colors一致
*/
public void setGradientColors(int[] colors, float[] positions) {
public void setGradientColors(final int[] colors, final float[] positions) {
if (colors == null || colors.length < 2 || positions == null || positions.length != colors.length) {
LogUtils.w(TAG, "setGradientColors: 渐变颜色参数不合法,颜色数组长度=" + (colors == null ? "null" : colors.length));
LogUtils.w(TAG, "setGradientColors invalid param, color array length=" + (colors == null ? "null" : colors.length));
return;
}
this.mGradientColors = colors;
this.mGradientPositions = positions;
LogUtils.d(TAG, "setGradientColors: 自定义渐变颜色已设置");
LogUtils.d(TAG, "setGradientColors custom gradient config applied");
invalidate();
}
/**
* 设置温度条边框颜色
* 更新温度条边框颜色
* @param color 目标色值
*/
public void setBorderColor(int color) {
public void setBorderColor(final int color) {
this.mBorderColor = color;
mThermometerPaint.setColor(color);
LogUtils.d(TAG, "setBorderColor: 边框颜色已更新");
LogUtils.d(TAG, "setBorderColor update border color");
invalidate();
}
/**
* 设置文本颜色
* 更新竖排文本颜色
* @param color 目标色值
*/
public void setTextColor(int color) {
public void setTextColor(final int color) {
this.mTextColor = color;
mTextPaint.setColor(color);
LogUtils.d(TAG, "setTextColor: 文本颜色已更新");
LogUtils.d(TAG, "setTextColor update text color");
invalidate();
}
// ====================== 生命周期方法 ======================
// ====================== 视图生命周期回调 ======================
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
// 控件从窗口移除时,从缓存中清除,避免内存泄漏
sViewCache.remove(this);
LogUtils.d(TAG, "onDetachedFromWindow: 控件实例已从缓存移除");
LogUtils.d(TAG, "onDetachedFromWindow remove view from static cache");
}
// ====================== 测量绘制 ======================
// ====================== 测量绘制工具私有方法 ======================
/**
* 测量辅助函数
* 测量尺寸计算工具
* @param defaultSize 默认尺寸
* @param measureSpec 测量规格
* @return 最终计算尺寸
*/
private int measureSize(int defaultSize, int measureSpec) {
private int measureSize(final int defaultSize, final int measureSpec) {
int result = defaultSize;
int specMode = MeasureSpec.getMode(measureSpec);
int specSize = MeasureSpec.getSize(measureSpec);
final int specMode = MeasureSpec.getMode(measureSpec);
final int specSize = MeasureSpec.getSize(measureSpec);
if (specMode == MeasureSpec.EXACTLY) {
result = specSize;
} else if (specMode == MeasureSpec.AT_MOST) {
@@ -302,90 +293,83 @@ public class DunTemperatureView extends View {
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
// 强制控件整体左右内边距=0,彻底消除外部边距
setPadding(0, getPaddingTop(), 0, getPaddingBottom());
// 控件宽度=温度条宽度 + 文本区宽度(均为5dp转px,无额外空白)
int defaultWidth = mThermometerWidth + mTextAreaWidth;
int width = measureSize(defaultWidth, widthMeasureSpec);
int height = measureSize(DEFAULT_HEIGHT, heightMeasureSpec);
final int defaultWidth = mThermometerWidth + mTextAreaWidth;
final int width = measureSize(defaultWidth, widthMeasureSpec);
final int height = measureSize(DEFAULT_HEIGHT, heightMeasureSpec);
setMeasuredDimension(width, height);
// 根据文本位置配置,计算温度条矩形坐标
float thermometerLeft, thermometerRight;
if (isTextOnRight) {
// 文本在右侧:温度条靠左,右接文本区
float thermometerLeft;
float thermometerRight;
final boolean textRightFlag = isTextOnRight;
if (textRightFlag) {
thermometerLeft = 0;
thermometerRight = thermometerLeft + mThermometerWidth;
} else {
// 文本在左侧:温度条靠右,左接文本区
thermometerLeft = width - mThermometerWidth;
thermometerRight = width;
}
float thermometerTop = getPaddingTop();
float thermometerBottom = height - getPaddingBottom();
final float thermometerTop = getPaddingTop();
final float thermometerBottom = height - getPaddingBottom();
mThermometerRect.set(thermometerLeft, thermometerTop, thermometerRight, thermometerBottom);
LogUtils.v(TAG, "onMeasure: 文本位置=" + (isTextOnRight ? "右侧" : "左侧") + ",控件尺寸=" + width + "x" + height + ",温度条区域=" + mThermometerRect.toShortString());
LogUtils.v(TAG, "onMeasure textPos=" + (textRightFlag ? "RIGHT" : "LEFT") + ", view size=" + width + "x" + height);
}
@Override
protected void onDraw(Canvas canvas) {
protected void onDraw(final Canvas canvas) {
super.onDraw(canvas);
// 1. 绘制温度条边框5dp宽度,小圆角适配)
// 绘制温度条边框
canvas.drawRoundRect(mThermometerRect, 3, 3, mThermometerPaint);
// 2. 计算填充高度(根据当前值占最大值的比例
float fillRatio = (float) mCurrentValue / mMaxValue;
float fillHeight = mThermometerRect.height() * fillRatio;
float fillTop = mThermometerRect.bottom - fillHeight;
// 计算渐变填充区域高度比例
final float fillRatio = (float) mCurrentValue / mMaxValue;
final float fillHeight = mThermometerRect.height() * fillRatio;
final float fillTop = mThermometerRect.bottom - fillHeight;
// 3. 绘制渐变填充部分(左右贴边框,无间距)
// 绘制渐变填充色块
if (fillHeight > 0) {
RectF fillRect = new RectF(
mThermometerRect.left + FILL_PADDING_HORIZONTAL,
fillTop + FILL_PADDING_VERTICAL,
mThermometerRect.right - FILL_PADDING_HORIZONTAL,
mThermometerRect.bottom - FILL_PADDING_VERTICAL
final RectF fillRect = new RectF(
mThermometerRect.left + FILL_PADDING_HORIZONTAL,
fillTop + FILL_PADDING_VERTICAL,
mThermometerRect.right - FILL_PADDING_HORIZONTAL,
mThermometerRect.bottom - FILL_PADDING_VERTICAL
);
LinearGradient gradient = new LinearGradient(
fillRect.centerX(), fillRect.bottom,
fillRect.centerX(), fillRect.top,
mGradientColors,
mGradientPositions,
Shader.TileMode.CLAMP
final LinearGradient gradient = new LinearGradient(
fillRect.centerX(), fillRect.bottom,
fillRect.centerX(), fillRect.top,
mGradientColors,
mGradientPositions,
Shader.TileMode.CLAMP
);
mFillPaint.setShader(gradient);
canvas.drawRoundRect(fillRect, 2, 2, mFillPaint);
mFillPaint.setShader(null);
}
// 4. 绘制文本(5dp固定宽度文本区,底部对齐竖排,文字居中)
String text = String.format("%d/%d", mCurrentValue, mMaxValue);
if (text.isEmpty()) return;
// 竖排文本绘制逻辑
final String text = String.format("%d/%d", mCurrentValue, mMaxValue);
if (text.length() == 0) {
return;
}
float textBaseX;
if (isTextOnRight) {
// 文本在右侧:X=温度条右边缘 + 文本区宽度的一半(紧贴温度条)
final boolean textRightFlag = isTextOnRight;
if (textRightFlag) {
textBaseX = mThermometerRect.right + (mTextAreaWidth / 2f);
} else {
// 文本在左侧:X=文本区宽度的一半(紧贴控件左边缘)
textBaseX = mTextAreaWidth / 2f;
}
// 文本绘制参数(适配5dp窄区域,缩小字间距提升紧凑度)
float singleCharHeight = mTextPaint.getTextSize() + (TEXT_CHAR_SPACING - 2f); // 字间距减为6f
float totalTextHeight = (singleCharHeight * text.length()) - (TEXT_CHAR_SPACING - 2f);
Paint.FontMetrics fontMetrics = mTextPaint.getFontMetrics();
float charBottomOffset = fontMetrics.bottom;
final float singleCharHeight = mTextPaint.getTextSize() + (TEXT_CHAR_SPACING - 2f);
final Paint.FontMetrics fontMetrics = mTextPaint.getFontMetrics();
final float charBottomOffset = fontMetrics.bottom;
final float startTextY = getHeight() - getPaddingBottom() - charBottomOffset;
// 文本起始Y(底部对齐控件底部,无间距)
float startTextY = getHeight() - getPaddingBottom() - charBottomOffset;
// 逐字竖排绘制(文字居中于5dp文本区,无超出)
for (int i = 0; i < text.length(); i++) {
char singleChar = text.charAt(i);
float currentTextY = startTextY - (i * singleCharHeight);
final char singleChar = text.charAt(i);
final float currentTextY = startTextY - (i * singleCharHeight);
canvas.drawText(String.valueOf(singleChar), textBaseX, currentTextY, mTextPaint);
}
}
@@ -13,7 +13,9 @@ import android.widget.LinearLayout;
import android.widget.Switch;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import cc.winboll.studio.contacts.R;
import cc.winboll.studio.contacts.services.LimitedTimeSpecialChannelService;
import cc.winboll.studio.contacts.dun.Rules;
import cc.winboll.studio.contacts.model.SettingsBean;
import cc.winboll.studio.contacts.services.LimitedTimeGreenChannelService;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.ToastUtils;
@@ -21,7 +23,7 @@ import cc.winboll.studio.libappbase.ToastUtils;
* @Author 豆包&ZhanGSKen<zhangsken@qq.com>
* @Date 2026/04/18 15:05:00 (GMT+8)
* @LastEditTime 2026/04/22 17:30:00 (GMT+8)
* @Describe 限时特殊通道视图
* @Describe 限时绿色通道视图
* 功能说明
* 1. Switch 打开时EditText 不可编辑布局背景变为绿色加减按钮不可用
* 2. Switch 关闭时EditText 可编辑布局背景恢复为白色加减按钮恢复可用
@@ -31,10 +33,10 @@ import cc.winboll.studio.libappbase.ToastUtils;
* 6. 新增快速设置按钮(btn_thisSeconds)点击直接设置为当前量级3600秒
* 7. [新增] 服务销毁时恢复EditText显示为倒计时剩余秒数
*/
public class LimitedTimeSpecialChannelView extends LinearLayout {
public class LimitedTimeGreenChannelView extends LinearLayout {
// ====================== 常量定义 =========================
public static final String TAG = "LimitedTimeSpecialChannelView";
public static final String TAG = "LimitedTimeGreenChannelView";
// 定义秒数增量的量级
private static final long SECONDS_INCREMENT = 3600;
@@ -50,17 +52,17 @@ public class LimitedTimeSpecialChannelView extends LinearLayout {
private android.content.BroadcastReceiver mCountdownReceiver;
// ====================== 构造函数 =========================
public LimitedTimeSpecialChannelView(Context context) {
public LimitedTimeGreenChannelView(Context context) {
super(context);
initView(context);
}
public LimitedTimeSpecialChannelView(Context context, AttributeSet attrs) {
public LimitedTimeGreenChannelView(Context context, AttributeSet attrs) {
super(context, attrs);
initView(context);
}
public LimitedTimeSpecialChannelView(Context context, AttributeSet attrs, int defStyleAttr) {
public LimitedTimeGreenChannelView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initView(context);
}
@@ -71,19 +73,22 @@ public class LimitedTimeSpecialChannelView extends LinearLayout {
this.mContext = context;
// 加载布局文件
LayoutInflater.from(context).inflate(R.layout.view_limitedtimespecialchannel, this, true);
LayoutInflater.from(context).inflate(R.layout.view_limitedtimegreenchannel, this, true);
LogUtils.i(TAG, "布局文件加载完成");
// 绑定控件ID
bindViews();
// 初始化所有按钮点击事件
initButtons();
// 初始化开关状态
// 初始化开关状态从持久化存储加载
initSwitchState();
// 注册广播监听
registerServiceDestroyedListener();
registerCountdownTickListener();
// 加载保存的绿色通道启用状态并设置Switch
loadSavedGreenChannelState();
LogUtils.i(TAG, "视图初始化流程结束");
}
@@ -191,15 +196,75 @@ public class LimitedTimeSpecialChannelView extends LinearLayout {
// 根据开关状态更新UI可操作状态
updateUIState(!isChecked);
// 保存绿色通道启用状态到持久化存储
saveGreenChannelState(isChecked);
// 发送绿色通道状态变更广播
LimitedTimeGreenChannelService.sendGreenChannelStateChangedBroadcast(mContext, isChecked);
if (isChecked) {
startLimitedTimeSpecialChannelService();
startLimitedTimeGreenChannelService();
} else {
LimitedTimeSpecialChannelService.stopService(mContext);
LimitedTimeGreenChannelService.stopService(mContext);
}
}
});
}
/**
* 从持久化存储加载绿色通道启用状态并设置Switch
*/
private void loadSavedGreenChannelState() {
Rules rules = Rules.getInstance(mContext);
if (rules == null) {
LogUtils.e(TAG, "loadSavedGreenChannelState: Rules实例获取失败");
return;
}
SettingsBean settings = rules.getSettingsModel();
if (settings == null) {
LogUtils.e(TAG, "loadSavedGreenChannelState: SettingsBean获取失败");
return;
}
boolean savedState = settings.isEnableGreenChannel();
LogUtils.i(TAG, "loadSavedGreenChannelState: 加载保存的绿色通道状态=" + savedState);
// 设置Switch状态不会触发监听器因为监听器在initSwitchState中已设置
if (mSwEnable != null && mSwEnable.isChecked() != savedState) {
mSwEnable.setChecked(savedState);
// 手动更新UI状态
updateUIState(!savedState);
LogUtils.i(TAG, "loadSavedGreenChannelState: Switch状态已恢复为" + (savedState ? "开启" : "关闭"));
}
// 如果保存的状态是开启启动服务
if (savedState && !LimitedTimeGreenChannelService.isServiceRunning()) {
LogUtils.i(TAG, "loadSavedGreenChannelState: 启动绿色通道服务");
startLimitedTimeGreenChannelService();
}
}
/**
* 保存绿色通道启用状态到持久化存储
* @param isEnabled 是否启用
*/
private void saveGreenChannelState(boolean isEnabled) {
Rules rules = Rules.getInstance(mContext);
if (rules == null) {
LogUtils.e(TAG, "saveGreenChannelState: Rules实例获取失败,保存失败");
return;
}
SettingsBean settings = rules.getSettingsModel();
if (settings == null) {
LogUtils.e(TAG, "saveGreenChannelState: SettingsBean获取失败,保存失败");
return;
}
settings.setIsEnableGreenChannel(isEnabled);
rules.saveDun();
LogUtils.i(TAG, "saveGreenChannelState: 绿色通道启用状态已保存为" + isEnabled);
}
/**
* 统一更新UI可操作状态
* @param enabled 可用状态
@@ -222,11 +287,11 @@ public class LimitedTimeSpecialChannelView extends LinearLayout {
*/
private void registerServiceDestroyedListener() {
LogUtils.i(TAG, "注册服务销毁广播监听");
IntentFilter filter = new IntentFilter(LimitedTimeSpecialChannelService.ACTION_SERVICE_DESTROYED);
IntentFilter filter = new IntentFilter(LimitedTimeGreenChannelService.ACTION_SERVICE_DESTROYED);
LocalBroadcastManager.getInstance(mContext).registerReceiver(new android.content.BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (LimitedTimeSpecialChannelService.ACTION_SERVICE_DESTROYED.equals(intent.getAction())) {
if (LimitedTimeGreenChannelService.ACTION_SERVICE_DESTROYED.equals(intent.getAction())) {
LogUtils.i(TAG, "收到服务销毁广播,执行恢复操作");
// 1. 恢复开关状态
@@ -236,7 +301,7 @@ public class LimitedTimeSpecialChannelView extends LinearLayout {
// 2. [核心修改] 检索并设置倒计时剩余秒数参数
// 从广播附加数据中获取之前服务发送的剩余秒数
long remainingSeconds = intent.getLongExtra(LimitedTimeSpecialChannelService.EXTRA_REMAINING_SECONDS, 0);
long remainingSeconds = intent.getLongExtra(LimitedTimeGreenChannelService.EXTRA_REMAINING_SECONDS, 0);
// 实际倒计时消耗冲正
remainingSeconds -= 1;
// 倒计时秒数0值保底
@@ -252,6 +317,10 @@ public class LimitedTimeSpecialChannelView extends LinearLayout {
LogUtils.i(TAG, "已将EditText设置为剩余秒数: " + remainingSeconds);
}
// 5. 保存绿色通道关闭状态并发送广播
saveGreenChannelState(false);
LimitedTimeGreenChannelService.sendGreenChannelStateChangedBroadcast(mContext, false);
//ToastUtils.show("服务已销毁,恢复倒计时剩余状态");
}
}
@@ -266,8 +335,8 @@ public class LimitedTimeSpecialChannelView extends LinearLayout {
mCountdownReceiver = new android.content.BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (LimitedTimeSpecialChannelService.ACTION_COUNTDOWN_TICK.equals(intent.getAction())) {
long remainingSeconds = intent.getLongExtra(LimitedTimeSpecialChannelService.EXTRA_REMAINING_SECONDS, 0);
if (LimitedTimeGreenChannelService.ACTION_COUNTDOWN_TICK.equals(intent.getAction())) {
long remainingSeconds = intent.getLongExtra(LimitedTimeGreenChannelService.EXTRA_REMAINING_SECONDS, 0);
if (mEtSeconds != null) {
mEtSeconds.setText(String.valueOf(remainingSeconds));
}
@@ -278,7 +347,7 @@ public class LimitedTimeSpecialChannelView extends LinearLayout {
}
};
IntentFilter filter = new IntentFilter(LimitedTimeSpecialChannelService.ACTION_COUNTDOWN_TICK);
IntentFilter filter = new IntentFilter(LimitedTimeGreenChannelService.ACTION_COUNTDOWN_TICK);
LocalBroadcastManager.getInstance(mContext).registerReceiver(mCountdownReceiver, filter);
LogUtils.i(TAG, "倒计时广播注册成功");
}
@@ -286,8 +355,8 @@ public class LimitedTimeSpecialChannelView extends LinearLayout {
/**
* 启动限时特殊通道服务
*/
private void startLimitedTimeSpecialChannelService() {
LogUtils.i(TAG, "准备启动限时特殊通道服务");
private void startLimitedTimeGreenChannelService() {
LogUtils.i(TAG, "准备启动限时绿色通道服务");
String secondsStr = mEtSeconds.getText().toString().trim();
if (secondsStr.isEmpty()) {
LogUtils.w(TAG, "输入框为空,使用默认值 3600 秒");
@@ -299,8 +368,8 @@ public class LimitedTimeSpecialChannelView extends LinearLayout {
long delayMillis = seconds * 1000;
LogUtils.i(TAG, "启动参数 - 输入秒数: " + seconds + ", 转换毫秒: " + delayMillis);
//ToastUtils.show("调用 LimitedTimeSpecialChannelService 服务");
LimitedTimeSpecialChannelService.startService(mContext, delayMillis);
//ToastUtils.show("调用 LimitedTimeGreenChannelService 服务");
LimitedTimeGreenChannelService.startService(mContext, delayMillis);
} catch (NumberFormatException e) {
LogUtils.e(TAG, "输入的秒数格式错误: " + secondsStr, e);
}
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24">
<path
android:fillColor="#ff000000"
android:pathData="M5.8,10C5.4,8.8 4.3,8 3,8C1.3,8 0,9.3 0,11S1.3,14 3,14C4.3,14 5.4,13.2 5.8,12H7V14H9V12H11V10H5.8M3,12C2.4,12 2,11.6 2,11S2.4,10 3,10 4,10.4 4,11 3.6,12 3,12M16,4C13.8,4 12,5.8 12,8S13.8,12 16,12 20,10.2 20,8 18.2,4 16,4M16,10.1C14.8,10.1 13.9,9.2 13.9,8C13.9,6.8 14.8,5.9 16,5.9C17.2,5.9 18.1,6.8 18.1,8S17.2,10.1 16,10.1M16,13C13.3,13 8,14.3 8,17V20H24V17C24,14.3 18.7,13 16,13M22.1,18.1H9.9V17C9.9,16.4 13,14.9 16,14.9C19,14.9 22.1,16.4 22.1,17V18.1Z"/>
</vector>
@@ -5,8 +5,10 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<cc.winboll.studio.libappbase.LogView
android:layout_height="match_parent"
android:layout_width="match_parent"
android:id="@+id/logview"/>
<androidx.appcompat.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/activity_layoutdraft_preview_toolbar"/>
</LinearLayout>
@@ -17,6 +17,7 @@
android:id="@+id/activitymainToolbar1"/>
<LinearLayout
android:id="@+id/activity_settings_content"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="0dp"
@@ -57,7 +58,6 @@
android:id="@+id/tv_DunInfo"/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
@@ -67,12 +67,12 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="特殊通道设置:"/>
android:text="绿色通道设置:"/>
<cc.winboll.studio.contacts.views.LimitedTimeSpecialChannelView
<cc.winboll.studio.contacts.views.LimitedTimeGreenChannelView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/view_LimitedTimeSpecialChannel"/>
android:id="@+id/view_LimitedTimeGreenChannel"/>
</LinearLayout>
@@ -325,29 +325,18 @@
android:background="@drawable/recycler_view_border"
android:layout_margin="5dp"/>
<TextView
android:layout_width="wrap_content"
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="单元测试:"/>
android:text="初始化测试规则"
android:onClick="onInitTestRules"
android:layout_margin="5dp"/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="LogView"
android:onClick="onLogView"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Unit Test"
android:onClick="onUnitTest"/>
</LinearLayout>
<TextView
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<cc.winboll.studio.contacts.views.DunQueryView
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="8dp"
android:padding="12dp"
android:background="@drawable/recycler_view_border">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="调试工具"
android:textSize="16sp"
android:textStyle="bold"
android:textColor="@color/red_normal"
android:layout_marginBottom="8dp"/>
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right">
<Button
android:id="@+id/btn_debug_green_channel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="绿色通道"
android:textSize="12sp"
android:layout_margin="2dp"/>
<Button
android:id="@+id/btn_debug_logview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="应用日志"
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"/>
<Button
android:id="@+id/btn_debug_layout_preview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="布局草稿"
android:textSize="12sp"
android:layout_margin="2dp"/>
<Button
android:id="@+id/btn_debug_crash"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="测试崩溃"
android:textSize="12sp"
android:layout_margin="2dp"/>
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="8dp"
android:padding="12dp"
android:background="@drawable/recycler_view_border">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="云盾拦截查询"
android:textSize="16sp"
android:textStyle="bold"
android:textColor="@color/red_normal"
android:layout_marginBottom="8dp"/>
<EditText
android:id="@+id/et_dun_query_phone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="输入电话号码查询拦截状态"
android:inputType="phone"
android:textSize="14sp"
android:layout_marginBottom="8dp"/>
<TextView
android:id="@+id/tv_dun_query_result"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="请输入电话号码"
android:textSize="14sp"
android:textColor="@color/gray_500"/>
</LinearLayout>
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ll_green_channel_floating"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@android:color/white"
android:elevation="4dp">
<cc.winboll.studio.contacts.views.LimitedTimeGreenChannelView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/view_LimitedTimeGreenChannel"/>
</LinearLayout>