diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index e924a50..e35e000 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -33,14 +33,29 @@ jobs: uses: actions/upload-artifact@v4 with: name: MediaControl-Release-Snapshot - path: | - app/build/outputs/apk/release + path: app/build/outputs/apk/release compression-level: 9 - name: Upload Debug Snapshot uses: actions/upload-artifact@v4 with: name: MediaControl-Debug-Snapshot - path: | - app/build/outputs/apk/debug - compression-level: 9 \ No newline at end of file + path: app/build/outputs/apk/debug + compression-level: 9 + + - name: Post to Telegram ci channel + if: ${{ success() && github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && github.ref_type != 'tag' }} + env: + CHANNEL_ID: ${{ secrets.CHANNEL_ID }} + BOT_TOKEN: ${{ secrets.BOT_TOKEN }} + run: | + if [ ! -z "${{ secrets.BOT_TOKEN }}" ]; then + export RELEASE=$(find "app/build/outputs/apk/release/" -name "*.apk") + export DEBUG=$(find "app/build/outputs/apk/debug/" -name "*.apk") + event_path=$GITHUB_EVENT_PATH + commit_count=$(jq -r '.commits | length' $event_path) + { echo -e 'New CI from MediaControl-BlurBg\n'; git log -$commit_count --pretty=format:"%h %s"; } > ${{ github.workspace }}/git_log + 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')" + cd ${{ github.workspace }} + 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" + fi diff --git a/app/build.gradle.kts b/app/build.gradle.kts index c7d7979..d7b6871 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -15,8 +15,8 @@ android { applicationId = namespace minSdk = 34 targetSdk = 35 - versionCode = 2520 - versionName = "2.5.2" + versionCode = 2530 + versionName = "2.5.3" } val properties = Properties() runCatching { properties.load(project.rootProject.file("local.properties").inputStream()) } diff --git a/app/src/main/kotlin/top/yukonga/mediaControlBlur/MainHook.kt b/app/src/main/kotlin/top/yukonga/mediaControlBlur/MainHook.kt index 3ea6596..0ec56b4 100644 --- a/app/src/main/kotlin/top/yukonga/mediaControlBlur/MainHook.kt +++ b/app/src/main/kotlin/top/yukonga/mediaControlBlur/MainHook.kt @@ -60,6 +60,7 @@ class MainHook : IXposedHookLoadPackage { var lockScreenStatus: Boolean? = null var darkModeStatus: Boolean? = null + val mediaControlPanel = loadClassOrNull("com.android.systemui.media.controls.ui.MediaControlPanel") val miuiMediaControlPanel = loadClassOrNull("com.android.systemui.statusbar.notification.mediacontrol.MiuiMediaControlPanel") val notificationUtil = loadClassOrNull("com.android.systemui.statusbar.notification.NotificationUtil") val playerTwoCircleView = loadClassOrNull("com.android.systemui.statusbar.notification.mediacontrol.PlayerTwoCircleView") @@ -122,6 +123,42 @@ class MainHook : IXposedHookLoadPackage { } } + mediaControlPanel?.methodFinder()?.filterByName("attachPlayer")?.first()?.createAfterHook { + val context = it.thisObject.objectHelper().getObjectOrNullUntilSuperclassAs("mContext") ?: return@createAfterHook + + val isBackgroundBlurOpened = XposedHelpers.callStaticMethod(notificationUtil, "isBackgroundBlurOpened", context) as Boolean + + val mMediaViewHolder = it.args[0] + + val titleText = mMediaViewHolder.objectHelper().getObjectOrNullAs("titleText") + val artistText = mMediaViewHolder.objectHelper().getObjectOrNullAs("artistText") + val seamlessIcon = mMediaViewHolder.objectHelper().getObjectOrNullAs("seamlessIcon") + val seekBar = mMediaViewHolder.objectHelper().getObjectOrNullAs("seekBar") + val elapsedTimeView = mMediaViewHolder.objectHelper().getObjectOrNullAs("elapsedTimeView") + val totalTimeView = mMediaViewHolder.objectHelper().getObjectOrNullAs("totalTimeView") + val appIcon = mMediaViewHolder.objectHelper().getObjectOrNullAs("appIcon") + + val grey = if (isDarkMode(context)) Color.LTGRAY else Color.DKGRAY + val color = if (isDarkMode(context)) Color.WHITE else Color.BLACK + seekBar?.thumb?.colorFilter = colorFilter(Color.TRANSPARENT) + elapsedTimeView?.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11f) + totalTimeView?.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11f) + (appIcon?.parent as ViewGroup?)?.removeView(appIcon) + if (!isBackgroundBlurOpened) { + titleText?.setTextColor(Color.WHITE) + seamlessIcon?.setColorFilter(Color.WHITE) + seekBar?.progressDrawable?.colorFilter = colorFilter(Color.WHITE) + } else { + artistText?.setTextColor(grey) + elapsedTimeView?.setTextColor(grey) + totalTimeView?.setTextColor(grey) + titleText?.setTextColor(grey) + titleText?.setTextColor(color) + seamlessIcon?.setColorFilter(color) + seekBar?.progressDrawable?.colorFilter = colorFilter(color) + } + } + miuiMediaControlPanel?.methodFinder()?.filterByName("bindPlayer")?.first()?.createAfterHook { val context = it.thisObject.objectHelper().getObjectOrNullUntilSuperclassAs("mContext") ?: return@createAfterHook diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a6e2dea..90d449b 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -agp = "8.5.2" +agp = "8.6.0" ezXHelper = "2.2.0" kotlin = "2.0.20" xposed = "82"