From af78ea0978dc96f1d5f9707d1e43d465aa2469ee Mon Sep 17 00:00:00 2001 From: sneazy-ibo <41344259+sneazy-ibo@users.noreply.github.com> Date: Fri, 29 Mar 2024 00:53:33 +0100 Subject: [PATCH] fine... --- .../ani/dantotsu/media/anime/ExoplayerView.kt | 8 -- .../manga/mangareader/MangaReaderActivity.kt | 8 -- .../ani/dantotsu/settings/SettingsActivity.kt | 40 --------- .../main/res/layout/discord_rpc_layout.xml | 90 ------------------- app/src/main/res/values/strings.xml | 4 +- 5 files changed, 3 insertions(+), 147 deletions(-) diff --git a/app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt b/app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt index 0ca02de7..2dbfcd12 100644 --- a/app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt +++ b/app/src/main/java/ani/dantotsu/media/anime/ExoplayerView.kt @@ -1098,14 +1098,6 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL RPC.Link("View My AniList", anilistLink) ) } - "custom" -> { - val customButtonText = PrefManager.getCustomVal("custom_button_text", "") - val customButtonLink = PrefManager.getCustomVal("custom_button_link", "") - mutableListOf( - RPC.Link(getString(R.string.view_anime), media.shareLink ?: ""), - RPC.Link(customButtonText, customButtonLink) - ) - } else -> mutableListOf() } val presence = RPC.createPresence( diff --git a/app/src/main/java/ani/dantotsu/media/manga/mangareader/MangaReaderActivity.kt b/app/src/main/java/ani/dantotsu/media/manga/mangareader/MangaReaderActivity.kt index 4b54fe2f..438a8b08 100644 --- a/app/src/main/java/ani/dantotsu/media/manga/mangareader/MangaReaderActivity.kt +++ b/app/src/main/java/ani/dantotsu/media/manga/mangareader/MangaReaderActivity.kt @@ -388,14 +388,6 @@ class MangaReaderActivity : AppCompatActivity() { RPC.Link("View My AniList", anilistLink) ) } - "custom" -> { - val customButtonText = PrefManager.getCustomVal("custom_button_text", "") - val customButtonLink = PrefManager.getCustomVal("custom_button_link", "") - mutableListOf( - RPC.Link(getString(R.string.view_manga), media.shareLink ?: ""), - RPC.Link(customButtonText, customButtonLink) - ) - } else -> mutableListOf() } val presence = RPC.createPresence( diff --git a/app/src/main/java/ani/dantotsu/settings/SettingsActivity.kt b/app/src/main/java/ani/dantotsu/settings/SettingsActivity.kt index 60300009..493502f9 100644 --- a/app/src/main/java/ani/dantotsu/settings/SettingsActivity.kt +++ b/app/src/main/java/ani/dantotsu/settings/SettingsActivity.kt @@ -13,16 +13,12 @@ import android.os.Build.VERSION.CODENAME import android.os.Build.VERSION.RELEASE import android.os.Build.VERSION.SDK_INT import android.os.Bundle -import android.text.Editable -import android.text.TextWatcher import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.view.animation.AnimationUtils import android.view.inputmethod.EditorInfo import android.widget.ArrayAdapter -import android.widget.Button -import android.widget.EditText import android.widget.RadioButton import android.widget.RadioGroup import android.widget.TextView @@ -33,7 +29,6 @@ import androidx.appcompat.app.AppCompatActivity import androidx.core.content.ContextCompat import android.view.HapticFeedbackConstants import androidx.core.view.updateLayoutParams -import androidx.core.widget.doAfterTextChanged import androidx.documentfile.provider.DocumentFile import androidx.lifecycle.lifecycleScope import androidx.media3.common.util.UnstableApi @@ -310,47 +305,17 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListene val radioGroup = dialogView.findViewById(R.id.radio_group) val radioDantotsu = dialogView.findViewById(R.id.radio_dantotsu) val radioAnilist = dialogView.findViewById(R.id.radio_anilist) - val radioCustom = dialogView.findViewById(R.id.radio_custom) val anilistLinkPreview = dialogView.findViewById(R.id.anilistLinkPreview) - val customButtonPreview = dialogView.findViewById(R.id.customButtonPreview) - val customLinkPreview = dialogView.findViewById(R.id.customLinkPreview) - val buttonEditText = dialogView.findViewById(R.id.buttonEditText) - val linkEditText = dialogView.findViewById(R.id.linkEditText) - - buttonEditText.addTextChangedListener(object : TextWatcher { - override fun afterTextChanged(s: Editable?) {} - override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {} - override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { - PrefManager.setCustomVal("custom_button_text", s.toString()) - customButtonPreview.text = s.toString().ifEmpty { "Sample" } - } - }) - - linkEditText.addTextChangedListener(object : TextWatcher { - override fun afterTextChanged(s: Editable?) {} - override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {} - override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { - PrefManager.setCustomVal("custom_button_link", s.toString()) - customLinkPreview.text = s.toString().ifEmpty { "https://example.com/" } - } - }) val userId = PrefManager.getVal(PrefName.AnilistUserName) val currentMode = PrefManager.getCustomVal("discord_mode", "dantotsu") - val customButtonText = PrefManager.getCustomVal("custom_button_text", "") - val customButtonLink = PrefManager.getCustomVal("custom_button_link", "") when (currentMode) { "dantotsu" -> radioDantotsu.isChecked = true "anilist" -> radioAnilist.isChecked = true - "custom" -> radioCustom.isChecked = true } anilistLinkPreview.text = getString(R.string.anilist_link, userId) - customButtonPreview.text = customButtonText.ifEmpty { "Sample" } - customLinkPreview.text = customButtonLink.ifEmpty { "https://example.com/" } - buttonEditText.setText(customButtonText) - linkEditText.setText(customButtonLink) val bottomSheetDialog = BottomSheetDialog(this@SettingsActivity) bottomSheetDialog.setContentView(dialogView) @@ -363,11 +328,6 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListene R.id.radio_anilist -> { PrefManager.setCustomVal("discord_mode", "anilist") } - R.id.radio_custom -> { - PrefManager.setCustomVal("discord_mode", "custom") - PrefManager.setCustomVal("custom_button_text", buttonEditText.text.toString()) - PrefManager.setCustomVal("custom_button_link", linkEditText.text.toString()) - } } } bottomSheetDialog.show() diff --git a/app/src/main/res/layout/discord_rpc_layout.xml b/app/src/main/res/layout/discord_rpc_layout.xml index e482c533..355aa6ed 100644 --- a/app/src/main/res/layout/discord_rpc_layout.xml +++ b/app/src/main/res/layout/discord_rpc_layout.xml @@ -124,96 +124,6 @@ app:drawableTint="?attr/colorPrimary" /> - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b32fbae7..a87428a9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -16,6 +16,8 @@ https://t.me/+gzBCQExtLQo1YTNh https://www.buymeacoffee.com/rebelonion + https://anilist.co/user/%1$s/ + Home Anime Browse Anime @@ -414,7 +416,7 @@ NOTE Display dantotsu in the second button - Display your AniList profile + Display your AniList profile instead Set up your own custom button Discord Rich Presence Stream on Dantotsu