feat: add option to only show the first button

This commit is contained in:
sneazy-ibo
2024-03-30 02:38:05 +01:00
parent f441412723
commit 9b4bd4f255
4 changed files with 18 additions and 0 deletions

View File

@@ -1086,6 +1086,9 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
lifecycleScope.launch {
val discordMode = PrefManager.getCustomVal("discord_mode", "dantotsu")
val buttons = when (discordMode) {
"nothing" -> mutableListOf(
RPC.Link(getString(R.string.view_anime), media.shareLink ?: ""),
)
"dantotsu" -> mutableListOf(
RPC.Link(getString(R.string.view_anime), media.shareLink ?: ""),
RPC.Link("Watch on Dantotsu", getString(R.string.dantotsu))

View File

@@ -376,6 +376,9 @@ class MangaReaderActivity : AppCompatActivity() {
lifecycleScope.launch {
val discordMode = PrefManager.getCustomVal("discord_mode", "dantotsu")
val buttons = when (discordMode) {
"nothing" -> mutableListOf(
RPC.Link(getString(R.string.view_manga), media.shareLink ?: ""),
)
"dantotsu" -> mutableListOf(
RPC.Link(getString(R.string.view_manga), media.shareLink ?: ""),
RPC.Link("Read on Dantotsu", getString(R.string.dantotsu))

View File

@@ -303,6 +303,7 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListene
it.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS)
val dialogView = LayoutInflater.from(this@SettingsActivity).inflate(R.layout.discord_rpc_layout, null)
val radioGroup = dialogView.findViewById<RadioGroup>(R.id.radio_group)
val radioNothing = dialogView.findViewById<RadioButton>(R.id.radio_nothing)
val radioDantotsu = dialogView.findViewById<RadioButton>(R.id.radio_dantotsu)
val radioAnilist = dialogView.findViewById<RadioButton>(R.id.radio_anilist)
val anilistLinkPreview = dialogView.findViewById<TextView>(R.id.anilistLinkPreview)
@@ -311,6 +312,7 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListene
val currentMode = PrefManager.getCustomVal("discord_mode", "dantotsu")
when (currentMode) {
"nothing" -> radioNothing.isChecked= true
"dantotsu" -> radioDantotsu.isChecked = true
"anilist" -> radioAnilist.isChecked = true
}
@@ -322,6 +324,9 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListene
radioGroup.setOnCheckedChangeListener { _, checkedId ->
when (checkedId) {
R.id.radio_nothing -> {
PrefManager.setCustomVal("discord_mode", "nothing")
}
R.id.radio_dantotsu -> {
PrefManager.setCustomVal("discord_mode", "dantotsu")
}

View File

@@ -28,6 +28,13 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RadioButton
android:id="@+id/radio_nothing"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="25dp"
android:text="@string/discord_nothing_button" />
<RadioButton
android:id="@+id/radio_dantotsu"
android:layout_width="match_parent"