Skip to content

Commit

Permalink
feat: add supported links by default, closes #72
Browse files Browse the repository at this point in the history
credits DanielSevillano
  • Loading branch information
Malopieds committed Aug 23, 2024
1 parent e360e89 commit cfb5873
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,23 @@ fun ContentSettings(
)
}

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
PreferenceEntry(
title = { Text(stringResource(R.string.open_supported_links)) },
description = stringResource(R.string.configure_supported_links),
icon = { Icon(painterResource(R.drawable.add_link), null) },
onClick = {
try {
context.startActivity(
Intent(Settings.ACTION_APP_OPEN_BY_DEFAULT_SETTINGS, Uri.parse("package:${context.packageName}")),
)
} catch (e: ActivityNotFoundException) {
Toast.makeText(context, R.string.intent_supported_links_not_found, Toast.LENGTH_LONG).show()
}
},
)
}

SwitchPreference(
title = { Text(stringResource(R.string.hide_explicit)) },
icon = { Icon(painterResource(R.drawable.explicit), null) },
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/add_link.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#FFFFFF" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">

<path android:fillColor="@android:color/white" android:pathData="M8,11h8v2L8,13zM20.1,12L22,12c0,-2.76 -2.24,-5 -5,-5h-4v1.9h4c1.71,0 3.1,1.39 3.1,3.1zM3.9,12c0,-1.71 1.39,-3.1 3.1,-3.1h4L11,7L7,7c-2.76,0 -5,2.24 -5,5s2.24,5 5,5h4v-1.9L7,15.1c-1.71,0 -3.1,-1.39 -3.1,-3.1zM19,12h-2v3h-3v2h3v3h2v-3h3v-2h-3z"/>

</vector>
3 changes: 3 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,9 @@
<string name="app_language">App language</string>
<string name="configure_app_language">Configure app languages</string>
<string name="intent_app_language_not_found">Couldn\'t find app language settings, please configure them manually</string>
<string name="open_supported_links">Open supported link by default</string>
<string name="configure_supported_links">Configure supported links</string>
<string name="intent_supported_links_not_found">Couldn\'t find supported links settings, please configure them manually</string>

<string name="player_and_audio">Player and audio</string>
<string name="audio_quality">Audio quality</string>
Expand Down

0 comments on commit cfb5873

Please sign in to comment.