Fixed Modify System settings button not working

This commit is contained in:
Prathamesh More 2022-05-13 13:10:58 +05:30
parent 3219ba0a5d
commit 1cfa5aaac5
2 changed files with 2 additions and 2 deletions

View file

@ -50,7 +50,7 @@ class PermissionActivity : AbsMusicServiceActivity() {
if (VersionUtils.hasMarshmallow()) { if (VersionUtils.hasMarshmallow()) {
binding.audioPermission.show() binding.audioPermission.show()
binding.audioPermission.setButtonClick { binding.audioPermission.setButtonClick {
if (hasAudioPermission()) { if (!hasAudioPermission()) {
val intent = Intent(Settings.ACTION_MANAGE_WRITE_SETTINGS) val intent = Intent(Settings.ACTION_MANAGE_WRITE_SETTINGS)
intent.data = ("package:" + applicationContext.packageName).toUri() intent.data = ("package:" + applicationContext.packageName).toUri()
startActivity(intent) startActivity(intent)

View file

@ -46,7 +46,7 @@ class AudioSettings : AbsSettingsFragment() {
} }
val bluetoothPreference: Preference? = findPreference(BLUETOOTH_PLAYBACK) val bluetoothPreference: Preference? = findPreference(BLUETOOTH_PLAYBACK)
if (VersionUtils.hasS()) { if (VersionUtils.hasS()) {
bluetoothPreference?.setOnPreferenceChangeListener { preference, newValue -> bluetoothPreference?.setOnPreferenceChangeListener { _, newValue ->
if (newValue as Boolean) { if (newValue as Boolean) {
if (ActivityCompat.checkSelfPermission(requireContext(), if (ActivityCompat.checkSelfPermission(requireContext(),
BLUETOOTH_CONNECT) != PERMISSION_GRANTED BLUETOOTH_CONNECT) != PERMISSION_GRANTED