Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 23 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,39 @@ jobs:
runs-on: ubuntu-latest
needs: call-build
steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Download Build Artifacts
uses: actions/download-artifact@v4
with:
name: Build Artifacts

- name: Generate Dynamic Tag
id: tag
run: echo "TAG_NAME=$(date +'%Y%m%d-%H%M%S')" >> $GITHUB_ENV
- name: Extract APK Version
id: apk_version
run: |
APK_FILE=$(ls *.apk | head -n 1) # Get the first APK file
echo "Found APK: $APK_FILE"
VERSION=$(echo $APK_FILE | grep -oP '\d+\.\d+\.\d+')
echo "Extracted Version: $VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV

- name: Generate Changelog
id: changelog
run: |
echo "CHANGELOG<<EOF" >> $GITHUB_ENV
git log --pretty=format:"- %s [%h]" $(git describe --tags --abbrev=0)..HEAD >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV

- name: Create Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ env.TAG_NAME }}
release_name: Release ${{ env.TAG_NAME }}
body: |
Automatically generated release.
draft: false
prerelease: false
tag_name: v${{ env.VERSION }}
release_name: Release v${{ env.VERSION }}
body: ${{ env.CHANGELOG }}
draft: true
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ Works when the screen is off.

## Requirements

Android 11+ (may be working on lower versions, you can try and install it even on Android 7)
* [LSPosed](https://github.com/LSPosed/LSPosed) 93+
* Android 11+ (may be working on lower versions, you can try and install it even on Android 8.1)

## Tested on

Expand Down
39 changes: 0 additions & 39 deletions app/build.gradle

This file was deleted.

55 changes: 55 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("org.jetbrains.kotlin.plugin.compose")
}

