├── .gitattributes ├── .github └── workflows │ └── android.yml ├── .gitignore ├── LICENSE ├── app ├── .gitignore ├── build.gradle.kts ├── proguard-rules.pro └── src │ ├── .gitignore │ └── main │ ├── AndroidManifest.xml │ ├── assets │ └── xposed_init │ ├── kotlin │ └── top │ │ └── yukonga │ │ └── mediaControlOpt │ │ ├── MainHook.kt │ │ └── utils │ │ └── AppUtils.kt │ └── res │ └── values │ └── array.xml ├── build.gradle.kts ├── gradle.properties ├── gradle ├── libs.versions.toml └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle.kts /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.github/workflows/android.yml: -------------------------------------------------------------------------------- 1 | name: Android CI 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | workflow_dispatch: 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - uses: actions/checkout@v4 15 | - name: Setup JDK 16 | uses: actions/setup-java@v4 17 | with: 18 | distribution: 'zulu' 19 | java-version: 17 20 | - name: Setup Gradle 21 | uses: gradle/actions/setup-gradle@v4 22 | - name: Build with Gradle 23 | run: | 24 | echo ${{ secrets.SIGNING_KEY }} | base64 -d > keystore.jks 25 | ./gradlew assemble 26 | env: 27 | KEYSTORE_PATH: "../keystore.jks" 28 | KEYSTORE_PASS: ${{ secrets.KEY_STORE_PASSWORD }} 29 | KEY_ALIAS: ${{ secrets.ALIAS }} 30 | KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} 31 | - name: Upload Release Snapshot 32 | uses: actions/upload-artifact@v4 33 | with: 34 | name: MediaControl-Release-Snapshot 35 | path: app/build/outputs/apk/release 36 | compression-level: 9 37 | - name: Upload Debug Snapshot 38 | uses: actions/upload-artifact@v4 39 | with: 40 | name: MediaControl-Debug-Snapshot 41 | path: app/build/outputs/apk/debug 42 | compression-level: 9 43 | - name: Post to Telegram ci channel 44 | if: ${{ success() && github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && github.ref_type != 'tag' }} 45 | env: 46 | CHANNEL_ID: ${{ secrets.CHANNEL_ID }} 47 | BOT_TOKEN: ${{ secrets.BOT_TOKEN }} 48 | run: | 49 | if [ ! -z "${{ secrets.BOT_TOKEN }}" ]; then 50 | export RELEASE=$(find "app/build/outputs/apk/release/" -name "*.apk") 51 | export DEBUG=$(find "app/build/outputs/apk/debug/" -name "*.apk") 52 | event_path=$GITHUB_EVENT_PATH 53 | commit_count=$(jq -r '.commits | length' $event_path) 54 | { echo -e 'New CI from MediaControl-BlurBg\n'; git log -$commit_count --pretty=format:"%h %s"; } > ${{ github.workspace }}/git_log 55 | ESCAPED="$(cat ${{ github.workspace }}/git_log | gawk '{gsub(/[_*[\]()~`>#+=\|{}.!-]/,"\\\\\\\\&")}1' | sed -e 's|"|\\"|g' -e 's|^[0-9a-z]\+|__&__|' | hexdump -v -e '/1 "%02X"' | sed 's/\(..\)/%\1/g')" 56 | cd ${{ github.workspace }} 57 | curl -v "https://api.telegram.org/bot${BOT_TOKEN}/sendMediaGroup?chat_id=${CHANNEL_ID}&media=%5B%7B%22type%22%3A%22document%22%2C%22media%22%3A%22attach%3A%2F%2Frelease%22%7D%2C%7B%22type%22%3A%22document%22%2C%22media%22%3A%22attach%3A%2F%2Fdebug%22%2C%22caption%22%3A%22${ESCAPED}%22%2C%22parse_mode%22%3A%22MarkdownV2%22%7D%5D" -F release="@$RELEASE" -F debug="@$DEBUG" 58 | fi 59 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.toptal.com/developers/gitignore/api/java,linux,macos,gradle,kotlin,android,windows,jetbrains,androidstudio,visualstudiocode 2 | # Edit at https://www.toptal.com/developers/gitignore?templates=java,linux,macos,gradle,kotlin,android,windows,jetbrains,androidstudio,visualstudiocode 3 | 4 | ### Android ### 5 | # Gradle files 6 | .gradle/ 7 | build/ 8 | 9 | # Local configuration file (sdk path, etc) 10 | local.properties 11 | 12 | # Log/OS Files 13 | *.log 14 | 15 | # Android Studio generated files and folders 16 | captures/ 17 | .externalNativeBuild/ 18 | .cxx/ 19 | *.apk 20 | output.json 21 | 22 | # IntelliJ 23 | *.iml 24 | .idea/ 25 | misc.xml 26 | deploymentTargetDropDown.xml 27 | render.experimental.xml 28 | 29 | # Keystore files 30 | *.jks 31 | *.keystore 32 | 33 | # Google Services (e.g. APIs or Firebase) 34 | google-services.json 35 | 36 | # Android Profiling 37 | *.hprof 38 | 39 | ### Android Patch ### 40 | gen-external-apklibs 41 | 42 | # Replacement of .externalNativeBuild directories introduced 43 | # with Android Studio 3.5. 44 | 45 | ### Java ### 46 | # Compiled class file 47 | *.class 48 | 49 | # Log file 50 | 51 | # BlueJ files 52 | *.ctxt 53 | 54 | # Mobile Tools for Java (J2ME) 55 | .mtj.tmp/ 56 | 57 | # Package Files # 58 | *.jar 59 | *.war 60 | *.nar 61 | *.ear 62 | *.zip 63 | *.tar.gz 64 | *.rar 65 | 66 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 67 | hs_err_pid* 68 | replay_pid* 69 | 70 | ### JetBrains ### 71 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider 72 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 73 | 74 | # User-specific stuff 75 | .idea/**/workspace.xml 76 | .idea/**/tasks.xml 77 | .idea/**/usage.statistics.xml 78 | .idea/**/dictionaries 79 | .idea/**/shelf 80 | 81 | # AWS User-specific 82 | .idea/**/aws.xml 83 | 84 | # Generated files 85 | .idea/**/contentModel.xml 86 | 87 | # Sensitive or high-churn files 88 | .idea/**/dataSources/ 89 | .idea/**/dataSources.ids 90 | .idea/**/dataSources.local.xml 91 | .idea/**/sqlDataSources.xml 92 | .idea/**/dynamic.xml 93 | .idea/**/uiDesigner.xml 94 | .idea/**/dbnavigator.xml 95 | 96 | # Gradle 97 | .idea/**/gradle.xml 98 | .idea/**/libraries 99 | 100 | # Gradle and Maven with auto-import 101 | # When using Gradle or Maven with auto-import, you should exclude module files, 102 | # since they will be recreated, and may cause churn. Uncomment if using 103 | # auto-import. 104 | # .idea/artifacts 105 | # .idea/compiler.xml 106 | # .idea/jarRepositories.xml 107 | # .idea/modules.xml 108 | # .idea/*.iml 109 | # .idea/modules 110 | # *.iml 111 | # *.ipr 112 | 113 | # CMake 114 | cmake-build-*/ 115 | 116 | # Mongo Explorer plugin 117 | .idea/**/mongoSettings.xml 118 | 119 | # File-based project format 120 | *.iws 121 | 122 | # IntelliJ 123 | out/ 124 | 125 | # mpeltonen/sbt-idea plugin 126 | .idea_modules/ 127 | 128 | # JIRA plugin 129 | atlassian-ide-plugin.xml 130 | 131 | # Cursive Clojure plugin 132 | .idea/replstate.xml 133 | 134 | # SonarLint plugin 135 | .idea/sonarlint/ 136 | 137 | # Crashlytics plugin (for Android Studio and IntelliJ) 138 | com_crashlytics_export_strings.xml 139 | crashlytics.properties 140 | crashlytics-build.properties 141 | fabric.properties 142 | 143 | # Editor-based Rest Client 144 | .idea/httpRequests 145 | 146 | # Android studio 3.1+ serialized cache file 147 | .idea/caches/build_file_checksums.ser 148 | 149 | ### JetBrains Patch ### 150 | # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 151 | 152 | # *.iml 153 | # modules.xml 154 | # .idea/misc.xml 155 | # *.ipr 156 | 157 | # Sonarlint plugin 158 | # https://plugins.jetbrains.com/plugin/7973-sonarlint 159 | .idea/**/sonarlint/ 160 | 161 | # SonarQube Plugin 162 | # https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin 163 | .idea/**/sonarIssues.xml 164 | 165 | # Markdown Navigator plugin 166 | # https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced 167 | .idea/**/markdown-navigator.xml 168 | .idea/**/markdown-navigator-enh.xml 169 | .idea/**/markdown-navigator/ 170 | 171 | # Cache file creation bug 172 | # See https://youtrack.jetbrains.com/issue/JBR-2257 173 | .idea/$CACHE_FILE$ 174 | 175 | # CodeStream plugin 176 | # https://plugins.jetbrains.com/plugin/12206-codestream 177 | .idea/codestream.xml 178 | 179 | # Azure Toolkit for IntelliJ plugin 180 | # https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij 181 | .idea/**/azureSettings.xml 182 | 183 | ### Kotlin ### 184 | /.kotlin 185 | 186 | # Compiled class file 187 | 188 | # Log file 189 | 190 | # BlueJ files 191 | 192 | # Mobile Tools for Java (J2ME) 193 | 194 | # Package Files # 195 | 196 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 197 | 198 | ### Linux ### 199 | *~ 200 | 201 | # temporary files which can be created if a process still has a handle open of a deleted file 202 | .fuse_hidden* 203 | 204 | # KDE directory preferences 205 | .directory 206 | 207 | # Linux trash folder which might appear on any partition or disk 208 | .Trash-* 209 | 210 | # .nfs files are created when an open file is removed but is still being accessed 211 | .nfs* 212 | 213 | ### macOS ### 214 | # General 215 | .DS_Store 216 | .AppleDouble 217 | .LSOverride 218 | 219 | # Icon must end with two \r 220 | Icon 221 | 222 | 223 | # Thumbnails 224 | ._* 225 | 226 | # Files that might appear in the root of a volume 227 | .DocumentRevisions-V100 228 | .fseventsd 229 | .Spotlight-V100 230 | .TemporaryItems 231 | .Trashes 232 | .VolumeIcon.icns 233 | .com.apple.timemachine.donotpresent 234 | 235 | # Directories potentially created on remote AFP share 236 | .AppleDB 237 | .AppleDesktop 238 | Network Trash Folder 239 | Temporary Items 240 | .apdisk 241 | 242 | ### macOS Patch ### 243 | # iCloud generated files 244 | *.icloud 245 | 246 | ### VisualStudioCode ### 247 | .vscode/* 248 | !.vscode/settings.json 249 | !.vscode/tasks.json 250 | !.vscode/launch.json 251 | !.vscode/extensions.json 252 | !.vscode/*.code-snippets 253 | 254 | # Local History for Visual Studio Code 255 | .history/ 256 | 257 | # Built Visual Studio Code Extensions 258 | *.vsix 259 | 260 | ### VisualStudioCode Patch ### 261 | # Ignore all local history of files 262 | .history 263 | .ionide 264 | 265 | ### Windows ### 266 | # Windows thumbnail cache files 267 | Thumbs.db 268 | Thumbs.db:encryptable 269 | ehthumbs.db 270 | ehthumbs_vista.db 271 | 272 | # Dump file 273 | *.stackdump 274 | 275 | # Folder config file 276 | [Dd]esktop.ini 277 | 278 | # Recycle Bin used on file shares 279 | $RECYCLE.BIN/ 280 | 281 | # Windows Installer files 282 | *.cab 283 | *.msi 284 | *.msix 285 | *.msm 286 | *.msp 287 | 288 | # Windows shortcuts 289 | *.lnk 290 | 291 | ### Gradle ### 292 | .gradle 293 | **/build/ 294 | !src/**/build/ 295 | 296 | # Ignore Gradle GUI config 297 | gradle-app.setting 298 | 299 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 300 | !gradle-wrapper.jar 301 | 302 | # Avoid ignore Gradle wrappper properties 303 | !gradle-wrapper.properties 304 | 305 | # Cache of project 306 | .gradletasknamecache 307 | 308 | # Eclipse Gradle plugin generated files 309 | # Eclipse Core 310 | .project 311 | # JDT-specific (Eclipse Java Development Tools) 312 | .classpath 313 | 314 | ### Gradle Patch ### 315 | # Java heap dump 316 | 317 | ### AndroidStudio ### 318 | # Covers files to be ignored for android development using Android Studio. 319 | 320 | # Built application files 321 | *.ap_ 322 | *.aab 323 | 324 | # Files for the ART/Dalvik VM 325 | *.dex 326 | 327 | # Java class files 328 | 329 | # Generated files 330 | bin/ 331 | gen/ 332 | 333 | # Gradle files 334 | 335 | # Signing files 336 | .signing/ 337 | 338 | # Local configuration file (sdk path, etc) 339 | 340 | # Proguard folder generated by Eclipse 341 | proguard/ 342 | 343 | # Log Files 344 | 345 | # Android Studio 346 | /*/build/ 347 | /*/local.properties 348 | /*/out 349 | /*/*/build 350 | /*/*/production 351 | .navigation/ 352 | *.ipr 353 | *.swp 354 | 355 | # Keystore files 356 | 357 | # Google Services (e.g. APIs or Firebase) 358 | # google-services.json 359 | 360 | # Android Patch 361 | 362 | # External native build folder generated in Android Studio 2.2 and later 363 | .externalNativeBuild 364 | 365 | # NDK 366 | obj/ 367 | 368 | # IntelliJ IDEA 369 | /out/ 370 | 371 | # User-specific configurations 372 | .idea/caches/ 373 | .idea/libraries/ 374 | .idea/shelf/ 375 | .idea/workspace.xml 376 | .idea/tasks.xml 377 | .idea/.name 378 | .idea/compiler.xml 379 | .idea/copyright/profiles_settings.xml 380 | .idea/encodings.xml 381 | .idea/misc.xml 382 | .idea/modules.xml 383 | .idea/scopes/scope_settings.xml 384 | .idea/dictionaries 385 | .idea/vcs.xml 386 | .idea/jsLibraryMappings.xml 387 | .idea/datasources.xml 388 | .idea/dataSources.ids 389 | .idea/sqlDataSources.xml 390 | .idea/dynamic.xml 391 | .idea/uiDesigner.xml 392 | .idea/assetWizardSettings.xml 393 | .idea/gradle.xml 394 | .idea/jarRepositories.xml 395 | .idea/navEditor.xml 396 | 397 | # Legacy Eclipse project files 398 | .cproject 399 | .settings/ 400 | 401 | # Mobile Tools for Java (J2ME) 402 | 403 | # Package Files # 404 | 405 | # virtual machine crash logs (Reference: http://www.java.com/en/download/help/error_hotspot.xml) 406 | 407 | ## Plugin-specific files: 408 | 409 | # mpeltonen/sbt-idea plugin 410 | 411 | # JIRA plugin 412 | 413 | # Mongo Explorer plugin 414 | .idea/mongoSettings.xml 415 | 416 | # Crashlytics plugin (for Android Studio and IntelliJ) 417 | 418 | ### AndroidStudio Patch ### 419 | 420 | !/gradle/wrapper/gradle-wrapper.jar 421 | 422 | # End of https://www.toptal.com/developers/gitignore/api/java,linux,macos,gradle,kotlin,android,windows,jetbrains,androidstudio,visualstudiocode -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 YuKongA 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /release -------------------------------------------------------------------------------- /app/build.gradle.kts: -------------------------------------------------------------------------------- 1 | @file:Suppress("UnstableApiUsage") 2 | 3 | import com.android.build.gradle.internal.api.BaseVariantOutputImpl 4 | import java.util.Properties 5 | 6 | plugins { 7 | alias(libs.plugins.android.application) 8 | alias(libs.plugins.kotlin.android) 9 | } 10 | 11 | android { 12 | namespace = "top.yukonga.mediaControlOpt" 13 | compileSdk = 35 14 | defaultConfig { 15 | applicationId = namespace 16 | minSdk = 35 17 | targetSdk = 35 18 | versionCode = 4020 19 | versionName = "4.0.2" 20 | } 21 | val properties = Properties() 22 | runCatching { properties.load(project.rootProject.file("local.properties").inputStream()) } 23 | val keystorePath = properties.getProperty("KEYSTORE_PATH") ?: System.getenv("KEYSTORE_PATH") 24 | val keystorePwd = properties.getProperty("KEYSTORE_PASS") ?: System.getenv("KEYSTORE_PASS") 25 | val alias = properties.getProperty("KEY_ALIAS") ?: System.getenv("KEY_ALIAS") 26 | val pwd = properties.getProperty("KEY_PASSWORD") ?: System.getenv("KEY_PASSWORD") 27 | if (keystorePath != null) { 28 | signingConfigs { 29 | register("github") { 30 | storeFile = file(keystorePath) 31 | storePassword = keystorePwd 32 | keyAlias = alias 33 | keyPassword = pwd 34 | enableV3Signing = true 35 | enableV4Signing = true 36 | } 37 | } 38 | } else { 39 | signingConfigs { 40 | register("release") { 41 | enableV3Signing = true 42 | enableV4Signing = true 43 | } 44 | } 45 | } 46 | buildFeatures { 47 | buildConfig = true 48 | } 49 | buildTypes { 50 | release { 51 | isMinifyEnabled = true 52 | isShrinkResources = true 53 | vcsInfo.include = false 54 | proguardFiles("proguard-rules.pro") 55 | signingConfig = signingConfigs.getByName(if (keystorePath != null) "github" else "release") 56 | } 57 | debug { 58 | if (keystorePath != null) signingConfig = signingConfigs.getByName("github") 59 | } 60 | } 61 | java.toolchain.languageVersion = JavaLanguageVersion.of(21) 62 | kotlin.jvmToolchain(21) 63 | packaging { 64 | resources.excludes += "**" 65 | applicationVariants.all { 66 | outputs.all { 67 | (this as BaseVariantOutputImpl).outputFileName = "MediaControlOpt-$versionName.apk" 68 | } 69 | } 70 | } 71 | } 72 | 73 | dependencies { 74 | compileOnly(libs.xposed) 75 | implementation(libs.ezXHelper) 76 | } -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | -keep class top.yukonga.mediaControlOpt.MainHook { 2 | (); 3 | } -------------------------------------------------------------------------------- /app/src/.gitignore: -------------------------------------------------------------------------------- 1 | /androidTest 2 | /test -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 8 | 11 | 12 | 15 | 16 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/assets/xposed_init: -------------------------------------------------------------------------------- 1 | top.yukonga.mediaControlOpt.MainHook -------------------------------------------------------------------------------- /app/src/main/kotlin/top/yukonga/mediaControlOpt/MainHook.kt: -------------------------------------------------------------------------------- 1 | package top.yukonga.mediaControlOpt 2 | 3 | import android.content.Context 4 | import android.content.res.ColorStateList 5 | import android.graphics.Color 6 | import android.graphics.drawable.ClipDrawable 7 | import android.graphics.drawable.GradientDrawable 8 | import android.graphics.drawable.LayerDrawable 9 | import android.view.Gravity 10 | import android.view.ViewGroup 11 | import android.widget.ImageView 12 | import android.widget.SeekBar 13 | import android.widget.TextView 14 | import com.github.kyuubiran.ezxhelper.ClassUtils.loadClassOrNull 15 | import com.github.kyuubiran.ezxhelper.EzXHelper 16 | import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createAfterHook 17 | import com.github.kyuubiran.ezxhelper.Log 18 | import com.github.kyuubiran.ezxhelper.ObjectHelper.Companion.objectHelper 19 | import com.github.kyuubiran.ezxhelper.finders.MethodFinder.`-Static`.methodFinder 20 | import de.robv.android.xposed.IXposedHookLoadPackage 21 | import de.robv.android.xposed.callbacks.XC_LoadPackage 22 | import top.yukonga.mediaControlOpt.utils.AppUtils.colorFilter 23 | import top.yukonga.mediaControlOpt.utils.AppUtils.dp 24 | import top.yukonga.mediaControlOpt.utils.AppUtils.isDarkMode 25 | 26 | class MainHook : IXposedHookLoadPackage { 27 | override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) { 28 | EzXHelper.initHandleLoadPackage(lpparam) 29 | EzXHelper.setLogTag("MediaControlBlur") 30 | when (lpparam.packageName) { 31 | "com.android.systemui" -> { 32 | try { 33 | val miuiMediaControlPanel = loadClassOrNull("com.android.systemui.statusbar.notification.mediacontrol.MiuiMediaControlPanel") 34 | val mediaViewHolder = loadClassOrNull("com.android.systemui.media.controls.ui.view.MediaViewHolder") 35 | 36 | mediaViewHolder?.constructors?.first()?.createAfterHook { 37 | val seekBar = it.thisObject.objectHelper().getObjectOrNullAs("seekBar") 38 | val backgroundDrawable = GradientDrawable().apply { 39 | color = ColorStateList(arrayOf(intArrayOf()), intArrayOf(Color.parseColor("#20ffffff"))) 40 | cornerRadius = 7.dp.toFloat() 41 | } 42 | val onProgressDrawable = GradientDrawable().apply { 43 | color = ColorStateList(arrayOf(intArrayOf()), intArrayOf(Color.parseColor("#ccffffff"))) 44 | cornerRadius = 7.dp.toFloat() 45 | } 46 | val layerDrawable = LayerDrawable( 47 | arrayOf(backgroundDrawable, ClipDrawable(onProgressDrawable, Gravity.START, ClipDrawable.HORIZONTAL)) 48 | ).apply { 49 | val layerHeight = 7.dp 50 | 51 | val totalHeight = seekBar?.height ?: 0 52 | val topOffset = (totalHeight - layerHeight) / 2 53 | 54 | setLayerInset(0, 0, topOffset, 0, topOffset) 55 | setLayerInset(1, 0, topOffset, 0, topOffset) 56 | } 57 | seekBar?.progressDrawable = layerDrawable 58 | } 59 | 60 | miuiMediaControlPanel?.methodFinder()?.filterByName("bindPlayer")?.first()?.createAfterHook { 61 | val context = it.thisObject.objectHelper().getObjectOrNullUntilSuperclassAs("mContext") ?: return@createAfterHook 62 | val mMediaViewHolder = it.thisObject.objectHelper().getObjectOrNullUntilSuperclass("mMediaViewHolder") ?: return@createAfterHook 63 | 64 | val appIcon = mMediaViewHolder.objectHelper().getObjectOrNullAs("appIcon") 65 | (appIcon?.parent as ViewGroup?)?.removeView(appIcon) 66 | 67 | val seekBar = mMediaViewHolder.objectHelper().getObjectOrNullAs("seekBar") 68 | seekBar?.thumb?.colorFilter = colorFilter(Color.TRANSPARENT) 69 | 70 | val elapsedTimeView = mMediaViewHolder.objectHelper().getObjectOrNullAs("elapsedTimeView") 71 | val totalTimeView = mMediaViewHolder.objectHelper().getObjectOrNullAs("totalTimeView") 72 | val grey = if (isDarkMode(context)) Color.LTGRAY else Color.DKGRAY 73 | 74 | elapsedTimeView?.setTextColor(grey) 75 | totalTimeView?.setTextColor(grey) 76 | elapsedTimeView?.textSize = 12f 77 | totalTimeView?.textSize = 12f 78 | } 79 | } catch (t: Throwable) { 80 | Log.ex(t) 81 | } 82 | } 83 | 84 | else -> return 85 | } 86 | } 87 | } -------------------------------------------------------------------------------- /app/src/main/kotlin/top/yukonga/mediaControlOpt/utils/AppUtils.kt: -------------------------------------------------------------------------------- 1 | package top.yukonga.mediaControlOpt.utils 2 | 3 | import android.content.Context 4 | import android.content.res.Configuration 5 | import android.content.res.Resources.getSystem 6 | import android.graphics.BlendMode 7 | import android.graphics.BlendModeColorFilter 8 | import android.os.PowerManager 9 | import android.util.TypedValue 10 | 11 | object AppUtils { 12 | 13 | fun colorFilter(colorInt: Int) = BlendModeColorFilter(colorInt, BlendMode.SRC_IN) 14 | 15 | fun isDarkMode(context: Context): Boolean { 16 | return context.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK == Configuration.UI_MODE_NIGHT_YES || !(context.getSystemService(Context.POWER_SERVICE) as PowerManager).isInteractive 17 | } 18 | 19 | val Int.dp: Int get() = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, this.toFloat(), getSystem().displayMetrics).toInt() 20 | } -------------------------------------------------------------------------------- /app/src/main/res/values/array.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | com.android.systemui 5 | 6 | -------------------------------------------------------------------------------- /build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | alias(libs.plugins.android.application) apply false 3 | alias(libs.plugins.kotlin.android) apply false 4 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 2 | android.useAndroidX=true 3 | kotlin.code.style=official 4 | android.nonTransitiveRClass=true 5 | android.useMinimalKeepRules=true 6 | org.gradle.parallel=true 7 | org.gradle.configureondemand=true 8 | org.gradle.caching=true -------------------------------------------------------------------------------- /gradle/libs.versions.toml: -------------------------------------------------------------------------------- 1 | [versions] 2 | agp = "8.7.3" 3 | ezXHelper = "2.2.0" 4 | kotlin = "2.1.0" 5 | xposed = "82" 6 | 7 | [libraries] 8 | ezXHelper = { module = "com.github.kyuubiran:EzXHelper", version.ref = "ezXHelper" } 9 | xposed = { module = "de.robv.android.xposed:api", version.ref = "xposed" } 10 | 11 | [plugins] 12 | android-application = { id = "com.android.application", version.ref = "agp" } 13 | kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuKongA/MediaControlOpt/027ef3a54473d57072889f91d6fba58c4374dc8f/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | # SPDX-License-Identifier: Apache-2.0 19 | # 20 | 21 | ############################################################################## 22 | # 23 | # Gradle start up script for POSIX generated by Gradle. 24 | # 25 | # Important for running: 26 | # 27 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 28 | # noncompliant, but you have some other compliant shell such as ksh or 29 | # bash, then to run this script, type that shell name before the whole 30 | # command line, like: 31 | # 32 | # ksh Gradle 33 | # 34 | # Busybox and similar reduced shells will NOT work, because this script 35 | # requires all of these POSIX shell features: 36 | # * functions; 37 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 38 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 39 | # * compound commands having a testable exit status, especially «case»; 40 | # * various built-in commands including «command», «set», and «ulimit». 41 | # 42 | # Important for patching: 43 | # 44 | # (2) This script targets any POSIX shell, so it avoids extensions provided 45 | # by Bash, Ksh, etc; in particular arrays are avoided. 46 | # 47 | # The "traditional" practice of packing multiple parameters into a 48 | # space-separated string is a well documented source of bugs and security 49 | # problems, so this is (mostly) avoided, by progressively accumulating 50 | # options in "$@", and eventually passing that to Java. 51 | # 52 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 53 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 54 | # see the in-line comments for details. 55 | # 56 | # There are tweaks for specific operating systems such as AIX, CygWin, 57 | # Darwin, MinGW, and NonStop. 58 | # 59 | # (3) This script is generated from the Groovy template 60 | # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 61 | # within the Gradle project. 62 | # 63 | # You can find Gradle at https://github.com/gradle/gradle/. 64 | # 65 | ############################################################################## 66 | 67 | # Attempt to set APP_HOME 68 | 69 | # Resolve links: $0 may be a link 70 | app_path=$0 71 | 72 | # Need this for daisy-chained symlinks. 73 | while 74 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 75 | [ -h "$app_path" ] 76 | do 77 | ls=$( ls -ld "$app_path" ) 78 | link=${ls#*' -> '} 79 | case $link in #( 80 | /*) app_path=$link ;; #( 81 | *) app_path=$APP_HOME$link ;; 82 | esac 83 | done 84 | 85 | # This is normally unused 86 | # shellcheck disable=SC2034 87 | APP_BASE_NAME=${0##*/} 88 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) 89 | APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s 90 | ' "$PWD" ) || exit 91 | 92 | # Use the maximum available, or set MAX_FD != -1 to use that value. 93 | MAX_FD=maximum 94 | 95 | warn () { 96 | echo "$*" 97 | } >&2 98 | 99 | die () { 100 | echo 101 | echo "$*" 102 | echo 103 | exit 1 104 | } >&2 105 | 106 | # OS specific support (must be 'true' or 'false'). 107 | cygwin=false 108 | msys=false 109 | darwin=false 110 | nonstop=false 111 | case "$( uname )" in #( 112 | CYGWIN* ) cygwin=true ;; #( 113 | Darwin* ) darwin=true ;; #( 114 | MSYS* | MINGW* ) msys=true ;; #( 115 | NONSTOP* ) nonstop=true ;; 116 | esac 117 | 118 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 119 | 120 | 121 | # Determine the Java command to use to start the JVM. 122 | if [ -n "$JAVA_HOME" ] ; then 123 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 124 | # IBM's JDK on AIX uses strange locations for the executables 125 | JAVACMD=$JAVA_HOME/jre/sh/java 126 | else 127 | JAVACMD=$JAVA_HOME/bin/java 128 | fi 129 | if [ ! -x "$JAVACMD" ] ; then 130 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 131 | 132 | Please set the JAVA_HOME variable in your environment to match the 133 | location of your Java installation." 134 | fi 135 | else 136 | JAVACMD=java 137 | if ! command -v java >/dev/null 2>&1 138 | then 139 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 140 | 141 | Please set the JAVA_HOME variable in your environment to match the 142 | location of your Java installation." 143 | fi 144 | fi 145 | 146 | # Increase the maximum file descriptors if we can. 147 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 148 | case $MAX_FD in #( 149 | max*) 150 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 151 | # shellcheck disable=SC2039,SC3045 152 | MAX_FD=$( ulimit -H -n ) || 153 | warn "Could not query maximum file descriptor limit" 154 | esac 155 | case $MAX_FD in #( 156 | '' | soft) :;; #( 157 | *) 158 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 159 | # shellcheck disable=SC2039,SC3045 160 | ulimit -n "$MAX_FD" || 161 | warn "Could not set maximum file descriptor limit to $MAX_FD" 162 | esac 163 | fi 164 | 165 | # Collect all arguments for the java command, stacking in reverse order: 166 | # * args from the command line 167 | # * the main class name 168 | # * -classpath 169 | # * -D...appname settings 170 | # * --module-path (only if needed) 171 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 172 | 173 | # For Cygwin or MSYS, switch paths to Windows format before running java 174 | if "$cygwin" || "$msys" ; then 175 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 176 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 177 | 178 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 179 | 180 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 181 | for arg do 182 | if 183 | case $arg in #( 184 | -*) false ;; # don't mess with options #( 185 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 186 | [ -e "$t" ] ;; #( 187 | *) false ;; 188 | esac 189 | then 190 | arg=$( cygpath --path --ignore --mixed "$arg" ) 191 | fi 192 | # Roll the args list around exactly as many times as the number of 193 | # args, so each arg winds up back in the position where it started, but 194 | # possibly modified. 195 | # 196 | # NB: a `for` loop captures its iteration list before it begins, so 197 | # changing the positional parameters here affects neither the number of 198 | # iterations, nor the values presented in `arg`. 199 | shift # remove old arg 200 | set -- "$@" "$arg" # push replacement arg 201 | done 202 | fi 203 | 204 | 205 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 206 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 207 | 208 | # Collect all arguments for the java command: 209 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, 210 | # and any embedded shellness will be escaped. 211 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be 212 | # treated as '${Hostname}' itself on the command line. 213 | 214 | set -- \ 215 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 216 | -classpath "$CLASSPATH" \ 217 | org.gradle.wrapper.GradleWrapperMain \ 218 | "$@" 219 | 220 | # Stop when "xargs" is not available. 221 | if ! command -v xargs >/dev/null 2>&1 222 | then 223 | die "xargs is not available" 224 | fi 225 | 226 | # Use "xargs" to parse quoted args. 227 | # 228 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 229 | # 230 | # In Bash we could simply go: 231 | # 232 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 233 | # set -- "${ARGS[@]}" "$@" 234 | # 235 | # but POSIX shell has neither arrays nor command substitution, so instead we 236 | # post-process each arg (as a line of input to sed) to backslash-escape any 237 | # character that might be a shell metacharacter, then use eval to reverse 238 | # that process (while maintaining the separation between arguments), and wrap 239 | # the whole thing up as a single "set" statement. 240 | # 241 | # This will of course break if any of these variables contains a newline or 242 | # an unmatched quote. 243 | # 244 | 245 | eval "set -- $( 246 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 247 | xargs -n1 | 248 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 249 | tr '\n' ' ' 250 | )" '"$@"' 251 | 252 | exec "$JAVACMD" "$@" 253 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | @rem SPDX-License-Identifier: Apache-2.0 17 | @rem 18 | 19 | @if "%DEBUG%"=="" @echo off 20 | @rem ########################################################################## 21 | @rem 22 | @rem Gradle startup script for Windows 23 | @rem 24 | @rem ########################################################################## 25 | 26 | @rem Set local scope for the variables with windows NT shell 27 | if "%OS%"=="Windows_NT" setlocal 28 | 29 | set DIRNAME=%~dp0 30 | if "%DIRNAME%"=="" set DIRNAME=. 31 | @rem This is normally unused 32 | set APP_BASE_NAME=%~n0 33 | set APP_HOME=%DIRNAME% 34 | 35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 37 | 38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 40 | 41 | @rem Find java.exe 42 | if defined JAVA_HOME goto findJavaFromJavaHome 43 | 44 | set JAVA_EXE=java.exe 45 | %JAVA_EXE% -version >NUL 2>&1 46 | if %ERRORLEVEL% equ 0 goto execute 47 | 48 | echo. 1>&2 49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 50 | echo. 1>&2 51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 52 | echo location of your Java installation. 1>&2 53 | 54 | goto fail 55 | 56 | :findJavaFromJavaHome 57 | set JAVA_HOME=%JAVA_HOME:"=% 58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 59 | 60 | if exist "%JAVA_EXE%" goto execute 61 | 62 | echo. 1>&2 63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 64 | echo. 1>&2 65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 66 | echo location of your Java installation. 1>&2 67 | 68 | goto fail 69 | 70 | :execute 71 | @rem Setup the command line 72 | 73 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 74 | 75 | 76 | @rem Execute Gradle 77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 78 | 79 | :end 80 | @rem End local scope for the variables with windows NT shell 81 | if %ERRORLEVEL% equ 0 goto mainEnd 82 | 83 | :fail 84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 85 | rem the _cmd.exe /c_ return code! 86 | set EXIT_CODE=%ERRORLEVEL% 87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 89 | exit /b %EXIT_CODE% 90 | 91 | :mainEnd 92 | if "%OS%"=="Windows_NT" endlocal 93 | 94 | :omega 95 | -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | @file:Suppress("UnstableApiUsage") 2 | 3 | pluginManagement { 4 | repositories { 5 | google { 6 | content { 7 | includeGroupByRegex("com\\.android.*") 8 | includeGroupByRegex("com\\.google.*") 9 | includeGroupByRegex("androidx.*") 10 | } 11 | } 12 | mavenCentral() 13 | gradlePluginPortal() 14 | maven("https://api.xposed.info/") 15 | } 16 | } 17 | 18 | dependencyResolutionManagement { 19 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) 20 | repositories { 21 | google() 22 | mavenCentral() 23 | maven("https://api.xposed.info/") 24 | } 25 | } 26 | 27 | rootProject.name = "MediaControlOpt" 28 | include(":app") --------------------------------------------------------------------------------