56 Commits

Author SHA1 Message Date
Hen_Ry
1401ddcc52 update german translation (#244) 2023-04-11 09:58:16 +08:00
乌堆小透明
eb7779ea84 Revert "合并拉取请求 #233" (#237)
This reverts commit 317340bf6f.
2023-03-05 21:07:11 +08:00
Howie
317340bf6f 合并拉取请求 #233
* 修改 隐藏 SIM 卡 的方法

* 修改 隐藏 SIM 卡 的方法
2023-02-27 16:36:06 +08:00
LittleTurtle2333
bc26ba512c 更新版本号至1.7.5 2023-02-20 21:37:28 +08:00
乌堆小透明
cd28e662a1 New Crowdin updates (#226)
* New translations strings.xml (Chinese Traditional)
[ci skip] New translations from Crowdin

* New translations strings.xml (Romanian)
[ci skip] New translations from Crowdin

* New translations strings.xml (French)
[ci skip] New translations from Crowdin

* New translations strings.xml (Spanish)
[ci skip] New translations from Crowdin

* New translations strings.xml (Czech)
[ci skip] New translations from Crowdin

* New translations strings.xml (Hungarian)
[ci skip] New translations from Crowdin

* New translations strings.xml (Japanese)
[ci skip] New translations from Crowdin

* New translations strings.xml (Korean)
[ci skip] New translations from Crowdin

* New translations strings.xml (Dutch)
[ci skip] New translations from Crowdin

* New translations strings.xml (Polish)
[ci skip] New translations from Crowdin

* New translations strings.xml (Portuguese)
[ci skip] New translations from Crowdin

* New translations strings.xml (Russian)
[ci skip] New translations from Crowdin

* New translations strings.xml (Turkish)
[ci skip] New translations from Crowdin

* New translations strings.xml (Chinese Simplified)
[ci skip] New translations from Crowdin

* New translations strings.xml (Chinese Traditional)
[ci skip] New translations from Crowdin

* New translations strings.xml (Vietnamese)
[ci skip] New translations from Crowdin

* New translations strings.xml (Portuguese, Brazilian)
[ci skip] New translations from Crowdin

* New translations strings.xml (Indonesian)
[ci skip] New translations from Crowdin

* New translations strings.xml (Chinese Traditional, Hong Kong)
[ci skip] New translations from Crowdin

* New translations strings.xml (Spanish)
[ci skip] New translations from Crowdin

* New translations strings.xml (Portuguese)
[ci skip] New translations from Crowdin

* New translations strings.xml (Chinese Simplified)
[ci skip] New translations from Crowdin

* New translations strings.xml (Vietnamese)
[ci skip] New translations from Crowdin

* New translations strings.xml (Portuguese, Brazilian)
[ci skip] New translations from Crowdin

* New translations strings.xml (Chinese Traditional)
[ci skip] New translations from Crowdin

* New translations strings.xml (Polish)
[ci skip] New translations from Crowdin

* New translations strings.xml (Polish)
[ci skip] New translations from Crowdin

* New translations strings.xml (Japanese)
[ci skip] New translations from Crowdin

* New translations strings.xml (Spanish)
[ci skip] New translations from Crowdin

* New translations strings.xml (Chinese Traditional)
[ci skip] New translations from Crowdin

* New translations strings.xml (Portuguese)
[ci skip] New translations from Crowdin

* New translations strings.xml (Portuguese, Brazilian)
[ci skip] New translations from Crowdin

* New translations strings.xml (Portuguese)
[ci skip] New translations from Crowdin

* New translations strings.xml (Chinese Simplified)
[ci skip] New translations from Crowdin

* New translations strings.xml (Portuguese, Brazilian)
[ci skip] New translations from Crowdin
2023-02-20 21:32:58 +08:00
LittleTurtle2333
f67d387020 新增A13禁用临时蓝牙关闭 2023-02-20 21:27:04 +08:00
乌堆小透明
f2354022aa [skip ci] rename android.yml 2023-02-20 20:17:08 +08:00
LittleTurtle2333
d7a1af8846 A12自定义时钟极客模式支持更多内容(未测试) 2023-02-20 20:15:04 +08:00
LittleTurtle2333
8a1c8a85c3 [skip ci] Update README.md 2023-02-19 23:22:59 +08:00
LittleTurtle2333
12848808d3 修复A12状态栏布局兼容模式的一些BUG 2023-02-19 23:03:29 +08:00
LittleTurtle2333
7f23f07209 修复状态栏布局兼容模式的一些BUG 2023-02-19 17:11:25 +08:00
乌堆小透明
54b31ea478 Update dev.yml 2023-02-19 16:25:40 +08:00
乌堆小透明
44e6995da1 Create dev.yml 2023-02-19 16:19:12 +08:00
LittleTurtle2333
12e76869dd 优化开启时间居中后的细节 2023-02-18 23:56:04 +08:00
LittleTurtle2333
97212d74d3 更新Xposed description 2023-02-18 22:31:26 +08:00
LittleTurtle2333
e152a5ba74 更新BlockMIUI 2023-02-18 21:54:56 +08:00
LittleTurtle2333
efc77eb518 更新版本号至1.7.4 2023-02-18 21:53:21 +08:00
乌堆小透明
8cad8e371c 合并拉取请求 #225
* New translations strings.xml (Spanish)

* New translations strings.xml (Portuguese)

* New translations strings.xml (Vietnamese)

* New translations strings.xml (Portuguese, Brazilian)

* New translations strings.xml (Japanese)

* New translations strings.xml (Chinese Traditional)

* New translations strings.xml (Chinese Traditional)

* New translations strings.xml (Chinese Traditional)

* New translations strings.xml (Chinese Traditional)
2023-02-18 21:52:39 +08:00
LittleTurtle2333
990ea8ef7e 新增修改划卡动画&桌面快捷小窗 2023-02-18 21:50:10 +08:00
LittleTurtle2333
4ce55d1fb3 移除无用dependencies 2023-02-18 21:48:42 +08:00
LittleTurtle2333
1feb754385 添加KotlinXposedHelper 2023-02-18 21:48:19 +08:00
LittleTurtle2333
a107f71986 修改状态栏图标顺序(未实现) 2023-02-18 19:00:57 +08:00
LittleTurtle2333
2177850498 修复A13状态栏兼容模式横屏 2023-02-17 23:55:48 +08:00
LittleTurtle2333
5e4160aed4 修复A13状态栏布局切换功能 2023-02-17 23:22:26 +08:00
LittleTurtle2333
99da21e762 修复A13控制中心时钟对齐问题 2023-02-17 23:07:44 +08:00
LittleTurtle2333
8fe9d09624 统一A13状态栏兼容模式 2023-02-17 23:07:07 +08:00
LittleTurtle2333
de220825a2 修复A13状态栏兼容模式 2023-02-17 22:29:30 +08:00
LittleTurtle2333
4ed3e40e99 修复A13大移动类型图标的一些问题 2023-02-17 22:24:32 +08:00
LittleTurtle2333
5f5bc6572c 更新版本号至1.7.3 2023-02-17 20:49:38 +08:00
乌堆小透明
b3859653ef 合并拉取请求 #224
* New translations strings.xml (Japanese)

* New translations strings.xml (Polish)

* New translations strings.xml (Portuguese)

* New translations strings.xml (Vietnamese)

* New translations strings.xml (Portuguese, Brazilian)

* New translations strings.xml (Russian)

* New translations strings.xml (Russian)

* New translations strings.xml (Chinese Traditional)

* New translations strings.xml (Japanese)
2023-02-17 20:22:30 +08:00
LittleTurtle2333
7dcfdcced7 修复去除游戏自动连招黑名单 2023-02-17 20:19:39 +08:00
LittleTurtle2333
f2a4f06301 修复连接WiFi时非上网卡显示大移动类型 2023-02-17 17:31:49 +08:00
乌堆小透明
90294a1599 New Crowdin updates (#222)
* New translations strings.xml (Romanian)
[ci skip] New translations from Crowdin

* New translations strings.xml (French)
[ci skip] New translations from Crowdin

* New translations strings.xml (Spanish)
[ci skip] New translations from Crowdin

* New translations strings.xml (Czech)
[ci skip] New translations from Crowdin

* New translations strings.xml (Hungarian)
[ci skip] New translations from Crowdin

* New translations strings.xml (Japanese)
[ci skip] New translations from Crowdin

* New translations strings.xml (Dutch)
[ci skip] New translations from Crowdin

* New translations strings.xml (Polish)
[ci skip] New translations from Crowdin

* New translations strings.xml (Portuguese)
[ci skip] New translations from Crowdin

* New translations strings.xml (Russian)
[ci skip] New translations from Crowdin

* New translations strings.xml (Vietnamese)
[ci skip] New translations from Crowdin

* New translations strings.xml (Portuguese, Brazilian)
[ci skip] New translations from Crowdin

* New translations strings.xml (Indonesian)
[ci skip] New translations from Crowdin

* New translations strings.xml (Portuguese)
[ci skip] New translations from Crowdin

* New translations strings.xml (Russian)
[ci skip] New translations from Crowdin

* New translations strings.xml (Vietnamese)
[ci skip] New translations from Crowdin

* New translations strings.xml (Portuguese, Brazilian)
[ci skip] New translations from Crowdin

* New translations strings.xml (Chinese Traditional, Hong Kong)
[ci skip] New translations from Crowdin

* New translations strings.xml (Spanish)
[ci skip] New translations from Crowdin

* New translations strings.xml (Japanese)
[ci skip] New translations from Crowdin

* New translations strings.xml (Portuguese)
[ci skip] New translations from Crowdin

* New translations strings.xml (Vietnamese)
[ci skip] New translations from Crowdin

* New translations strings.xml (Portuguese, Brazilian)
[ci skip] New translations from Crowdin

* New translations strings.xml (Spanish)
[ci skip] New translations from Crowdin

* New translations strings.xml (Russian)
[ci skip] New translations from Crowdin

* New translations strings.xml (Vietnamese)
[ci skip] New translations from Crowdin

* New translations strings.xml (Polish)
[ci skip] New translations from Crowdin

* New translations strings.xml (Polish)
[ci skip] New translations from Crowdin

* New translations strings.xml (Chinese Traditional)
[ci skip] New translations from Crowdin

* New translations strings.xml (Japanese)
[ci skip] New translations from Crowdin

* New translations strings.xml (Chinese Traditional)
[ci skip] New translations from Crowdin

* New translations strings.xml (Portuguese)
[ci skip] New translations from Crowdin

* New translations strings.xml (Portuguese, Brazilian)
[ci skip] New translations from Crowdin

* New translations strings.xml (Spanish)
[ci skip] New translations from Crowdin

* New translations strings.xml (Portuguese)
[ci skip] New translations from Crowdin

* New translations strings.xml (Portuguese, Brazilian)
[ci skip] New translations from Crowdin

* New translations strings.xml (Portuguese)
[ci skip] New translations from Crowdin

* New translations strings.xml (Chinese Simplified)
[ci skip] New translations from Crowdin

* New translations strings.xml (Portuguese, Brazilian)
[ci skip] New translations from Crowdin
2023-02-16 23:41:25 +08:00
LittleTurtle2333
2b7e5e0833 更新版本号至1.7.2 2023-02-16 23:29:30 +08:00
LittleTurtle2333
4a5e83cfda 暂时注释未开发完成的功能 2023-02-16 23:29:06 +08:00
YuKongA
b4bc91043e 合并部分针对小米桌面的钩子 (#223)
Co-authored-by: 乌堆小透明 <lturtle2333@outlook.com>
2023-02-16 23:05:24 +08:00
LittleTurtle2333
d07bd2aaf1 自定义时钟极客模式支持更多内容 2023-02-16 22:58:23 +08:00
LittleTurtle2333
8bd401b88f 更新BlockMIUI版本 2023-02-16 22:57:07 +08:00
LittleTurtle2333
2b36ad29d8 修复A13开启大移动类型图标后非上网卡显示箭头 2023-02-16 00:37:08 +08:00
LittleTurtle2333
3e0d94ab81 更新版本号至1.7.1 2023-02-15 22:04:27 +08:00
LittleTurtle2333
7914d51168 新增A13大移动类型图标显示位置 2023-02-15 22:01:30 +08:00
LittleTurtle2333
d8cf1bdc34 Merge remote-tracking branch 'origin/main' 2023-02-15 22:01:03 +08:00
LittleTurtle2333
2f69115907 新增A13大移动类型图标仅显示上网卡 2023-02-15 22:00:39 +08:00
乌堆小透明
4295af9cc5 New Crowdin updates (#221)
* New translations strings.xml (Romanian)
[ci skip] New translations from Crowdin

* New translations strings.xml (French)
[ci skip] New translations from Crowdin

* New translations strings.xml (Spanish)
[ci skip] New translations from Crowdin

* New translations strings.xml (Czech)
[ci skip] New translations from Crowdin

* New translations strings.xml (Hungarian)
[ci skip] New translations from Crowdin

* New translations strings.xml (Japanese)
[ci skip] New translations from Crowdin

* New translations strings.xml (Dutch)
[ci skip] New translations from Crowdin

* New translations strings.xml (Polish)
[ci skip] New translations from Crowdin

* New translations strings.xml (Portuguese)
[ci skip] New translations from Crowdin

* New translations strings.xml (Russian)
[ci skip] New translations from Crowdin

* New translations strings.xml (Vietnamese)
[ci skip] New translations from Crowdin

* New translations strings.xml (Portuguese, Brazilian)
[ci skip] New translations from Crowdin

* New translations strings.xml (Indonesian)
[ci skip] New translations from Crowdin

* New translations strings.xml (Portuguese)
[ci skip] New translations from Crowdin

* New translations strings.xml (Russian)
[ci skip] New translations from Crowdin

* New translations strings.xml (Vietnamese)
[ci skip] New translations from Crowdin

* New translations strings.xml (Portuguese, Brazilian)
[ci skip] New translations from Crowdin

* New translations strings.xml (Chinese Traditional, Hong Kong)
[ci skip] New translations from Crowdin
2023-02-15 20:47:23 +08:00
LittleTurtle2333
179c82d563 Update README.md 2023-02-14 23:17:52 +08:00
LittleTurtle2333
6d1aa2e824 更新版本号至1.7.0 2023-02-14 22:39:13 +08:00
LittleTurtle2333
5c12c0aa56 修复A13中大移动类型图标 2023-02-14 22:36:02 +08:00
LittleTurtle2333
e63b9a861d UI细节优化 2023-02-14 21:15:56 +08:00
LittleTurtle2333
5b3ad4dd6a 修复A13隐藏网络类型图标不可用 2023-02-14 20:24:21 +08:00
LittleTurtle2333
b781f59486 修复A13自定义网络类型文本不可用 2023-02-14 19:38:03 +08:00
LittleTurtle2333
5a74882005 修复A13中双排时钟无法居中对齐 2023-02-14 18:51:26 +08:00
LittleTurtle2333
0c71f68362 修复时钟极客模式自定义无法换行 2023-02-14 18:50:24 +08:00
LittleTurtle2333
f39d7d601d 修复A13中部分场景无法强制截图 2023-02-14 17:30:51 +08:00
LittleTurtle2333
ebb5e1435b 对Android13进行兼容性测试并拆分结构 2023-02-13 00:09:59 +08:00
QQ little ice
40c24cbb40 Disable installation's count checking (#216)
Disable installation's count checking
2023-02-12 20:34:38 +08:00
YuKongA
2830c8f48a Fix AlwaysDisplayTime on newer version miuihome (#215)
Fix AlwaysDisplayTime on newer version miuihome
2023-02-12 19:48:15 +08:00
124 changed files with 5063 additions and 1097 deletions

50
.github/workflows/dev.yml vendored Normal file
View File

@@ -0,0 +1,50 @@
name: Dev
on:
push:
branches: [ "main" ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Clone UI
run: |
cd blockmiui
git submodule init
git submodule update
- name: Build with Gradle
run: |
bash ./gradlew assembleDebug
- name: Sign Debug APK
if: success()
id: sign_debug
uses: r0adkll/sign-android-release@v1.0.4
with:
releaseDirectory: ./app/build/outputs/apk/debug
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.KEY_STORE_ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_STORE_PASSWORD }}
- name: Upload Debug APK
uses: actions/upload-artifact@v2
with:
name: WooBox_Debug
path: ${{ steps.sign_debug.outputs.signedReleaseFile }}

View File

@@ -1,4 +1,4 @@
name: Android CI
name: PR Check
on:
pull_request:

View File

@@ -1,9 +1,7 @@
<div align="center">
<img width="160" src="https://raw.githubusercontent.com/LittleTurtle2333/SimplicityTools/main/doc/ic_launcher.png" alt="logo">
<h1>WooBox For MIUI</h1>
<p>
<b><a href="https://github.com/LittleTurtle2333/SimplicityTools/blob/main/README_EN.md">English</a> 丨 简体中文</b>
</p>
<p><b><a href="https://github.com/LittleTurtle2333/SimplicityTools/blob/main/README_EN.md">English</a> 丨 简体中文</b></p>
<a href="https://github.com/Xposed-Modules-Repo/com.lt2333.simplicitytools/releases"><img alt="GitHub all releases" src="https://img.shields.io/github/downloads/Xposed-Modules-Repo/com.lt2333.simplicitytools/total?label=Downloads"></a>
<a href="https://github.com/LittleTurtle2333/SimplicityTools/stargazers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/LittleTurtle2333/SimplicityTools"></a>
<a href="https://github.com/LittleTurtle2333/SimplicityTools/issues"><img alt="GitHub issues" src="https://img.shields.io/github/issues/LittleTurtle2333/SimplicityTools"></a>
@@ -14,42 +12,56 @@
---
### 模块说明
开发者:[酷安@乌堆小透明](http://www.coolapk.com/u/883441)
当前仅基于`Android13`进行开发,`Android12`几乎不再维护。也有基于`Android13`开发,但是能在`Android12`使用的情况,请广大社区使用`Android12`的开发者自行测试和修复后提交`Pull Request`
---
### 模块截图
![截图](https://raw.githubusercontent.com/LittleTurtle2333/SimplicityTools/main/doc/cn.jpg)
![截图](https://raw.githubusercontent.com/LittleTurtle2333/SimplicityTools/main/doc/cn.jpg)
---
### 下载地址
Xposed仓库下载:[点击此处下载最新发行版](https://github.com/Xposed-Modules-Repo/com.lt2333.simplicitytools/releases)
Xposed
仓库下载:[点击此处下载最新发行版](https://github.com/Xposed-Modules-Repo/com.lt2333.simplicitytools/releases)
酷安下载:[点击此处下载最新发行版](https://www.coolapk.com/apk/com.lt2333.simplicitytools)
酷安下载:[点击此处下载最新发行版](https://www.coolapk.com/apk/com.lt2333.simplicitytools)
---
### 改进翻译
[![Crowdin](https://badges.crowdin.net/simplicitytools/localized.svg)](https://crowdin.com/project/simplicitytools)[点击此处进入Crowdin](https://crowdin.com/project/simplicitytools)
[![Crowdin](https://badges.crowdin.net/simplicitytools/localized.svg)](https://crowdin.com/project/simplicitytools) [点击此处进入Crowdin](https://crowdin.com/project/simplicitytools)
---
### 第三方开源引用
##### GNU General Public License v3.0
[qqlittleice/MiuiHome](https://github.com/qqlittleice/MiuiHome)
[yujincheng08/BiliRoaming](https://github.com/yujincheng08/BiliRoaming)
[Mikanoshi/CustoMIUIzer](https://code.highspec.ru/Mikanoshi/CustoMIUIzer)
[yujincheng08/BiliRoaming](https://github.com/yujincheng08/BiliRoaming)
[Mikanoshi/CustoMIUIzer](https://code.highspec.ru/Mikanoshi/CustoMIUIzer)
[MonwF/customiuizer](https://github.com/MonwF/customiuizer)
##### GNU General Public License v2.0
[LSPosed/CorePatch](https://github.com/LSPosed/CorePatch)
[LSPosed/CorePatch](https://github.com/LSPosed/CorePatch)
##### GNU Lesser General Public License v2.1
[577fkj/blockmiui](https://github.com/577fkj/blockmiui)
[577fkj/blockmiui](https://github.com/577fkj/blockmiui)
##### Apache License 2.0
[KyuubiRan/EzXHelper](https://github.com/KyuubiRan/EzXHelper)
[KyuubiRan/EzXHelper](https://github.com/KyuubiRan/EzXHelper)
---
### License
[GNU General Public License v3.0](https://github.com/LittleTurtle2333/SimplicityTools/blob/main/LICENSE)

View File

@@ -1,9 +1,7 @@
<div align="center">
<img width="160" src="https://raw.githubusercontent.com/LittleTurtle2333/SimplicityTools/main/doc/ic_launcher.png" alt="logo">
<h1>WooBox For MIUI</h1>
<p>
<b>English 丨 <a href="https://github.com/LittleTurtle2333/SimplicityTools/blob/main/README.md">简体中文</a></b>
</p>
<p><b>English 丨 <a href="https://github.com/LittleTurtle2333/SimplicityTools/blob/main/README.md">简体中文</a></b></p>
<a href="https://github.com/Xposed-Modules-Repo/com.lt2333.simplicitytools/releases"><img alt="GitHub all releases" src="https://img.shields.io/github/downloads/Xposed-Modules-Repo/com.lt2333.simplicitytools/total?label=Downloads"></a>
<a href="https://github.com/LittleTurtle2333/SimplicityTools/stargazers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/LittleTurtle2333/SimplicityTools"></a>
<a href="https://github.com/LittleTurtle2333/SimplicityTools/issues"><img alt="GitHub issues" src="https://img.shields.io/github/issues/LittleTurtle2333/SimplicityTools"></a>
@@ -13,36 +11,52 @@
---
### Module Description
Currently only developed based on `Android13`, `Android12` is almost no longer maintained. There are also cases where the development is based on `Android13`, but it can be used in `Android12`. Developers in the community who use `Android12` are requested to submit `Pull Request` after testing and repairing by themselves.
---
### Screenshot
![Screenshot](https://raw.githubusercontent.com/LittleTurtle2333/SimplicityTools/main/doc/en.jpg)
![Screenshot](https://raw.githubusercontent.com/LittleTurtle2333/SimplicityTools/main/doc/en.jpg)
---
### Download
Xposed Repo[Click here to download the latest release](https://github.com/Xposed-Modules-Repo/com.lt2333.simplicitytools/releases)
Xposed Repo[Click here to download the latest release](https://github.com/Xposed-Modules-Repo/com.lt2333.simplicitytools/releases)
---
### Participate in translation
[![Crowdin](https://badges.crowdin.net/simplicitytools/localized.svg)](https://crowdin.com/project/simplicitytools)[Click here to Crowdin](https://crowdin.com/project/simplicitytools)
[![Crowdin](https://badges.crowdin.net/simplicitytools/localized.svg)](https://crowdin.com/project/simplicitytools) [Click here to Crowdin](https://crowdin.com/project/simplicitytools)
---
## Third party open source references
##### GNU General Public License v3.0
[qqlittleice/MiuiHome](https://github.com/qqlittleice/MiuiHome)
[yujincheng08/BiliRoaming](https://github.com/yujincheng08/BiliRoaming)
[yujincheng08/BiliRoaming](https://github.com/yujincheng08/BiliRoaming)
[Mikanoshi/CustoMIUIzer](https://code.highspec.ru/Mikanoshi/CustoMIUIzer)
[MonwF/customiuizer](https://github.com/MonwF/customiuizer)
##### GNU General Public License v2.0
[LSPosed/CorePatch](https://github.com/LSPosed/CorePatch)
[LSPosed/CorePatch](https://github.com/LSPosed/CorePatch)
##### GNU Lesser General Public License v2.1
[577fkj/blockmiui](https://github.com/577fkj/blockmiui)
##### Apache License 2.0
[KyuubiRan/EzXHelper](https://github.com/KyuubiRan/EzXHelper)
---
## License
[GNU General Public License v3.0](https://github.com/LittleTurtle2333/SimplicityTools/blob/main/LICENSE)

View File

@@ -11,8 +11,8 @@ android {
applicationId = "com.lt2333.simplicitytools"
minSdk = 31
targetSdk = 33
versionCode = 69
versionName = "1.6.9"
versionCode = 75
versionName = "1.7.5"
buildConfigField("String", "BUILD_TIME", "\"${System.currentTimeMillis()}\"")
}
@@ -54,10 +54,9 @@ dependencies {
implementation("com.github.kyuubiran:EzXHelper:1.0.3")
//UI
implementation(project(":blockmiui"))
implementation("androidx.constraintlayout:constraintlayout:2.1.3")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
//APP Center
val appCenterSdkVersion = "4.4.3"
implementation("com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}")
implementation("com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}")
implementation("androidx.core:core-splashscreen:1.0.0-rc01")
}

View File

@@ -66,7 +66,7 @@ class AboutPage : BasePage() {
})
Line()
TitleText(text = getString(R.string.thank_list))
TextSummaryArrow(
TextSummaryWithArrow(
TextSummaryV(
textId = R.string.contributor_list,
onClickListener = {
@@ -80,7 +80,7 @@ class AboutPage : BasePage() {
}
})
)
TextSummaryArrow(
TextSummaryWithArrow(
TextSummaryV(
textId = R.string.third_party_open_source_statement,
onClickListener = {
@@ -96,7 +96,7 @@ class AboutPage : BasePage() {
)
Line()
TitleText(text = getString(R.string.discussions))
TextSummaryArrow(TextSummaryV(textId = R.string.qq_channel, onClickListener = {
TextSummaryWithArrow(TextSummaryV(textId = R.string.qq_channel, onClickListener = {
try {
val uri =
Uri.parse("https://qun.qq.com/qqweb/qunpro/share?_wv=3&_wwv=128&inviteCode=29Mu64&from=246610&biz=ka")
@@ -106,7 +106,7 @@ class AboutPage : BasePage() {
Toast.makeText(activity, "访问失败", Toast.LENGTH_SHORT).show()
}
}))
TextSummaryArrow(
TextSummaryWithArrow(
TextSummaryV(
textId = R.string.tg_channel,
tipsId = R.string.tg_channel_summary,
@@ -127,7 +127,7 @@ class AboutPage : BasePage() {
}
})
)
TextSummaryArrow(
TextSummaryWithArrow(
TextSummaryV(
textId = R.string.issues,
tipsId = R.string.issues_url,
@@ -144,7 +144,7 @@ class AboutPage : BasePage() {
)
Line()
TitleText(getString(R.string.other))
TextSummaryArrow(
TextSummaryWithArrow(
TextSummaryV(
textId = R.string.app_coolapk_url,
tipsId = R.string.app_coolapk_url_summary,
@@ -166,7 +166,7 @@ class AboutPage : BasePage() {
}
})
)
TextSummaryArrow(
TextSummaryWithArrow(
TextSummaryV(
textId = R.string.opensource,
tipsId = R.string.github_url,
@@ -181,7 +181,7 @@ class AboutPage : BasePage() {
}
})
)
TextSummaryArrow(
TextSummaryWithArrow(
TextSummaryV(
textId = R.string.participate_in_translation,
tipsId = R.string.participate_in_translation_summary,

View File

@@ -13,7 +13,7 @@ import java.util.*
class MenuPage : BasePage() {
override fun onCreate() {
TextSummaryArrow(TextSummaryV(textId = R.string.reboot, onClickListener = {
TextSummaryWithArrow(TextSummaryV(textId = R.string.reboot, onClickListener = {
MIUIDialog(activity) {
setTitle(R.string.Tips)
setMessage(R.string.are_you_sure_reboot)
@@ -28,7 +28,7 @@ class MenuPage : BasePage() {
}.show()
}))
TextSummaryArrow(TextSummaryV(textId = R.string.reboot_host, onClickListener = {
TextSummaryWithArrow(TextSummaryV(textId = R.string.reboot_host, onClickListener = {
MIUIDialog(activity) {
setTitle(R.string.Tips)
setMessage(R.string.are_you_sure_reboot_scope)
@@ -47,6 +47,7 @@ class MenuPage : BasePage() {
"killall com.miui.screenshot",
"killall com.milink.service",
"killall com.xiaomi.misubscreenui",
"killall com.miui.packageinstaller"
)
ShellUtils.execCommand(command, true)
dismiss()

View File

@@ -66,7 +66,7 @@ class AndroidPageForS : BasePage() {
tipsId = R.string.remove_small_window_restrictions_summary
), SwitchV("remove_small_window_restrictions")
)
TextSummaryArrow(
TextSummaryWithArrow(
TextSummaryV(
textId = R.string.max_wallpaper_scale,
onClickListener = {

View File

@@ -18,7 +18,7 @@ class MainPageForS : BasePage() {
TextSummaryWithSwitch(
TextSummaryV(
textId = R.string.main_switch,
colorId = R.color.purple_700
colorId = R.color.blue
), SwitchV("main_switch", true)
)
TextSummaryWithSwitch(
@@ -35,7 +35,7 @@ class MainPageForS : BasePage() {
)
})
)
TextSummaryArrow(
TextSummaryWithArrow(
TextSummaryV(
textId = R.string.matters_needing_attention,
colorId = R.color.red,
@@ -51,19 +51,19 @@ class MainPageForS : BasePage() {
)
Line()
TitleText(textId = R.string.scope)
TextSummaryArrow(
TextSummaryWithArrow(
TextSummaryV(
textId = R.string.scope_systemui,
tipsId = R.string.scope_systemui_summary,
onClickListener = { showFragment("scope_systemui") })
)
TextSummaryArrow(
TextSummaryWithArrow(
TextSummaryV(
textId = R.string.scope_android,
tipsId = R.string.scope_android_summary,
onClickListener = { showFragment("scope_android") })
)
TextSummaryArrow(
TextSummaryWithArrow(
TextSummaryV(
textId = R.string.scope_other,
tipsId = R.string.scope_other_summary,
@@ -71,7 +71,7 @@ class MainPageForS : BasePage() {
)
Line()
TitleText(textId = R.string.about)
TextSummaryArrow(
TextSummaryWithArrow(
TextSummaryV(
textId = R.string.about_module,
tips = getString(R.string.about_module_summary),

View File

@@ -2,7 +2,6 @@ package com.lt2333.simplicitytools.activity.pages.s
import android.content.ComponentName
import android.content.Intent
import android.content.pm.PackageManager
import android.view.View
import android.widget.Switch
import android.widget.Toast
@@ -11,12 +10,10 @@ import cn.fkj233.ui.activity.annotation.BMPage
import cn.fkj233.ui.activity.data.BasePage
import cn.fkj233.ui.activity.view.SwitchV
import cn.fkj233.ui.activity.view.TextSummaryV
import cn.fkj233.ui.dialog.MIUIDialog
import com.lt2333.simplicitytools.BuildConfig
import com.lt2333.simplicitytools.R
@BMPage("scope_other","Other", hideMenu = false)
@BMPage("scope_other", "Other", hideMenu = false)
class OtherPageForS : BasePage() {
override fun onCreate() {
@@ -33,6 +30,24 @@ class OtherPageForS : BasePage() {
tipsId = R.string.home_double_tap_to_sleep_summary
), SwitchV("double_tap_to_sleep")
)
TextSummaryWithSwitch(
TextSummaryV(
textId = R.string.miuihome_recentwiew_wallpaper_darkening, tipsId = R.string.miuihome_recentwiew_wallpaper_darkening_summary
), SwitchV("miuihome_recentwiew_wallpaper_darkening", false)
)
TextSummaryWithSwitch(
TextSummaryV(
textId = R.string.miuihome_recentview_remove_card_animation, tipsId = R.string.miuihome_recentview_remove_card_animation_summary
), SwitchV("miuihome_recentview_remove_card_animation", false)
)
TextSummaryWithSwitch(
TextSummaryV(textId = R.string.miuihome_shortcut_add_small_window, tipsId = R.string.miuihome_shortcut_add_small_window_summary),
SwitchV("miuihome_shortcut_add_small_window", false)
)
TextSummaryWithSwitch(
TextSummaryV(textId = R.string.miuihome_scroll_icon_name, tipsId = R.string.miuihome_scroll_icon_name_summary),
SwitchV("miuihome_scroll_icon_name", false)
)
Line()
TitleText(textId = R.string.scope_powerkeeper)
TextSummaryWithSwitch(
@@ -82,7 +97,7 @@ class OtherPageForS : BasePage() {
SwitchV("make_millet_ignore_active"),
dataBindingRecv = makeMilletMoreAggressiveSwitchBinding.binding.getRecv(2)
)
TextSummaryArrow(
TextSummaryWithArrow(
TextSummaryV(
textId = R.string.battery_optimization,
tipsId = R.string.battery_optimization_summary,
@@ -172,6 +187,12 @@ class OtherPageForS : BasePage() {
TextSummaryV(textId = R.string.remove_thememanager_ads),
SwitchV("remove_thememanager_ads")
)
Line()
TitleText(textId = R.string.pkg_installer)
TextSummaryWithSwitch(
TextSummaryV(textId = R.string.pkg_installer_summary),
SwitchV("pkg_installer_count_checking")
)
}
}

View File

@@ -1,5 +1,7 @@
package com.lt2333.simplicitytools.activity.pages.s
import android.content.Intent
import android.net.Uri
import android.view.View
import android.widget.Switch
import android.widget.Toast
@@ -11,11 +13,11 @@ import cn.fkj233.ui.activity.view.SwitchV
import cn.fkj233.ui.activity.view.TextSummaryV
import cn.fkj233.ui.activity.view.TextV
import cn.fkj233.ui.dialog.MIUIDialog
import cn.fkj233.ui.dialog.NewDialog
import com.lt2333.simplicitytools.R
import java.util.HashMap
@BMPage("scope_systemui","System UI", hideMenu = false)
@BMPage("scope_systemui", "System UI", hideMenu = false)
class SystemUIPageForS : BasePage() {
override fun onCreate() {
@@ -54,11 +56,10 @@ class SystemUIPageForS : BasePage() {
}
})
val layoutCompatibilityModeBinding = GetDataBinding({
MIUIActivity.safeSP.getInt(
"screen_hole_location",
0
) == 2
val layoutCompatibilityBinding = GetDataBinding({
MIUIActivity.safeSP.getBoolean(
"layout_compatibility_mode", false
)
}) { view, flags, data ->
when (flags) {
1 -> (view as Switch).isEnabled = data as Boolean
@@ -66,57 +67,23 @@ class SystemUIPageForS : BasePage() {
}
}
val screenHoleLocation: HashMap<Int, String> = hashMapOf<Int, String>().also {
it[0] = getString(R.string.off)
it[1] = getString(R.string.center)
it[2] = getString(R.string.left_or_right)
}
TextSummaryWithSpinner(
TextSummaryWithSwitch(
TextSummaryV(
textId = R.string.layout_compatibility_mode,
tipsId = R.string.screen_hole_location
),
SpinnerV(
screenHoleLocation[MIUIActivity.safeSP.getInt(
"screen_hole_location",
0
)].toString()
) {
add(screenHoleLocation[0].toString()) {
MIUIActivity.safeSP.putAny("screen_hole_location", 0)
layoutCompatibilityModeBinding.binding.Send().send(false)
}
add(screenHoleLocation[1].toString()) {
MIUIActivity.safeSP.putAny("screen_hole_location", 1)
layoutCompatibilityModeBinding.binding.Send().send(false)
}
add(screenHoleLocation[2].toString()) {
MIUIActivity.safeSP.putAny("screen_hole_location", 2)
layoutCompatibilityModeBinding.binding.Send().send(true)
}
})
textId = R.string.layout_compatibility_mode, tipsId = R.string.layout_compatibility_mode_summary
), SwitchV("layout_compatibility_mode", dataBindingSend = layoutCompatibilityBinding.bindingSend)
)
Text(
textId = R.string.left_margin,
dataBindingRecv = layoutCompatibilityModeBinding.binding.getRecv(2)
textId = R.string.left_margin, dataBindingRecv = layoutCompatibilityBinding.binding.getRecv(2)
)
SeekBarWithText(
"status_bar_left_margin",
0,
300,
0,
dataBindingRecv = layoutCompatibilityModeBinding.binding.getRecv(2)
"status_bar_left_margin", 0, 300, 0, dataBindingRecv = layoutCompatibilityBinding.binding.getRecv(2)
)
Text(
textId = R.string.right_margin,
dataBindingRecv = layoutCompatibilityModeBinding.binding.getRecv(2)
textId = R.string.right_margin, dataBindingRecv = layoutCompatibilityBinding.binding.getRecv(2)
)
SeekBarWithText(
"status_bar_right_margin",
0,
300,
0,
dataBindingRecv = layoutCompatibilityModeBinding.binding.getRecv(2)
"status_bar_right_margin", 0, 300, 0, dataBindingRecv = layoutCompatibilityBinding.binding.getRecv(2)
)
Line()
TitleText(textId = R.string.status_bar_clock_format)
@@ -245,24 +212,38 @@ class SystemUIPageForS : BasePage() {
//预设模式结束
//极客模式起始
TextSummaryArrow(TextSummaryV(textId = R.string.custom_clock_format_geek) {
MIUIDialog(activity) {
TextSummaryWithArrow(TextSummaryV(textId = R.string.custom_clock_format_geek) {
NewDialog(activity) {
setTitle(R.string.custom_clock_format_geek)
setEditText(MIUIActivity.safeSP.getString("custom_clock_format_geek", "HH:mm:ss"), "")
setLButton(textId = R.string.cancel) {
dismiss()
setEditText(
MIUIActivity.safeSP.getString("custom_clock_format_geek", "HH:mm:ss"), "", isSingleLine = false
)
Button(getString(R.string.click_to_view_use_cases)) {
val locale = context.resources.configuration.locale
val language = locale.language
if (language.endsWith("zh")) {
val uri = Uri.parse("https://zhuti.designer.xiaomi.com/docs/grammar/#%E6%97%B6%E9%97%B4%E6%97%A5%E6%9C%9F")
val intent = Intent(Intent.ACTION_VIEW, uri)
activity.startActivity(intent)
} else {
val uri = Uri.parse("https://docs.google.com/spreadsheets/d/1ghkT2iFbxB3bT4TKCiKAfmEdGt6kTVKFU3dm4Nz1or8/edit?usp=sharing")
val intent = Intent(Intent.ACTION_VIEW, uri)
activity.startActivity(intent)
}
}
setRButton(textId = R.string.Done) {
Button(getString(R.string.Done)) {
if (getEditText().isNotEmpty()) {
try {
MIUIActivity.safeSP.putAny("custom_clock_format_geek", getEditText())
dismiss()
return@setRButton
return@Button
} catch (_: Throwable) {
}
}
Toast.makeText(activity, R.string.input_error, Toast.LENGTH_SHORT)
.show()
Toast.makeText(activity, R.string.input_error, Toast.LENGTH_SHORT).show()
}
Button(getString(R.string.cancel), cancelStyle = true) {
dismiss()
}
}.show()
}, dataBindingRecv = customClockGeekBinding.binding.getRecv(2))
@@ -287,7 +268,7 @@ class SystemUIPageForS : BasePage() {
Line()
TitleText(textId = R.string.status_bar_icon)
TextSummaryArrow(
TextSummaryWithArrow(
TextSummaryV(
textId = R.string.hide_icon,
onClickListener = { showFragment("hide_icon") })
@@ -314,7 +295,7 @@ class SystemUIPageForS : BasePage() {
dataBindingSend = customMobileTypeTextBinding.bindingSend
)
)
TextSummaryArrow(TextSummaryV(textId = R.string.custom_mobile_type_text) {
TextSummaryWithArrow(TextSummaryV(textId = R.string.custom_mobile_type_text) {
MIUIDialog(activity) {
setTitle(R.string.custom_mobile_type_text)
setEditText(MIUIActivity.safeSP.getString("custom_mobile_type_text", "5G"), "")
@@ -358,7 +339,7 @@ class SystemUIPageForS : BasePage() {
SwitchV("big_mobile_type_icon_bold", true),
dataBindingRecv = bigMobileTypeIconBinding.binding.getRecv(2)
)
TextSummaryArrow(
TextSummaryWithArrow(
TextSummaryV(
textId = R.string.big_mobile_type_icon_size,
onClickListener = {
@@ -385,7 +366,7 @@ class SystemUIPageForS : BasePage() {
}.show()
}), dataBindingRecv = bigMobileTypeIconBinding.binding.getRecv(2)
)
TextSummaryArrow(TextSummaryV(textId = R.string.big_mobile_type_icon_up_and_down_position) {
TextSummaryWithArrow(TextSummaryV(textId = R.string.big_mobile_type_icon_up_and_down_position) {
MIUIDialog(activity) {
setTitle(R.string.big_mobile_type_icon_up_and_down_position)
setMessage("${activity.getString(R.string.range)} -15~15")
@@ -418,7 +399,7 @@ class SystemUIPageForS : BasePage() {
}
}.show()
}, dataBindingRecv = bigMobileTypeIconBinding.binding.getRecv(2))
TextSummaryArrow(TextSummaryV(textId = R.string.big_mobile_type_icon_left_and_right_margins) {
TextSummaryWithArrow(TextSummaryV(textId = R.string.big_mobile_type_icon_left_and_right_margins) {
MIUIDialog(activity) {
setTitle(R.string.big_mobile_type_icon_left_and_right_margins)
setMessage("${activity.getString(R.string.range)} 0~30")
@@ -455,7 +436,7 @@ class SystemUIPageForS : BasePage() {
SeekBarWithText("maximum_number_of_notification_icons", 1, 30, 3)
Text(textId = R.string.maximum_number_of_notification_dots)
SeekBarWithText("maximum_number_of_notification_dots", 0, 4, 3)
TextSummaryArrow(
TextSummaryWithArrow(
TextSummaryV(
textId = R.string.battery_percentage_font_size,
onClickListener = {
@@ -599,7 +580,7 @@ class SystemUIPageForS : BasePage() {
TextSummaryWithSwitch(
TextSummaryV(
textId = R.string.show_weather_main_switch,
colorId = R.color.purple_700
colorId = R.color.blue
),
SwitchV(
"notification_weather",
@@ -636,7 +617,7 @@ class SystemUIPageForS : BasePage() {
TextSummaryWithSwitch(
TextSummaryV(
textId = R.string.show_weather_main_switch,
colorId = R.color.purple_700,
colorId = R.color.blue,
tipsId = R.string.control_center_weather_summary
),
SwitchV(
@@ -703,7 +684,7 @@ class SystemUIPageForS : BasePage() {
TextSummaryWithSwitch(
TextSummaryV(
textId = R.string.old_qs_custom_switch,
colorId = R.color.purple_700
colorId = R.color.blue
),
SwitchV(
"old_qs_custom_switch",

View File

@@ -66,7 +66,7 @@ class AndroidPageForT : BasePage() {
tipsId = R.string.remove_small_window_restrictions_summary
), SwitchV("remove_small_window_restrictions")
)
TextSummaryArrow(
TextSummaryWithArrow(
TextSummaryV(
textId = R.string.max_wallpaper_scale,
onClickListener = {

View File

@@ -18,7 +18,7 @@ class MainPageForT : BasePage() {
TextSummaryWithSwitch(
TextSummaryV(
textId = R.string.main_switch,
colorId = R.color.purple_700
colorId = R.color.blue
), SwitchV("main_switch", true)
)
TextSummaryWithSwitch(
@@ -35,7 +35,7 @@ class MainPageForT : BasePage() {
)
})
)
TextSummaryArrow(
TextSummaryWithArrow(
TextSummaryV(
textId = R.string.matters_needing_attention,
colorId = R.color.red,
@@ -51,19 +51,19 @@ class MainPageForT : BasePage() {
)
Line()
TitleText(textId = R.string.scope)
TextSummaryArrow(
TextSummaryWithArrow(
TextSummaryV(
textId = R.string.scope_systemui,
tipsId = R.string.scope_systemui_summary,
onClickListener = { showFragment("scope_systemui") })
)
TextSummaryArrow(
TextSummaryWithArrow(
TextSummaryV(
textId = R.string.scope_android,
tipsId = R.string.scope_android_summary,
onClickListener = { showFragment("scope_android") })
)
TextSummaryArrow(
TextSummaryWithArrow(
TextSummaryV(
textId = R.string.scope_other,
tipsId = R.string.scope_other_summary,
@@ -71,7 +71,7 @@ class MainPageForT : BasePage() {
)
Line()
TitleText(textId = R.string.about)
TextSummaryArrow(
TextSummaryWithArrow(
TextSummaryV(
textId = R.string.about_module,
tips = getString(R.string.about_module_summary),

View File

@@ -2,7 +2,6 @@ package com.lt2333.simplicitytools.activity.pages.t
import android.content.ComponentName
import android.content.Intent
import android.content.pm.PackageManager
import android.view.View
import android.widget.Switch
import android.widget.Toast
@@ -11,12 +10,10 @@ import cn.fkj233.ui.activity.annotation.BMPage
import cn.fkj233.ui.activity.data.BasePage
import cn.fkj233.ui.activity.view.SwitchV
import cn.fkj233.ui.activity.view.TextSummaryV
import cn.fkj233.ui.dialog.MIUIDialog
import com.lt2333.simplicitytools.BuildConfig
import com.lt2333.simplicitytools.R
@BMPage("scope_other","Other", hideMenu = false)
@BMPage("scope_other", "Other", hideMenu = false)
class OtherPageForT : BasePage() {
override fun onCreate() {
@@ -33,6 +30,24 @@ class OtherPageForT : BasePage() {
tipsId = R.string.home_double_tap_to_sleep_summary
), SwitchV("double_tap_to_sleep")
)
TextSummaryWithSwitch(
TextSummaryV(
textId = R.string.miuihome_recentwiew_wallpaper_darkening, tipsId = R.string.miuihome_recentwiew_wallpaper_darkening_summary
), SwitchV("miuihome_recentwiew_wallpaper_darkening", false)
)
TextSummaryWithSwitch(
TextSummaryV(
textId = R.string.miuihome_recentview_remove_card_animation, tipsId = R.string.miuihome_recentview_remove_card_animation_summary
), SwitchV("miuihome_recentview_remove_card_animation", false)
)
TextSummaryWithSwitch(
TextSummaryV(textId = R.string.miuihome_shortcut_add_small_window, tipsId = R.string.miuihome_shortcut_add_small_window_summary),
SwitchV("miuihome_shortcut_add_small_window", false)
)
TextSummaryWithSwitch(
TextSummaryV(textId = R.string.miuihome_scroll_icon_name, tipsId = R.string.miuihome_scroll_icon_name_summary),
SwitchV("miuihome_scroll_icon_name", false)
)
Line()
TitleText(textId = R.string.scope_powerkeeper)
TextSummaryWithSwitch(
@@ -82,7 +97,7 @@ class OtherPageForT : BasePage() {
SwitchV("make_millet_ignore_active"),
dataBindingRecv = makeMilletMoreAggressiveSwitchBinding.binding.getRecv(2)
)
TextSummaryArrow(
TextSummaryWithArrow(
TextSummaryV(
textId = R.string.battery_optimization,
tipsId = R.string.battery_optimization_summary,
@@ -172,6 +187,12 @@ class OtherPageForT : BasePage() {
TextSummaryV(textId = R.string.remove_thememanager_ads),
SwitchV("remove_thememanager_ads")
)
Line()
TitleText(textId = R.string.pkg_installer)
TextSummaryWithSwitch(
TextSummaryV(textId = R.string.pkg_installer_summary),
SwitchV("pkg_installer_count_checking")
)
}
}

View File

@@ -1,5 +1,7 @@
package com.lt2333.simplicitytools.activity.pages.t
import android.content.Intent
import android.net.Uri
import android.view.View
import android.widget.Switch
import android.widget.Toast
@@ -11,18 +13,16 @@ import cn.fkj233.ui.activity.view.SwitchV
import cn.fkj233.ui.activity.view.TextSummaryV
import cn.fkj233.ui.activity.view.TextV
import cn.fkj233.ui.dialog.MIUIDialog
import cn.fkj233.ui.dialog.NewDialog
import com.lt2333.simplicitytools.R
import java.util.HashMap
@BMPage("scope_systemui","System UI", hideMenu = false)
class SystemUIPageForT : BasePage() {
@BMPage("scope_systemui", "System UI", hideMenu = false) class SystemUIPageForT : BasePage() {
override fun onCreate() {
TitleText(textId = R.string.statusbar)
TextSummaryWithSwitch(
TextSummaryV(textId = R.string.double_tap_to_sleep),
SwitchV("status_bar_double_tap_to_sleep")
TextSummaryV(textId = R.string.double_tap_to_sleep), SwitchV("status_bar_double_tap_to_sleep")
)
Line()
TitleText(textId = R.string.status_bar_layout)
@@ -32,33 +32,29 @@ class SystemUIPageForT : BasePage() {
it[2] = getString(R.string.clock_right)
it[3] = getString(R.string.clock_center_and_icon_left)
}
TextWithSpinner(
TextV(textId = R.string.status_bar_layout_mode),
SpinnerV(
statusBarLayoutMode[MIUIActivity.safeSP.getInt(
"status_bar_layout_mode",
0
)].toString()
) {
add(statusBarLayoutMode[0].toString()) {
MIUIActivity.safeSP.putAny("status_bar_layout_mode", 0)
}
add(statusBarLayoutMode[1].toString()) {
MIUIActivity.safeSP.putAny("status_bar_layout_mode", 1)
}
add(statusBarLayoutMode[2].toString()) {
MIUIActivity.safeSP.putAny("status_bar_layout_mode", 2)
}
add(statusBarLayoutMode[3].toString()) {
MIUIActivity.safeSP.putAny("status_bar_layout_mode", 3)
}
})
TextWithSpinner(TextV(textId = R.string.status_bar_layout_mode), SpinnerV(
statusBarLayoutMode[MIUIActivity.safeSP.getInt(
"status_bar_layout_mode", 0
)].toString()
) {
add(statusBarLayoutMode[0].toString()) {
MIUIActivity.safeSP.putAny("status_bar_layout_mode", 0)
}
add(statusBarLayoutMode[1].toString()) {
MIUIActivity.safeSP.putAny("status_bar_layout_mode", 1)
}
add(statusBarLayoutMode[2].toString()) {
MIUIActivity.safeSP.putAny("status_bar_layout_mode", 2)
}
add(statusBarLayoutMode[3].toString()) {
MIUIActivity.safeSP.putAny("status_bar_layout_mode", 3)
}
})
val layoutCompatibilityModeBinding = GetDataBinding({
MIUIActivity.safeSP.getInt(
"screen_hole_location",
0
) == 2
val layoutCompatibilityBinding = GetDataBinding({
MIUIActivity.safeSP.getBoolean(
"layout_compatibility_mode", false
)
}) { view, flags, data ->
when (flags) {
1 -> (view as Switch).isEnabled = data as Boolean
@@ -66,57 +62,23 @@ class SystemUIPageForT : BasePage() {
}
}
val screenHoleLocation: HashMap<Int, String> = hashMapOf<Int, String>().also {
it[0] = getString(R.string.off)
it[1] = getString(R.string.center)
it[2] = getString(R.string.left_or_right)
}
TextSummaryWithSpinner(
TextSummaryWithSwitch(
TextSummaryV(
textId = R.string.layout_compatibility_mode,
tipsId = R.string.screen_hole_location
),
SpinnerV(
screenHoleLocation[MIUIActivity.safeSP.getInt(
"screen_hole_location",
0
)].toString()
) {
add(screenHoleLocation[0].toString()) {
MIUIActivity.safeSP.putAny("screen_hole_location", 0)
layoutCompatibilityModeBinding.binding.Send().send(false)
}
add(screenHoleLocation[1].toString()) {
MIUIActivity.safeSP.putAny("screen_hole_location", 1)
layoutCompatibilityModeBinding.binding.Send().send(false)
}
add(screenHoleLocation[2].toString()) {
MIUIActivity.safeSP.putAny("screen_hole_location", 2)
layoutCompatibilityModeBinding.binding.Send().send(true)
}
})
textId = R.string.layout_compatibility_mode, tipsId = R.string.layout_compatibility_mode_summary
), SwitchV("layout_compatibility_mode", dataBindingSend = layoutCompatibilityBinding.bindingSend)
)
Text(
textId = R.string.left_margin,
dataBindingRecv = layoutCompatibilityModeBinding.binding.getRecv(2)
textId = R.string.left_margin, dataBindingRecv = layoutCompatibilityBinding.binding.getRecv(2)
)
SeekBarWithText(
"status_bar_left_margin",
0,
300,
0,
dataBindingRecv = layoutCompatibilityModeBinding.binding.getRecv(2)
"status_bar_left_margin", 0, 300, 0, dataBindingRecv = layoutCompatibilityBinding.binding.getRecv(2)
)
Text(
textId = R.string.right_margin,
dataBindingRecv = layoutCompatibilityModeBinding.binding.getRecv(2)
textId = R.string.right_margin, dataBindingRecv = layoutCompatibilityBinding.binding.getRecv(2)
)
SeekBarWithText(
"status_bar_right_margin",
0,
300,
0,
dataBindingRecv = layoutCompatibilityModeBinding.binding.getRecv(2)
"status_bar_right_margin", 0, 300, 0, dataBindingRecv = layoutCompatibilityBinding.binding.getRecv(2)
)
Line()
TitleText(textId = R.string.status_bar_clock_format)
@@ -124,8 +86,7 @@ class SystemUIPageForT : BasePage() {
val customClockPresetBinding = GetDataBinding({
MIUIActivity.safeSP.getInt(
"custom_clock_mode",
0
"custom_clock_mode", 0
) == 1
}) { view, flags, data ->
when (flags) {
@@ -134,40 +95,41 @@ class SystemUIPageForT : BasePage() {
}
}
val customClockGeekBinding =
GetDataBinding({ MIUIActivity.safeSP.getInt("custom_clock_mode", 0) == 2 }
val customClockGeekBinding = GetDataBinding({ MIUIActivity.safeSP.getInt("custom_clock_mode", 0) == 2 }
) { view, flags, data ->
when (flags) {
1 -> (view as Switch).isEnabled = data as Boolean
2 -> view.visibility = if (data as Boolean) View.VISIBLE else View.GONE
}
) { view, flags, data ->
when (flags) {
1 -> (view as Switch).isEnabled = data as Boolean
2 -> view.visibility = if (data as Boolean) View.VISIBLE else View.GONE
}
}
val customClockMode: HashMap<Int, String> = hashMapOf<Int, String>().also {
it[0] = getString(R.string.off)
it[1] = getString(R.string.preset)
it[2] = getString(R.string.geek)
}
TextWithSpinner(
TextV(textId = R.string.custom_clock_mode),
SpinnerV(customClockMode[MIUIActivity.safeSP.getInt("custom_clock_mode", 0)].toString()) {
add(customClockMode[0].toString()) {
MIUIActivity.safeSP.putAny("custom_clock_mode", 0)
customClockPresetBinding.binding.Send().send(false)
customClockGeekBinding.binding.Send().send(false)
}
add(customClockMode[1].toString()) {
MIUIActivity.safeSP.putAny("custom_clock_mode", 1)
customClockPresetBinding.binding.Send().send(true)
customClockGeekBinding.binding.Send().send(false)
}
add(customClockMode[2].toString()) {
MIUIActivity.safeSP.putAny("custom_clock_mode", 2)
customClockPresetBinding.binding.Send().send(false)
customClockGeekBinding.binding.Send().send(true)
}
})
TextWithSpinner(TextV(textId = R.string.custom_clock_mode), SpinnerV(
customClockMode[MIUIActivity.safeSP.getInt(
"custom_clock_mode", 0
)].toString()
) {
add(customClockMode[0].toString()) {
MIUIActivity.safeSP.putAny("custom_clock_mode", 0)
customClockPresetBinding.binding.Send().send(false)
customClockGeekBinding.binding.Send().send(false)
}
add(customClockMode[1].toString()) {
MIUIActivity.safeSP.putAny("custom_clock_mode", 1)
customClockPresetBinding.binding.Send().send(true)
customClockGeekBinding.binding.Send().send(false)
}
add(customClockMode[2].toString()) {
MIUIActivity.safeSP.putAny("custom_clock_mode", 2)
customClockPresetBinding.binding.Send().send(false)
customClockGeekBinding.binding.Send().send(true)
}
})
//预设模式起始
TextWithSwitch(
@@ -221,48 +183,53 @@ class SystemUIPageForT : BasePage() {
dataBindingRecv = customClockPresetBinding.binding.getRecv(2)
)
Text(
textId = R.string.status_bar_clock_size,
dataBindingRecv = customClockPresetBinding.binding.getRecv(2)
textId = R.string.status_bar_clock_size, dataBindingRecv = customClockPresetBinding.binding.getRecv(2)
)
SeekBarWithText(
"status_bar_clock_size",
0,
18,
0,
dataBindingRecv = customClockPresetBinding.binding.getRecv(2)
"status_bar_clock_size", 0, 18, 0, dataBindingRecv = customClockPresetBinding.binding.getRecv(2)
)
Text(
textId = R.string.status_bar_clock_double_line_size,
dataBindingRecv = customClockPresetBinding.binding.getRecv(2)
)
SeekBarWithText(
"status_bar_clock_double_line_size",
0,
9,
0,
dataBindingRecv = customClockPresetBinding.binding.getRecv(2)
"status_bar_clock_double_line_size", 0, 9, 0, dataBindingRecv = customClockPresetBinding.binding.getRecv(2)
)
//预设模式结束
//极客模式起始
TextSummaryArrow(TextSummaryV(textId = R.string.custom_clock_format_geek) {
MIUIDialog(activity) {
TextSummaryWithArrow(TextSummaryV(textId = R.string.custom_clock_format_geek) {
NewDialog(activity) {
setTitle(R.string.custom_clock_format_geek)
setEditText(MIUIActivity.safeSP.getString("custom_clock_format_geek", "HH:mm:ss"), "")
setLButton(textId = R.string.cancel) {
dismiss()
setEditText(
MIUIActivity.safeSP.getString("custom_clock_format_geek", "HH:mm:ss"), "", isSingleLine = false
)
Button(getString(R.string.click_to_view_use_cases)) {
val locale = context.resources.configuration.locale
val language = locale.language
if (language.endsWith("zh")) {
val uri = Uri.parse("https://zhuti.designer.xiaomi.com/docs/grammar/#%E6%97%B6%E9%97%B4%E6%97%A5%E6%9C%9F")
val intent = Intent(Intent.ACTION_VIEW, uri)
activity.startActivity(intent)
} else {
val uri = Uri.parse("https://docs.google.com/spreadsheets/d/1ghkT2iFbxB3bT4TKCiKAfmEdGt6kTVKFU3dm4Nz1or8/edit?usp=sharing")
val intent = Intent(Intent.ACTION_VIEW, uri)
activity.startActivity(intent)
}
}
setRButton(textId = R.string.Done) {
Button(getString(R.string.Done)) {
if (getEditText().isNotEmpty()) {
try {
MIUIActivity.safeSP.putAny("custom_clock_format_geek", getEditText())
dismiss()
return@setRButton
return@Button
} catch (_: Throwable) {
}
}
Toast.makeText(activity, R.string.input_error, Toast.LENGTH_SHORT)
.show()
Toast.makeText(activity, R.string.input_error, Toast.LENGTH_SHORT).show()
}
Button(getString(R.string.cancel), cancelStyle = true) {
dismiss()
}
}.show()
}, dataBindingRecv = customClockGeekBinding.binding.getRecv(2))
@@ -272,34 +239,25 @@ class SystemUIPageForT : BasePage() {
dataBindingRecv = customClockGeekBinding.binding.getRecv(2)
)
Text(
textId = R.string.status_bar_clock_size,
dataBindingRecv = customClockGeekBinding.binding.getRecv(2)
textId = R.string.status_bar_clock_size, dataBindingRecv = customClockGeekBinding.binding.getRecv(2)
)
SeekBarWithText(
"status_bar_clock_size_geek",
0,
18,
0,
dataBindingRecv = customClockGeekBinding.binding.getRecv(2)
"status_bar_clock_size_geek", 0, 18, 0, dataBindingRecv = customClockGeekBinding.binding.getRecv(2)
)
//极客模式结束
Line()
TitleText(textId = R.string.status_bar_icon)
TextSummaryArrow(
TextSummaryV(
textId = R.string.hide_icon,
onClickListener = { showFragment("hide_icon") })
TextSummaryWithArrow(
TextSummaryV(textId = R.string.hide_icon, onClickListener = { showFragment("hide_icon") })
)
TextWithSwitch(
TextV(textId = R.string.show_wifi_standard),
SwitchV("show_wifi_standard")
TextV(textId = R.string.show_wifi_standard), SwitchV("show_wifi_standard")
)
val customMobileTypeTextBinding = GetDataBinding({
MIUIActivity.safeSP.getBoolean(
"custom_mobile_type_text_switch",
false
"custom_mobile_type_text_switch", false
)
}) { view, flags, data ->
when (flags) {
@@ -308,13 +266,11 @@ class SystemUIPageForT : BasePage() {
}
}
TextSummaryWithSwitch(
TextSummaryV(textId = R.string.custom_mobile_type_text_switch),
SwitchV(
"custom_mobile_type_text_switch",
dataBindingSend = customMobileTypeTextBinding.bindingSend
TextSummaryV(textId = R.string.custom_mobile_type_text_switch), SwitchV(
"custom_mobile_type_text_switch", dataBindingSend = customMobileTypeTextBinding.bindingSend
)
)
TextSummaryArrow(TextSummaryV(textId = R.string.custom_mobile_type_text) {
TextSummaryWithArrow(TextSummaryV(textId = R.string.custom_mobile_type_text) {
MIUIDialog(activity) {
setTitle(R.string.custom_mobile_type_text)
setEditText(MIUIActivity.safeSP.getString("custom_mobile_type_text", "5G"), "")
@@ -330,15 +286,13 @@ class SystemUIPageForT : BasePage() {
} catch (_: Throwable) {
}
}
Toast.makeText(activity, R.string.input_error, Toast.LENGTH_SHORT)
.show()
Toast.makeText(activity, R.string.input_error, Toast.LENGTH_SHORT).show()
}
}.show()
}, dataBindingRecv = customMobileTypeTextBinding.binding.getRecv(2))
val bigMobileTypeIconBinding = GetDataBinding({
MIUIActivity.safeSP.getBoolean(
"big_mobile_type_icon",
false
"big_mobile_type_icon", false
)
}) { view, flags, data ->
when (flags) {
@@ -347,51 +301,67 @@ class SystemUIPageForT : BasePage() {
}
}
TextSummaryWithSwitch(
TextSummaryV(textId = R.string.big_mobile_type_icon),
SwitchV(
"big_mobile_type_icon",
dataBindingSend = bigMobileTypeIconBinding.bindingSend
TextSummaryV(textId = R.string.big_mobile_type_icon), SwitchV(
"big_mobile_type_icon", dataBindingSend = bigMobileTypeIconBinding.bindingSend
)
)
val bigMobileTypeLocation: HashMap<Int, String> = hashMapOf<Int, String>().also {
it[0] = getString(R.string.left)
it[1] = getString(R.string.right)
}
TextWithSpinner(
TextV(textId = R.string.big_mobile_type_location), SpinnerV(
bigMobileTypeLocation[MIUIActivity.safeSP.getInt(
"big_mobile_type_location", 1
)].toString()
) {
add(bigMobileTypeLocation[0].toString()) {
MIUIActivity.safeSP.putAny("big_mobile_type_location", 0)
}
add(bigMobileTypeLocation[1].toString()) {
MIUIActivity.safeSP.putAny("big_mobile_type_location", 1)
}
}, dataBindingRecv = bigMobileTypeIconBinding.binding.getRecv(2)
)
TextSummaryWithSwitch(
TextSummaryV(textId = R.string.big_mobile_type_only_show_network_card),
SwitchV("big_mobile_type_only_show_network_card", false),
dataBindingRecv = bigMobileTypeIconBinding.binding.getRecv(2)
)
TextSummaryWithSwitch(
TextSummaryV(textId = R.string.big_mobile_type_icon_bold),
SwitchV("big_mobile_type_icon_bold", true),
dataBindingRecv = bigMobileTypeIconBinding.binding.getRecv(2)
)
TextSummaryArrow(
TextSummaryV(
textId = R.string.big_mobile_type_icon_size,
onClickListener = {
MIUIDialog(activity) {
setTitle(R.string.big_mobile_type_icon_size)
setEditText(
"",
"${activity.getString(R.string.def)}12.5, ${activity.getString(R.string.current)}${
MIUIActivity.safeSP.getFloat("big_mobile_type_icon_size", 12.5f)
}"
)
setLButton(textId = R.string.cancel) {
dismiss()
TextSummaryWithArrow(
TextSummaryV(textId = R.string.big_mobile_type_icon_size, onClickListener = {
MIUIDialog(activity) {
setTitle(R.string.big_mobile_type_icon_size)
setEditText(
"", "${activity.getString(R.string.def)}12.5, ${activity.getString(R.string.current)}${
MIUIActivity.safeSP.getFloat("big_mobile_type_icon_size", 12.5f)
}"
)
setLButton(textId = R.string.cancel) {
dismiss()
}
setRButton(textId = R.string.Done) {
if (getEditText() != "") {
MIUIActivity.safeSP.putAny(
"big_mobile_type_icon_size", getEditText().toFloat()
)
}
setRButton(textId = R.string.Done) {
if (getEditText() != "") {
MIUIActivity.safeSP.putAny(
"big_mobile_type_icon_size",
getEditText().toFloat()
)
}
dismiss()
}
}.show()
}), dataBindingRecv = bigMobileTypeIconBinding.binding.getRecv(2)
dismiss()
}
}.show()
}), dataBindingRecv = bigMobileTypeIconBinding.binding.getRecv(2)
)
TextSummaryArrow(TextSummaryV(textId = R.string.big_mobile_type_icon_up_and_down_position) {
TextSummaryWithArrow(TextSummaryV(textId = R.string.big_mobile_type_icon_up_and_down_position) {
MIUIDialog(activity) {
setTitle(R.string.big_mobile_type_icon_up_and_down_position)
setMessage("${activity.getString(R.string.range)} -15~15")
setEditText(
"",
"${activity.getString(R.string.def)}0, ${activity.getString(R.string.current)}${
"", "${activity.getString(R.string.def)}0, ${activity.getString(R.string.current)}${
MIUIActivity.safeSP.getInt("big_mobile_type_icon_up_and_down_position", 0)
}"
)
@@ -404,8 +374,7 @@ class SystemUIPageForT : BasePage() {
val value = getEditText().toInt()
if (value in (-15..15)) {
MIUIActivity.safeSP.putAny(
"big_mobile_type_icon_up_and_down_position",
value
"big_mobile_type_icon_up_and_down_position", value
)
dismiss()
return@setRButton
@@ -413,18 +382,16 @@ class SystemUIPageForT : BasePage() {
} catch (_: Throwable) {
}
}
Toast.makeText(activity, R.string.input_error, Toast.LENGTH_SHORT)
.show()
Toast.makeText(activity, R.string.input_error, Toast.LENGTH_SHORT).show()
}
}.show()
}, dataBindingRecv = bigMobileTypeIconBinding.binding.getRecv(2))
TextSummaryArrow(TextSummaryV(textId = R.string.big_mobile_type_icon_left_and_right_margins) {
TextSummaryWithArrow(TextSummaryV(textId = R.string.big_mobile_type_icon_left_and_right_margins) {
MIUIDialog(activity) {
setTitle(R.string.big_mobile_type_icon_left_and_right_margins)
setMessage("${activity.getString(R.string.range)} 0~30")
setEditText(
"",
"${activity.getString(R.string.def)}0, ${activity.getString(R.string.current)}${
"", "${activity.getString(R.string.def)}0, ${activity.getString(R.string.current)}${
MIUIActivity.safeSP.getInt("big_mobile_type_icon_left_and_right_margins", 0)
}"
)
@@ -437,8 +404,7 @@ class SystemUIPageForT : BasePage() {
val value = getEditText().toInt()
if (value in (0..30)) {
MIUIActivity.safeSP.putAny(
"big_mobile_type_icon_left_and_right_margins",
value
"big_mobile_type_icon_left_and_right_margins", value
)
dismiss()
return@setRButton
@@ -446,8 +412,7 @@ class SystemUIPageForT : BasePage() {
} catch (_: Throwable) {
}
}
Toast.makeText(activity, R.string.input_error, Toast.LENGTH_SHORT)
.show()
Toast.makeText(activity, R.string.input_error, Toast.LENGTH_SHORT).show()
}
}.show()
}, dataBindingRecv = bigMobileTypeIconBinding.binding.getRecv(2))
@@ -455,37 +420,33 @@ class SystemUIPageForT : BasePage() {
SeekBarWithText("maximum_number_of_notification_icons", 1, 30, 3)
Text(textId = R.string.maximum_number_of_notification_dots)
SeekBarWithText("maximum_number_of_notification_dots", 0, 4, 3)
TextSummaryArrow(
TextSummaryV(
textId = R.string.battery_percentage_font_size,
onClickListener = {
MIUIDialog(activity) {
setTitle(R.string.battery_percentage_font_size)
setMessage(R.string.zero_do_no_change)
setEditText(
"", "${activity.getString(R.string.current)}${
MIUIActivity.safeSP.getFloat("battery_percentage_font_size", 0f)
}"
)
setLButton(textId = R.string.cancel) {
dismiss()
TextSummaryWithArrow(
TextSummaryV(textId = R.string.battery_percentage_font_size, onClickListener = {
MIUIDialog(activity) {
setTitle(R.string.battery_percentage_font_size)
setMessage(R.string.zero_do_no_change)
setEditText(
"", "${activity.getString(R.string.current)}${
MIUIActivity.safeSP.getFloat("battery_percentage_font_size", 0f)
}"
)
setLButton(textId = R.string.cancel) {
dismiss()
}
setRButton(textId = R.string.Done) {
if (getEditText() != "") {
MIUIActivity.safeSP.putAny(
"battery_percentage_font_size", getEditText().toFloat()
)
}
setRButton(textId = R.string.Done) {
if (getEditText() != "") {
MIUIActivity.safeSP.putAny(
"battery_percentage_font_size",
getEditText().toFloat()
)
}
dismiss()
}
}.show()
})
dismiss()
}
}.show()
})
)
TextSummaryWithSwitch(
TextSummaryV(
textId = R.string.hide_battery_percentage_icon,
tipsId = R.string.hide_battery_percentage_icon_summary
textId = R.string.hide_battery_percentage_icon, tipsId = R.string.hide_battery_percentage_icon_summary
), SwitchV("hide_battery_percentage_icon")
)
Line()
@@ -503,13 +464,11 @@ class SystemUIPageForT : BasePage() {
), SwitchV("hide_status_bar_network_speed_second")
)
TextWithSwitch(
TextV(textId = R.string.hide_network_speed_splitter),
SwitchV("hide_network_speed_splitter")
TextV(textId = R.string.hide_network_speed_splitter), SwitchV("hide_network_speed_splitter")
)
val statusBarDualRowNetworkSpeedBinding = GetDataBinding({
MIUIActivity.safeSP.getBoolean(
"status_bar_dual_row_network_speed",
false
"status_bar_dual_row_network_speed", false
)
}) { view, flags, data ->
when (flags) {
@@ -521,21 +480,17 @@ class SystemUIPageForT : BasePage() {
TextSummaryV(
textId = R.string.status_bar_dual_row_network_speed,
tipsId = R.string.status_bar_dual_row_network_speed_summary
),
SwitchV(
"status_bar_dual_row_network_speed",
dataBindingSend = statusBarDualRowNetworkSpeedBinding.bindingSend
), SwitchV(
"status_bar_dual_row_network_speed", dataBindingSend = statusBarDualRowNetworkSpeedBinding.bindingSend
)
)
val align: HashMap<Int, String> = hashMapOf()
align[0] = getString(R.string.left)
align[1] = getString(R.string.right)
TextWithSpinner(
TextV(textId = R.string.status_bar_network_speed_dual_row_gravity),
SpinnerV(
TextV(textId = R.string.status_bar_network_speed_dual_row_gravity), SpinnerV(
align[MIUIActivity.safeSP.getInt(
"status_bar_network_speed_dual_row_gravity",
0
"status_bar_network_speed_dual_row_gravity", 0
)].toString()
) {
add(align[0].toString()) {
@@ -545,33 +500,28 @@ class SystemUIPageForT : BasePage() {
MIUIActivity.safeSP.putAny("status_bar_network_speed_dual_row_gravity", 1)
}
},
dataBindingRecv = statusBarDualRowNetworkSpeedBinding.binding.getRecv(2)
}, dataBindingRecv = statusBarDualRowNetworkSpeedBinding.binding.getRecv(2)
)
TextWithSpinner(
TextV(textId = R.string.status_bar_network_speed_dual_row_icon),
SpinnerV(
MIUIActivity.safeSP.getString(
"status_bar_network_speed_dual_row_icon",
getString(R.string.none)
TextWithSpinner(TextV(textId = R.string.status_bar_network_speed_dual_row_icon), SpinnerV(
MIUIActivity.safeSP.getString(
"status_bar_network_speed_dual_row_icon", getString(R.string.none)
)
) {
add(getString(R.string.none)) {
MIUIActivity.safeSP.putAny(
"status_bar_network_speed_dual_row_icon", getString(R.string.none)
)
) {
add(getString(R.string.none)) {
MIUIActivity.safeSP.putAny(
"status_bar_network_speed_dual_row_icon",
getString(R.string.none)
)
}
add("▲▼") {
MIUIActivity.safeSP.putAny("status_bar_network_speed_dual_row_icon", "▲▼")
}
add("△▽") {
MIUIActivity.safeSP.putAny("status_bar_network_speed_dual_row_icon", "△▽")
}
add("↑↓") {
MIUIActivity.safeSP.putAny("status_bar_network_speed_dual_row_icon", "↑↓")
}
})
}
add("▲▼") {
MIUIActivity.safeSP.putAny("status_bar_network_speed_dual_row_icon", "▲▼")
}
add("△▽") {
MIUIActivity.safeSP.putAny("status_bar_network_speed_dual_row_icon", "△▽")
}
add("↑↓") {
MIUIActivity.safeSP.putAny("status_bar_network_speed_dual_row_icon", "↑↓")
}
})
Text(
textId = R.string.status_bar_network_speed_dual_row_size,
dataBindingRecv = statusBarDualRowNetworkSpeedBinding.binding.getRecv(2)
@@ -587,8 +537,7 @@ class SystemUIPageForT : BasePage() {
TitleText(textId = R.string.notification_center)
val showWeatherMainSwitchBinding = GetDataBinding({
MIUIActivity.safeSP.getBoolean(
"notification_weather",
false
"notification_weather", false
)
}) { view, flags, data ->
when (flags) {
@@ -598,20 +547,15 @@ class SystemUIPageForT : BasePage() {
}
TextSummaryWithSwitch(
TextSummaryV(
textId = R.string.show_weather_main_switch,
colorId = R.color.purple_700
),
SwitchV(
"notification_weather",
dataBindingSend = showWeatherMainSwitchBinding.bindingSend
textId = R.string.show_weather_main_switch, colorId = R.color.blue
), SwitchV(
"notification_weather", dataBindingSend = showWeatherMainSwitchBinding.bindingSend
)
)
TextSummaryWithSwitch(
TextSummaryV(
textId = R.string.show_city,
),
SwitchV("notification_weather_city"),
dataBindingRecv = showWeatherMainSwitchBinding.binding.getRecv(2)
), SwitchV("notification_weather_city"), dataBindingRecv = showWeatherMainSwitchBinding.binding.getRecv(2)
)
TextSummaryWithSwitch(
TextSummaryV(
@@ -622,10 +566,16 @@ class SystemUIPageForT : BasePage() {
)
Line()
TitleText(textId = R.string.control_center)
TextSummaryWithSwitch(
TextSummaryV(
textId = R.string.disable_bluetooth_temporarily_off
), SwitchV(
"disable_bluetooth_temporarily_off"
)
)
val controlCenterWeatherBinding = GetDataBinding({
MIUIActivity.safeSP.getBoolean(
"control_center_weather",
false
"control_center_weather", false
)
}) { view, flags, data ->
when (flags) {
@@ -636,20 +586,16 @@ class SystemUIPageForT : BasePage() {
TextSummaryWithSwitch(
TextSummaryV(
textId = R.string.show_weather_main_switch,
colorId = R.color.purple_700,
colorId = R.color.blue,
tipsId = R.string.control_center_weather_summary
),
SwitchV(
"control_center_weather",
dataBindingSend = controlCenterWeatherBinding.bindingSend
), SwitchV(
"control_center_weather", dataBindingSend = controlCenterWeatherBinding.bindingSend
)
)
TextSummaryWithSwitch(
TextSummaryV(
textId = R.string.show_city,
),
SwitchV("control_center_weather_city"),
dataBindingRecv = controlCenterWeatherBinding.binding.getRecv(2)
), SwitchV("control_center_weather_city"), dataBindingRecv = controlCenterWeatherBinding.binding.getRecv(2)
)
Line()
TitleText(textId = R.string.lock_screen)
@@ -672,8 +618,7 @@ class SystemUIPageForT : BasePage() {
), SwitchV("remove_lock_screen_camera")
)
TextSummaryWithSwitch(
TextSummaryV(textId = R.string.enable_wave_charge_animation),
SwitchV("enable_wave_charge_animation")
TextSummaryV(textId = R.string.enable_wave_charge_animation), SwitchV("enable_wave_charge_animation")
)
TextSummaryWithSwitch(
TextSummaryV(
@@ -683,16 +628,14 @@ class SystemUIPageForT : BasePage() {
)
TextSummaryWithSwitch(
TextSummaryV(
textId = R.string.double_tap_to_sleep,
tipsId = R.string.home_double_tap_to_sleep_summary
textId = R.string.double_tap_to_sleep, tipsId = R.string.home_double_tap_to_sleep_summary
), SwitchV("lock_screen_double_tap_to_sleep")
)
Line()
TitleText(textId = R.string.old_quick_settings_panel)
val oldQSCustomSwitchBinding = GetDataBinding({
MIUIActivity.safeSP.getBoolean(
"old_qs_custom_switch",
false
"old_qs_custom_switch", false
)
}) { view, flags, data ->
when (flags) {
@@ -702,57 +645,35 @@ class SystemUIPageForT : BasePage() {
}
TextSummaryWithSwitch(
TextSummaryV(
textId = R.string.old_qs_custom_switch,
colorId = R.color.purple_700
),
SwitchV(
"old_qs_custom_switch",
dataBindingSend = oldQSCustomSwitchBinding.bindingSend
textId = R.string.old_qs_custom_switch, colorId = R.color.blue
), SwitchV(
"old_qs_custom_switch", dataBindingSend = oldQSCustomSwitchBinding.bindingSend
)
)
Text(
textId = R.string.qs_custom_rows,
dataBindingRecv = oldQSCustomSwitchBinding.binding.getRecv(2)
textId = R.string.qs_custom_rows, dataBindingRecv = oldQSCustomSwitchBinding.binding.getRecv(2)
)
SeekBarWithText(
"qs_custom_rows",
1,
6,
3,
dataBindingRecv = oldQSCustomSwitchBinding.binding.getRecv(2)
"qs_custom_rows", 1, 6, 3, dataBindingRecv = oldQSCustomSwitchBinding.binding.getRecv(2)
)
Text(
textId = R.string.qs_custom_rows_horizontal,
dataBindingRecv = oldQSCustomSwitchBinding.binding.getRecv(2)
textId = R.string.qs_custom_rows_horizontal, dataBindingRecv = oldQSCustomSwitchBinding.binding.getRecv(2)
)
SeekBarWithText(
"qs_custom_rows_horizontal",
1,
3,
2,
dataBindingRecv = oldQSCustomSwitchBinding.binding.getRecv(2)
"qs_custom_rows_horizontal", 1, 3, 2, dataBindingRecv = oldQSCustomSwitchBinding.binding.getRecv(2)
)
Text(
textId = R.string.qs_custom_columns,
dataBindingRecv = oldQSCustomSwitchBinding.binding.getRecv(2)
textId = R.string.qs_custom_columns, dataBindingRecv = oldQSCustomSwitchBinding.binding.getRecv(2)
)
SeekBarWithText(
"qs_custom_columns",
1,
7,
4,
dataBindingRecv = oldQSCustomSwitchBinding.binding.getRecv(2)
"qs_custom_columns", 1, 7, 4, dataBindingRecv = oldQSCustomSwitchBinding.binding.getRecv(2)
)
Text(
textId = R.string.qs_custom_columns_unexpanded,
dataBindingRecv = oldQSCustomSwitchBinding.binding.getRecv(2)
)
SeekBarWithText(
"qs_custom_columns_unexpanded",
1,
7,
5,
dataBindingRecv = oldQSCustomSwitchBinding.binding.getRecv(2)
"qs_custom_columns_unexpanded", 1, 7, 5, dataBindingRecv = oldQSCustomSwitchBinding.binding.getRecv(2)
)
}

View File

@@ -2,7 +2,7 @@ package com.lt2333.simplicitytools.hooks
import com.lt2333.simplicitytools.BuildConfig
import com.lt2333.simplicitytools.hooks.apps.*
import com.lt2333.simplicitytools.hooks.rules.all.CorePatchMainHook
import com.lt2333.simplicitytools.hooks.rules.all.corepatch.CorePatchMainHook
import com.lt2333.simplicitytools.utils.xposed.EasyXposedInit
import com.lt2333.simplicitytools.utils.xposed.base.AppRegister
import de.robv.android.xposed.IXposedHookZygoteInit
@@ -25,6 +25,7 @@ class MainHook : EasyXposedInit() {
ScreenShot, // 截屏
Cast, //投屏
RearDisplay, //背屏
PackageInstaller, // 应用包管理组件
)
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam?) {

View File

@@ -1,9 +1,15 @@
package com.lt2333.simplicitytools.hooks.apps
import android.os.Build
import com.lt2333.simplicitytools.hooks.rules.all.CorePatchMainHook
import com.lt2333.simplicitytools.hooks.rules.s.android.*
import com.lt2333.simplicitytools.hooks.rules.all.android.AllowUntrustedTouchesForAll
import com.lt2333.simplicitytools.hooks.rules.all.android.DeleteOnPostNotificationForAll
import com.lt2333.simplicitytools.hooks.rules.all.android.DisableFlagSecureForAll
import com.lt2333.simplicitytools.hooks.rules.all.corepatch.CorePatchMainHook
import com.lt2333.simplicitytools.hooks.rules.s.android.MaxWallpaperScaleForS
import com.lt2333.simplicitytools.hooks.rules.s.android.RemoveSmallWindowRestrictionsForS
import com.lt2333.simplicitytools.hooks.rules.s.android.SystemPropertiesHookForS
import com.lt2333.simplicitytools.hooks.rules.t.android.MaxWallpaperScaleForT
import com.lt2333.simplicitytools.hooks.rules.t.android.SystemPropertiesHookForT
import com.lt2333.simplicitytools.utils.xposed.base.AppRegister
import de.robv.android.xposed.callbacks.XC_LoadPackage
@@ -17,23 +23,24 @@ object Android : AppRegister() {
Build.VERSION_CODES.TIRAMISU -> {
autoInitHooks(
lpparam,
DisableFlagSecureForS, //允许截图
DeleteOnPostNotificationForS, //上层显示
DisableFlagSecureForAll, //允许截图
DeleteOnPostNotificationForAll, //上层显示
RemoveSmallWindowRestrictionsForS, //解除小窗限制
MaxWallpaperScaleForT, //壁纸缩放比例
SystemPropertiesHookForS, //SystemPropertiesHook
AllowUntrustedTouchesForS, //允许不受信任的触摸
SystemPropertiesHookForT, //SystemPropertiesHook
AllowUntrustedTouchesForAll, //允许不受信任的触摸
)
}
Build.VERSION_CODES.S -> {
autoInitHooks(
lpparam,
DisableFlagSecureForS, //允许截图
DeleteOnPostNotificationForS, //上层显示
DisableFlagSecureForAll, //允许截图
DeleteOnPostNotificationForAll, //上层显示
RemoveSmallWindowRestrictionsForS, //解除小窗限制
MaxWallpaperScaleForS, //壁纸缩放比例
SystemPropertiesHookForS, //SystemPropertiesHook
AllowUntrustedTouchesForS, //允许不受信任的触摸
AllowUntrustedTouchesForAll, //允许不受信任的触摸
)
}
}

View File

@@ -1,23 +1,26 @@
package com.lt2333.simplicitytools.hooks.apps
import android.os.Build
import com.lt2333.simplicitytools.hooks.rules.s.cast.ForceSupportSendAppForS
import com.lt2333.simplicitytools.hooks.rules.all.cast.ForceSupportSendAppForAll
import com.lt2333.simplicitytools.utils.xposed.base.AppRegister
import de.robv.android.xposed.callbacks.XC_LoadPackage
object Cast: AppRegister() {
object Cast : AppRegister() {
override val packageName: String = "com.milink.service"
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
when (Build.VERSION.SDK_INT) {
Build.VERSION_CODES.TIRAMISU -> {
autoInitHooks(lpparam,
ForceSupportSendAppForS, //强制允许所有应用接力
autoInitHooks(
lpparam,
ForceSupportSendAppForAll, //强制允许所有应用接力
)
}
Build.VERSION_CODES.S -> {
autoInitHooks(lpparam,
ForceSupportSendAppForS, //强制允许所有应用接力
autoInitHooks(
lpparam,
ForceSupportSendAppForAll, //强制允许所有应用接力
)
}
}

View File

@@ -17,6 +17,7 @@ object MediaEditor : AppRegister() {
UnlockUnlimitedCroppingForT, //解锁裁切最小值
)
}
Build.VERSION_CODES.S -> {
autoInitHooks(
lpparam,

View File

@@ -1,8 +1,13 @@
package com.lt2333.simplicitytools.hooks.apps
import android.os.Build
import com.lt2333.simplicitytools.hooks.rules.s.miuihome.AlwaysDisplayTimeForS
import com.lt2333.simplicitytools.hooks.rules.s.miuihome.DoubleTapToSleepForS
import com.lt2333.simplicitytools.hooks.rules.all.miuihome.AlwaysShowStatusBarClockForAll
import com.lt2333.simplicitytools.hooks.rules.all.miuihome.DisableRecentViewWallpaperDarkeningForAll
import com.lt2333.simplicitytools.hooks.rules.all.miuihome.DoubleTapToSleepForAll
import com.lt2333.simplicitytools.hooks.rules.all.miuihome.ModifyRecentViewRemoveCardAnimForAll
import com.lt2333.simplicitytools.hooks.rules.all.miuihome.RemoveSmallWindowRestrictionForMiuiHomeForAll
import com.lt2333.simplicitytools.hooks.rules.all.miuihome.ScrollIconNameForAll
import com.lt2333.simplicitytools.hooks.rules.all.miuihome.ShortcutAddSmallWindowForAll
import com.lt2333.simplicitytools.utils.xposed.base.AppRegister
import de.robv.android.xposed.callbacks.XC_LoadPackage
@@ -14,15 +19,26 @@ object MiuiHome : AppRegister() {
Build.VERSION_CODES.TIRAMISU -> {
autoInitHooks(
lpparam,
AlwaysDisplayTimeForS, //时钟显示时钟
DoubleTapToSleepForS, //双击锁屏
AlwaysShowStatusBarClockForAll, //时钟显示时钟
DoubleTapToSleepForAll, //双击锁屏
DisableRecentViewWallpaperDarkeningForAll, //取消后台壁纸压暗效果
ModifyRecentViewRemoveCardAnimForAll, //横向排布后台划卡动画
ScrollIconNameForAll, //滚动显示应用标题
RemoveSmallWindowRestrictionForMiuiHomeForAll, //取消小窗限制
ShortcutAddSmallWindowForAll, //快捷菜单添加小窗
)
}
Build.VERSION_CODES.S -> {
autoInitHooks(
lpparam,
AlwaysDisplayTimeForS, //时钟显示时钟
DoubleTapToSleepForS, //双击锁屏
AlwaysShowStatusBarClockForAll, //时钟显示时钟
DoubleTapToSleepForAll, //双击锁屏
DisableRecentViewWallpaperDarkeningForAll, //取消后台壁纸压暗效果
ModifyRecentViewRemoveCardAnimForAll, //横向排布后台划卡动画
ScrollIconNameForAll, //滚动显示应用标题
RemoveSmallWindowRestrictionForMiuiHomeForAll, //取消小窗限制
ShortcutAddSmallWindowForAll, //快捷菜单添加小窗
)
}
}

View File

@@ -0,0 +1,24 @@
package com.lt2333.simplicitytools.hooks.apps
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.hookBefore
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.AppRegister
import de.robv.android.xposed.XposedBridge
import de.robv.android.xposed.callbacks.XC_LoadPackage
object PackageInstaller : AppRegister() {
override val packageName: String = "com.miui.packageinstaller"
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
hasEnable("pkg_installer_count_checking") {
findMethod("com.miui.packageInstaller.model.RiskControlRules") {
name == "getCurrentLevel"
}.hookBefore { param ->
XposedBridge.log("Hooked getCurrentLevel, param result = ${param.result}")
param.result = 0
}
}
}
}

View File

@@ -1,29 +1,32 @@
package com.lt2333.simplicitytools.hooks.apps
import android.os.Build
import com.lt2333.simplicitytools.hooks.rules.all.powerkeeper.LockMaxFpsForAll
import com.lt2333.simplicitytools.hooks.rules.s.powerkeeper.DoNotClearAppForS
import com.lt2333.simplicitytools.hooks.rules.s.powerkeeper.LockMaxFpsForS
import com.lt2333.simplicitytools.hooks.rules.s.powerkeeper.MakeMilletMoreAggressiveForS
import com.lt2333.simplicitytools.hooks.rules.s.powerkeeper.PreventRecoveryOfBatteryOptimizationWhitelistForS
import com.lt2333.simplicitytools.utils.xposed.base.AppRegister
import de.robv.android.xposed.callbacks.XC_LoadPackage
object PowerKeeper: AppRegister() {
object PowerKeeper : AppRegister() {
override val packageName: String = "com.miui.powerkeeper"
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
when (Build.VERSION.SDK_INT) {
Build.VERSION_CODES.TIRAMISU -> {
autoInitHooks(lpparam,
LockMaxFpsForS, //锁定最高刷新率
autoInitHooks(
lpparam,
LockMaxFpsForAll, //锁定最高刷新率
PreventRecoveryOfBatteryOptimizationWhitelistForS, //防止恢复电池优化白名单
DoNotClearAppForS,//阻止杀后台
MakeMilletMoreAggressiveForS,//使 Millet 更激进
)
}
Build.VERSION_CODES.S -> {
autoInitHooks(lpparam,
LockMaxFpsForS, //锁定最高刷新率
autoInitHooks(
lpparam,
LockMaxFpsForAll, //锁定最高刷新率
PreventRecoveryOfBatteryOptimizationWhitelistForS, //防止恢复电池优化白名单
DoNotClearAppForS,//阻止杀后台
MakeMilletMoreAggressiveForS,//使 Millet 更激进

View File

@@ -1,23 +1,26 @@
package com.lt2333.simplicitytools.hooks.apps
import android.os.Build
import com.lt2333.simplicitytools.hooks.rules.s.reardisplay.RearDisplayWeatherForS
import com.lt2333.simplicitytools.hooks.rules.all.reardisplay.RearDisplayWeatherForAll
import com.lt2333.simplicitytools.utils.xposed.base.AppRegister
import de.robv.android.xposed.callbacks.XC_LoadPackage
object RearDisplay: AppRegister() {
object RearDisplay : AppRegister() {
override val packageName: String = "com.xiaomi.misubscreenui"
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
when (Build.VERSION.SDK_INT) {
Build.VERSION_CODES.TIRAMISU -> {
autoInitHooks(lpparam,
RearDisplayWeatherForS, //背屏显示天气
autoInitHooks(
lpparam,
RearDisplayWeatherForAll, //背屏显示天气
)
}
Build.VERSION_CODES.S -> {
autoInitHooks(lpparam,
RearDisplayWeatherForS, //背屏显示天气
autoInitHooks(
lpparam,
RearDisplayWeatherForAll, //背屏显示天气
)
}
}

View File

@@ -6,18 +6,21 @@ import com.lt2333.simplicitytools.hooks.rules.t.mediaeditor.UnlockUnlimitedCropp
import com.lt2333.simplicitytools.utils.xposed.base.AppRegister
import de.robv.android.xposed.callbacks.XC_LoadPackage
object ScreenShot: AppRegister() {
object ScreenShot : AppRegister() {
override val packageName: String = "com.miui.screenshot"
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
when (Build.VERSION.SDK_INT) {
Build.VERSION_CODES.TIRAMISU -> {
autoInitHooks(lpparam,
autoInitHooks(
lpparam,
UnlockUnlimitedCroppingForT, //解锁裁切限制
)
}
Build.VERSION_CODES.S -> {
autoInitHooks(lpparam,
autoInitHooks(
lpparam,
UnlockUnlimitedCroppingForS, //解锁裁切限制
)
}

View File

@@ -1,32 +1,39 @@
package com.lt2333.simplicitytools.hooks.apps
import android.os.Build
import com.lt2333.simplicitytools.hooks.rules.s.securitycenter.*
import com.lt2333.simplicitytools.hooks.rules.all.securitycenter.LockOneHundredForAll
import com.lt2333.simplicitytools.hooks.rules.all.securitycenter.RemoveMacroBlacklistForAll
import com.lt2333.simplicitytools.hooks.rules.all.securitycenter.RemoveOpenAppConfirmationPopupForAll
import com.lt2333.simplicitytools.hooks.rules.all.securitycenter.SkipWaitingTimeForAll
import com.lt2333.simplicitytools.hooks.rules.s.securitycenter.ShowBatteryTemperatureForS
import com.lt2333.simplicitytools.hooks.rules.t.securitycenter.ShowBatteryTemperatureForT
import com.lt2333.simplicitytools.utils.xposed.base.AppRegister
import de.robv.android.xposed.callbacks.XC_LoadPackage
object SecurityCenter: AppRegister() {
object SecurityCenter : AppRegister() {
override val packageName: String = "com.miui.securitycenter"
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
when (Build.VERSION.SDK_INT) {
Build.VERSION_CODES.TIRAMISU -> {
autoInitHooks(lpparam,
SkipWaitingTimeForS, //跳过 5/10秒等待时间
LockOneHundredForS, //锁定 100分
RemoveMacroBlacklistForS, //去除自动连招黑名单
autoInitHooks(
lpparam,
SkipWaitingTimeForAll, //跳过 5/10秒等待时间
LockOneHundredForAll, //锁定 100分
RemoveMacroBlacklistForAll, //去除自动连招黑名单
ShowBatteryTemperatureForT, //显示电池温度
RemoveOpenAppConfirmationPopupForS, //去除打开应用弹窗
RemoveOpenAppConfirmationPopupForAll, //去除打开应用弹窗
)
}
Build.VERSION_CODES.S -> {
autoInitHooks(lpparam,
SkipWaitingTimeForS, //跳过 5/10秒等待时间
LockOneHundredForS, //锁定 100分
RemoveMacroBlacklistForS, //去除自动连招黑名单
autoInitHooks(
lpparam,
SkipWaitingTimeForAll, //跳过 5/10秒等待时间
LockOneHundredForAll, //锁定 100分
RemoveMacroBlacklistForAll, //去除自动连招黑名单
ShowBatteryTemperatureForS, //显示电池温度
RemoveOpenAppConfirmationPopupForS, //去除打开应用弹窗
RemoveOpenAppConfirmationPopupForAll, //去除打开应用弹窗
)
}
}

View File

@@ -1,23 +1,26 @@
package com.lt2333.simplicitytools.hooks.apps
import android.os.Build
import com.lt2333.simplicitytools.hooks.rules.s.settings.ShowNotificationImportanceForS
import com.lt2333.simplicitytools.hooks.rules.all.settings.ShowNotificationImportanceForAll
import com.lt2333.simplicitytools.utils.xposed.base.AppRegister
import de.robv.android.xposed.callbacks.XC_LoadPackage
object Settings: AppRegister() {
object Settings : AppRegister() {
override val packageName: String = "com.android.settings"
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
when (Build.VERSION.SDK_INT) {
Build.VERSION_CODES.TIRAMISU -> {
autoInitHooks(lpparam,
ShowNotificationImportanceForS, //显示通知重要程度
autoInitHooks(
lpparam,
ShowNotificationImportanceForAll, //显示通知重要程度
)
}
Build.VERSION_CODES.S -> {
autoInitHooks(lpparam,
ShowNotificationImportanceForS, //显示通知重要程度
autoInitHooks(
lpparam,
ShowNotificationImportanceForAll, //显示通知重要程度
)
}
}

View File

@@ -1,54 +1,87 @@
package com.lt2333.simplicitytools.hooks.apps
import android.os.Build
import com.lt2333.simplicitytools.hooks.rules.s.systemui.*
import com.lt2333.simplicitytools.hooks.rules.s.systemui.BatteryPercentageForS
import com.lt2333.simplicitytools.hooks.rules.s.systemui.CanNotificationSlideForS
import com.lt2333.simplicitytools.hooks.rules.s.systemui.ControlCenterWeatherForS
import com.lt2333.simplicitytools.hooks.rules.s.systemui.CustomMobileTypeTextForS
import com.lt2333.simplicitytools.hooks.rules.s.systemui.DoubleLineNetworkSpeedForS
import com.lt2333.simplicitytools.hooks.rules.s.systemui.HideBatteryIconForS
import com.lt2333.simplicitytools.hooks.rules.s.systemui.HideHDIconForS
import com.lt2333.simplicitytools.hooks.rules.s.systemui.HideMobileActivityIconForS
import com.lt2333.simplicitytools.hooks.rules.s.systemui.HideMobileTypeIconForS
import com.lt2333.simplicitytools.hooks.rules.s.systemui.HideNetworkSpeedSplitterForS
import com.lt2333.simplicitytools.hooks.rules.s.systemui.HideSimIconForS
import com.lt2333.simplicitytools.hooks.rules.s.systemui.HideStatusBarIconForS
import com.lt2333.simplicitytools.hooks.rules.s.systemui.HideStatusBarNetworkSpeedSecondForS
import com.lt2333.simplicitytools.hooks.rules.s.systemui.HideWifiActivityIconForS
import com.lt2333.simplicitytools.hooks.rules.s.systemui.LockScreenClockDisplaySecondsForS
import com.lt2333.simplicitytools.hooks.rules.s.systemui.LockScreenCurrentForS
import com.lt2333.simplicitytools.hooks.rules.s.systemui.LockScreenDoubleTapToSleepForS
import com.lt2333.simplicitytools.hooks.rules.s.systemui.MaximumNumberOfNotificationIconsForS
import com.lt2333.simplicitytools.hooks.rules.s.systemui.NewNotificationWeatherForS
import com.lt2333.simplicitytools.hooks.rules.s.systemui.NotificationWeatherForS
import com.lt2333.simplicitytools.hooks.rules.s.systemui.OldNotificationWeatherForS
import com.lt2333.simplicitytools.hooks.rules.s.systemui.OldQSCustomForS
import com.lt2333.simplicitytools.hooks.rules.s.systemui.RemoveLockScreenCameraForS
import com.lt2333.simplicitytools.hooks.rules.s.systemui.RemoveTheLeftSideOfTheLockScreenForS
import com.lt2333.simplicitytools.hooks.rules.s.systemui.ShowWifiStandardForS
import com.lt2333.simplicitytools.hooks.rules.s.systemui.StatusBarBigMobileTypeIconForS
import com.lt2333.simplicitytools.hooks.rules.s.systemui.StatusBarDoubleTapToSleepForS
import com.lt2333.simplicitytools.hooks.rules.s.systemui.StatusBarLayoutForS
import com.lt2333.simplicitytools.hooks.rules.s.systemui.StatusBarNetworkSpeedRefreshSpeedForS
import com.lt2333.simplicitytools.hooks.rules.s.systemui.StatusBarTimeCustomizationForS
import com.lt2333.simplicitytools.hooks.rules.s.systemui.WaveChargeForS
import com.lt2333.simplicitytools.hooks.rules.t.systemui.*
import com.lt2333.simplicitytools.utils.xposed.base.AppRegister
import de.robv.android.xposed.callbacks.XC_LoadPackage
object SystemUI: AppRegister() {
object SystemUI : AppRegister() {
override val packageName: String = "com.android.systemui"
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
when (Build.VERSION.SDK_INT) {
Build.VERSION_CODES.TIRAMISU -> {
autoInitHooks(lpparam,
HideStatusBarIconForS, //隐藏状态栏图标
HideBatteryIconForS, //隐藏电池
HideHDIconForS, //隐藏HD图标
HideSimIconForS, //隐藏SIM卡图标
HideMobileActivityIconForS, //隐藏移动箭头图标
HideMobileTypeIconForS, //隐藏移动类型图标
HideStatusBarNetworkSpeedSecondForS, //隐藏状态栏网速/s
HideWifiActivityIconForS, //隐藏WIFI活动箭头图标
MaximumNumberOfNotificationIconsForS, //通知图标上限
StatusBarNetworkSpeedRefreshSpeedForS, //状态栏网速秒刷新
StatusBarTimeCustomizationForS, //状态栏时钟自定义
RemoveTheLeftSideOfTheLockScreenForS, //移除锁屏负一屏功能
RemoveLockScreenCameraForS, //移除锁屏相机功能
NotificationWeatherForS, //通知面板天气
NewNotificationWeatherForS, // 新控制中心天气
OldNotificationWeatherForS,
ControlCenterWeatherForS, //控制中心天气
//StatusBarCurrent, //TODO状态栏电流
StatusBarLayoutForS, //状态栏布局
HideNetworkSpeedSplitterForS, //隐藏时钟与实时网速之间的分隔符
WaveChargeForS, //Alpha充电动画
LockScreenCurrentForS, //锁屏电流
LockScreenDoubleTapToSleepForS, //锁屏下双击锁屏
StatusBarDoubleTapToSleepForS, //双击状态栏锁屏
OldQSCustomForS, //旧版快速设置自定义
DoubleLineNetworkSpeedForS, //双排网速
StatusBarBigMobileTypeIconForS, //大移动类型
BatteryPercentageForS, //电量百分比
CustomMobileTypeTextForS, //自定义移动类型文本
CanNotificationSlideForS, //允许下滑通知打开小窗
LockScreenClockDisplaySecondsForS, // 锁屏时钟显示秒
ShowWifiStandardForS, // 显示 WIFI 角标
NoPasswordHookForS, // 显示 WIFI 角标
autoInitHooks(
lpparam,
HideStatusBarIconForT, //隐藏状态栏图标
HideBatteryIconForT, //隐藏电池
HideHDIconForT, //隐藏HD图标
HideSimIconForT, //隐藏SIM卡图标
HideMobileActivityIconForT, //隐藏移动箭头图标
HideMobileTypeIconForT, //隐藏移动类型图标
HideStatusBarNetworkSpeedSecondForT, //隐藏状态栏网速/s
HideWifiActivityIconForT, //隐藏WIFI活动箭头图标
MaximumNumberOfNotificationIconsForT, //通知图标上限
StatusBarNetworkSpeedRefreshSpeedForT, //状态栏网速秒刷新
StatusBarTimeCustomizationForT, //状态栏时钟自定义
RemoveTheLeftSideOfTheLockScreenForT, //移除锁屏负一屏功能
RemoveLockScreenCameraForT, //移除锁屏相机功能
NotificationWeatherForT, //通知面板天气
NewNotificationWeatherForT, // 新控制中心天气
OldNotificationWeatherForT,
ControlCenterWeatherForT, //控制中心天气
StatusBarLayoutForT, //状态栏布局
HideNetworkSpeedSplitterForT, //隐藏时钟与实时网速之间的分隔符
WaveChargeForT, //Alpha充电动画
LockScreenCurrentForT, //锁屏电流
LockScreenDoubleTapToSleepForT, //锁屏下双击锁屏
StatusBarDoubleTapToSleepForT, //双击状态栏锁屏
OldQSCustomForT, //旧版快速设置自定义
DoubleLineNetworkSpeedForT, //双排网速
StatusBarBigMobileTypeIconForT, //大移动类型
BatteryPercentageForT, //电量百分比
CustomMobileTypeTextForT, //自定义移动类型文本
CanNotificationSlideForT, //允许下滑通知打开小窗
LockScreenClockDisplaySecondsForT, // 锁屏时钟显示秒
ShowWifiStandardForT, // 显示 WIFI 角标
DisableBluetoothTemporarilyOffForT, //禁用临时蓝牙关闭
)
}
Build.VERSION_CODES.S -> {
autoInitHooks(lpparam,
autoInitHooks(
lpparam,
HideStatusBarIconForS, //隐藏状态栏图标
HideBatteryIconForS, //隐藏电池
HideHDIconForS, //隐藏HD图标
@@ -66,7 +99,6 @@ object SystemUI: AppRegister() {
NewNotificationWeatherForS, // 新控制中心天气
OldNotificationWeatherForS,
ControlCenterWeatherForS, //控制中心天气
//StatusBarCurrent, //TODO状态栏电流
StatusBarLayoutForS, //状态栏布局
HideNetworkSpeedSplitterForS, //隐藏时钟与实时网速之间的分隔符
WaveChargeForS, //Alpha充电动画
@@ -81,7 +113,6 @@ object SystemUI: AppRegister() {
CanNotificationSlideForS, //允许下滑通知打开小窗
LockScreenClockDisplaySecondsForS, // 锁屏时钟显示秒
ShowWifiStandardForS, // 显示 WIFI 角标
NoPasswordHookForS, // 显示 WIFI 角标
)
}
}

View File

@@ -1,23 +1,26 @@
package com.lt2333.simplicitytools.hooks.apps
import android.os.Build
import com.lt2333.simplicitytools.hooks.rules.s.thememanager.RemoveAdsForS
import com.lt2333.simplicitytools.hooks.rules.all.thememanager.RemoveAdsForAll
import com.lt2333.simplicitytools.utils.xposed.base.AppRegister
import de.robv.android.xposed.callbacks.XC_LoadPackage
object ThemeManager: AppRegister() {
object ThemeManager : AppRegister() {
override val packageName: String = "com.android.thememanager"
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
when (Build.VERSION.SDK_INT) {
Build.VERSION_CODES.TIRAMISU -> {
autoInitHooks(lpparam,
RemoveAdsForS, //移除主题壁纸的广告
autoInitHooks(
lpparam,
RemoveAdsForAll, //移除主题壁纸的广告
)
}
Build.VERSION_CODES.S -> {
autoInitHooks(lpparam,
RemoveAdsForS, //移除主题壁纸的广告
autoInitHooks(
lpparam,
RemoveAdsForAll, //移除主题壁纸的广告
)
}
}

View File

@@ -1,12 +1,13 @@
package com.lt2333.simplicitytools.hooks.apps
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.hookBefore
import com.github.kyuubiran.ezxhelper.utils.hookReturnConstant
import com.github.kyuubiran.ezxhelper.utils.loadClassOrNull
import com.github.kyuubiran.ezxhelper.utils.hookBefore
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.AppRegister
import de.robv.android.xposed.callbacks.XC_LoadPackage
object Updater : AppRegister() {
override val packageName: String = "com.android.updater"

View File

@@ -1,4 +0,0 @@
package com.lt2333.simplicitytools.hooks.rules.all;
public class CorePatchForSv2 extends CorePatchForS{
}

View File

@@ -1,4 +1,4 @@
package com.lt2333.simplicitytools.hooks.rules.s.android
package com.lt2333.simplicitytools.hooks.rules.all.android
import android.content.Context
import com.github.kyuubiran.ezxhelper.utils.findMethod
@@ -6,7 +6,7 @@ import com.github.kyuubiran.ezxhelper.utils.hookReturnConstant
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object AllowUntrustedTouchesForS : HookRegister() {
object AllowUntrustedTouchesForAll : HookRegister() {
override fun init() = hasEnable("allow_untrusted_touches") {
findMethod("android.hardware.input.InputManager") {
name == "getBlockUntrustedTouchesMode" && parameterTypes[0] == Context::class.java

View File

@@ -1,11 +1,11 @@
package com.lt2333.simplicitytools.hooks.rules.s.android
package com.lt2333.simplicitytools.hooks.rules.all.android
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.hookBefore
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object DeleteOnPostNotificationForS : HookRegister() {
object DeleteOnPostNotificationForAll : HookRegister() {
override fun init() {
findMethod("com.android.server.wm.AlertWindowNotification") {
name == "onPostNotification"

View File

@@ -0,0 +1,34 @@
package com.lt2333.simplicitytools.hooks.rules.all.android
import android.os.Build
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.hookAllConstructorBefore
import com.github.kyuubiran.ezxhelper.utils.hookBefore
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object DisableFlagSecureForAll : HookRegister() {
override fun init() {
findMethod("com.android.server.wm.WindowState") {
name == "isSecureLocked"
}.hookBefore {
hasEnable("disable_flag_secure") {
it.result = false
}
}
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.TIRAMISU) {
findMethod("com.android.server.wm.WindowSurfaceController") {
name == "setSecure"
}.hookBefore {
it.args[0] = false
}
hookAllConstructorBefore("com.android.server.wm.WindowSurfaceController") {
var flags = it.args[2] as Int
val secureFlag = 128
flags = flags and secureFlag.inv()
it.args[2] = flags
}
}
}
}

View File

@@ -1,11 +1,11 @@
package com.lt2333.simplicitytools.hooks.rules.s.cast
package com.lt2333.simplicitytools.hooks.rules.all.cast
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.hookAfter
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object ForceSupportSendAppForS : HookRegister() {
object ForceSupportSendAppForAll : HookRegister() {
override fun init() = hasEnable("force_support_send_app") {
findMethod("com.xiaomi.mirror.synergy.MiuiSynergySdk") {

View File

@@ -1,4 +1,4 @@
package com.lt2333.simplicitytools.hooks.rules.all;
package com.lt2333.simplicitytools.hooks.rules.all.corepatch;
import android.content.pm.ApplicationInfo;

View File

@@ -1,4 +1,4 @@
package com.lt2333.simplicitytools.hooks.rules.all;
package com.lt2333.simplicitytools.hooks.rules.all.corepatch;
import android.app.AndroidAppHelper;

View File

@@ -1,4 +1,4 @@
package com.lt2333.simplicitytools.hooks.rules.all;
package com.lt2333.simplicitytools.hooks.rules.all.corepatch;
import java.lang.reflect.InvocationTargetException;

View File

@@ -0,0 +1,4 @@
package com.lt2333.simplicitytools.hooks.rules.all.corepatch;
public class CorePatchForSv2 extends CorePatchForS{
}

View File

@@ -1,4 +1,4 @@
package com.lt2333.simplicitytools.hooks.rules.all;
package com.lt2333.simplicitytools.hooks.rules.all.corepatch;
import android.util.Log;

View File

@@ -1,4 +1,4 @@
package com.lt2333.simplicitytools.hooks.rules.all;
package com.lt2333.simplicitytools.hooks.rules.all.corepatch;
import android.os.Build;
import android.util.Log;

View File

@@ -1,4 +1,4 @@
package com.lt2333.simplicitytools.hooks.rules.all;
package com.lt2333.simplicitytools.hooks.rules.all.corepatch;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XSharedPreferences;

View File

@@ -1,4 +1,4 @@
package com.lt2333.simplicitytools.hooks.rules.all;
package com.lt2333.simplicitytools.hooks.rules.all.corepatch;
import com.lt2333.simplicitytools.BuildConfig;

View File

@@ -0,0 +1,29 @@
package com.lt2333.simplicitytools.hooks.rules.all.miuihome
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.hookBefore
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object AlwaysShowStatusBarClockForAll : HookRegister() {
override fun init() {
try {
findMethod("com.miui.home.launcher.Workspace") {
name == "isScreenHasClockGadget"
}
} catch (e: Exception) {
findMethod("com.miui.home.launcher.Workspace") {
name == "isScreenHasClockWidget"
}
} catch (e: Exception) {
findMethod("com.miui.home.launcher.Workspace") {
name == "isClockWidget"
}
}.hookBefore {
hasEnable("home_time") {
it.result = false
}
}
}
}

View File

@@ -0,0 +1,19 @@
package com.lt2333.simplicitytools.hooks.rules.all.miuihome
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.hookBefore
import com.github.kyuubiran.ezxhelper.utils.putObject
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object DisableRecentViewWallpaperDarkeningForAll : HookRegister() {
override fun init() = hasEnable("miuihome_recentwiew_wallpaper_darkening") {
findMethod("com.miui.home.recents.DimLayer") {
name == "dim" && parameterCount == 3
}.hookBefore {
it.args[0] = 0.0f
it.thisObject.putObject("mCurrentAlpha", 0.0f)
}
}
}

View File

@@ -1,4 +1,4 @@
package com.lt2333.simplicitytools.hooks.rules.s.miuihome
package com.lt2333.simplicitytools.hooks.rules.all.miuihome
import android.content.Context
import android.os.SystemClock
@@ -6,7 +6,7 @@ import android.view.MotionEvent
import android.view.ViewConfiguration
import kotlin.math.abs
class DoubleTapControllerForS internal constructor(mContext: Context) {
class DoubleTapControllerForAll internal constructor(mContext: Context) {
private val maxDuration: Long = 500
private var mActionDownRawX: Float = 0f

View File

@@ -1,4 +1,4 @@
package com.lt2333.simplicitytools.hooks.rules.s.miuihome
package com.lt2333.simplicitytools.hooks.rules.all.miuihome
import android.content.Context
import android.content.Intent
@@ -8,14 +8,14 @@ import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
import de.robv.android.xposed.XposedHelpers
object DoubleTapToSleepForS : HookRegister() {
object DoubleTapToSleepForAll : HookRegister() {
override fun init() = hasEnable("double_tap_to_sleep") {
hookAllConstructorAfter("com.miui.home.launcher.Workspace") {
var mDoubleTapControllerEx =
XposedHelpers.getAdditionalInstanceField(it.thisObject, "mDoubleTapControllerEx")
if (mDoubleTapControllerEx != null) return@hookAllConstructorAfter
mDoubleTapControllerEx = DoubleTapControllerForS((it.args[0] as Context))
mDoubleTapControllerEx = DoubleTapControllerForAll((it.args[0] as Context))
XposedHelpers.setAdditionalInstanceField(
it.thisObject,
"mDoubleTapControllerEx",
@@ -28,7 +28,7 @@ object DoubleTapToSleepForS : HookRegister() {
val mDoubleTapControllerEx = XposedHelpers.getAdditionalInstanceField(
it.thisObject,
"mDoubleTapControllerEx"
) as DoubleTapControllerForS
) as DoubleTapControllerForAll
if (!mDoubleTapControllerEx.isDoubleTapEvent(it.args[0] as MotionEvent)) return@hookBefore
val mCurrentScreenIndex = it.thisObject.getObject("mCurrentScreenIndex") as Int
val cellLayout = it.thisObject.invokeMethodAuto("getCellLayout", mCurrentScreenIndex)

View File

@@ -0,0 +1,46 @@
package com.lt2333.simplicitytools.hooks.rules.all.miuihome
import android.animation.ObjectAnimator
import android.animation.TimeInterpolator
import android.view.MotionEvent
import android.view.View
import com.lt2333.simplicitytools.utils.*
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
import de.robv.android.xposed.XposedHelpers
object ModifyRecentViewRemoveCardAnimForAll : HookRegister() {
override fun init() = hasEnable("miuihome_recentview_remove_card_animation") {
"com.miui.home.recents.views.SwipeHelperForRecents".hookAfterMethod("onTouchEvent", MotionEvent::class.java) {
val mCurrView = it.thisObject.getObjectField("mCurrView") as View?
if (mCurrView != null) {
mCurrView.alpha = 1f
mCurrView.scaleX = 1f
mCurrView.scaleY = 1f
}
}
"com.miui.home.recents.TaskStackViewLayoutStyleHorizontal".replaceMethod("createScaleDismissAnimation", View::class.java, Float::class.java) {
val view = it.args[0] as View
val getScreenHeight = "com.miui.home.launcher.DeviceConfig".findClass().callStaticMethod("getScreenHeight") as Int
val ofFloat = ObjectAnimator.ofFloat(view, View.TRANSLATION_Y, view.translationY, -getScreenHeight * 1.1484375f)
val physicBasedInterpolator = XposedHelpers.newInstance("com.miui.home.launcher.anim.PhysicBasedInterpolator".findClass(), 0.9f, 0.78f)
ofFloat.interpolator = physicBasedInterpolator as TimeInterpolator
ofFloat.duration = 400
return@replaceMethod ofFloat
}
"com.miui.home.recents.views.VerticalSwipe".hookAfterMethod("calculate", Float::class.java) {
val f = it.args[0] as Float
val asScreenHeightWhenDismiss = "com.miui.home.recents.views.VerticalSwipe".findClass().callStaticMethod("getAsScreenHeightWhenDismiss") as Int
val f2 = f / asScreenHeightWhenDismiss
val mTaskViewHeight = it.thisObject.getObjectField("mTaskViewHeight") as Float
val mCurScale = it.thisObject.getObjectField("mCurScale") as Float
val f3: Float = mTaskViewHeight * mCurScale
val i = if (f2 > 0.0f) 1 else if (f2 == 0.0f) 0 else -1
val afterFrictionValue: Float = it.thisObject.callMethod("afterFrictionValue", f, asScreenHeightWhenDismiss) as Float
if (i < 0) it.thisObject.setObjectField("mCurTransY", (mTaskViewHeight / 2.0f + afterFrictionValue * 2) - (f3 / 2.0f))
}
}
}

View File

@@ -0,0 +1,28 @@
package com.lt2333.simplicitytools.hooks.rules.all.miuihome
import com.github.kyuubiran.ezxhelper.utils.findAllMethods
import com.github.kyuubiran.ezxhelper.utils.hookBefore
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object RemoveSmallWindowRestrictionForMiuiHomeForAll : HookRegister() {
override fun init() {
findAllMethods("com.miui.home.launcher.RecentsAndFSGestureUtils") {
name == "canTaskEnterSmallWindow"
}.hookBefore {
hasEnable("android_remove_small_window_restriction") {
it.result = true
}
}
findAllMethods("com.miui.home.launcher.RecentsAndFSGestureUtils") {
name == "canTaskEnterMiniSmallWindow"
}.hookBefore {
hasEnable("android_remove_small_window_restriction") {
it.result = true
}
}
}
}

View File

@@ -0,0 +1,85 @@
package com.lt2333.simplicitytools.hooks.rules.all.miuihome
import android.annotation.SuppressLint
import android.content.Context
import android.text.TextUtils
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import com.github.kyuubiran.ezxhelper.utils.Log
import com.github.kyuubiran.ezxhelper.utils.args
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.getObject
import com.github.kyuubiran.ezxhelper.utils.hookAfter
import com.github.kyuubiran.ezxhelper.utils.invokeMethod
import com.lt2333.simplicitytools.utils.*
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object ScrollIconNameForAll : HookRegister() {
@SuppressLint("DiscouragedApi")
override fun init() = hasEnable("miuihome_scroll_icon_name") {
val launcherClass = "com.miui.home.launcher.Launcher".findClass()
val shortcutInfoClass = "com.miui.home.launcher.ShortcutInfo".findClass()
try {
"com.miui.home.launcher.ItemIcon".hookAfterMethod(
"onFinishInflate"
) {
val mTitle = it.thisObject.getObjectField("mTitle") as TextView
mTitleScrolling(mTitle)
}
"com.miui.home.launcher.maml.MaMlWidgetView".hookAfterMethod(
"onFinishInflate"
) {
val mTitle = it.thisObject.getObjectField("mTitleTextView") as TextView
mTitleScrolling(mTitle)
}
"com.miui.home.launcher.LauncherMtzGadgetView".hookAfterMethod(
"onFinishInflate"
) {
val mTitle = it.thisObject.getObjectField("mTitleTextView") as TextView
mTitleScrolling(mTitle)
}
"com.miui.home.launcher.LauncherWidgetView".hookAfterMethod(
"onFinishInflate"
) {
val mTitle = it.thisObject.getObjectField("mTitleTextView") as TextView
mTitleScrolling(mTitle)
}
"com.miui.home.launcher.ShortcutIcon".hookAfterMethod(
"fromXml", Int::class.javaPrimitiveType, launcherClass, ViewGroup::class.java, shortcutInfoClass
) {
val buddyIconView = it.args[3].callMethod("getBuddyIconView", it.args[2]) as View
val mTitle = buddyIconView.getObjectField("mTitle") as TextView
mTitleScrolling(mTitle)
}
"com.miui.home.launcher.ShortcutIcon".hookAfterMethod(
"createShortcutIcon", Int::class.javaPrimitiveType, launcherClass, ViewGroup::class.java
) {
val buddyIcon = it.result as View
val mTitle = buddyIcon.getObjectField("mTitle") as TextView
mTitleScrolling(mTitle)
}
"com.miui.home.launcher.common.Utilities".hookAfterMethod(
"adaptTitleStyleToWallpaper", Context::class.java, TextView::class.java, Int::class.javaPrimitiveType, Int::class.javaPrimitiveType
) {
val mTitle = it.args[1] as TextView
if (mTitle.id == mTitle.resources.getIdentifier("icon_title", "id", "com.miui.home")) {
mTitleScrolling(mTitle)
}
}
} catch (e: Throwable) {
Log.ex(e)
}
}
private fun mTitleScrolling(mTitle: TextView) {
mTitle.ellipsize = TextUtils.TruncateAt.MARQUEE
mTitle.isHorizontalFadingEdgeEnabled = true
mTitle.setSingleLine()
mTitle.marqueeRepeatLimit = -1
mTitle.isSelected = true
mTitle.setHorizontallyScrolling(true)
}
}

View File

@@ -0,0 +1,89 @@
package com.lt2333.simplicitytools.hooks.rules.all.miuihome
import android.app.AndroidAppHelper
import android.content.ComponentName
import android.content.Intent
import android.content.res.Configuration
import android.os.Bundle
import android.view.View
import com.github.kyuubiran.ezxhelper.init.InitFields.moduleRes
import com.github.kyuubiran.ezxhelper.utils.args
import com.github.kyuubiran.ezxhelper.utils.findAllMethods
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.getStaticObject
import com.github.kyuubiran.ezxhelper.utils.hookAfter
import com.github.kyuubiran.ezxhelper.utils.hookBefore
import com.github.kyuubiran.ezxhelper.utils.invokeMethod
import com.github.kyuubiran.ezxhelper.utils.invokeStaticMethod
import com.github.kyuubiran.ezxhelper.utils.loadClass
import com.github.kyuubiran.ezxhelper.utils.putStaticObject
import com.lt2333.simplicitytools.R
import com.lt2333.simplicitytools.utils.*
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
import de.robv.android.xposed.XposedHelpers
object ShortcutAddSmallWindowForAll : HookRegister() {
override fun init() = hasEnable("miuihome_shortcut_add_small_window") {
val mViewDarkModeHelper = ("com.miui.home.launcher.util.ViewDarkModeHelper").findClass()
val mSystemShortcutMenu = ("com.miui.home.launcher.shortcuts.SystemShortcutMenu").findClass()
val mSystemShortcutMenuItem = ("com.miui.home.launcher.shortcuts.SystemShortcutMenuItem").findClass()
val mAppShortcutMenu = ("com.miui.home.launcher.shortcuts.AppShortcutMenu").findClass()
val mShortcutMenuItem = ("com.miui.home.launcher.shortcuts.ShortcutMenuItem").findClass()
val mAppDetailsShortcutMenuItem = ("com.miui.home.launcher.shortcuts.SystemShortcutMenuItem\$AppDetailsShortcutMenuItem").findClass()
val mActivityUtilsCompat = ("com.miui.launcher.utils.ActivityUtilsCompat").findClass()
mViewDarkModeHelper.hookAfterAllMethods("onConfigurationChanged") {
mSystemShortcutMenuItem.callStaticMethod("createAllSystemShortcutMenuItems")
}
mShortcutMenuItem.hookAfterAllMethods("getShortTitle") {
if (it.result == "应用信息") {
it.result = "信息"
}
}
mAppDetailsShortcutMenuItem.hookBeforeMethod("lambda\$getOnClickListener$0", mAppDetailsShortcutMenuItem, View::class.java) {
val obj = it.args[0]
val view: View = it.args[1] as View
val mShortTitle = obj.callMethod("getShortTitle") as CharSequence
if (mShortTitle == moduleRes.getString(R.string.miuihome_shortcut_add_small_window_title)) {
it.result = null
val intent = Intent()
val mComponentName = obj.callMethod("getComponentName") as ComponentName
intent.action = "android.intent.action.MAIN"
intent.addCategory("android.intent.category.LAUNCHER")
intent.component = mComponentName
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
val callStaticMethod = mActivityUtilsCompat.callStaticMethod("makeFreeformActivityOptions", view.context, mComponentName.packageName)
if (callStaticMethod != null) {
view.context.startActivity(intent, callStaticMethod.callMethod("toBundle") as Bundle)
}
}
}
mSystemShortcutMenu.hookAfterAllMethods("getMaxShortcutItemCount") {
it.result = 5
}
mAppShortcutMenu.hookAfterAllMethods("getMaxShortcutItemCount") {
it.result = 5
}
mSystemShortcutMenuItem.hookAfterAllMethods("createAllSystemShortcutMenuItems") {
val isDarkMode =
AndroidAppHelper.currentApplication().applicationContext.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK == Configuration.UI_MODE_NIGHT_YES
val mAllSystemShortcutMenuItems = mSystemShortcutMenuItem.getStaticObjectField("sAllSystemShortcutMenuItems") as Collection<Any>
val mSmallWindowInstance = XposedHelpers.newInstance(mAppDetailsShortcutMenuItem)
mSmallWindowInstance.callMethod("setShortTitle", moduleRes.getString(R.string.miuihome_shortcut_add_small_window_title))
mSmallWindowInstance.callMethod(
"setIconDrawable",
if (isDarkMode) moduleRes.getDrawable(R.drawable.ic_small_window_dark) else moduleRes.getDrawable(R.drawable.ic_small_window_light)
)
val sAllSystemShortcutMenuItems = ArrayList<Any>()
sAllSystemShortcutMenuItems.add(mSmallWindowInstance)
sAllSystemShortcutMenuItems.addAll(mAllSystemShortcutMenuItems)
mSystemShortcutMenuItem.setStaticObjectField("sAllSystemShortcutMenuItems", sAllSystemShortcutMenuItems)
}
}
}

View File

@@ -1,11 +1,11 @@
package com.lt2333.simplicitytools.hooks.rules.s.powerkeeper
package com.lt2333.simplicitytools.hooks.rules.all.powerkeeper
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.hookBefore
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object LockMaxFpsForS : HookRegister() {
object LockMaxFpsForAll: HookRegister() {
override fun init() {
findMethod("com.miui.powerkeeper.statemachine.DisplayFrameSetting") {

View File

@@ -1,4 +1,4 @@
package com.lt2333.simplicitytools.hooks.rules.s.reardisplay
package com.lt2333.simplicitytools.hooks.rules.all.reardisplay
import android.graphics.Typeface
import android.util.TypedValue
@@ -15,7 +15,7 @@ import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
import com.lt2333.simplicitytools.views.WeatherView
object RearDisplayWeatherForS : HookRegister() {
object RearDisplayWeatherForAll : HookRegister() {
override fun init() = hasEnable("rear_show_weather") {
findMethod("com.xiaomi.misubscreenui.light.aod.view.VerticalClockView") {

View File

@@ -1,4 +1,4 @@
package com.lt2333.simplicitytools.hooks.rules.s.securitycenter
package com.lt2333.simplicitytools.hooks.rules.all.securitycenter
import android.view.View
import com.github.kyuubiran.ezxhelper.utils.findMethod
@@ -6,7 +6,7 @@ import com.github.kyuubiran.ezxhelper.utils.hookBefore
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object LockOneHundredForS : HookRegister() {
object LockOneHundredForAll : HookRegister() {
override fun init() {
//防止点击重新检测

View File

@@ -0,0 +1,34 @@
package com.lt2333.simplicitytools.hooks.rules.all.securitycenter
import com.github.kyuubiran.ezxhelper.utils.*
import com.lt2333.simplicitytools.utils.XSPUtils
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
import de.robv.android.xposed.XC_MethodHook
import de.robv.android.xposed.XposedBridge
import de.robv.android.xposed.XposedHelpers
object RemoveMacroBlacklistForAll : HookRegister() {
override fun init() {
if (XSPUtils.getBoolean("remove_macro_blacklist", false)) {
var letter = 'a'
for (i in 0..25) {
val classIfExists = XposedHelpers.findClassIfExists(
"com.miui.gamebooster.utils.$letter" + "0", getDefaultClassLoader()
) ?: continue
if (classIfExists.declaredMethods.size in 10..15 && classIfExists.fields.isEmpty() && classIfExists.declaredFields.size >= 2) {
XposedBridge.log("Woobox: RemoveMacroBlacklist in ${classIfExists.name}")
findMethod(classIfExists){
name=="c" && returnType==Boolean::class.java && isStatic &&parameterCount==1
}.hookBefore {
XposedBridge.log("Woobox: c")
it.result = false
}
return
}
letter++
}
}
}
}

View File

@@ -1,4 +1,4 @@
package com.lt2333.simplicitytools.hooks.rules.s.securitycenter
package com.lt2333.simplicitytools.hooks.rules.all.securitycenter
import android.widget.TextView
import com.github.kyuubiran.ezxhelper.utils.findMethod
@@ -6,7 +6,7 @@ import com.github.kyuubiran.ezxhelper.utils.hookAfter
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object RemoveOpenAppConfirmationPopupForS : HookRegister() {
object RemoveOpenAppConfirmationPopupForAll : HookRegister() {
override fun init() {
findMethod("android.widget.TextView") {

View File

@@ -1,11 +1,11 @@
package com.lt2333.simplicitytools.hooks.rules.s.securitycenter
package com.lt2333.simplicitytools.hooks.rules.all.securitycenter
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.hookBefore
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object SkipWaitingTimeForS : HookRegister() {
object SkipWaitingTimeForAll : HookRegister() {
override fun init() {
findMethod("android.widget.TextView") {

View File

@@ -1,4 +1,4 @@
package com.lt2333.simplicitytools.hooks.rules.s.settings
package com.lt2333.simplicitytools.hooks.rules.all.settings
import android.app.NotificationChannel
import com.github.kyuubiran.ezxhelper.utils.*
@@ -6,7 +6,7 @@ import com.lt2333.simplicitytools.utils.XSPUtils
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
import de.robv.android.xposed.XposedHelpers
object ShowNotificationImportanceForS : HookRegister() {
object ShowNotificationImportanceForAll : HookRegister() {
override fun init() {
findMethod("com.android.settings.notification.ChannelNotificationSettings") {

View File

@@ -1,11 +1,11 @@
package com.lt2333.simplicitytools.hooks.rules.s.thememanager
package com.lt2333.simplicitytools.hooks.rules.all.thememanager
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.hookBefore
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object RemoveAdsForS : HookRegister() {
object RemoveAdsForAll : HookRegister() {
override fun init() {
findMethod("com.android.thememanager.basemodule.ad.model.AdInfoResponse") {

View File

@@ -1,19 +0,0 @@
package com.lt2333.simplicitytools.hooks.rules.s.android
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.hookBefore
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object DisableFlagSecureForS : HookRegister() {
override fun init() {
findMethod("com.android.server.wm.WindowState") {
name == "isSecureLocked"
}.hookBefore {
hasEnable("disable_flag_secure") {
it.result = false
}
}
}
}

View File

@@ -1,20 +0,0 @@
package com.lt2333.simplicitytools.hooks.rules.s.miuihome
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.hookBefore
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object AlwaysDisplayTimeForS : HookRegister() {
override fun init() {
findMethod("com.miui.home.launcher.Workspace") {
name == "isScreenHasClockGadget" && parameterCount == 1
}.hookBefore {
hasEnable("home_time") {
it.result = false
}
}
}
}

View File

@@ -1,31 +0,0 @@
package com.lt2333.simplicitytools.hooks.rules.s.securitycenter
import com.lt2333.simplicitytools.utils.XSPUtils
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
import de.robv.android.xposed.XC_MethodHook
import de.robv.android.xposed.XposedHelpers
object RemoveMacroBlacklistForS : HookRegister() {
override fun init() {
if (XSPUtils.getBoolean("remove_macro_blacklist", false)) {
var letter = 'a'
for (i in 0..25) {
val classIfExists = XposedHelpers.findClassIfExists(
"com.miui.gamebooster.v.$letter" + "0", getDefaultClassLoader()
) ?: continue
if (classIfExists.declaredMethods.size in 6..12 && classIfExists.fields.isEmpty() && classIfExists.declaredFields.size >= 2) {
XposedHelpers.findAndHookMethod(classIfExists, "c", String::class.java,
object : XC_MethodHook() {
override fun beforeHookedMethod(param: MethodHookParam?) {
param?.result = false
}
})
return
}
letter++
}
}
}
}

View File

@@ -27,7 +27,6 @@ object NewNotificationWeatherForS : HookRegister() {
val time = it.args[0]?.toString()
val view = it.thisObject as TextView
if (view.id == clockId && time != null && this::weather.isInitialized) {
// TODO("调高天气位置")
// val layout = view.layoutParams as ViewGroup.MarginLayoutParams
// val y = view.height / 2
// layout.topMargin = -y

View File

@@ -1,21 +0,0 @@
package com.lt2333.simplicitytools.hooks.rules.s.systemui
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.hookBefore
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object NoPasswordHookForS : HookRegister() {
override fun init() {
hasEnable("no_need_to_enter_password_when_power_on") {
findMethod("com.android.internal.widget.LockPatternUtils\$StrongAuthTracker") { name == "isBiometricAllowedForUser" }.hookBefore {
it.result = true
}
findMethod("com.android.internal.widget.LockPatternUtils") { name == "isBiometricAllowedForUser" }.hookBefore {
it.result = true
}
}
}
}

View File

@@ -1,5 +1,6 @@
package com.lt2333.simplicitytools.hooks.rules.s.systemui
import android.app.KeyguardManager
import android.content.Context
import android.content.res.Configuration
@@ -16,10 +17,11 @@ import com.lt2333.simplicitytools.utils.XSPUtils
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object StatusBarLayoutForS : HookRegister() {
private val getMode = XSPUtils.getInt("status_bar_layout_mode", 0)
private val getHoleLocation = XSPUtils.getInt("screen_hole_location", 0)
private val isCompatibilityMode = XSPUtils.getBoolean("layout_compatibility_mode", false)
private var statusBarLeft = 0
private var statusBarTop = 0
@@ -32,23 +34,31 @@ object StatusBarLayoutForS : HookRegister() {
var mCenterLayout: LinearLayout?
var statusBar: ViewGroup? = null
fun updateLayout(context: Context) {
//判断屏幕方向
val mConfiguration: Configuration = context.resources.configuration
if (mConfiguration.orientation == Configuration.ORIENTATION_PORTRAIT) {
mLeftLayout!!.setPadding(statusBarLeft, 0, 0, 0)
mRightLayout!!.setPadding(0, 0, statusBarRight, 0)
statusBar!!.setPadding(0, statusBarTop, 0, statusBarBottom)
} else {
//横屏状态
mLeftLayout!!.setPadding(175, 0, 0, 0)
mRightLayout!!.setPadding(0, 0, 175, 0)
statusBar!!.setPadding(0, statusBarTop, 0, statusBarBottom)
//判断屏幕状态更新布局 mode: 1正常布局 2居中布局
fun updateLayout(context: Context,mode: Int) {
when(mode){
1->{
val mConfiguration: Configuration = context.resources.configuration
if (mConfiguration.orientation == Configuration.ORIENTATION_PORTRAIT) { //横屏
statusBar!!.setPadding(statusBarLeft, statusBarTop, statusBarRight, statusBarBottom)
}
}
2->{
val mConfiguration: Configuration = context.resources.configuration
if (mConfiguration.orientation == Configuration.ORIENTATION_PORTRAIT) { //横屏
mLeftLayout!!.setPadding(statusBarLeft, 0, 0, 0)
mRightLayout!!.setPadding(0, 0, statusBarRight, 0)
statusBar!!.setPadding(0, statusBarTop, 0, statusBarBottom)
}else{ //竖屏
mLeftLayout!!.setPadding(0, 0, 0, 0)
mRightLayout!!.setPadding(0, 0, 0, 0)
}
}
}
}
//判断是否开启居中挖孔兼容模式
if (getHoleLocation == 1) {
//判断是否开启挖孔兼容模式
if (isCompatibilityMode) {
findMethod("com.android.systemui.ScreenDecorations\$DisplayCutoutView") {
name == "boundsFromDirection" && parameterCount == 3 && isStatic
}.hookBefore {
@@ -56,48 +66,83 @@ object StatusBarLayoutForS : HookRegister() {
}
}
//修改对应布局
when (getMode) {
//默认
0 -> return
0 -> {
findMethod("com.android.systemui.statusbar.phone.CollapsedStatusBarFragment") {
name == "onViewCreated" && parameterCount == 2
}.hookAfter { param ->
val miuiPhoneStatusBarView = param.thisObject.getObjectAs<ViewGroup>("mStatusBar")
val context: Context = miuiPhoneStatusBarView.context
val res: Resources = miuiPhoneStatusBarView.resources
val statusBarId: Int = res.getIdentifier("status_bar", "id", "com.android.systemui")
statusBar = miuiPhoneStatusBarView.findViewById(statusBarId)
if (statusBar == null) return@hookAfter
statusBarLeft = statusBar!!.paddingLeft
statusBarTop = statusBar!!.paddingTop
statusBarRight = statusBar!!.paddingRight
statusBarBottom = statusBar!!.paddingBottom
if (isCompatibilityMode) {
val customLeftMargin = XSPUtils.getInt("status_bar_left_margin", 0)
if (customLeftMargin != 0) {
statusBarLeft = customLeftMargin
}
val customRightMargin = XSPUtils.getInt("status_bar_right_margin", 0)
if (customRightMargin != 0) {
statusBarRight = customRightMargin
}
updateLayout(context,1)
}
}
//兼容模式
findMethod("com.android.systemui.statusbar.phone.PhoneStatusBarView") {
name == "updateLayoutForCutout"
}.hookAfter {
if (isCompatibilityMode) {
val context = (it.thisObject as ViewGroup).context
updateLayout(context,1)
}
}
}
//时钟居中
1 -> {
findMethod("com.android.systemui.statusbar.phone.CollapsedStatusBarFragment") {
name == "onViewCreated" && parameterCount == 2
}.hookAfter { param ->
val miuiPhoneStatusBarView =
param.thisObject.getObjectAs<ViewGroup>("mStatusBar")
val miuiPhoneStatusBarView = param.thisObject.getObjectAs<ViewGroup>("mStatusBar")
val context: Context = miuiPhoneStatusBarView.context
val res: Resources = miuiPhoneStatusBarView.resources
val statusBarId: Int =
res.getIdentifier("status_bar", "id", "com.android.systemui")
val statusBarContentsId: Int =
res.getIdentifier("status_bar_contents", "id", "com.android.systemui")
val systemIconAreaId: Int =
res.getIdentifier("system_icon_area", "id", "com.android.systemui")
val statusBarId: Int = res.getIdentifier("status_bar", "id", "com.android.systemui")
val statusBarContentsId: Int = res.getIdentifier(
"status_bar_contents", "id", "com.android.systemui"
)
val systemIconAreaId: Int = res.getIdentifier("system_icon_area", "id", "com.android.systemui")
val clockId: Int = res.getIdentifier("clock", "id", "com.android.systemui")
val phoneStatusBarLeftContainerId: Int =
res.getIdentifier(
"phone_status_bar_left_container",
"id",
"com.android.systemui"
)
val notificationIconAreaInnerId: Int =
res.getIdentifier(
"notification_icon_area_inner",
"id",
"com.android.systemui"
)
val phoneStatusBarLeftContainerId: Int = res.getIdentifier(
"phone_status_bar_left_container", "id", "com.android.systemui"
)
val notificationIconAreaInnerId: Int = res.getIdentifier(
"notification_icon_area_inner", "id", "com.android.systemui"
)
statusBar = miuiPhoneStatusBarView.findViewById(statusBarId)
val statusBarContents: ViewGroup =
miuiPhoneStatusBarView.findViewById(statusBarContentsId)
val statusBarContents: ViewGroup = miuiPhoneStatusBarView.findViewById(statusBarContentsId)
if (statusBar == null) return@hookAfter
val clock: TextView = miuiPhoneStatusBarView.findViewById(clockId)
val phoneStatusBarLeftContainer: ViewGroup =
miuiPhoneStatusBarView.findViewById(phoneStatusBarLeftContainerId)
val notificationIconAreaInner: ViewGroup =
miuiPhoneStatusBarView.findViewById(notificationIconAreaInnerId)
val systemIconArea: ViewGroup =
miuiPhoneStatusBarView.findViewById(systemIconAreaId)
val phoneStatusBarLeftContainer: ViewGroup = miuiPhoneStatusBarView.findViewById(
phoneStatusBarLeftContainerId
)
val notificationIconAreaInner: ViewGroup = miuiPhoneStatusBarView.findViewById(
notificationIconAreaInnerId
)
val systemIconArea: ViewGroup = miuiPhoneStatusBarView.findViewById(systemIconAreaId)
(clock.parent as ViewGroup).removeView(clock)
(phoneStatusBarLeftContainer.parent as ViewGroup).removeView(
@@ -108,41 +153,39 @@ object StatusBarLayoutForS : HookRegister() {
)
(systemIconArea.parent as ViewGroup).removeView(systemIconArea)
val mConstraintLayout =
ConstraintLayout(context).also {
it.layoutParams = ConstraintLayout.LayoutParams(
ConstraintLayout.LayoutParams.MATCH_PARENT,
ConstraintLayout.LayoutParams.MATCH_PARENT
)
}
val mConstraintLayout = ConstraintLayout(context).also {
it.layoutParams = ConstraintLayout.LayoutParams(
ConstraintLayout.LayoutParams.MATCH_PARENT, ConstraintLayout.LayoutParams.MATCH_PARENT
)
}
mConstraintLayout.addView(notificationIconAreaInner)
val fullscreenNotificationIconAreaLp = LinearLayout.LayoutParams(
ConstraintLayout.LayoutParams.MATCH_PARENT,
ConstraintLayout.LayoutParams.MATCH_PARENT
ConstraintLayout.LayoutParams.MATCH_PARENT, ConstraintLayout.LayoutParams.MATCH_PARENT
)
notificationIconAreaInner.layoutParams = fullscreenNotificationIconAreaLp
//增加一个左对齐布局
mLeftLayout = LinearLayout(context)
val leftLp: LinearLayout.LayoutParams =
LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f)
val leftLp: LinearLayout.LayoutParams = LinearLayout.LayoutParams(
0, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f
)
mLeftLayout!!.layoutParams = leftLp
mLeftLayout!!.gravity = Gravity.START or Gravity.CENTER_VERTICAL
//增加一个居中布局
mCenterLayout = LinearLayout(context)
val centerLp: LinearLayout.LayoutParams = LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.MATCH_PARENT
LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT
)
mCenterLayout!!.layoutParams = centerLp
mCenterLayout!!.gravity = Gravity.CENTER or Gravity.CENTER_VERTICAL
mRightLayout = LinearLayout(context)
val rightLp: LinearLayout.LayoutParams =
LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f)
val rightLp: LinearLayout.LayoutParams = LinearLayout.LayoutParams(
0, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f
)
mRightLayout!!.layoutParams = rightLp
mRightLayout!!.gravity = Gravity.END or Gravity.CENTER_VERTICAL
mLeftLayout!!.addView(phoneStatusBarLeftContainer)
@@ -160,7 +203,7 @@ object StatusBarLayoutForS : HookRegister() {
statusBarBottom = statusBar!!.paddingBottom
if (getHoleLocation == 2) {
if (isCompatibilityMode) {
val customLeftMargin = XSPUtils.getInt("status_bar_left_margin", 0)
if (customLeftMargin != 0) {
statusBarLeft = customLeftMargin
@@ -170,7 +213,7 @@ object StatusBarLayoutForS : HookRegister() {
if (customRightMargin != 0) {
statusBarRight = customRightMargin
}
updateLayout(context)
updateLayout(context,2)
}
}
@@ -179,7 +222,7 @@ object StatusBarLayoutForS : HookRegister() {
}.hookAfter {
hasEnable("layout_compatibility_mode") {
val context = (it.thisObject as ViewGroup).context
updateLayout(context)
updateLayout(context,2)
}
}
}
@@ -188,14 +231,12 @@ object StatusBarLayoutForS : HookRegister() {
findMethod("com.android.systemui.statusbar.phone.CollapsedStatusBarFragment") {
name == "onViewCreated" && parameterCount == 2
}.hookAfter { param ->
val miuiPhoneStatusBarView =
param.thisObject.getObjectAs<ViewGroup>("mStatusBar")
val miuiPhoneStatusBarView = param.thisObject.getObjectAs<ViewGroup>("mStatusBar")
val context: Context = miuiPhoneStatusBarView.context
val res: Resources = miuiPhoneStatusBarView.resources
//组件ID
val statusBarId: Int =
res.getIdentifier("status_bar", "id", "com.android.systemui")
val statusBarId: Int = res.getIdentifier("status_bar", "id", "com.android.systemui")
val clockId: Int = res.getIdentifier("clock", "id", "com.android.systemui")
val batteryId: Int = res.getIdentifier("battery", "id", "com.android.systemui")
@@ -207,8 +248,7 @@ object StatusBarLayoutForS : HookRegister() {
//新建布局
val rightLp = LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.MATCH_PARENT
LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT
).also {
it.marginStart = dp2px(context, 5f)
}
@@ -220,6 +260,36 @@ object StatusBarLayoutForS : HookRegister() {
battery.addView(mRightLayout)
(clock.parent as ViewGroup).removeView(clock)
mRightLayout!!.addView(clock)
statusBarLeft = statusBar!!.paddingLeft
statusBarTop = statusBar!!.paddingTop
statusBarRight = statusBar!!.paddingRight
statusBarBottom = statusBar!!.paddingBottom
if (isCompatibilityMode) {
val customLeftMargin = XSPUtils.getInt("status_bar_left_margin", 0)
if (customLeftMargin != 0) {
statusBarLeft = customLeftMargin
}
val customRightMargin = XSPUtils.getInt("status_bar_right_margin", 0)
if (customRightMargin != 0) {
statusBarRight = customRightMargin
}
updateLayout(context,1)
}
}
//兼容模式
findMethod("com.android.systemui.statusbar.phone.PhoneStatusBarView") {
name == "updateLayoutForCutout"
}.hookAfter {
if (isCompatibilityMode) {
val context = (it.thisObject as ViewGroup).context
updateLayout(context,1)
}
}
}
//时钟居中+图标居左
@@ -227,65 +297,45 @@ object StatusBarLayoutForS : HookRegister() {
findMethod("com.android.systemui.statusbar.phone.CollapsedStatusBarFragment") {
name == "onViewCreated" && parameterCount == 2
}.hookAfter { param ->
val miuiPhoneStatusBarView =
param.thisObject.getObjectAs<ViewGroup>("mStatusBar")
val miuiPhoneStatusBarView = param.thisObject.getObjectAs<ViewGroup>("mStatusBar")
val context: Context = miuiPhoneStatusBarView.context
val res: Resources = miuiPhoneStatusBarView.resources
val statusBarId: Int =
res.getIdentifier("status_bar", "id", "com.android.systemui")
val statusBarContentsId: Int =
res.getIdentifier("status_bar_contents", "id", "com.android.systemui")
val systemIconAreaId: Int =
res.getIdentifier("system_icon_area", "id", "com.android.systemui")
val statusBarId: Int = res.getIdentifier("status_bar", "id", "com.android.systemui")
val statusBarContentsId: Int = res.getIdentifier(
"status_bar_contents", "id", "com.android.systemui"
)
val systemIconAreaId: Int = res.getIdentifier("system_icon_area", "id", "com.android.systemui")
val clockId: Int = res.getIdentifier("clock", "id", "com.android.systemui")
val phoneStatusBarLeftContainerId: Int =
res.getIdentifier(
"phone_status_bar_left_container",
"id",
"com.android.systemui"
)
val fullscreenNotificationIconAreaId: Int =
res.getIdentifier(
"fullscreen_notification_icon_area",
"id",
"com.android.systemui"
)
val statusIconsId: Int =
res.getIdentifier(
"statusIcons",
"id",
"com.android.systemui"
)
val systemIconsId: Int =
res.getIdentifier(
"system_icons",
"id",
"com.android.systemui"
)
val batteryId: Int =
res.getIdentifier(
"battery",
"id",
"com.android.systemui"
)
val phoneStatusBarLeftContainerId: Int = res.getIdentifier(
"phone_status_bar_left_container", "id", "com.android.systemui"
)
val fullscreenNotificationIconAreaId: Int = res.getIdentifier(
"fullscreen_notification_icon_area", "id", "com.android.systemui"
)
val statusIconsId: Int = res.getIdentifier(
"statusIcons", "id", "com.android.systemui"
)
val systemIconsId: Int = res.getIdentifier(
"system_icons", "id", "com.android.systemui"
)
val batteryId: Int = res.getIdentifier(
"battery", "id", "com.android.systemui"
)
statusBar = miuiPhoneStatusBarView.findViewById(statusBarId)
val statusBarContents: ViewGroup =
miuiPhoneStatusBarView.findViewById(statusBarContentsId)
val statusBarContents: ViewGroup = miuiPhoneStatusBarView.findViewById(statusBarContentsId)
if (statusBar == null) return@hookAfter
val clock: TextView = miuiPhoneStatusBarView.findViewById(clockId)
val phoneStatusBarLeftContainer: ViewGroup =
miuiPhoneStatusBarView.findViewById(phoneStatusBarLeftContainerId)
val fullscreenNotificationIconArea: ViewGroup =
miuiPhoneStatusBarView.findViewById(fullscreenNotificationIconAreaId)
val systemIconArea: ViewGroup =
miuiPhoneStatusBarView.findViewById(systemIconAreaId)
val statusIcons: ViewGroup =
miuiPhoneStatusBarView.findViewById(statusIconsId)
val systemIcons: ViewGroup =
miuiPhoneStatusBarView.findViewById(systemIconsId)
val battery: ViewGroup =
miuiPhoneStatusBarView.findViewById(batteryId)
val phoneStatusBarLeftContainer: ViewGroup = miuiPhoneStatusBarView.findViewById(
phoneStatusBarLeftContainerId
)
val fullscreenNotificationIconArea: ViewGroup = miuiPhoneStatusBarView.findViewById(
fullscreenNotificationIconAreaId
)
val systemIconArea: ViewGroup = miuiPhoneStatusBarView.findViewById(systemIconAreaId)
val statusIcons: ViewGroup = miuiPhoneStatusBarView.findViewById(statusIconsId)
val systemIcons: ViewGroup = miuiPhoneStatusBarView.findViewById(systemIconsId)
val battery: ViewGroup = miuiPhoneStatusBarView.findViewById(batteryId)
(clock.parent as ViewGroup).removeView(clock)
(phoneStatusBarLeftContainer.parent as ViewGroup).removeView(
@@ -299,29 +349,25 @@ object StatusBarLayoutForS : HookRegister() {
fullscreenNotificationIconArea
)
val mConstraintLayout =
ConstraintLayout(context).also {
it.layoutParams = ConstraintLayout.LayoutParams(
ConstraintLayout.LayoutParams.MATCH_PARENT,
ConstraintLayout.LayoutParams.MATCH_PARENT
)
}
val mConstraintLayout = ConstraintLayout(context).also {
it.layoutParams = ConstraintLayout.LayoutParams(
ConstraintLayout.LayoutParams.MATCH_PARENT, ConstraintLayout.LayoutParams.MATCH_PARENT
)
}
mConstraintLayout.addView(fullscreenNotificationIconArea)
mConstraintLayout.addView(battery)
battery.layoutParams = ConstraintLayout.LayoutParams(
ConstraintLayout.LayoutParams.WRAP_CONTENT,
ConstraintLayout.LayoutParams.MATCH_PARENT
ConstraintLayout.LayoutParams.WRAP_CONTENT, ConstraintLayout.LayoutParams.MATCH_PARENT
).also {
it.endToEnd = 0
}
fullscreenNotificationIconArea.layoutParams = ConstraintLayout.LayoutParams(
0,
ConstraintLayout.LayoutParams.MATCH_PARENT
0, ConstraintLayout.LayoutParams.MATCH_PARENT
).also {
it.startToEnd = batteryId
it.endToEnd = 0
@@ -331,24 +377,25 @@ object StatusBarLayoutForS : HookRegister() {
//增加一个左对齐布局
mLeftLayout = LinearLayout(context)
val leftLp: LinearLayout.LayoutParams =
LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f)
val leftLp: LinearLayout.LayoutParams = LinearLayout.LayoutParams(
0, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f
)
mLeftLayout!!.layoutParams = leftLp
mLeftLayout!!.gravity = Gravity.START or Gravity.CENTER_VERTICAL
//增加一个居中布局
mCenterLayout = LinearLayout(context)
val centerLp: LinearLayout.LayoutParams = LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.MATCH_PARENT
LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT
)
mCenterLayout!!.layoutParams = centerLp
mCenterLayout!!.gravity = Gravity.CENTER or Gravity.CENTER_VERTICAL
//增加一个右布局
mRightLayout = LinearLayout(context)
val rightLp: LinearLayout.LayoutParams =
LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f)
val rightLp: LinearLayout.LayoutParams = LinearLayout.LayoutParams(
0, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f
)
mRightLayout!!.layoutParams = rightLp
mRightLayout!!.gravity = Gravity.END or Gravity.CENTER_VERTICAL
@@ -375,7 +422,7 @@ object StatusBarLayoutForS : HookRegister() {
statusBarBottom = statusBar!!.paddingBottom
if (getHoleLocation == 2) {
if (isCompatibilityMode) {
val customLeftMargin = XSPUtils.getInt("status_bar_left_margin", 0)
if (customLeftMargin != 0) {
statusBarLeft = customLeftMargin
@@ -385,16 +432,16 @@ object StatusBarLayoutForS : HookRegister() {
if (customRightMargin != 0) {
statusBarRight = customRightMargin
}
updateLayout(context)
updateLayout(context,2)
}
}
//兼容模式
findMethod("com.android.systemui.statusbar.phone.PhoneStatusBarView") {
name == "updateLayoutForCutout"
}.hookAfter {
if (getHoleLocation == 2) {
if (isCompatibilityMode) {
val context = (it.thisObject as ViewGroup).context
updateLayout(context)
updateLayout(context,2)
}
}
@@ -404,12 +451,10 @@ object StatusBarLayoutForS : HookRegister() {
}.hookAfter {
val miuiPhoneStatusBarView = it.thisObject.getObjectAs<ViewGroup>("mStatusBar")
val res = miuiPhoneStatusBarView.resources
val statusBarId =
res.getIdentifier("status_bar", "id", "com.android.systemui")
val statusBarId = res.getIdentifier("status_bar", "id", "com.android.systemui")
val statusBar1 = miuiPhoneStatusBarView.findViewById<ViewGroup>(statusBarId)
//非锁屏下整个状态栏布局
val keyguardMgr =
statusBar1.context.getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager
val keyguardMgr = statusBar1.context.getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager
if (keyguardMgr.isKeyguardLocked) {
statusBar1!!.visibility = View.GONE
} else {

View File

@@ -2,12 +2,10 @@ package com.lt2333.simplicitytools.hooks.rules.s.systemui
import android.annotation.SuppressLint
import android.content.Context
import android.content.res.Resources
import android.os.Handler
import android.provider.Settings
import android.util.TypedValue
import android.view.Gravity
import android.view.ViewGroup
import android.widget.TextView
import com.github.kyuubiran.ezxhelper.utils.*
import com.lt2333.simplicitytools.utils.XSPUtils
@@ -16,6 +14,7 @@ import java.lang.reflect.Method
import java.text.SimpleDateFormat
import java.util.*
object StatusBarTimeCustomizationForS : HookRegister() {
private val getMode = XSPUtils.getInt("custom_clock_mode", 0)
@@ -30,14 +29,12 @@ object StatusBarTimeCustomizationForS : HookRegister() {
private val isSecond = XSPUtils.getBoolean("status_bar_time_seconds", false)
private val isDoubleHour = XSPUtils.getBoolean("status_bar_time_double_hour", false)
private val isPeriod = XSPUtils.getBoolean("status_bar_time_period", true)
private val isCenterAlign =
XSPUtils.getBoolean("status_bar_time_double_line_center_align", false)
private val isCenterAlign = XSPUtils.getBoolean("status_bar_time_double_line_center_align", false)
//极客模式
private val getGeekClockSize = XSPUtils.getInt("status_bar_clock_size_geek", 0)
private val getGeekFormat = XSPUtils.getString("custom_clock_format_geek", "HH:mm:ss")
private val isGeekCenterAlign =
XSPUtils.getBoolean("status_bar_time_center_align_geek", false)
private val isGeekCenterAlign = XSPUtils.getBoolean("status_bar_time_center_align_geek", false)
private lateinit var nowTime: Date
private var str = ""
@@ -83,9 +80,7 @@ object StatusBarTimeCustomizationForS : HookRegister() {
}
}
Timer().scheduleAtFixedRate(
T(),
1000 - System.currentTimeMillis() % 1000,
1000
T(), 1000 - System.currentTimeMillis() % 1000, 1000
)
} catch (_: Exception) {
}
@@ -98,8 +93,7 @@ object StatusBarTimeCustomizationForS : HookRegister() {
val textV = it.thisObject as TextView
if (textV.resources.getResourceEntryName(textV.id) == "clock") {
val t = Settings.System.getString(
c!!.contentResolver,
Settings.System.TIME_12_24
c!!.contentResolver, Settings.System.TIME_12_24
)
val is24 = t == "24"
nowTime = Calendar.getInstance().time
@@ -110,15 +104,18 @@ object StatusBarTimeCustomizationForS : HookRegister() {
}
if (isCenterAlign) {
findMethod("com.android.systemui.statusbar.phone.CollapsedStatusBarFragment") {
name == "onViewCreated" && parameterCount == 2
findConstructor("com.android.systemui.statusbar.views.MiuiClock") {
paramCount == 3
}.hookAfter {
val miuiPhoneStatusBarView =
it.thisObject.getObject("mStatusBar") as ViewGroup
val res: Resources = miuiPhoneStatusBarView.resources
val clockId: Int = res.getIdentifier("clock", "id", "com.android.systemui")
val clock: TextView = miuiPhoneStatusBarView.findViewById(clockId)
clock.gravity = Gravity.CENTER
try {
val textV = it.thisObject as TextView
if (textV.resources.getResourceEntryName(textV.id) == "clock") {
c = it.args[0] as Context
val textV = it.thisObject as TextView
textV.gravity = Gravity.CENTER
}
} catch (_: Exception) {
}
}
}
}
@@ -152,9 +149,7 @@ object StatusBarTimeCustomizationForS : HookRegister() {
}
}
Timer().scheduleAtFixedRate(
T(),
1000 - System.currentTimeMillis() % 1000,
1000
T(), 1000 - System.currentTimeMillis() % 1000, 1000
)
} catch (_: Exception) {
}
@@ -162,27 +157,38 @@ object StatusBarTimeCustomizationForS : HookRegister() {
findMethod("com.android.systemui.statusbar.views.MiuiClock") {
name == "updateTime"
}.hookAfter {
}.hookBefore {
try {
val textV = it.thisObject as TextView
if (textV.resources.getResourceEntryName(textV.id) == "clock") {
nowTime = Calendar.getInstance().time
textV.text = SimpleDateFormat(getGeekFormat).format(nowTime)
val mMiuiStatusBarClockController = textV.getObject("mMiuiStatusBarClockController")
val mCalendar = mMiuiStatusBarClockController.invokeMethodAuto("getCalendar")
mCalendar?.invokeMethodAuto(
"setTimeInMillis", System.currentTimeMillis()
)
val textSb = StringBuilder()
val formatSb = StringBuilder(getGeekFormat.toString())
mCalendar?.invokeMethodAuto("format", c, textSb, formatSb)
textV.text = textSb.toString()
it.result = null
}
} catch (_: Exception) {
}
}
if (isGeekCenterAlign) {
findMethod("com.android.systemui.statusbar.phone.CollapsedStatusBarFragment") {
name == "onViewCreated" && parameterCount == 2
findConstructor("com.android.systemui.statusbar.views.MiuiClock") {
paramCount == 3
}.hookAfter {
val miuiPhoneStatusBarView =
it.thisObject.getObject("mStatusBar") as ViewGroup
val res: Resources = miuiPhoneStatusBarView.resources
val clockId: Int = res.getIdentifier("clock", "id", "com.android.systemui")
val clock: TextView = miuiPhoneStatusBarView.findViewById(clockId)
clock.gravity = Gravity.CENTER
try {
val textV = it.thisObject as TextView
if (textV.resources.getResourceEntryName(textV.id) == "clock") {
c = it.args[0] as Context
val textV = it.thisObject as TextView
textV.gravity = Gravity.CENTER
}
} catch (_: Exception) {
}
}
}
}
@@ -197,7 +203,6 @@ object StatusBarTimeCustomizationForS : HookRegister() {
if (isYear) {
if (isZh) {
datePattern += "YY年"
// if (!isHideSpace) datePattern = "$datePattern "
} else {
datePattern += "YY"
if (isMonth || isDay) datePattern += "/"
@@ -206,7 +211,6 @@ object StatusBarTimeCustomizationForS : HookRegister() {
if (isMonth) {
if (isZh) {
datePattern += "M月"
// if (!isHideSpace) datePattern = "$datePattern "
} else {
datePattern += "M"
if (isDay) datePattern += "/"

View File

@@ -0,0 +1,22 @@
package com.lt2333.simplicitytools.hooks.rules.t.android
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.hookBefore
import com.lt2333.simplicitytools.utils.XSPUtils
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object SystemPropertiesHookForT : HookRegister() {
override fun init() {
val mediaStepsSwitch = XSPUtils.getBoolean("media_volume_steps_switch", false)
val mediaSteps = XSPUtils.getInt("media_volume_steps", 15)
findMethod("android.os.SystemProperties") {
name == "getInt" && returnType == Int::class.java
}.hookBefore {
when (it.args[0] as String) {
"ro.config.media_vol_steps" -> if (mediaStepsSwitch) it.result = mediaSteps
}
}
}
}

View File

@@ -0,0 +1,25 @@
package com.lt2333.simplicitytools.hooks.rules.t.systemui
import android.util.TypedValue
import android.widget.TextView
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.getObjectAs
import com.github.kyuubiran.ezxhelper.utils.hookAfter
import com.lt2333.simplicitytools.utils.XSPUtils
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object BatteryPercentageForT : HookRegister() {
override fun init() {
val size = XSPUtils.getFloat("battery_percentage_font_size", 0f)
if (size == 0f) return
findMethod("com.android.systemui.statusbar.views.MiuiBatteryMeterView") {
name == "updateResources"
}.hookAfter {
(it.thisObject.getObjectAs<TextView>("mBatteryPercentView")).setTextSize(
TypedValue.COMPLEX_UNIT_DIP, size
)
}
}
}

View File

@@ -0,0 +1,20 @@
package com.lt2333.simplicitytools.hooks.rules.t.systemui
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.hookAfter
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object CanNotificationSlideForT: HookRegister() {
override fun init() {
findMethod("com.android.systemui.statusbar.notification.NotificationSettingsManager") {
name == "canSlide"
}.hookAfter {
hasEnable("can_notification_slide") {
it.result = true
}
}
}
}

View File

@@ -0,0 +1,200 @@
package com.lt2333.simplicitytools.hooks.rules.t.systemui
import android.content.ComponentName
import android.content.Intent
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import android.widget.TextView
import android.widget.Toast
import androidx.constraintlayout.widget.ConstraintLayout
import cn.fkj233.ui.activity.dp2px
import com.github.kyuubiran.ezxhelper.utils.*
import com.lt2333.simplicitytools.utils.SystemProperties
import com.lt2333.simplicitytools.utils.XSPUtils
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
import com.lt2333.simplicitytools.views.WeatherView
object ControlCenterWeatherForT : HookRegister() {
override fun init() = hasEnable("control_center_weather") {
var mWeatherView: TextView? = null
var mConstraintLayout: ConstraintLayout? = null
val isDisplayCity = XSPUtils.getBoolean("control_center_weather_city", false)
findMethod("com.android.systemui.controlcenter.phone.widget.QSControlCenterHeaderView") {
name == "onFinishInflate"
}.hookAfter { param ->
val viewGroup = param.thisObject as ViewGroup
val context = viewGroup.context
// MIUI编译时间大于 2022-03-12 00:00:00 且为内测版
if (SystemProperties[context, "ro.build.date.utc"]!!.toInt() >= 1647014400 &&
!SystemProperties[context, "ro.build.version.incremental"]!!.endsWith("XM")
) {
//获取原组件
val bigTimeId =
context.resources.getIdentifier("big_time", "id", context.packageName)
val big_time: TextView = viewGroup.findViewById(bigTimeId)
val dateTimeId =
context.resources.getIdentifier("date_time", "id", context.packageName)
val dateTime: TextView = viewGroup.findViewById(dateTimeId)
//创建新布局
val mConstraintLayoutLp = LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT
).also {
it.topMargin = context.resources.getDimensionPixelSize(
context.resources.getIdentifier(
"qs_control_header_tiles_margin_top",
"dimen",
context.packageName
)
)
}
mConstraintLayout =
ConstraintLayout(context).also { it.layoutParams = mConstraintLayoutLp }
(big_time.parent as ViewGroup).addView(mConstraintLayout, 0)
//从原布局中删除组件
(big_time.parent as ViewGroup).removeView(big_time)
(dateTime.parent as ViewGroup).removeView(dateTime)
//添加组件至新布局
mConstraintLayout!!.addView(big_time)
mConstraintLayout!!.addView(dateTime)
//组件属性
val dateTimeLp = ConstraintLayout.LayoutParams(
ConstraintLayout.LayoutParams.WRAP_CONTENT,
ConstraintLayout.LayoutParams.WRAP_CONTENT
).also {
it.startToEnd = bigTimeId
it.bottomToBottom = 0
it.marginStart = context.resources.getDimensionPixelSize(
context.resources.getIdentifier(
"notification_panel_time_date_space",
"dimen",
context.packageName
)
)
it.bottomMargin = dp2px(context, 5f)
}
dateTime.layoutParams = dateTimeLp
//创建天气组件
mWeatherView = WeatherView(context, isDisplayCity).apply {
setTextAppearance(
context.resources.getIdentifier(
"TextAppearance.QSControl.Date",
"style",
context.packageName
)
)
}
mConstraintLayout!!.addView(mWeatherView)
val mweatherviewLp = ConstraintLayout.LayoutParams(
ConstraintLayout.LayoutParams.WRAP_CONTENT,
ConstraintLayout.LayoutParams.WRAP_CONTENT
).also {
it.startToEnd = bigTimeId
it.bottomToTop = dateTimeId
it.marginStart = context.resources.getDimensionPixelSize(
context.resources.getIdentifier(
"notification_panel_time_date_space",
"dimen",
context.packageName
)
)
}
(mWeatherView as WeatherView).layoutParams = mweatherviewLp
} else {
val layoutParam =
loadClass("androidx.constraintlayout.widget.ConstraintLayout\$LayoutParams").getConstructor(
Int::class.java,
Int::class.java
).newInstance(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT
) as ViewGroup.MarginLayoutParams
layoutParam.putObject(
"bottomToTop",
context.resources.getIdentifier("date_time", "id", context.packageName)
)
layoutParam.putObject(
"startToEnd",
context.resources.getIdentifier("big_time", "id", context.packageName)
)
layoutParam.marginStart = context.resources.getDimensionPixelSize(
context.resources.getIdentifier(
"notification_panel_time_date_space",
"dimen",
context.packageName
)
)
mWeatherView = WeatherView(context, isDisplayCity).apply {
setTextAppearance(
context.resources.getIdentifier(
"TextAppearance.QSControl.Date",
"style",
context.packageName
)
)
layoutParams = layoutParam
}
viewGroup.addView(mWeatherView)
}
(mWeatherView as WeatherView).setOnClickListener {
try {
val intent = Intent().apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK
component = ComponentName(
"com.miui.weather2",
"com.miui.weather2.ActivityWeatherMain"
)
}
context.startActivity(intent)
} catch (e: Exception) {
Toast.makeText(context, "启动失败", Toast.LENGTH_LONG).show()
}
}
}
//解决横屏重叠
findMethod("com.android.systemui.controlcenter.phone.widget.QSControlCenterHeaderView") {
name == "updateLayout"
}.hookAfter {
val viewGroup = it.thisObject as ViewGroup
val context = viewGroup.context
val mOrientation = viewGroup.getObject("mOrientation") as Int
// MIUI编译时间大于 2022-03-12 00:00:00 且为内测版
if (SystemProperties[context, "ro.build.date.utc"]!!.toInt() >= 1647014400 && !SystemProperties[context, "ro.build.version.incremental"]!!.endsWith(
"DEV"
) && !SystemProperties[context, "ro.build.version.incremental"]!!.endsWith("XM")
) {
if (mOrientation == 1) {
mConstraintLayout!!.visibility = View.VISIBLE
} else {
mConstraintLayout!!.visibility = View.GONE
}
} else {
if (mOrientation == 1) {
mWeatherView!!.visibility = View.VISIBLE
} else {
mWeatherView!!.visibility = View.GONE
}
}
}
}
}

View File

@@ -0,0 +1,19 @@
package com.lt2333.simplicitytools.hooks.rules.t.systemui
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.hookAfter
import com.lt2333.simplicitytools.utils.XSPUtils
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object CustomMobileTypeTextForT : HookRegister() {
override fun init() = hasEnable("custom_mobile_type_text_switch") {
findMethod("com.android.systemui.statusbar.connectivity.MobileSignalController") {
name == "getMobileTypeName" && parameterTypes[0] == Int::class.java
}.hookAfter {
it.result = XSPUtils.getString("custom_mobile_type_text", "5G")
}
}
}

View File

@@ -0,0 +1,16 @@
package com.lt2333.simplicitytools.hooks.rules.t.systemui
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.hookBefore
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object DisableBluetoothTemporarilyOffForT: HookRegister() {
override fun init()= hasEnable("disable_bluetooth_temporarily_off") {
findMethod("com.android.settingslib.bluetooth.LocalBluetoothAdapter"){
name == "isSupportBluetoothRestrict" && parameterCount==1
}.hookBefore {
it.result = false
}
}
}

View File

@@ -0,0 +1,134 @@
package com.lt2333.simplicitytools.hooks.rules.t.systemui
import android.content.Context
import android.net.TrafficStats
import android.util.TypedValue
import android.view.Gravity
import android.widget.TextView
import com.github.kyuubiran.ezxhelper.init.InitFields
import com.github.kyuubiran.ezxhelper.utils.findConstructor
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.hookAfter
import com.github.kyuubiran.ezxhelper.utils.hookBefore
import com.lt2333.simplicitytools.R
import com.lt2333.simplicitytools.utils.XSPUtils
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
import java.text.DecimalFormat
object DoubleLineNetworkSpeedForT : HookRegister() {
private var mLastTotalUp: Long = 0
private var mLastTotalDown: Long = 0
private var lastTimeStampTotalUp: Long = 0
private var lastTimeStampTotalDown: Long = 0
private var upIcon = ""
private var downIcon = ""
private val getDualSize = XSPUtils.getInt("status_bar_network_speed_dual_row_size", 0)
private val getDualAlign = XSPUtils.getInt("status_bar_network_speed_dual_row_gravity", 0)
override fun init() = hasEnable("status_bar_dual_row_network_speed") {
val none = InitFields.moduleRes.getString(R.string.none)
if (XSPUtils.getString("status_bar_network_speed_dual_row_icon", none) != none) {
upIcon = XSPUtils.getString("status_bar_network_speed_dual_row_icon", none)?.firstOrNull().toString()
downIcon = XSPUtils.getString("status_bar_network_speed_dual_row_icon", none)?.lastOrNull().toString()
}
findConstructor("com.android.systemui.statusbar.views.NetworkSpeedView") {
parameterCount == 2
}.hookAfter {
val mView = it.thisObject as TextView
mView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 7f)
if (getDualSize != 0) {
mView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, getDualSize.toFloat())
}
mView.isSingleLine = false
mView.setLineSpacing(0F, 0.8F)
if (getDualAlign == 0) {
mView.gravity = Gravity.START or Gravity.CENTER_VERTICAL
} else {
mView.gravity = Gravity.END or Gravity.CENTER_VERTICAL
}
}
findMethod("com.android.systemui.statusbar.policy.NetworkSpeedController") {
name == "formatSpeed" && parameterCount == 2
}.hookBefore {
if (getDualAlign == 0) {
it.result = "$upIcon ${getTotalUpSpeed(it.args[0] as Context)}\n$downIcon ${
getTotalDownloadSpeed(it.args[0] as Context)
}"
} else {
it.result = "${getTotalUpSpeed(it.args[0] as Context)} $upIcon\n${
getTotalDownloadSpeed(it.args[0] as Context)
} $downIcon"
}
}
}
//获取总的上行速度
private fun getTotalUpSpeed(context: Context): String {
val totalUpSpeed: Float
val currentTotalTxBytes = TrafficStats.getTotalTxBytes()
val nowTimeStampTotalUp = System.currentTimeMillis()
//计算上传速度
val bytes = (currentTotalTxBytes - mLastTotalUp) * 1000 / (nowTimeStampTotalUp - lastTimeStampTotalUp).toFloat()
val unit: String
if (bytes >= 1048576) {
totalUpSpeed = DecimalFormat("0.0").format(bytes / 1048576).toFloat()
unit = context.resources.getString(context.resources.getIdentifier("megabyte_per_second", "string", context.packageName))
} else {
totalUpSpeed = DecimalFormat("0.0").format(bytes / 1024).toFloat()
unit = context.resources.getString(context.resources.getIdentifier("kilobyte_per_second", "string", context.packageName))
}
//保存当前的流量总和和上次的时间戳
mLastTotalUp = currentTotalTxBytes
lastTimeStampTotalUp = nowTimeStampTotalUp
return if (totalUpSpeed >= 100) {
"${totalUpSpeed.toInt()}$unit"
} else {
"${totalUpSpeed}$unit"
}
}
//获取总的下行速度
private fun getTotalDownloadSpeed(context: Context): String {
val totalDownSpeed: Float
val currentTotalRxBytes = TrafficStats.getTotalRxBytes()
val nowTimeStampTotalDown = System.currentTimeMillis()
//计算下行速度
val bytes = (currentTotalRxBytes - mLastTotalDown) * 1000 / (nowTimeStampTotalDown - lastTimeStampTotalDown).toFloat()
val unit: String
if (bytes >= 1048576) {
totalDownSpeed = DecimalFormat("0.0").format(bytes / 1048576).toFloat()
unit = context.resources.getString(context.resources.getIdentifier("megabyte_per_second", "string", context.packageName))
} else {
totalDownSpeed = DecimalFormat("0.0").format(bytes / 1024).toFloat()
unit = context.resources.getString(context.resources.getIdentifier("kilobyte_per_second", "string", context.packageName))
}
//保存当前的流量总和和上次的时间戳
mLastTotalDown = currentTotalRxBytes
lastTimeStampTotalDown = nowTimeStampTotalDown
return if (totalDownSpeed >= 100) {
"${totalDownSpeed.toInt()}$unit"
} else {
"${totalDownSpeed}$unit"
}
}
}

View File

@@ -0,0 +1,51 @@
package com.lt2333.simplicitytools.hooks.rules.t.systemui
import android.view.View
import android.widget.FrameLayout
import android.widget.ImageView
import android.widget.TextView
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.getObject
import com.github.kyuubiran.ezxhelper.utils.getObjectAs
import com.github.kyuubiran.ezxhelper.utils.hookAfter
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object HideBatteryIconForT : HookRegister() {
override fun init() {
findMethod("com.android.systemui.statusbar.views.MiuiBatteryMeterView") {
name == "updateResources"
}.hookAfter {
//隐藏电池图标
hasEnable("hide_battery_icon") {
(it.thisObject.getObjectAs<ImageView>("mBatteryIconView")).visibility = View.GONE
if (it.thisObject.getObject("mBatteryStyle") == 1) {
(it.thisObject.getObjectAs<FrameLayout>("mBatteryDigitalView")).visibility =
View.GONE
}
}
//隐藏电池内的百分比
hasEnable("hide_battery_percentage_icon") {
(it.thisObject.getObjectAs<TextView>("mBatteryPercentMarkView")).textSize = 0F
}
//隐藏电池百分号
hasEnable("hide_battery_percentage_icon") {
(it.thisObject.getObjectAs<TextView>("mBatteryPercentMarkView")).textSize = 0F
}
}
findMethod("com.android.systemui.statusbar.views.MiuiBatteryMeterView") {
name == "updateChargeAndText"
}.hookAfter {
//隐藏电池充电图标
hasEnable("hide_battery_charging_icon") {
(it.thisObject.getObjectAs<ImageView>("mBatteryChargingInView")).visibility =
View.GONE
(it.thisObject.getObjectAs<ImageView>("mBatteryChargingView")).visibility =
View.GONE
}
}
}
}

View File

@@ -0,0 +1,45 @@
package com.lt2333.simplicitytools.hooks.rules.t.systemui
import android.view.View
import android.widget.ImageView
import com.github.kyuubiran.ezxhelper.utils.*
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
import de.robv.android.xposed.XC_MethodHook
object HideHDIconForT : HookRegister() {
override fun init() {
findMethod("com.android.systemui.statusbar.StatusBarMobileView") {
name == "initViewState" && parameterCount == 1
}.hookAfter {
hide(it)
}
findMethod("com.android.systemui.statusbar.StatusBarMobileView") {
name == "updateState" && parameterCount == 1
}.hookAfter {
hide(it)
}
hasEnable("hide_new_hd_icon") {
findMethod("com.android.systemui.statusbar.policy.HDController") { name == "update" }.hookBefore {
it.result = null
}
}
}
private fun hide(it: XC_MethodHook.MethodHookParam) {
hasEnable("hide_big_hd_icon") {
(it.thisObject.getObjectAs<ImageView>("mVolte")).visibility = View.GONE
}
hasEnable("hide_small_hd_icon") {
(it.thisObject.getObjectAs<ImageView>("mSmallHd")).visibility = View.GONE
}
hasEnable("hide_hd_no_service_icon") {
(it.thisObject.getObjectAs<ImageView>("mVolteNoService")).visibility = View.GONE
}
}
}

View File

@@ -0,0 +1,35 @@
package com.lt2333.simplicitytools.hooks.rules.t.systemui
import android.view.View
import android.widget.ImageView
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.getObjectAs
import com.github.kyuubiran.ezxhelper.utils.hookAfter
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
import de.robv.android.xposed.XC_MethodHook
object HideMobileActivityIconForT : HookRegister() {
override fun init() {
findMethod("com.android.systemui.statusbar.StatusBarMobileView") {
name == "initViewState" && parameterCount == 1
}.hookAfter {
hide(it)
}
findMethod("com.android.systemui.statusbar.StatusBarMobileView") {
name == "updateState" && parameterCount == 1
}.hookAfter {
hide(it)
}
}
private fun hide(it: XC_MethodHook.MethodHookParam) {
hasEnable("hide_mobile_activity_icon") {
(it.thisObject.getObjectAs<ImageView>("mLeftInOut")).visibility = View.GONE
(it.thisObject.getObjectAs<ImageView>("mRightInOut")).visibility = View.GONE
}
}
}

View File

@@ -0,0 +1,52 @@
package com.lt2333.simplicitytools.hooks.rules.t.systemui
import android.view.View
import android.widget.ImageView
import android.widget.TextView
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.getObjectAs
import com.github.kyuubiran.ezxhelper.utils.hookAfter
import com.lt2333.simplicitytools.utils.XSPUtils
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
import de.robv.android.xposed.XC_MethodHook
object HideMobileTypeIconForT : HookRegister() {
private val isBigType = XSPUtils.getBoolean("big_mobile_type_icon", false)
override fun init() {
findMethod("com.android.systemui.statusbar.StatusBarMobileView") {
name == "initViewState" && parameterCount == 1
}.hookAfter {
hideMobileTypeIcon(it)
}
findMethod("com.android.systemui.statusbar.StatusBarMobileView") {
name == "updateState" && parameterCount == 1
}.hookAfter {
hideMobileTypeIcon(it)
}
}
private fun hideMobileTypeIcon(it: XC_MethodHook.MethodHookParam) {
hasEnable("hide_mobile_type_icon") {
if (isBigType) {
(it.thisObject.getObjectAs<ImageView>("mMobileType")).visibility =
View.GONE
(it.thisObject.getObjectAs<ImageView>("mMobileTypeImage")).visibility =
View.GONE
(it.thisObject.getObjectAs<TextView>("mMobileTypeSingle")).visibility =
View.GONE
} else {
(it.thisObject.getObjectAs<ImageView>("mMobileType")).visibility =
View.INVISIBLE
(it.thisObject.getObjectAs<ImageView>("mMobileTypeImage")).visibility =
View.INVISIBLE
(it.thisObject.getObjectAs<TextView>("mMobileTypeSingle")).visibility =
View.INVISIBLE
}
}
}
}

View File

@@ -0,0 +1,22 @@
package com.lt2333.simplicitytools.hooks.rules.t.systemui
import android.widget.TextView
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.hookAfter
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object HideNetworkSpeedSplitterForT : HookRegister() {
override fun init() {
findMethod("com.android.systemui.statusbar.views.NetworkSpeedSplitter") {
name == "init"
}.hookAfter {
hasEnable("hide_network_speed_splitter") {
val textView = it.thisObject as TextView
textView.text = " "
}
}
}
}

View File

@@ -0,0 +1,25 @@
package com.lt2333.simplicitytools.hooks.rules.t.systemui
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.hookBefore
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object HideSimIconForT : HookRegister() {
override fun init() {
findMethod("com.android.systemui.statusbar.phone.StatusBarSignalPolicy") {
name == "hasCorrectSubs" && parameterTypes[0] == MutableList::class.java
}.hookBefore {
val list = it.args[0] as MutableList<*>
val size = list.size
hasEnable("hide_sim_two_icon", extraCondition = { size == 2 }) {
list.removeAt(1)
}
hasEnable("hide_sim_one_icon", extraCondition = { size >= 1 }) {
list.removeAt(0)
}
}
}
}

View File

@@ -0,0 +1,87 @@
package com.lt2333.simplicitytools.hooks.rules.t.systemui
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.hookBefore
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
import de.robv.android.xposed.XC_MethodHook
object HideStatusBarIconForT : HookRegister() {
override fun init() {
findMethod("com.android.systemui.statusbar.phone.StatusBarIconControllerImpl") {
name == "setIconVisibility" && parameterCount == 2
}.hookBefore {
hideIcon(it)
}
findMethod("com.android.systemui.statusbar.phone.MiuiDripLeftStatusBarIconControllerImpl") {
name == "setIconVisibility" && parameterCount == 2
}.hookBefore {
hideIcon(it)
}
}
private fun hideIcon(it: XC_MethodHook.MethodHookParam) {
//Log.d("图标名字", "handleLoadPackage: " + it.args[0])
when (it.args[0] as String) {
//隐藏蓝牙
"bluetooth" -> hasEnable("hide_bluetooth_icon") {
it.args[1] = false
}
//隐藏蓝牙电量
"bluetooth_handsfree_battery" -> hasEnable("hide_bluetooth_battery_icon") {
it.args[1] = false
}
//隐藏勿扰
"zen" -> hasEnable("hide_zen_icon") {
it.args[1] = false
}
//隐藏声音
"volume" -> hasEnable("hide_volume_icon") {
it.args[1] = false
}
//隐藏WIFI
"wifi" -> hasEnable("hide_wifi_icon") {
it.args[1] = false
}
//隐藏WIFI辅助
"slave_wifi" -> hasEnable("hide_slave_wifi_icon") {
it.args[1] = false
}
//隐藏飞行模式
"airplane" -> hasEnable("hide_airplane_icon") {
it.args[1] = false
}
//隐藏闹钟
"alarm_clock" -> hasEnable("hide_alarm_icon") {
it.args[1] = false
}
//隐藏定位
"location" -> hasEnable("hide_gps_icon") {
it.args[1] = false
}
//隐藏热点
"hotspot" -> hasEnable("hide_hotspot_icon") {
it.args[1] = false
}
//隐藏耳机
"headset" -> hasEnable("hide_headset_icon") {
it.args[1] = false
}
//隐藏VPN
"vpn" -> hasEnable("hide_vpn_icon") {
it.args[1] = false
}
//隐藏无SIM卡
"no_sim" -> hasEnable("hide_no_sim_icon") {
it.args[1] = false
}
//隐藏NFC图标
"nfc" -> hasEnable("hide_nfc_icon") {
it.args[1] = false
}
}
}
}

View File

@@ -0,0 +1,26 @@
package com.lt2333.simplicitytools.hooks.rules.t.systemui
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.hookBefore
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object HideStatusBarNetworkSpeedSecondForT : HookRegister() {
override fun init() {
findMethod("com.android.systemui.statusbar.views.NetworkSpeedView") {
name == "setNetworkSpeed" && parameterCount == 1
}.hookBefore {
hasEnable("hide_status_bar_network_speed_second") {
if (it.args[0] != null) {
val mText = (it.args[0] as String)
.replace("/", "")
.replace("s", "")
.replace("\'", "")
.replace("วิ", "")
it.args[0] = mText
}
}
}
}
}

View File

@@ -0,0 +1,42 @@
package com.lt2333.simplicitytools.hooks.rules.t.systemui
import android.view.View
import android.widget.ImageView
import android.widget.TextView
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.getObjectAs
import com.github.kyuubiran.ezxhelper.utils.hookAfter
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
import de.robv.android.xposed.XC_MethodHook
object HideWifiActivityIconForT : HookRegister() {
override fun init() {
findMethod("com.android.systemui.statusbar.StatusBarWifiView") {
name == "initViewState" && parameterCount == 1
}.hookAfter {
hide(it)
}
findMethod("com.android.systemui.statusbar.StatusBarWifiView") {
name == "updateState" && parameterCount == 1
}.hookAfter {
hide(it)
}
}
private fun hide(it: XC_MethodHook.MethodHookParam) {
//隐藏WIFI箭头
hasEnable("hide_wifi_activity_icon") {
(it.thisObject.getObjectAs<ImageView>("mWifiActivityView")).visibility =
View.INVISIBLE
}
//隐藏WIFI标准图标
hasEnable("hide_wifi_standard_icon") {
(it.thisObject.getObjectAs<TextView>("mWifiStandardView")).visibility =
View.INVISIBLE
}
}
}

View File

@@ -0,0 +1,87 @@
package com.lt2333.simplicitytools.hooks.rules.t.systemui
import android.annotation.SuppressLint
import android.content.Context
import android.os.Handler
import android.provider.Settings
import android.util.Log
import android.widget.LinearLayout
import android.widget.TextView
import com.github.kyuubiran.ezxhelper.utils.*
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
import de.robv.android.xposed.XC_MethodHook
import java.lang.reflect.Method
import java.text.SimpleDateFormat
import java.util.*
object LockScreenClockDisplaySecondsForT : HookRegister() {
private var nowTime: Date = Calendar.getInstance().time
override fun init() = hasEnable("lock_screen_clock_display_seconds") {
findConstructor("com.miui.clock.MiuiBaseClock") {
paramCount == 2
}.hookAfter {
try {
val viewGroup = it.thisObject as LinearLayout
val d: Method = viewGroup.javaClass.getDeclaredMethod("updateTime")
val r = Runnable {
d.isAccessible = true
d.invoke(viewGroup)
}
class T : TimerTask() {
override fun run() {
Handler(viewGroup.context.mainLooper).post(r)
}
}
Timer().scheduleAtFixedRate(T(), 1000 - System.currentTimeMillis() % 1000, 1000)
} catch (_: Exception) {
}
}
findMethod("com.miui.clock.MiuiLeftTopClock") {
name == "updateTime"
}.hookAfter { updateTime(it, false) }
findMethod("com.miui.clock.MiuiCenterHorizontalClock") {
name == "updateTime"
}.hookAfter { updateTime(it, false) }
findMethod("com.miui.clock.MiuiLeftTopLargeClock") {
name == "updateTime"
}.hookAfter { updateTime(it, false) }
findMethod("com.miui.clock.MiuiVerticalClock") {
name == "updateTime"
}.hookAfter { updateTime(it, true) }
}
private fun updateTime(it: XC_MethodHook.MethodHookParam, isVertical: Boolean) {
val textV = it.thisObject.getObjectAs<TextView>("mTimeText")
val c: Context = textV.context
Log.d("lock_screen_clock_display_seconds", "updateTime: ${it.thisObject.javaClass.simpleName}")
val is24 = Settings.System.getString(c.contentResolver, Settings.System.TIME_12_24) == "24"
nowTime = Calendar.getInstance().time
textV.text = getTime(is24, isVertical)
}
@SuppressLint("SimpleDateFormat")
private fun getTime(is24: Boolean, isVertical: Boolean): String {
var timePattern = ""
timePattern += if (isVertical) { //垂直
if (is24) "HH\nmm\nss" else "hh\nmm\nss"
} else { //水平
if (is24) "HH:mm:ss" else "h:mm:ss"
}
timePattern = SimpleDateFormat(timePattern).format(nowTime)
return timePattern
}
}

View File

@@ -0,0 +1,82 @@
package com.lt2333.simplicitytools.hooks.rules.t.systemui
import android.app.AndroidAppHelper
import android.content.Context
import android.os.BatteryManager
import android.widget.TextView
import com.github.kyuubiran.ezxhelper.init.InitFields
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.getObject
import com.github.kyuubiran.ezxhelper.utils.hookAfter
import com.lt2333.simplicitytools.R
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
import java.io.BufferedReader
import java.io.FileReader
import kotlin.math.abs
object LockScreenCurrentForT : HookRegister() {
override fun init() = hasEnable("lock_screen_charging_current") {
findMethod("com.android.keyguard.charge.ChargeUtils") {
name == "getChargingHintText" && parameterCount == 3
}.hookAfter {
it.result = "${getCurrent()}\n${it.result}"
}
findMethod("com.android.systemui.statusbar.phone.KeyguardBottomAreaView") {
name == "onFinishInflate"
}.hookAfter {
(it.thisObject.getObject("mIndicationText") as TextView).isSingleLine = false
}
}
private fun getCurrent(): String {
val batteryManager = AndroidAppHelper.currentApplication().getSystemService(Context.BATTERY_SERVICE) as BatteryManager
val current = abs(batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CURRENT_NOW) / 1000)
return "${InitFields.moduleRes.getString(R.string.current_current)} ${current}mA"
}
/**
* 获取平均电流值
* 获取 filePath 文件 totalCount 次数的平均值,每次采样间隔 intervalMs 时间
*/
private fun getMeanCurrentVal(filePath: String, totalCount: Int, intervalMs: Int): Float {
var meanVal = 0.0f
if (totalCount <= 0) {
return 0.0f
}
for (i in 0 until totalCount) {
try {
val f: Float = readFile(filePath, 0).toFloat()
meanVal += f / totalCount
} catch (e: Exception) {
e.printStackTrace()
}
if (intervalMs <= 0) {
continue
}
try {
Thread.sleep(intervalMs.toLong())
} catch (e: Exception) {
e.printStackTrace()
}
}
return meanVal
}
private fun readFile(path: String, defaultValue: Int): Int {
try {
val bufferedReader = BufferedReader(FileReader(path))
val i: Int = bufferedReader.readLine().toInt(10)
bufferedReader.close()
return i
} catch (_: java.lang.Exception) {
}
return defaultValue
}
}

View File

@@ -0,0 +1,70 @@
package com.lt2333.simplicitytools.hooks.rules.t.systemui
import android.app.KeyguardManager
import android.content.Context
import android.os.SystemClock
import android.view.MotionEvent
import android.view.View
import android.view.View.OnTouchListener
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.hookBefore
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
import de.robv.android.xposed.XposedHelpers
import kotlin.math.abs
object LockScreenDoubleTapToSleepForT : HookRegister() {
override fun init() = hasEnable("lock_screen_double_tap_to_sleep") {
findMethod("com.android.systemui.statusbar.phone.NotificationsQuickSettingsContainer") {
name == "onFinishInflate"
}.hookBefore {
val view = it.thisObject as View
XposedHelpers.setAdditionalInstanceField(view, "currentTouchTime", 0L)
XposedHelpers.setAdditionalInstanceField(view, "currentTouchX", 0f)
XposedHelpers.setAdditionalInstanceField(view, "currentTouchY", 0f)
view.setOnTouchListener(OnTouchListener { v, event ->
if (event.action != MotionEvent.ACTION_DOWN) return@OnTouchListener false
var currentTouchTime =
XposedHelpers.getAdditionalInstanceField(view, "currentTouchTime") as Long
var currentTouchX =
XposedHelpers.getAdditionalInstanceField(view, "currentTouchX") as Float
var currentTouchY =
XposedHelpers.getAdditionalInstanceField(view, "currentTouchY") as Float
val lastTouchTime = currentTouchTime
val lastTouchX = currentTouchX
val lastTouchY = currentTouchY
currentTouchTime = System.currentTimeMillis()
currentTouchX = event.x
currentTouchY = event.y
if (currentTouchTime - lastTouchTime < 250L && abs(currentTouchX - lastTouchX) < 100f && abs(
currentTouchY - lastTouchY
) < 100f
) {
val keyguardMgr =
v.context.getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager
if (keyguardMgr.isKeyguardLocked) {
XposedHelpers.callMethod(
v.context.getSystemService(Context.POWER_SERVICE),
"goToSleep",
SystemClock.uptimeMillis()
)
}
currentTouchTime = 0L
currentTouchX = 0f
currentTouchY = 0f
}
XposedHelpers.setAdditionalInstanceField(
view,
"currentTouchTime",
currentTouchTime
)
XposedHelpers.setAdditionalInstanceField(view, "currentTouchX", currentTouchX)
XposedHelpers.setAdditionalInstanceField(view, "currentTouchY", currentTouchY)
v.performClick()
false
})
}
}
}

View File

@@ -0,0 +1,31 @@
package com.lt2333.simplicitytools.hooks.rules.t.systemui
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.hookReplace
import com.github.kyuubiran.ezxhelper.utils.invokeMethod
import com.github.kyuubiran.ezxhelper.utils.putObject
import com.lt2333.simplicitytools.utils.XSPUtils
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object MaximumNumberOfNotificationIconsForT : HookRegister() {
override fun init() {
val icons = XSPUtils.getInt("maximum_number_of_notification_icons", 3)
val dots = XSPUtils.getInt("maximum_number_of_notification_dots", 3)
findMethod("com.android.systemui.statusbar.phone.NotificationIconContainer") {
name == "miuiShowNotificationIcons" && parameterCount == 1
}.hookReplace {
if (it.args[0] as Boolean) {
it.thisObject.putObject("MAX_DOTS", dots)
it.thisObject.putObject("MAX_STATIC_ICONS", icons)
it.thisObject.putObject("MAX_VISIBLE_ICONS_ON_LOCK", icons)
} else {
it.thisObject.putObject("MAX_DOTS", 0)
it.thisObject.putObject("MAX_STATIC_ICONS", 0)
it.thisObject.putObject("MAX_VISIBLE_ICONS_ON_LOCK", 0)
}
it.thisObject.invokeMethod("updateState")
}
}
}

View File

@@ -0,0 +1,53 @@
package com.lt2333.simplicitytools.hooks.rules.t.systemui
import android.annotation.SuppressLint
import android.content.pm.ApplicationInfo
import android.widget.TextView
import com.github.kyuubiran.ezxhelper.utils.*
import com.lt2333.simplicitytools.utils.XSPUtils
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
import com.lt2333.simplicitytools.views.WeatherData
@SuppressLint("StaticFieldLeak")
object NewNotificationWeatherForT : HookRegister() {
// TODO: Android13控制中心天气不可用
lateinit var weather: WeatherData
var clockId: Int = -2
@SuppressLint("DiscouragedApi", "ClickableViewAccessibility")
override fun init() = hasEnable("control_center_weather") {
val isDisplayCity = XSPUtils.getBoolean("notification_weather_city", false)
findMethod("com.android.systemui.controlcenter.phone.widget.ControlCenterDateView", findSuper = true) { name == "onDetachedFromWindow" }.hookBefore {
if ((it.thisObject as TextView).id == clockId && this::weather.isInitialized) {
weather.onDetachedFromWindow()
}
}
findMethod("com.android.systemui.controlcenter.phone.widget.ControlCenterDateView", findSuper = true) { name == "setText" }.hookBefore {
val time = it.args[0]?.toString()
val view = it.thisObject as TextView
if (view.id == clockId && time != null && this::weather.isInitialized) {
// val layout = view.layoutParams as ViewGroup.MarginLayoutParams
// val y = view.height / 2
// layout.topMargin = -y
it.args[0] = "${weather.weatherData}$time"
}
}
findMethod("com.android.systemui.shared.plugins.PluginManagerImpl") { name == "getClassLoader" }.hookAfter { getClassLoader ->
val appInfo = getClassLoader.args[0] as ApplicationInfo
val classLoader = getClassLoader.result as ClassLoader
if (appInfo.packageName == "miui.systemui.plugin") {
findMethod("miui.systemui.controlcenter.windowview.MainPanelHeaderController", classLoader = classLoader) { name == "addClockViews" }.hookAfter {
val dateView = it.thisObject.getObjectAs<TextView>("dateView")
clockId = dateView.id
weather = WeatherData(dateView.context, isDisplayCity)
weather.callBacks = {
dateView.invokeMethod("updateTime")
}
}
}
}
}
}

View File

@@ -0,0 +1,201 @@
package com.lt2333.simplicitytools.hooks.rules.t.systemui
import android.content.ComponentName
import android.content.Intent
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import android.widget.TextView
import android.widget.Toast
import androidx.constraintlayout.widget.ConstraintLayout
import cn.fkj233.ui.activity.dp2px
import com.github.kyuubiran.ezxhelper.utils.*
import com.lt2333.simplicitytools.utils.SystemProperties
import com.lt2333.simplicitytools.utils.XSPUtils
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
import com.lt2333.simplicitytools.views.WeatherView
object NotificationWeatherForT : HookRegister() {
override fun init() = hasEnable("notification_weather") {
var mWeatherView: TextView? = null
var mConstraintLayout: ConstraintLayout? = null
val isDisplayCity = XSPUtils.getBoolean("notification_weather_city", false)
findMethod("com.android.systemui.qs.MiuiNotificationHeaderView") {
name == "onFinishInflate"
}.hookAfter { param ->
val viewGroup = param.thisObject as ViewGroup
val context = viewGroup.context
// MIUI编译时间大于 2022-03-12 00:00:00 且为内测版
if (SystemProperties[context, "ro.build.date.utc"].toInt() >= 1647014400 &&
!SystemProperties[context, "ro.build.version.incremental"].endsWith("XM")
) {
//获取原组件
val bigTimeId =
context.resources.getIdentifier("big_time", "id", context.packageName)
val bigTime: TextView = viewGroup.findViewById(bigTimeId)
val dateTimeId =
context.resources.getIdentifier("date_time", "id", context.packageName)
val dateTime: TextView = viewGroup.findViewById(dateTimeId)
//创建新布局
val mConstraintLayoutLp = LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT
).also {
it.topMargin = context.resources.getDimensionPixelSize(
context.resources.getIdentifier(
"qs_control_header_tiles_margin_top",
"dimen",
context.packageName
)
)
}
mConstraintLayout =
ConstraintLayout(context).also { it.layoutParams = mConstraintLayoutLp }
(bigTime.parent as ViewGroup).addView(mConstraintLayout, 0)
//从原布局中删除组件
(bigTime.parent as ViewGroup).removeView(bigTime)
(dateTime.parent as ViewGroup).removeView(dateTime)
//添加组件至新布局
mConstraintLayout!!.addView(bigTime)
mConstraintLayout!!.addView(dateTime)
//组件属性
val dateTimeLp = ConstraintLayout.LayoutParams(
ConstraintLayout.LayoutParams.WRAP_CONTENT,
ConstraintLayout.LayoutParams.WRAP_CONTENT
).also {
it.startToEnd = bigTimeId
it.bottomToBottom = 0
it.marginStart = context.resources.getDimensionPixelSize(
context.resources.getIdentifier(
"notification_panel_time_date_space",
"dimen",
context.packageName
)
)
it.bottomMargin = dp2px(context, 5f)
}
dateTime.layoutParams = dateTimeLp
//创建天气组件
mWeatherView = WeatherView(context, isDisplayCity).apply {
setTextAppearance(
context.resources.getIdentifier(
"TextAppearance.QSControl.Date",
"style",
context.packageName
)
)
}
mConstraintLayout!!.addView(mWeatherView)
val mweatherviewLp = ConstraintLayout.LayoutParams(
ConstraintLayout.LayoutParams.WRAP_CONTENT,
ConstraintLayout.LayoutParams.WRAP_CONTENT
).also {
it.startToEnd = bigTimeId
it.bottomToTop = dateTimeId
it.marginStart = context.resources.getDimensionPixelSize(
context.resources.getIdentifier(
"notification_panel_time_date_space",
"dimen",
context.packageName
)
)
}
(mWeatherView as WeatherView).layoutParams = mweatherviewLp
} else {
val layoutParam =
loadClass("androidx.constraintlayout.widget.ConstraintLayout\$LayoutParams").getConstructor(
Int::class.java,
Int::class.java
).newInstance(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT
) as ViewGroup.MarginLayoutParams
layoutParam.putObject(
"bottomToTop",
context.resources.getIdentifier("date_time", "id", context.packageName)
)
layoutParam.putObject(
"startToEnd",
context.resources.getIdentifier("big_time", "id", context.packageName)
)
layoutParam.marginStart = context.resources.getDimensionPixelSize(
context.resources.getIdentifier(
"notification_panel_time_date_space",
"dimen",
context.packageName
)
)
mWeatherView = WeatherView(context, isDisplayCity).apply {
setTextAppearance(
context.resources.getIdentifier(
"TextAppearance.QSControl.Date",
"style",
context.packageName
)
)
layoutParams = layoutParam
}
viewGroup.addView(mWeatherView)
}
(mWeatherView as WeatherView).setOnClickListener {
try {
val intent = Intent().apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK
component = ComponentName(
"com.miui.weather2",
"com.miui.weather2.ActivityWeatherMain"
)
}
context.startActivity(intent)
} catch (e: Exception) {
Toast.makeText(context, "启动失败", Toast.LENGTH_LONG).show()
}
}
}
findMethod("com.android.systemui.qs.MiuiNotificationHeaderView") {
name == "updateLayout"
}.hookAfter {
val viewGroup = it.thisObject as ViewGroup
val context = viewGroup.context
val mOrientation = viewGroup.getObject("mOrientation") as Int
// MIUI编译时间大于 2022-03-12 00:00:00 且为内测版
if (SystemProperties[context, "ro.build.date.utc"]!!.toInt() >= 1647014400 && !SystemProperties[context, "ro.build.version.incremental"]!!.endsWith(
"DEV"
) && !SystemProperties[context, "ro.build.version.incremental"]!!.endsWith("XM")
) {
if (mOrientation == 1) {
mConstraintLayout!!.visibility = View.VISIBLE
} else {
mConstraintLayout!!.visibility = View.GONE
}
} else {
if (mOrientation == 1) {
mWeatherView!!.visibility = View.VISIBLE
} else {
mWeatherView!!.visibility = View.GONE
}
}
}
}
}

View File

@@ -0,0 +1,98 @@
package com.lt2333.simplicitytools.hooks.rules.t.systemui
import android.content.ComponentName
import android.content.Intent
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import android.widget.Toast
import com.github.kyuubiran.ezxhelper.utils.*
import com.lt2333.simplicitytools.utils.XSPUtils
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
import com.lt2333.simplicitytools.views.WeatherView
object OldNotificationWeatherForT : HookRegister() {
override fun init() = hasEnable("notification_weather") {
var mWeatherView: TextView? = null
val isDisplayCity = XSPUtils.getBoolean("notification_weather_city", false)
findMethod("com.android.systemui.qs.MiuiQSHeaderView") {
name == "onFinishInflate"
}.hookAfter {
val viewGroup = it.thisObject as ViewGroup
val context = viewGroup.context
val layoutParam =
loadClass("androidx.constraintlayout.widget.ConstraintLayout\$LayoutParams")
.getConstructor(Int::class.java, Int::class.java)
.newInstance(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT
) as ViewGroup.MarginLayoutParams
layoutParam.putObject(
"endToStart",
context.resources.getIdentifier(
"notification_shade_shortcut",
"id",
context.packageName
)
)
layoutParam.putObject(
"topToTop",
context.resources.getIdentifier(
"notification_shade_shortcut",
"id",
context.packageName
)
)
layoutParam.putObject(
"bottomToBottom",
context.resources.getIdentifier(
"notification_shade_shortcut",
"id",
context.packageName
)
)
mWeatherView = WeatherView(context, isDisplayCity).apply {
setTextAppearance(
context.resources.getIdentifier(
"TextAppearance.StatusBar.Expanded.Clock.QuickSettingDate",
"style",
context.packageName
)
)
layoutParams = layoutParam
}
viewGroup.addView(mWeatherView)
(mWeatherView as WeatherView).setOnClickListener {
try {
val intent = Intent().apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK
component = ComponentName(
"com.miui.weather2",
"com.miui.weather2.ActivityWeatherMain"
)
}
context.startActivity(intent)
} catch (e: Exception) {
Toast.makeText(context, "启动失败,可能是不支持", Toast.LENGTH_LONG).show()
}
}
}
//解决横屏重叠
findMethod("com.android.systemui.qs.MiuiQSHeaderView") {
name == "updateLayout"
}.hookAfter {
val mOritation = it.thisObject.getObject("mOrientation") as Int
if (mOritation == 1) {
mWeatherView!!.visibility = View.VISIBLE
} else {
mWeatherView!!.visibility = View.GONE
}
}
}
}

View File

@@ -0,0 +1,50 @@
package com.lt2333.simplicitytools.hooks.rules.t.systemui
import android.content.res.Configuration
import android.view.ViewGroup
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.hookAfter
import com.github.kyuubiran.ezxhelper.utils.hookBefore
import com.github.kyuubiran.ezxhelper.utils.putObject
import com.lt2333.simplicitytools.utils.XSPUtils
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object OldQSCustomForT : HookRegister() {
override fun init() = hasEnable("old_qs_custom_switch") {
val mRows = XSPUtils.getInt("qs_custom_rows", 3)
val mRowsHorizontal = XSPUtils.getInt("qs_custom_rows_horizontal", 2)
val mColumns = XSPUtils.getInt("qs_custom_columns", 4)
val mColumnsUnexpanded = XSPUtils.getInt("qs_custom_columns_unexpanded", 5)
findMethod("com.android.systemui.qs.MiuiQuickQSPanel") {
name == "setMaxTiles" && parameterCount == 1
}.hookBefore {
//未展开时的列数
it.args[0] = mColumnsUnexpanded
}
findMethod("com.android.systemui.qs.MiuiTileLayout") {
name == "updateColumns"
}.hookAfter {
//展开时的列数
it.thisObject.putObject("mColumns", mColumns)
}
findMethod("com.android.systemui.qs.MiuiTileLayout") {
name == "updateResources"
}.hookAfter {
//展开时的行数
val viewGroup = it.thisObject as ViewGroup
val mConfiguration: Configuration = viewGroup.context.resources.configuration
if (mConfiguration.orientation == Configuration.ORIENTATION_PORTRAIT) {
viewGroup.putObject("mMaxAllowedRows", mRows)
} else {
viewGroup.putObject("mMaxAllowedRows", mRowsHorizontal)
}
viewGroup.requestLayout()
}
}
}

View File

@@ -0,0 +1,43 @@
package com.lt2333.simplicitytools.hooks.rules.t.systemui
import android.view.View
import android.widget.LinearLayout
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.getObject
import com.github.kyuubiran.ezxhelper.utils.hookAfter
import com.github.kyuubiran.ezxhelper.utils.hookBefore
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object RemoveLockScreenCameraForT : HookRegister() {
override fun init() {
//屏蔽右下角组件显示
findMethod("com.android.systemui.statusbar.phone.KeyguardBottomAreaView") {
name == "onFinishInflate"
}.hookAfter {
hasEnable("remove_lock_screen_camera") {
(it.thisObject.getObject("mRightAffordanceViewLayout") as LinearLayout).visibility =
View.GONE
}
}
//屏蔽滑动撞墙动画
findMethod("com.android.keyguard.KeyguardMoveRightController") {
name == "onTouchMove" && parameterCount == 2
}.hookBefore {
hasEnable("remove_lock_screen_camera") {
it.result = false
}
}
findMethod("com.android.keyguard.KeyguardMoveRightController") {
name == "reset"
}.hookBefore {
hasEnable("remove_lock_screen_camera") {
it.result = null
}
}
}
}

View File

@@ -0,0 +1,20 @@
package com.lt2333.simplicitytools.hooks.rules.t.systemui
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.hookBefore
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object RemoveTheLeftSideOfTheLockScreenForT : HookRegister() {
override fun init() {
findMethod("com.android.keyguard.negative.MiuiKeyguardMoveLeftViewContainer") {
name == "inflateLeftView"
}.hookBefore {
hasEnable("remove_the_left_side_of_the_lock_screen") {
it.result = null
}
}
}
}

View File

@@ -0,0 +1,40 @@
package com.lt2333.simplicitytools.hooks.rules.t.systemui
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.getObjectAs
import com.github.kyuubiran.ezxhelper.utils.hookBefore
import com.github.kyuubiran.ezxhelper.utils.putObject
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object ShowWifiStandardForT : HookRegister() {
override fun init() {
findMethod("com.android.systemui.statusbar.StatusBarWifiView") {
name == "initViewState" && parameterCount == 1
}.hookBefore {
hasEnable("show_wifi_standard") {
findMethod("com.android.systemui.statusbar.phone.StatusBarSignalPolicy\$WifiIconState") {
name == "copyTo" && parameterCount == 1
}.hookBefore {
val wifiStandard = it.thisObject.getObjectAs<Int>("wifiStandard")
it.thisObject.putObject("showWifiStandard", wifiStandard != 0)
}
}
}
findMethod("com.android.systemui.statusbar.StatusBarWifiView") {
name == "updateState" && parameterCount == 1
}.hookBefore {
hasEnable("show_wifi_standard") {
findMethod("com.android.systemui.statusbar.phone.StatusBarSignalPolicy\$WifiIconState") {
name == "copyTo" && parameterCount == 1
}.hookBefore {
val wifiStandard = it.thisObject.getObjectAs<Int>("wifiStandard")
it.thisObject.putObject("showWifiStandard", wifiStandard != 0)
}
}
}
}
}

View File

@@ -0,0 +1,89 @@
package com.lt2333.simplicitytools.hooks.rules.t.systemui
import android.content.Context
import android.content.res.Resources
import android.graphics.Typeface
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import com.github.kyuubiran.ezxhelper.utils.*
import com.lt2333.simplicitytools.utils.XSPUtils
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object StatusBarBigMobileTypeIconForT : HookRegister() {
private val getLocation = XSPUtils.getInt("big_mobile_type_location", 1)
private val upAndDownPosition = XSPUtils.getInt("big_mobile_type_icon_up_and_down_position", 0)
private val leftAndRightMargin = XSPUtils.getInt("big_mobile_type_icon_left_and_right_margins", 0)
private val isBold = XSPUtils.getBoolean("big_mobile_type_icon_bold", true)
private val size = XSPUtils.getFloat("big_mobile_type_icon_size", 12.5f)
private val isOnlyShowNetwork = XSPUtils.getBoolean("big_mobile_type_only_show_network_card", false)
override fun init() = hasEnable("big_mobile_type_icon") {
//使网络类型单独显示
findMethod("com.android.systemui.statusbar.StatusBarMobileView") {
name == "applyMobileState"
}.hookBefore {
val mobileIconState = it.args[0]
mobileIconState.putObject("showMobileDataTypeSingle", true)
}
findMethod("com.android.systemui.statusbar.StatusBarMobileView") {
name == "initViewState"
}.hookAfter {
val mobileIconState = it.args[0]
val statusBarMobileView = it.thisObject as ViewGroup
val context: Context = statusBarMobileView.context
val res: Resources = context.resources
//获取组件
val mobileContainerLeftId: Int = res.getIdentifier("mobile_container_left", "id", "com.android.systemui")
val mobileContainerLeft = statusBarMobileView.findViewById<ViewGroup>(mobileContainerLeftId)
val mobileGroupId: Int = res.getIdentifier("mobile_group", "id", "com.android.systemui")
val mobileGroup = statusBarMobileView.findViewById<ViewGroup>(mobileGroupId)
val mobileTypeSingleId: Int = res.getIdentifier("mobile_type_single", "id", "com.android.systemui")
val mobileTypeSingle = statusBarMobileView.findViewById<TextView>(mobileTypeSingleId)
//更改顺序
if (getLocation == 1) {
mobileGroup.removeView(mobileTypeSingle)
mobileGroup.addView(mobileTypeSingle)
mobileGroup.removeView(mobileContainerLeft)
mobileGroup.addView(mobileContainerLeft)
}
//更改样式
mobileTypeSingle.textSize = size
if (isBold) {
mobileTypeSingle.typeface = Typeface.DEFAULT_BOLD
}
mobileTypeSingle.setPadding(
leftAndRightMargin, upAndDownPosition, leftAndRightMargin, 0
)
it.thisObject.invokeMethodAuto("updateState",mobileIconState)
}
//显示非上网卡的大图标
if (!isOnlyShowNetwork) {
findMethod("com.android.systemui.statusbar.StatusBarMobileView") {
name == "updateState"
}.hookAfter {
val mobileIconState = it.args[0]
val statusBarMobileView = it.thisObject as ViewGroup
val context: Context = statusBarMobileView.context
val res: Resources = context.resources
val mobileTypeSingleId: Int = res.getIdentifier("mobile_type_single", "id", "com.android.systemui")
val mobileTypeSingle = statusBarMobileView.findViewById<TextView>(mobileTypeSingleId)
if (!mobileIconState.getObjectAs<Boolean>("dataConnected") && !mobileIconState.getObjectAs<Boolean>("wifiAvailable")) {
mobileTypeSingle.visibility = View.VISIBLE
}
}
}
}
}

View File

@@ -0,0 +1,65 @@
package com.lt2333.simplicitytools.hooks.rules.t.systemui
import android.content.Context
import android.os.SystemClock
import android.view.MotionEvent
import android.view.View.OnTouchListener
import android.view.ViewGroup
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.hookBefore
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
import de.robv.android.xposed.XposedHelpers
import kotlin.math.abs
object StatusBarDoubleTapToSleepForT : HookRegister() {
override fun init() = hasEnable("status_bar_double_tap_to_sleep") {
findMethod("com.android.systemui.statusbar.phone.MiuiPhoneStatusBarView") {
name == "onFinishInflate"
}.hookBefore {
val view = it.thisObject as ViewGroup
XposedHelpers.setAdditionalInstanceField(view, "currentTouchTime", 0L)
XposedHelpers.setAdditionalInstanceField(view, "currentTouchX", 0f)
XposedHelpers.setAdditionalInstanceField(view, "currentTouchY", 0f)
view.setOnTouchListener(OnTouchListener { v, event ->
if (event.action != MotionEvent.ACTION_DOWN) return@OnTouchListener false
var currentTouchTime =
XposedHelpers.getAdditionalInstanceField(view, "currentTouchTime") as Long
var currentTouchX =
XposedHelpers.getAdditionalInstanceField(view, "currentTouchX") as Float
var currentTouchY =
XposedHelpers.getAdditionalInstanceField(view, "currentTouchY") as Float
val lastTouchTime = currentTouchTime
val lastTouchX = currentTouchX
val lastTouchY = currentTouchY
currentTouchTime = System.currentTimeMillis()
currentTouchX = event.x
currentTouchY = event.y
if (currentTouchTime - lastTouchTime < 250L && abs(currentTouchX - lastTouchX) < 100f && abs(
currentTouchY - lastTouchY
) < 100f
) {
XposedHelpers.callMethod(
v.context.getSystemService(Context.POWER_SERVICE),
"goToSleep",
SystemClock.uptimeMillis()
)
currentTouchTime = 0L
currentTouchX = 0f
currentTouchY = 0f
}
XposedHelpers.setAdditionalInstanceField(
view,
"currentTouchTime",
currentTouchTime
)
XposedHelpers.setAdditionalInstanceField(view, "currentTouchX", currentTouchX)
XposedHelpers.setAdditionalInstanceField(view, "currentTouchY", currentTouchY)
v.performClick()
false
})
}
}
}

View File

@@ -0,0 +1,474 @@
package com.lt2333.simplicitytools.hooks.rules.t.systemui
import android.app.KeyguardManager
import android.content.Context
import android.content.res.Configuration
import android.content.res.Resources
import android.view.Gravity
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout
import cn.fkj233.ui.activity.dp2px
import com.github.kyuubiran.ezxhelper.utils.*
import com.lt2333.simplicitytools.utils.XSPUtils
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object StatusBarLayoutForT : HookRegister() {
private val getMode = XSPUtils.getInt("status_bar_layout_mode", 0)
private val isCompatibilityMode = XSPUtils.getBoolean("layout_compatibility_mode", false)
private var statusBarLeft = 0
private var statusBarTop = 0
private var statusBarRight = 0
private var statusBarBottom = 0
override fun init() {
var mLeftLayout: LinearLayout? = null
var mRightLayout: LinearLayout? = null
var mCenterLayout: LinearLayout?
var statusBar: ViewGroup? = null
//判断屏幕状态更新布局 mode: 1正常布局 2居中布局
fun updateLayout(context: Context,mode: Int) {
when(mode){
1->{
val mConfiguration: Configuration = context.resources.configuration
if (mConfiguration.orientation == Configuration.ORIENTATION_PORTRAIT) { //横屏
statusBar!!.setPadding(statusBarLeft, statusBarTop, statusBarRight, statusBarBottom)
}
}
2->{
val mConfiguration: Configuration = context.resources.configuration
if (mConfiguration.orientation == Configuration.ORIENTATION_PORTRAIT) { //横屏
mLeftLayout!!.setPadding(statusBarLeft, 0, 0, 0)
mRightLayout!!.setPadding(0, 0, statusBarRight, 0)
statusBar!!.setPadding(0, statusBarTop, 0, statusBarBottom)
}else{ //竖屏
mLeftLayout!!.setPadding(0, 0, 0, 0)
mRightLayout!!.setPadding(0, 0, 0, 0)
}
}
}
}
//判断是否开启挖孔兼容模式
if (isCompatibilityMode) {
findMethod("com.android.systemui.ScreenDecorations") {
name == "boundsFromDirection" && parameterCount == 3 && isStatic
}.hookBefore {
it.args[1] = 0
}
}
//修改对应布局
when (getMode) {
//默认
0 -> {
findMethod("com.android.systemui.statusbar.phone.fragment.CollapsedStatusBarFragment") {
name == "onViewCreated" && parameterCount == 2
}.hookAfter { param ->
val miuiPhoneStatusBarView = param.thisObject.getObjectAs<ViewGroup>("mStatusBar")
val context: Context = miuiPhoneStatusBarView.context
val res: Resources = miuiPhoneStatusBarView.resources
val statusBarId: Int = res.getIdentifier("status_bar", "id", "com.android.systemui")
statusBar = miuiPhoneStatusBarView.findViewById(statusBarId)
if (statusBar == null) return@hookAfter
statusBarLeft = statusBar!!.paddingLeft
statusBarTop = statusBar!!.paddingTop
statusBarRight = statusBar!!.paddingRight
statusBarBottom = statusBar!!.paddingBottom
if (isCompatibilityMode) {
val customLeftMargin = XSPUtils.getInt("status_bar_left_margin", 0)
if (customLeftMargin != 0) {
statusBarLeft = customLeftMargin
}
val customRightMargin = XSPUtils.getInt("status_bar_right_margin", 0)
if (customRightMargin != 0) {
statusBarRight = customRightMargin
}
updateLayout(context,1)
}
}
//兼容模式
findMethod("com.android.systemui.statusbar.phone.PhoneStatusBarView") {
name == "updateLayoutForCutout"
}.hookAfter {
if (isCompatibilityMode) {
val context = (it.thisObject as ViewGroup).context
updateLayout(context,1)
}
}
}
//时钟居中
1 -> {
findMethod("com.android.systemui.statusbar.phone.fragment.CollapsedStatusBarFragment") {
name == "onViewCreated" && parameterCount == 2
}.hookAfter { param ->
val miuiPhoneStatusBarView = param.thisObject.getObjectAs<ViewGroup>("mStatusBar")
val context: Context = miuiPhoneStatusBarView.context
val res: Resources = miuiPhoneStatusBarView.resources
val statusBarId: Int = res.getIdentifier("status_bar", "id", "com.android.systemui")
val statusBarContentsId: Int = res.getIdentifier(
"status_bar_contents", "id", "com.android.systemui"
)
val systemIconAreaId: Int = res.getIdentifier("system_icon_area", "id", "com.android.systemui")
val clockId: Int = res.getIdentifier("clock", "id", "com.android.systemui")
val phoneStatusBarLeftContainerId: Int = res.getIdentifier(
"phone_status_bar_left_container", "id", "com.android.systemui"
)
val notificationIconAreaInnerId: Int = res.getIdentifier(
"notification_icon_area_inner", "id", "com.android.systemui"
)
statusBar = miuiPhoneStatusBarView.findViewById(statusBarId)
val statusBarContents: ViewGroup = miuiPhoneStatusBarView.findViewById(statusBarContentsId)
if (statusBar == null) return@hookAfter
val clock: TextView = miuiPhoneStatusBarView.findViewById(clockId)
val phoneStatusBarLeftContainer: ViewGroup = miuiPhoneStatusBarView.findViewById(
phoneStatusBarLeftContainerId
)
val notificationIconAreaInner: ViewGroup = miuiPhoneStatusBarView.findViewById(
notificationIconAreaInnerId
)
val systemIconArea: ViewGroup = miuiPhoneStatusBarView.findViewById(systemIconAreaId)
(clock.parent as ViewGroup).removeView(clock)
(phoneStatusBarLeftContainer.parent as ViewGroup).removeView(
phoneStatusBarLeftContainer
)
(notificationIconAreaInner.parent as ViewGroup).removeView(
notificationIconAreaInner
)
(systemIconArea.parent as ViewGroup).removeView(systemIconArea)
val mConstraintLayout = ConstraintLayout(context).also {
it.layoutParams = ConstraintLayout.LayoutParams(
ConstraintLayout.LayoutParams.MATCH_PARENT, ConstraintLayout.LayoutParams.MATCH_PARENT
)
}
mConstraintLayout.addView(notificationIconAreaInner)
val fullscreenNotificationIconAreaLp = LinearLayout.LayoutParams(
ConstraintLayout.LayoutParams.MATCH_PARENT, ConstraintLayout.LayoutParams.MATCH_PARENT
)
notificationIconAreaInner.layoutParams = fullscreenNotificationIconAreaLp
//增加一个左对齐布局
mLeftLayout = LinearLayout(context)
val leftLp: LinearLayout.LayoutParams = LinearLayout.LayoutParams(
0, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f
)
mLeftLayout!!.layoutParams = leftLp
mLeftLayout!!.gravity = Gravity.START or Gravity.CENTER_VERTICAL
//增加一个居中布局
mCenterLayout = LinearLayout(context)
val centerLp: LinearLayout.LayoutParams = LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT
)
mCenterLayout!!.layoutParams = centerLp
mCenterLayout!!.gravity = Gravity.CENTER or Gravity.CENTER_VERTICAL
mRightLayout = LinearLayout(context)
val rightLp: LinearLayout.LayoutParams = LinearLayout.LayoutParams(
0, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f
)
mRightLayout!!.layoutParams = rightLp
mRightLayout!!.gravity = Gravity.END or Gravity.CENTER_VERTICAL
mLeftLayout!!.addView(phoneStatusBarLeftContainer)
mLeftLayout!!.addView(mConstraintLayout)
mCenterLayout!!.addView(clock)
mRightLayout!!.addView(systemIconArea)
statusBarContents.addView(mLeftLayout, 0)
statusBarContents.addView(mCenterLayout)
statusBarContents.addView(mRightLayout)
statusBarLeft = statusBar!!.paddingLeft
statusBarTop = statusBar!!.paddingTop
statusBarRight = statusBar!!.paddingRight
statusBarBottom = statusBar!!.paddingBottom
if (isCompatibilityMode) {
val customLeftMargin = XSPUtils.getInt("status_bar_left_margin", 0)
if (customLeftMargin != 0) {
statusBarLeft = customLeftMargin
}
val customRightMargin = XSPUtils.getInt("status_bar_right_margin", 0)
if (customRightMargin != 0) {
statusBarRight = customRightMargin
}
updateLayout(context,2)
}
}
findMethod("com.android.systemui.statusbar.phone.PhoneStatusBarView") {
name == "updateLayoutForCutout"
}.hookAfter {
hasEnable("layout_compatibility_mode") {
val context = (it.thisObject as ViewGroup).context
updateLayout(context,2)
}
}
}
//时钟居右
2 -> {
findMethod("com.android.systemui.statusbar.phone.fragment.CollapsedStatusBarFragment") {
name == "onViewCreated" && parameterCount == 2
}.hookAfter { param ->
val miuiPhoneStatusBarView = param.thisObject.getObjectAs<ViewGroup>("mStatusBar")
val context: Context = miuiPhoneStatusBarView.context
val res: Resources = miuiPhoneStatusBarView.resources
//组件ID
val statusBarId: Int = res.getIdentifier("status_bar", "id", "com.android.systemui")
val clockId: Int = res.getIdentifier("clock", "id", "com.android.systemui")
val batteryId: Int = res.getIdentifier("battery", "id", "com.android.systemui")
//查找组件
statusBar = miuiPhoneStatusBarView.findViewById(statusBarId)
if (statusBar == null) return@hookAfter
val clock: TextView = miuiPhoneStatusBarView.findViewById(clockId)
val battery: ViewGroup = miuiPhoneStatusBarView.findViewById(batteryId)
//新建布局
val rightLp = LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT
).also {
it.marginStart = dp2px(context, 5f)
}
mRightLayout = LinearLayout(context).also {
it.layoutParams = rightLp
}
//添加布局与组件
battery.addView(mRightLayout)
(clock.parent as ViewGroup).removeView(clock)
mRightLayout!!.addView(clock)
statusBarLeft = statusBar!!.paddingLeft
statusBarTop = statusBar!!.paddingTop
statusBarRight = statusBar!!.paddingRight
statusBarBottom = statusBar!!.paddingBottom
if (isCompatibilityMode) {
val customLeftMargin = XSPUtils.getInt("status_bar_left_margin", 0)
if (customLeftMargin != 0) {
statusBarLeft = customLeftMargin
}
val customRightMargin = XSPUtils.getInt("status_bar_right_margin", 0)
if (customRightMargin != 0) {
statusBarRight = customRightMargin
}
updateLayout(context,1)
}
}
//兼容模式
findMethod("com.android.systemui.statusbar.phone.PhoneStatusBarView") {
name == "updateLayoutForCutout"
}.hookAfter {
if (isCompatibilityMode) {
val context = (it.thisObject as ViewGroup).context
updateLayout(context,1)
}
}
}
//时钟居中+图标居左
3 -> {
findMethod("com.android.systemui.statusbar.phone.fragment.CollapsedStatusBarFragment") {
name == "onViewCreated" && parameterCount == 2
}.hookAfter { param ->
val miuiPhoneStatusBarView = param.thisObject.getObjectAs<ViewGroup>("mStatusBar")
val context: Context = miuiPhoneStatusBarView.context
val res: Resources = miuiPhoneStatusBarView.resources
val statusBarId: Int = res.getIdentifier("status_bar", "id", "com.android.systemui")
val statusBarContentsId: Int = res.getIdentifier(
"status_bar_contents", "id", "com.android.systemui"
)
val systemIconAreaId: Int = res.getIdentifier("system_icon_area", "id", "com.android.systemui")
val clockId: Int = res.getIdentifier("clock", "id", "com.android.systemui")
val phoneStatusBarLeftContainerId: Int = res.getIdentifier(
"phone_status_bar_left_container", "id", "com.android.systemui"
)
val fullscreenNotificationIconAreaId: Int = res.getIdentifier(
"fullscreen_notification_icon_area", "id", "com.android.systemui"
)
val statusIconsId: Int = res.getIdentifier(
"statusIcons", "id", "com.android.systemui"
)
val systemIconsId: Int = res.getIdentifier(
"system_icons", "id", "com.android.systemui"
)
val batteryId: Int = res.getIdentifier(
"battery", "id", "com.android.systemui"
)
statusBar = miuiPhoneStatusBarView.findViewById(statusBarId)
val statusBarContents: ViewGroup = miuiPhoneStatusBarView.findViewById(statusBarContentsId)
if (statusBar == null) return@hookAfter
val clock: TextView = miuiPhoneStatusBarView.findViewById(clockId)
val phoneStatusBarLeftContainer: ViewGroup = miuiPhoneStatusBarView.findViewById(
phoneStatusBarLeftContainerId
)
val fullscreenNotificationIconArea: ViewGroup = miuiPhoneStatusBarView.findViewById(
fullscreenNotificationIconAreaId
)
val systemIconArea: ViewGroup = miuiPhoneStatusBarView.findViewById(systemIconAreaId)
val statusIcons: ViewGroup = miuiPhoneStatusBarView.findViewById(statusIconsId)
val systemIcons: ViewGroup = miuiPhoneStatusBarView.findViewById(systemIconsId)
val battery: ViewGroup = miuiPhoneStatusBarView.findViewById(batteryId)
(clock.parent as ViewGroup).removeView(clock)
(phoneStatusBarLeftContainer.parent as ViewGroup).removeView(
phoneStatusBarLeftContainer
)
(systemIconArea.parent as ViewGroup).removeView(systemIconArea)
(statusIcons.parent as ViewGroup).removeView(statusIcons)
(systemIcons.parent as ViewGroup).removeView(systemIcons)
(battery.parent as ViewGroup).removeView(battery)
(fullscreenNotificationIconArea.parent as ViewGroup).removeView(
fullscreenNotificationIconArea
)
val mConstraintLayout = ConstraintLayout(context).also {
it.layoutParams = ConstraintLayout.LayoutParams(
ConstraintLayout.LayoutParams.MATCH_PARENT, ConstraintLayout.LayoutParams.MATCH_PARENT
)
}
mConstraintLayout.addView(fullscreenNotificationIconArea)
mConstraintLayout.addView(battery)
battery.layoutParams = ConstraintLayout.LayoutParams(
ConstraintLayout.LayoutParams.WRAP_CONTENT, ConstraintLayout.LayoutParams.MATCH_PARENT
).also {
it.endToEnd = 0
}
fullscreenNotificationIconArea.layoutParams = ConstraintLayout.LayoutParams(
0, ConstraintLayout.LayoutParams.MATCH_PARENT
).also {
it.startToEnd = batteryId
it.endToEnd = 0
}
fullscreenNotificationIconArea.layoutDirection = View.LAYOUT_DIRECTION_RTL
//增加一个左对齐布局
mLeftLayout = LinearLayout(context)
val leftLp: LinearLayout.LayoutParams = LinearLayout.LayoutParams(
0, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f
)
mLeftLayout!!.layoutParams = leftLp
mLeftLayout!!.gravity = Gravity.START or Gravity.CENTER_VERTICAL
//增加一个居中布局
mCenterLayout = LinearLayout(context)
val centerLp: LinearLayout.LayoutParams = LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT
)
mCenterLayout!!.layoutParams = centerLp
mCenterLayout!!.gravity = Gravity.CENTER or Gravity.CENTER_VERTICAL
//增加一个右布局
mRightLayout = LinearLayout(context)
val rightLp: LinearLayout.LayoutParams = LinearLayout.LayoutParams(
0, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f
)
mRightLayout!!.layoutParams = rightLp
mRightLayout!!.gravity = Gravity.END or Gravity.CENTER_VERTICAL
mLeftLayout!!.addView(phoneStatusBarLeftContainer)
mLeftLayout!!.addView(statusIcons)
statusIcons.layoutDirection = View.LAYOUT_DIRECTION_RTL
mCenterLayout!!.addView(clock)
mRightLayout!!.addView(mConstraintLayout)
fullscreenNotificationIconArea.layoutDirection = View.LAYOUT_DIRECTION_RTL
statusBarContents.addView(mLeftLayout, 0)
statusBarContents.addView(mCenterLayout)
statusBarContents.addView(mRightLayout)
statusBarLeft = statusBar!!.paddingLeft
statusBarTop = statusBar!!.paddingTop
statusBarRight = statusBar!!.paddingRight
statusBarBottom = statusBar!!.paddingBottom
if (isCompatibilityMode) {
val customLeftMargin = XSPUtils.getInt("status_bar_left_margin", 0)
if (customLeftMargin != 0) {
statusBarLeft = customLeftMargin
}
val customRightMargin = XSPUtils.getInt("status_bar_right_margin", 0)
if (customRightMargin != 0) {
statusBarRight = customRightMargin
}
updateLayout(context,2)
}
}
//兼容模式
findMethod("com.android.systemui.statusbar.phone.PhoneStatusBarView") {
name == "updateLayoutForCutout"
}.hookAfter {
if (isCompatibilityMode) {
val context = (it.thisObject as ViewGroup).context
updateLayout(context,2)
}
}
//解决重叠
findMethod("com.android.systemui.statusbar.phone.MiuiCollapsedStatusBarFragment") {
name == "showClock" && parameterTypes[0] == Boolean::class.java
}.hookAfter {
val miuiPhoneStatusBarView = it.thisObject.getObjectAs<ViewGroup>("mStatusBar")
val res = miuiPhoneStatusBarView.resources
val statusBarId = res.getIdentifier("status_bar", "id", "com.android.systemui")
val statusBar1 = miuiPhoneStatusBarView.findViewById<ViewGroup>(statusBarId)
//非锁屏下整个状态栏布局
val keyguardMgr = statusBar1.context.getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager
if (keyguardMgr.isKeyguardLocked) {
statusBar1!!.visibility = View.GONE
} else {
statusBar1!!.visibility = View.VISIBLE
}
}
//TODO: 修改图标的顺序
/*findConstructor("com.android.systemui.statusbar.phone.StatusBarIconList") {
parameterCount == 1
}.hookBefore {
}*/
}
}
}
}

View File

@@ -0,0 +1,20 @@
package com.lt2333.simplicitytools.hooks.rules.t.systemui
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.hookBefore
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object StatusBarNetworkSpeedRefreshSpeedForT : HookRegister() {
override fun init() {
findMethod("com.android.systemui.statusbar.policy.NetworkSpeedController") {
name == "postUpdateNetworkSpeedDelay" && parameterTypes[0] == Long::class.java
}.hookBefore {
hasEnable("status_bar_network_speed_refresh_speed") {
it.args[0] = 1000L
}
}
}
}

View File

@@ -0,0 +1,340 @@
package com.lt2333.simplicitytools.hooks.rules.t.systemui
import android.annotation.SuppressLint
import android.content.Context
import android.os.Handler
import android.provider.Settings
import android.util.TypedValue
import android.view.Gravity
import android.widget.TextView
import com.github.kyuubiran.ezxhelper.utils.*
import com.lt2333.simplicitytools.utils.XSPUtils
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
import java.lang.reflect.Method
import java.text.SimpleDateFormat
import java.util.*
object StatusBarTimeCustomizationForT : HookRegister() {
private val getMode = XSPUtils.getInt("custom_clock_mode", 0)
private val getClockSize = XSPUtils.getInt("status_bar_clock_size", 0)
private val getClockDoubleSize = XSPUtils.getInt("status_bar_clock_double_line_size", 0)
private val isYear = XSPUtils.getBoolean("status_bar_time_year", false)
private val isMonth = XSPUtils.getBoolean("status_bar_time_month", false)
private val isDay = XSPUtils.getBoolean("status_bar_time_day", false)
private val isWeek = XSPUtils.getBoolean("status_bar_time_week", false)
private val isHideSpace = XSPUtils.getBoolean("status_bar_time_hide_space", false)
private val isDoubleLine = XSPUtils.getBoolean("status_bar_time_double_line", false)
private val isSecond = XSPUtils.getBoolean("status_bar_time_seconds", false)
private val isDoubleHour = XSPUtils.getBoolean("status_bar_time_double_hour", false)
private val isPeriod = XSPUtils.getBoolean("status_bar_time_period", true)
private val isCenterAlign = XSPUtils.getBoolean("status_bar_time_double_line_center_align", false)
//极客模式
private val getGeekClockSize = XSPUtils.getInt("status_bar_clock_size_geek", 0)
private val getGeekFormat = XSPUtils.getString("custom_clock_format_geek", "HH:mm:ss")
private val isGeekCenterAlign = XSPUtils.getBoolean("status_bar_time_center_align_geek", false)
private lateinit var nowTime: Date
private var str = ""
@SuppressLint("SetTextI18n")
override fun init() {
when (getMode) {
//预设模式
1 -> {
var c: Context? = null
findConstructor("com.android.systemui.statusbar.views.MiuiClock") {
paramCount == 3
}.hookAfter {
try {
c = it.args[0] as Context
val textV = it.thisObject as TextView
if (textV.resources.getResourceEntryName(textV.id) != "clock") return@hookAfter
textV.isSingleLine = false
if (isDoubleLine) {
str = "\n"
var clockDoubleLineSize = 7F
if (getClockDoubleSize != 0) {
clockDoubleLineSize = getClockDoubleSize.toFloat()
}
textV.setTextSize(TypedValue.COMPLEX_UNIT_DIP, clockDoubleLineSize)
textV.setLineSpacing(0F, 0.8F)
} else {
if (getClockSize != 0) {
val clockSize = getClockSize.toFloat()
textV.setTextSize(TypedValue.COMPLEX_UNIT_DIP, clockSize)
}
}
val d: Method = textV.javaClass.getDeclaredMethod("updateTime")
val r = Runnable {
d.isAccessible = true
d.invoke(textV)
}
class T : TimerTask() {
override fun run() {
Handler(textV.context.mainLooper).post(r)
}
}
Timer().scheduleAtFixedRate(
T(), 1000 - System.currentTimeMillis() % 1000, 1000
)
} catch (_: Exception) {
}
}
findMethod("com.android.systemui.statusbar.views.MiuiClock") {
name == "updateTime"
}.hookAfter {
try {
val textV = it.thisObject as TextView
if (textV.resources.getResourceEntryName(textV.id) == "clock") {
val t = Settings.System.getString(
c!!.contentResolver, Settings.System.TIME_12_24
)
val is24 = t == "24"
nowTime = Calendar.getInstance().time
textV.text = getDate(c!!) + str + getTime(c!!, is24)
}
} catch (_: Exception) {
}
}
if (isCenterAlign) {
findConstructor("com.android.systemui.statusbar.views.MiuiClock") {
paramCount == 3
}.hookAfter {
try {
val textV = it.thisObject as TextView
if (textV.resources.getResourceEntryName(textV.id) == "clock") {
c = it.args[0] as Context
val textV = it.thisObject as TextView
textV.gravity = Gravity.CENTER
}
} catch (_: Exception) {
}
}
}
}
//极客模式
2 -> {
var c: Context? = null
findConstructor("com.android.systemui.statusbar.views.MiuiClock") {
paramCount == 3
}.hookAfter {
try {
c = it.args[0] as Context
val textV = it.thisObject as TextView
if (textV.resources.getResourceEntryName(textV.id) != "clock") return@hookAfter
textV.isSingleLine = false
textV.setLineSpacing(0F, 0.8F)
if (getGeekClockSize != 0) {
val clockSize = getGeekClockSize.toFloat()
textV.setTextSize(TypedValue.COMPLEX_UNIT_DIP, clockSize)
}
val d: Method = textV.javaClass.getDeclaredMethod("updateTime")
val r = Runnable {
d.isAccessible = true
d.invoke(textV)
}
class T : TimerTask() {
override fun run() {
Handler(textV.context.mainLooper).post(r)
}
}
Timer().scheduleAtFixedRate(
T(), 1000 - System.currentTimeMillis() % 1000, 1000
)
} catch (_: Exception) {
}
}
findMethod("com.android.systemui.statusbar.views.MiuiClock") {
name == "updateTime"
}.hookBefore {
try {
val textV = it.thisObject as TextView
if (textV.resources.getResourceEntryName(textV.id) == "clock") {
val mMiuiStatusBarClockController = textV.getObject("mMiuiStatusBarClockController")
val mCalendar = mMiuiStatusBarClockController.invokeMethodAuto("getCalendar")
mCalendar?.invokeMethodAuto(
"setTimeInMillis", System.currentTimeMillis()
)
val textSb = StringBuilder()
val formatSb = StringBuilder(getGeekFormat.toString())
mCalendar?.invokeMethodAuto("format", c, textSb, formatSb)
textV.text = textSb.toString()
it.result = null
}
} catch (_: Exception) {
}
}
if (isGeekCenterAlign) {
findConstructor("com.android.systemui.statusbar.views.MiuiClock") {
paramCount == 3
}.hookAfter {
try {
val textV = it.thisObject as TextView
if (textV.resources.getResourceEntryName(textV.id) == "clock") {
c = it.args[0] as Context
val textV = it.thisObject as TextView
textV.gravity = Gravity.CENTER
}
} catch (_: Exception) {
}
}
}
}
}
}
@SuppressLint("SimpleDateFormat")
private fun getDate(context: Context): String {
var datePattern = ""
val isZh = isZh(context)
if (isYear) {
if (isZh) {
datePattern += "YY年"
} else {
datePattern += "YY"
if (isMonth || isDay) datePattern += "/"
}
}
if (isMonth) {
if (isZh) {
datePattern += "M月"
} else {
datePattern += "M"
if (isDay) datePattern += "/"
}
}
if (isDay) {
datePattern += if (isZh) {
"d日"
} else {
"d"
}
}
if (isWeek) {
if (!isHideSpace) datePattern = "$datePattern "
datePattern += "E"
if (!isDoubleLine) {
if (!isHideSpace) datePattern = "$datePattern "
}
}
datePattern = SimpleDateFormat(datePattern).format(nowTime)
return datePattern
}
@SuppressLint("SimpleDateFormat")
private fun getTime(context: Context, t: Boolean): String {
var timePattern = ""
val isZh = isZh(context)
timePattern += if (t) "HH:mm" else "h:mm"
if (isSecond) timePattern += ":ss"
timePattern = SimpleDateFormat(timePattern).format(nowTime)
if (isZh) timePattern = getPeriod(isZh) + timePattern else timePattern += getPeriod(isZh)
timePattern = getDoubleHour() + timePattern
return timePattern
}
@SuppressLint("SimpleDateFormat")
private fun getPeriod(isZh: Boolean): String {
var period = ""
if (isPeriod) {
if (isZh) {
when (SimpleDateFormat("HH").format(nowTime)) {
"00", "01", "02", "03", "04", "05" -> {
period = "凌晨"
}
"06", "07", "08", "09", "10", "11" -> {
period = "上午"
}
"12" -> {
period = "中午"
}
"13", "14", "15", "16", "17" -> {
period = "下午"
}
"18" -> {
period = "傍晚"
}
"19", "20", "21", "22", "23" -> {
period = "晚上"
}
}
} else {
period = SimpleDateFormat("a").format(nowTime)
if (!isHideSpace) {
period = " $period"
}
}
}
return period
}
@SuppressLint("SimpleDateFormat")
private fun getDoubleHour(): String {
var doubleHour = ""
if (isDoubleHour) {
when (SimpleDateFormat("HH").format(nowTime)) {
"23", "00" -> {
doubleHour = "子时"
}
"01", "02" -> {
doubleHour = "丑时"
}
"03", "04" -> {
doubleHour = "寅时"
}
"05", "06" -> {
doubleHour = "卯时"
}
"07", "08" -> {
doubleHour = "辰时"
}
"09", "10" -> {
doubleHour = "巳时"
}
"11", "12" -> {
doubleHour = "午时"
}
"13", "14" -> {
doubleHour = "未时"
}
"15", "16" -> {
doubleHour = "申时"
}
"17", "18" -> {
doubleHour = "酉时"
}
"19", "20" -> {
doubleHour = "戌时"
}
"21", "22" -> {
doubleHour = "亥时"
}
}
if (!isHideSpace) {
doubleHour += " "
}
}
return doubleHour
}
private fun isZh(context: Context): Boolean {
val locale = context.resources.configuration.locale
val language = locale.language
return language.endsWith("zh")
}
}

View File

@@ -0,0 +1,41 @@
package com.lt2333.simplicitytools.hooks.rules.t.systemui
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.hookAfter
import com.github.kyuubiran.ezxhelper.utils.putObject
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object WaveChargeForT: HookRegister() {
override fun init() {
hasEnable("enable_wave_charge_animation") {
findMethod("com.android.keyguard.charge.ChargeUtils") {
name == "supportWaveChargeAnimation"
}.hookAfter {
val ex = Throwable()
val stackElement = ex.stackTrace
var mResult = false
val classTrue = setOf(
"com.android.keyguard.charge.ChargeUtils",
"com.android.keyguard.charge.container.MiuiChargeContainerView"
)
for (i in stackElement.indices) {
when (stackElement[i].className) {
in classTrue -> {
mResult = true
break
}
}
}
it.result = mResult
}
findMethod("com.android.keyguard.charge.wave.WaveView") {
name == "updateWaveHeight"
}.hookAfter {
it.thisObject.putObject("mWaveXOffset", 0)
}
}
}
}

View File

@@ -0,0 +1,439 @@
@file:Suppress("unused")
package com.lt2333.simplicitytools.utils
import android.annotation.SuppressLint
import android.content.res.XResources
import com.github.kyuubiran.ezxhelper.init.InitFields.ezXClassLoader
import com.github.kyuubiran.ezxhelper.utils.Log
import dalvik.system.BaseDexClassLoader
import de.robv.android.xposed.XC_MethodHook
import de.robv.android.xposed.XC_MethodHook.MethodHookParam
import de.robv.android.xposed.XC_MethodReplacement
import de.robv.android.xposed.XposedBridge.*
import de.robv.android.xposed.XposedHelpers.*
import de.robv.android.xposed.callbacks.XC_LayoutInflated
import java.lang.reflect.Field
import java.lang.reflect.Member
import java.lang.reflect.Modifier
import java.util.Enumeration
typealias MethodHookParam = MethodHookParam
typealias Replacer = (MethodHookParam) -> Any?
typealias Hooker = (MethodHookParam) -> Unit
fun Class<*>.hookMethod(method: String?, vararg args: Any?) = try {
findAndHookMethod(this, method, *args)
} catch (e: NoSuchMethodError) {
Log.e(e)
null
} catch (e: ClassNotFoundError) {
Log.e(e)
null
} catch (e: ClassNotFoundException) {
Log.e(e)
null
}
fun Member.hookMethod(callback: XC_MethodHook) = try {
hookMethod(this, callback)
} catch (e: Throwable) {
Log.e(e)
null
}
inline fun MethodHookParam.callHooker(crossinline hooker: Hooker) = try {
hooker(this)
} catch (e: Throwable) {
Log.e("Error occurred calling hooker on ${this.method}")
Log.e(e)
}
inline fun MethodHookParam.callReplacer(crossinline replacer: Replacer) = try {
replacer(this)
} catch (e: Throwable) {
Log.e("Error occurred calling replacer on ${this.method}")
Log.e(e)
null
}
inline fun Member.replaceMethod(crossinline replacer: Replacer) = hookMethod(object : XC_MethodReplacement() {
override fun replaceHookedMethod(param: MethodHookParam) = param.callReplacer(replacer)
})
inline fun Member.hookAfterMethod(crossinline hooker: Hooker) = hookMethod(object : XC_MethodHook() {
override fun afterHookedMethod(param: MethodHookParam) = param.callHooker(hooker)
})
inline fun Member.hookBeforeMethod(crossinline hooker: (MethodHookParam) -> Unit) = hookMethod(object : XC_MethodHook() {
override fun beforeHookedMethod(param: MethodHookParam) = param.callHooker(hooker)
})
inline fun Class<*>.hookBeforeMethod(
method: String?, vararg args: Any?, crossinline hooker: Hooker
) = hookMethod(method, *args, object : XC_MethodHook() {
override fun beforeHookedMethod(param: MethodHookParam) = param.callHooker(hooker)
})
inline fun Class<*>.hookAfterMethod(
method: String?, vararg args: Any?, crossinline hooker: Hooker
) = hookMethod(method, *args, object : XC_MethodHook() {
override fun afterHookedMethod(param: MethodHookParam) = param.callHooker(hooker)
})
inline fun Class<*>.replaceMethod(
method: String?, vararg args: Any?, crossinline replacer: Replacer
) = hookMethod(method, *args, object : XC_MethodReplacement() {
override fun replaceHookedMethod(param: MethodHookParam) = param.callReplacer(replacer)
})
fun Class<*>.hookAllMethods(methodName: String?, hooker: XC_MethodHook): Set<XC_MethodHook.Unhook> = try {
hookAllMethods(this, methodName, hooker)
} catch (e: NoSuchMethodError) {
Log.e(e)
emptySet()
} catch (e: ClassNotFoundError) {
Log.e(e)
emptySet()
} catch (e: ClassNotFoundException) {
Log.e(e)
emptySet()
}
inline fun Class<*>.hookBeforeAllMethods(methodName: String?, crossinline hooker: Hooker) = hookAllMethods(methodName, object : XC_MethodHook() {
override fun beforeHookedMethod(param: MethodHookParam) = param.callHooker(hooker)
})
inline fun Class<*>.hookAfterAllMethods(methodName: String?, crossinline hooker: Hooker) = hookAllMethods(methodName, object : XC_MethodHook() {
override fun afterHookedMethod(param: MethodHookParam) = param.callHooker(hooker)
})
inline fun Class<*>.replaceAllMethods(methodName: String?, crossinline replacer: Replacer) =
hookAllMethods(methodName, object : XC_MethodReplacement() {
override fun replaceHookedMethod(param: MethodHookParam) = param.callReplacer(replacer)
})
fun Class<*>.hookConstructor(vararg args: Any?) = try {
findAndHookConstructor(this, *args)
} catch (e: NoSuchMethodError) {
Log.e(e)
null
} catch (e: ClassNotFoundError) {
Log.e(e)
null
} catch (e: ClassNotFoundException) {
Log.e(e)
null
}
inline fun Class<*>.hookBeforeConstructor(vararg args: Any?, crossinline hooker: Hooker) = hookConstructor(*args, object : XC_MethodHook() {
override fun beforeHookedMethod(param: MethodHookParam) = param.callHooker(hooker)
})
inline fun Class<*>.hookAfterConstructor(vararg args: Any?, crossinline hooker: Hooker) = hookConstructor(*args, object : XC_MethodHook() {
override fun afterHookedMethod(param: MethodHookParam) = param.callHooker(hooker)
})
inline fun Class<*>.replaceConstructor(vararg args: Any?, crossinline hooker: Hooker) = hookConstructor(*args, object : XC_MethodReplacement() {
override fun replaceHookedMethod(param: MethodHookParam) = param.callHooker(hooker)
})
fun Class<*>.hookAllConstructors(hooker: XC_MethodHook): Set<XC_MethodHook.Unhook> = try {
hookAllConstructors(this, hooker)
} catch (e: NoSuchMethodError) {
Log.e(e)
emptySet()
} catch (e: ClassNotFoundError) {
Log.e(e)
emptySet()
} catch (e: ClassNotFoundException) {
Log.e(e)
emptySet()
}
inline fun Class<*>.hookAfterAllConstructors(crossinline hooker: Hooker) = hookAllConstructors(object : XC_MethodHook() {
override fun afterHookedMethod(param: MethodHookParam) = param.callHooker(hooker)
})
inline fun Class<*>.hookBeforeAllConstructors(crossinline hooker: Hooker) = hookAllConstructors(object : XC_MethodHook() {
override fun beforeHookedMethod(param: MethodHookParam) = param.callHooker(hooker)
})
inline fun Class<*>.replaceAllConstructors(crossinline hooker: Hooker) = hookAllConstructors(object : XC_MethodReplacement() {
override fun replaceHookedMethod(param: MethodHookParam) = param.callHooker(hooker)
})
fun String.hookMethod(
method: String?, vararg args: Any?
) = try {
findClass().hookMethod(method, *args)
} catch (e: ClassNotFoundError) {
Log.e(e)
null
} catch (e: ClassNotFoundException) {
Log.e(e)
null
}
inline fun String.hookBeforeMethod(
method: String?, vararg args: Any?, crossinline hooker: Hooker
) = try {
findClass().hookBeforeMethod(method, *args, hooker = hooker)
} catch (e: ClassNotFoundError) {
Log.e(e)
null
} catch (e: ClassNotFoundException) {
Log.e(e)
null
}
inline fun String.hookAfterMethod(
method: String?, vararg args: Any?, crossinline hooker: Hooker
) = try {
findClass().hookAfterMethod(method, *args, hooker = hooker)
} catch (e: ClassNotFoundError) {
Log.e(e)
null
} catch (e: ClassNotFoundException) {
Log.e(e)
null
}
inline fun String.replaceMethod(
method: String?, vararg args: Any?, crossinline replacer: Replacer
) = try {
findClass().replaceMethod(method, *args, replacer = replacer)
} catch (e: ClassNotFoundError) {
Log.e(e)
null
} catch (e: ClassNotFoundException) {
Log.e(e)
null
}
fun MethodHookParam.invokeOriginalMethod(): Any? = invokeOriginalMethod(method, thisObject, args)
inline fun <T, R> T.runCatchingOrNull(func: T.() -> R?) = try {
func()
} catch (e: Throwable) {
null
}
fun Any.getObjectField(field: String?): Any? = getObjectField(this, field)
fun Any.getObjectFieldOrNull(field: String?): Any? = runCatchingOrNull {
getObjectField(this, field)
}
@Suppress("UNCHECKED_CAST")
fun <T> Any.getObjectFieldAs(field: String?) = getObjectField(this, field) as T
@Suppress("UNCHECKED_CAST")
fun <T> Any.getObjectFieldOrNullAs(field: String?) = runCatchingOrNull {
getObjectField(this, field) as T
}
fun Any.getIntField(field: String?) = getIntField(this, field)
fun Any.getIntFieldOrNull(field: String?) = runCatchingOrNull {
getIntField(this, field)
}
fun Any.getLongField(field: String?) = getLongField(this, field)
fun Any.getLongFieldOrNull(field: String?) = runCatchingOrNull {
getLongField(this, field)
}
fun Any.getBooleanField(field: String?) = getBooleanField(this, field)
fun Any.getBooleanFieldOrNull(field: String?) = runCatchingOrNull {
getBooleanField(this, field)
}
fun Any.callMethod(methodName: String?, vararg args: Any?): Any? = callMethod(this, methodName, *args)
fun Any.callMethodOrNull(methodName: String?, vararg args: Any?): Any? = runCatchingOrNull {
callMethod(this, methodName, *args)
}
fun Class<*>.callStaticMethod(methodName: String?, vararg args: Any?): Any? = callStaticMethod(this, methodName, *args)
fun Class<*>.callStaticMethodOrNull(methodName: String?, vararg args: Any?): Any? = runCatchingOrNull {
callStaticMethod(this, methodName, *args)
}
@Suppress("UNCHECKED_CAST")
fun <T> Class<*>.callStaticMethodAs(methodName: String?, vararg args: Any?) = callStaticMethod(this, methodName, *args) as T
@Suppress("UNCHECKED_CAST")
fun <T> Class<*>.callStaticMethodOrNullAs(methodName: String?, vararg args: Any?) = runCatchingOrNull {
callStaticMethod(this, methodName, *args) as T
}
@Suppress("UNCHECKED_CAST")
fun <T> Class<*>.getStaticObjectFieldAs(field: String?) = getStaticObjectField(this, field) as T
@Suppress("UNCHECKED_CAST")
fun <T> Class<*>.getStaticObjectFieldOrNullAs(field: String?) = runCatchingOrNull {
getStaticObjectField(this, field) as T
}
fun Class<*>.getStaticObjectField(field: String?): Any? = getStaticObjectField(this, field)
fun Class<*>.getStaticObjectFieldOrNull(field: String?): Any? = runCatchingOrNull {
getStaticObjectField(this, field)
}
fun Class<*>.setStaticObjectField(field: String?, obj: Any?) = apply {
setStaticObjectField(this, field, obj)
}
fun Class<*>.setStaticObjectFieldIfExist(field: String?, obj: Any?) = apply {
try {
setStaticObjectField(this, field, obj)
} catch (ignored: Throwable) {
}
}
inline fun <reified T> Class<*>.findFieldByExactType(): Field? = findFirstFieldByExactType(this, T::class.java)
fun Class<*>.findFieldByExactType(type: Class<*>): Field? = findFirstFieldByExactType(this, type)
@Suppress("UNCHECKED_CAST")
fun <T> Any.callMethodAs(methodName: String?, vararg args: Any?) = callMethod(this, methodName, *args) as T
@Suppress("UNCHECKED_CAST")
fun <T> Any.callMethodOrNullAs(methodName: String?, vararg args: Any?) = runCatchingOrNull {
callMethod(this, methodName, *args) as T
}
fun Any.callMethod(methodName: String?, parameterTypes: Array<Class<*>>, vararg args: Any?): Any? =
callMethod(this, methodName, parameterTypes, *args)
fun Any.callMethodOrNull(
methodName: String?, parameterTypes: Array<Class<*>>, vararg args: Any?
): Any? = runCatchingOrNull {
callMethod(this, methodName, parameterTypes, *args)
}
fun Class<*>.callStaticMethod(
methodName: String?, parameterTypes: Array<Class<*>>, vararg args: Any?
): Any? = callStaticMethod(this, methodName, parameterTypes, *args)
fun Class<*>.callStaticMethodOrNull(
methodName: String?, parameterTypes: Array<Class<*>>, vararg args: Any?
): Any? = runCatchingOrNull {
callStaticMethod(this, methodName, parameterTypes, *args)
}
fun String.findClass(): Class<*> = findClass(this, ezXClassLoader)
fun String.findClassOrNull(): Class<*>? = findClassIfExists(this, ezXClassLoader)
fun Class<*>.new(vararg args: Any?): Any = newInstance(this, *args)
fun Class<*>.new(parameterTypes: Array<Class<*>>, vararg args: Any?): Any = newInstance(this, parameterTypes, *args)
fun Class<*>.findField(field: String?): Field = findField(this, field)
fun Class<*>.findFieldOrNull(field: String?): Field? = findFieldIfExists(this, field)
fun <T> T.setIntField(field: String?, value: Int) = apply {
setIntField(this, field, value)
}
fun <T> T.setLongField(field: String?, value: Long) = apply {
setLongField(this, field, value)
}
fun <T> T.setFloatField(field: String?, value: Float) = apply {
setFloatField(this, field, value)
}
fun <T> T.setBooleanField(field: String?, value: Boolean) = apply {
setBooleanField(this, field, value)
}
fun <T> T.setObjectField(field: String?, value: Any?) = apply {
setObjectField(this, field, value)
}
inline fun XResources.hookLayout(
id: Int, crossinline hooker: (XC_LayoutInflated.LayoutInflatedParam) -> Unit
) {
try {
hookLayout(id, object : XC_LayoutInflated() {
override fun handleLayoutInflated(liparam: LayoutInflatedParam) {
try {
hooker(liparam)
} catch (e: Throwable) {
Log.e(e)
}
}
})
} catch (e: Throwable) {
Log.e(e)
}
}
@SuppressLint("DiscouragedApi")
inline fun XResources.hookLayout(
pkg: String, type: String, name: String, crossinline hooker: (XC_LayoutInflated.LayoutInflatedParam) -> Unit
) {
try {
val id = getIdentifier(name, type, pkg)
hookLayout(id, hooker)
} catch (e: Throwable) {
Log.e(e)
}
}
fun Class<*>.findFirstFieldByExactType(type: Class<*>): Field = findFirstFieldByExactType(this, type)
fun Class<*>.findFirstFieldByExactTypeOrNull(type: Class<*>?): Field? = runCatchingOrNull {
findFirstFieldByExactType(this, type)
}
fun Any.getFirstFieldByExactType(type: Class<*>): Any? = javaClass.findFirstFieldByExactType(type).get(this)
@Suppress("UNCHECKED_CAST")
fun <T> Any.getFirstFieldByExactTypeAs(type: Class<*>) = javaClass.findFirstFieldByExactType(type).get(this) as? T
inline fun <reified T : Any> Any.getFirstFieldByExactType() = javaClass.findFirstFieldByExactType(T::class.java).get(this) as? T
fun Any.getFirstFieldByExactTypeOrNull(type: Class<*>?): Any? = runCatchingOrNull {
javaClass.findFirstFieldByExactTypeOrNull(type)?.get(this)
}
@Suppress("UNCHECKED_CAST")
fun <T> Any.getFirstFieldByExactTypeOrNullAs(type: Class<*>?) = getFirstFieldByExactTypeOrNull(type) as? T
inline fun <reified T> Any.getFirstFieldByExactTypeOrNull() = getFirstFieldByExactTypeOrNull(T::class.java) as? T
inline fun ClassLoader.findDexClassLoader(crossinline delegator: (BaseDexClassLoader) -> BaseDexClassLoader = { x -> x }): BaseDexClassLoader? {
var classLoader = this
while (classLoader !is BaseDexClassLoader) {
if (classLoader.parent != null) classLoader = classLoader.parent
else return null
}
return delegator(classLoader)
}
inline fun ClassLoader.allClassesList(crossinline delegator: (BaseDexClassLoader) -> BaseDexClassLoader = { x -> x }): List<String> {
return findDexClassLoader(delegator)?.getObjectField("pathList")?.getObjectFieldAs<Array<Any>>("dexElements")?.flatMap {
it.getObjectField("dexFile")?.callMethodAs<Enumeration<String>>("entries")?.toList().orEmpty()
}.orEmpty()
}
val Member.isStatic: Boolean
inline get() = Modifier.isStatic(modifiers)
val Member.isFinal: Boolean
inline get() = Modifier.isFinal(modifiers)
val Member.isPublic: Boolean
inline get() = Modifier.isPublic(modifiers)
val Member.isNotStatic: Boolean
inline get() = !isStatic
val Class<*>.isAbstract: Boolean
inline get() = !isPrimitive && Modifier.isAbstract(modifiers)

View File

@@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="63dp"
android:height="63dp"
android:autoMirrored="true"
android:viewportWidth="63"
android:viewportHeight="63">
<path
android:fillColor="#BCBDBE"
android:pathData="m17.85,15.85v17.3c0,0.83 0.67,1.5 1.5,1.5h13.3c0.83,0 1.5,-0.67 1.5,-1.5L34.15,15.85c0,-0.83 -0.68,-1.5 -1.5,-1.5h-13.3c-0.82,0 -1.5,0.67 -1.5,1.5ZM29.16,30.25h-6.32c-0.32,0 -0.59,-0.27 -0.59,-0.61v-10.27c0,-0.34 0.26,-0.61 0.59,-0.61h6.32c0.32,0 0.59,0.27 0.59,0.61v10.27c0,0.34 -0.26,0.61 -0.59,0.61Z" />
<path
android:fillColor="#BCBDBE"
android:pathData="m48.5,6.5L14.2,6.5c-2.32,0 -4.2,1.88 -4.2,4.2v41.3c0,2.49 2.01,4.5 4.5,4.5h34c2.49,0 4.5,-2.01 4.5,-4.5L53,11c0,-2.49 -2.01,-4.5 -4.5,-4.5ZM46.65,51.15h-30.3c-0.55,0 -1,-0.45 -1,-1L15.35,12.85c0,-0.55 0.45,-1 1,-1h30.3c0.55,0 1,0.45 1,1v37.3c0,0.55 -0.45,1 -1,1Z" />
</vector>

Some files were not shown because too many files have changed in this diff Show More