android {
compileSdk = 35

defaultConfig {
applicationId = "ru.hepolise.volumekeymusicmanagermodule"
minSdk = 27
targetSdk = 35
versionCode = rootProject.ext["appVersionCode"].toString().toInt()
versionName = rootProject.ext["appVersionName"].toString()
}

buildTypes {
getByName("release") {
isMinifyEnabled = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = "17"
}

namespace = "ru.hepolise.volumekeytrackcontrolmodule"
}

dependencies {
implementation(platform("org.jetbrains.kotlin:kotlin-bom:2.1.0"))
implementation("androidx.core:core-ktx:1.15.0")

// Compose BOM (Bill of Materials)
implementation(platform("androidx.compose:compose-bom:2024.12.01"))

// Compose dependencies
implementation("androidx.activity:activity-compose:1.9.3")
implementation("androidx.compose.ui:ui")
implementation("androidx.compose.ui:ui-tooling-preview")
implementation("androidx.compose.material3:material3:1.3.1")

// Required for preview support
debugImplementation("androidx.compose.ui:ui-tooling")

// Xposed Framework API dependencies
compileOnly("de.robv.android.xposed:api:82")
}
18 changes: 14 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.VIBRATE" />
<application
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:theme="@android:style/Theme.NoDisplay">
android:theme="@android:style/Theme.Material.NoActionBar">

<!-- Main activity -->
<activity
android:name="ru.hepolise.volumekeytrackcontrol.ui.SettingsActivity"
android:exported="true"
android:theme="@android:style/Theme.Material.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<!-- metadata -->
<meta-data
android:name="xposedmodule"
android:value="true" />
<meta-data
android:name="xposedminversion"
android:value="89" />
android:value="93" />
<meta-data
android:name="xposeddescription"
android:value="Skip and pause track with long press volume keys" />
Expand All @@ -22,6 +34,4 @@
android:resource="@array/module_scope" />
</application>



</manifest>
2 changes: 1 addition & 1 deletion app/src/main/assets/xposed_init
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ru.hepolise.volumekeytrackcontrolmodule.VolumeControlModule
ru.hepolise.volumekeytrackcontrol.module.VolumeControlModule
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package ru.hepolise.volumekeytrackcontrolmodule
package ru.hepolise.volumekeytrackcontrol.module

import android.content.Context
import android.view.KeyEvent
import androidx.annotation.Keep
import de.robv.android.xposed.IXposedHookLoadPackage
import de.robv.android.xposed.XposedHelpers
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam
import ru.hepolise.volumekeytrackcontrolmodule.VolumeKeyControlModuleHandlers.handleConstructPhoneWindowManager
import ru.hepolise.volumekeytrackcontrolmodule.VolumeKeyControlModuleHandlers.handleInterceptKeyBeforeQueueing
import ru.hepolise.volumekeytrackcontrol.module.VolumeKeyControlModuleHandlers.handleConstructPhoneWindowManager
import ru.hepolise.volumekeytrackcontrol.module.VolumeKeyControlModuleHandlers.handleInterceptKeyBeforeQueueing
import ru.hepolise.volumekeytrackcontrol.module.util.LogHelper
import java.io.Serializable

@Keep
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
package ru.hepolise.volumekeytrackcontrolmodule
package ru.hepolise.volumekeytrackcontrol.module

import android.content.Context
import android.hardware.display.DisplayManager
import android.media.AudioManager
import android.media.session.MediaController
import android.media.session.PlaybackState
import android.os.Build
import android.os.Handler
import android.os.PowerManager
import android.os.Vibrator
import android.os.VibratorManager
import android.view.Display
import android.view.KeyEvent
import android.view.ViewConfiguration
import de.robv.android.xposed.XC_MethodHook
import de.robv.android.xposed.XC_MethodHook.MethodHookParam
import de.robv.android.xposed.XposedHelpers
import ru.hepolise.volumekeytrackcontrolmodule.extension.VibratorExtension.triggerVibration
import ru.hepolise.volumekeytrackcontrol.module.util.LogHelper
import ru.hepolise.volumekeytrackcontrol.util.SharedPreferencesUtil
import ru.hepolise.volumekeytrackcontrol.util.SharedPreferencesUtil.getLongPressDuration
import ru.hepolise.volumekeytrackcontrol.util.VibratorUtil.getVibrator
import ru.hepolise.volumekeytrackcontrol.util.VibratorUtil.triggerVibration


object VolumeKeyControlModuleHandlers {
Expand All @@ -29,8 +30,6 @@ object VolumeKeyControlModuleHandlers {
"android.media.session.MediaSessionLegacyHelper"
private const val CLASS_COMPONENT_NAME = "android.content.ComponentName"

private val TIMEOUT = ViewConfiguration.getLongPressTimeout().toLong()

private var isLongPress = false
private var isDownPressed = false
private var isUpPressed = false
Expand Down Expand Up @@ -129,14 +128,7 @@ object VolumeKeyControlModuleHandlers {
?: throw NullPointerException("Unable to obtain power service")
displayManager = getSystemService(Context.DISPLAY_SERVICE) as DisplayManager?
?: throw NullPointerException("Unable to obtain display service")
vibrator = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
val vibratorManager =
getSystemService(Context.VIBRATOR_MANAGER_SERVICE) as VibratorManager
vibratorManager.defaultVibrator
} else {
@Suppress("DEPRECATION")
getSystemService(Context.VIBRATOR_SERVICE) as Vibrator
}
vibrator = context.getVibrator()
}

val mediaSessionHelperClass = XposedHelpers.findClass(
Expand Down Expand Up @@ -237,7 +229,10 @@ object VolumeKeyControlModuleHandlers {

private fun handleVolumePlayPausePress(instance: Any) {
val handler = instance.getHandler()
handler.postDelayed(getRunnable(instance, VOLUME_BOTH_LONG_PRESS), TIMEOUT)
handler.postDelayed(
getRunnable(instance, VOLUME_BOTH_LONG_PRESS),
SharedPreferencesUtil.prefs().getLongPressDuration()
)
}

private fun handleVolumeSkipPress(instance: Any, keyCode: Int) {
Expand All @@ -248,7 +243,7 @@ object VolumeKeyControlModuleHandlers {
KeyEvent.KEYCODE_VOLUME_DOWN -> getRunnable(instance, VOLUME_DOWN_LONG_PRESS)
else -> return
},
TIMEOUT
SharedPreferencesUtil.prefs().getLongPressDuration()
)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ru.hepolise.volumekeytrackcontrolmodule
package ru.hepolise.volumekeytrackcontrol.module.util

import de.robv.android.xposed.XposedBridge
import ru.hepolise.volumekeytrackcontrolmodule.BuildConfig

object LogHelper {
fun log(prefix: String, text: String) {
Expand Down
Loading
Loading