summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAbandoned Cart <twistedumbrella@gmail.com>2023-06-17 00:50:36 +0200
committerAbandoned Cart <twistedumbrella@gmail.com>2023-06-21 23:21:36 +0200
commite31152ee347c2dddeba847ca08bd101ef53d1cce (patch)
tree57f63a26945549c5e9fedbd2d3d9fe8c8c2de9b2
parentMerge pull request #10864 from t895/disable-mali-driver (diff)
downloadyuzu-e31152ee347c2dddeba847ca08bd101ef53d1cce.tar
yuzu-e31152ee347c2dddeba847ca08bd101ef53d1cce.tar.gz
yuzu-e31152ee347c2dddeba847ca08bd101ef53d1cce.tar.bz2
yuzu-e31152ee347c2dddeba847ca08bd101ef53d1cce.tar.lz
yuzu-e31152ee347c2dddeba847ca08bd101ef53d1cce.tar.xz
yuzu-e31152ee347c2dddeba847ca08bd101ef53d1cce.tar.zst
yuzu-e31152ee347c2dddeba847ca08bd101ef53d1cce.zip
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt48
-rw-r--r--src/android/app/src/main/res/drawable/ic_pip_audio.xml9
-rw-r--r--src/android/app/src/main/res/drawable/ic_pip_mute.xml9
-rw-r--r--src/android/app/src/main/res/values/strings.xml2
4 files changed, 68 insertions, 0 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt
index f0a6753a9..8a071f4da 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/activities/EmulationActivity.kt
@@ -63,6 +63,10 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener {
private val actionPause = "ACTION_EMULATOR_PAUSE"
private val actionPlay = "ACTION_EMULATOR_PLAY"
+ private val actionMute = "ACTION_EMULATOR_MUTE"
+ private val actionAudio = "ACTION_EMULATOR_AUDIO"
+ private var isAudioMuted = false
+ private var userAudio = IntSetting.AUDIO_VOLUME.int
private val settingsViewModel: SettingsViewModel by viewModels()
@@ -305,6 +309,38 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener {
pictureInPictureActions.add(pauseRemoteAction)
}
+ if (isAudioMuted) {
+ val audioIcon = Icon.createWithResource(this@EmulationActivity, R.drawable.ic_pip_audio)
+ val audioPendingIntent = PendingIntent.getBroadcast(
+ this@EmulationActivity,
+ R.drawable.ic_pip_audio,
+ Intent(actionAudio),
+ pendingFlags
+ )
+ val audioRemoteAction = RemoteAction(
+ audioIcon,
+ getString(R.string.audio),
+ getString(R.string.audio),
+ audioPendingIntent
+ )
+ pictureInPictureActions.add(audioRemoteAction)
+ } else {
+ val muteIcon = Icon.createWithResource(this@EmulationActivity, R.drawable.ic_pip_mute)
+ val mutePendingIntent = PendingIntent.getBroadcast(
+ this@EmulationActivity,
+ R.drawable.ic_pip_mute,
+ Intent(actionMute),
+ pendingFlags
+ )
+ val muteRemoteAction = RemoteAction(
+ muteIcon,
+ getString(R.string.mute),
+ getString(R.string.mute),
+ mutePendingIntent
+ )
+ pictureInPictureActions.add(muteRemoteAction)
+ }
+
return this.apply { setActions(pictureInPictureActions) }
}
@@ -326,6 +362,18 @@ class EmulationActivity : AppCompatActivity(), SensorEventListener {
} else if (intent.action == actionPause) {
if (!NativeLibrary.isPaused()) NativeLibrary.pauseEmulation()
}
+ if (intent.action == actionAudio) {
+ if (isAudioMuted) {
+ IntSetting.AUDIO_VOLUME.int = userAudio
+ isAudioMuted = false
+ }
+ } else if (intent.action == actionMute) {
+ if (!isAudioMuted) {
+ isAudioMuted = true
+ userAudio = IntSetting.AUDIO_VOLUME.int
+ IntSetting.AUDIO_VOLUME.int = 0
+ }
+ }
buildPictureInPictureParams()
}
}
diff --git a/src/android/app/src/main/res/drawable/ic_pip_audio.xml b/src/android/app/src/main/res/drawable/ic_pip_audio.xml
new file mode 100644
index 000000000..f7ed0862e
--- /dev/null
+++ b/src/android/app/src/main/res/drawable/ic_pip_audio.xml
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportHeight="24"
+ android:viewportWidth="24">
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M3,9v6h4l5,5L12,4L7,9L3,9zM16.5,12c0,-1.77 -1.02,-3.29 -2.5,-4.03v8.05c1.48,-0.73 2.5,-2.25 2.5,-4.02zM14,3.23v2.06c2.89,0.86 5,3.54 5,6.71s-2.11,5.85 -5,6.71v2.06c4.01,-0.91 7,-4.49 7,-8.77s-2.99,-7.86 -7,-8.77z" />
+</vector>
diff --git a/src/android/app/src/main/res/drawable/ic_pip_mute.xml b/src/android/app/src/main/res/drawable/ic_pip_mute.xml
new file mode 100644
index 000000000..a271c5fe8
--- /dev/null
+++ b/src/android/app/src/main/res/drawable/ic_pip_mute.xml
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportHeight="24"
+ android:viewportWidth="24">
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M7,9v6h4l5,5V4l-5,5H7z" />
+</vector>
diff --git a/src/android/app/src/main/res/values/strings.xml b/src/android/app/src/main/res/values/strings.xml
index cc1d8c39d..d4f089c7f 100644
--- a/src/android/app/src/main/res/values/strings.xml
+++ b/src/android/app/src/main/res/values/strings.xml
@@ -387,6 +387,8 @@
<string name="picture_in_picture_description">Minimize window when placed in the background</string>
<string name="pause">Pause</string>
<string name="play">Play</string>
+ <string name="mute">Mute</string>
+ <string name="audio">Audio</string>
<!-- Licenses screen strings -->
<string name="licenses">Licenses</string>