From a3b1d3db571119438aa19b94afc7de1832386268 Mon Sep 17 00:00:00 2001 From: aayush262 Date: Tue, 14 May 2024 00:33:14 +0530 Subject: [PATCH] fix: reply text background color --- .../download/anime/OfflineAnimeAdapter.kt | 3 +- .../download/manga/OfflineMangaAdapter.kt | 3 +- .../home/status/RepliesBottomDialog.kt | 25 +++++- .../java/ani/dantotsu/home/status/Stories.kt | 18 ++--- .../dantotsu/media/MediaListViewActivity.kt | 4 +- .../profile/activity/NotificationActivity.kt | 3 + .../ani/dantotsu/settings/SettingsActivity.kt | 2 +- .../main/res/layout/bottom_sheet_recycler.xml | 79 ++++++++++--------- .../main/res/layout/custom_dialog_layout.xml | 1 + app/src/main/res/layout/fragment_status.xml | 75 ++++++++---------- .../main/res/layout/item_activity_reply.xml | 2 - 11 files changed, 118 insertions(+), 97 deletions(-) diff --git a/app/src/main/java/ani/dantotsu/download/anime/OfflineAnimeAdapter.kt b/app/src/main/java/ani/dantotsu/download/anime/OfflineAnimeAdapter.kt index ebeeb93c34..a4f03cf75c 100644 --- a/app/src/main/java/ani/dantotsu/download/anime/OfflineAnimeAdapter.kt +++ b/app/src/main/java/ani/dantotsu/download/anime/OfflineAnimeAdapter.kt @@ -58,7 +58,8 @@ class OfflineAnimeAdapter( if (style == 0) { val bannerView = view.findViewById(R.id.itemCompactBanner) // for large view val episodes = view.findViewById(R.id.itemTotal) - episodes.text = context.getString(R.string.episodes) + val text = " ${context.getString(R.string.episodes)}" + episodes.text = text bannerView.setImageURI(item.banner ?: item.image) totalEpisodes.text = item.totalEpisodeList } else if (style == 1) { diff --git a/app/src/main/java/ani/dantotsu/download/manga/OfflineMangaAdapter.kt b/app/src/main/java/ani/dantotsu/download/manga/OfflineMangaAdapter.kt index 746a6b5fc2..612f81e099 100644 --- a/app/src/main/java/ani/dantotsu/download/manga/OfflineMangaAdapter.kt +++ b/app/src/main/java/ani/dantotsu/download/manga/OfflineMangaAdapter.kt @@ -57,7 +57,8 @@ class OfflineMangaAdapter( if (style == 0) { val bannerView = view.findViewById(R.id.itemCompactBanner) // for large view val chapters = view.findViewById(R.id.itemTotal) - chapters.text = context.getString(R.string.chapters) + val text = " ${context.getString(R.string.chapters)}" + chapters.text = text bannerView.setImageURI(item.banner ?: item.image) totalChapter.text = item.totalChapter } else if (style == 1) { diff --git a/app/src/main/java/ani/dantotsu/home/status/RepliesBottomDialog.kt b/app/src/main/java/ani/dantotsu/home/status/RepliesBottomDialog.kt index 69b5738a87..1927384ae9 100644 --- a/app/src/main/java/ani/dantotsu/home/status/RepliesBottomDialog.kt +++ b/app/src/main/java/ani/dantotsu/home/status/RepliesBottomDialog.kt @@ -13,6 +13,7 @@ import ani.dantotsu.BottomSheetDialogFragment import ani.dantotsu.connections.anilist.Anilist import ani.dantotsu.connections.anilist.api.ActivityReply import ani.dantotsu.databinding.BottomSheetRecyclerBinding +import ani.dantotsu.profile.ProfileActivity import ani.dantotsu.profile.activity.ActivityReplyItem import ani.dantotsu.snackString import ani.dantotsu.util.MarkdownCreatorActivity @@ -40,12 +41,12 @@ class RepliesBottomDialog : BottomSheetDialogFragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { binding.repliesRecyclerView.adapter = adapter binding.repliesRecyclerView.layoutManager = LinearLayoutManager( - requireContext(), + context, LinearLayoutManager.VERTICAL, false ) + val context = requireContext() binding.replyButton.setOnClickListener { - val context = requireContext() ContextCompat.startActivity( context, Intent(context, MarkdownCreatorActivity::class.java) @@ -63,7 +64,17 @@ class RepliesBottomDialog : BottomSheetDialogFragment() { if (response != null) { replies.clear() replies.addAll(response.data.page.activityReplies) - adapter.update(replies.map { ActivityReplyItem(it, requireActivity()) { _, _ -> } }) + adapter.update( + replies.map { + ActivityReplyItem( + it, + requireActivity(), + clickCallback = { int, _ -> + onClick(int) + } + ) + } + ) } else { snackString("Failed to load replies") } @@ -72,6 +83,14 @@ class RepliesBottomDialog : BottomSheetDialogFragment() { } + private fun onClick(int: Int) { + ContextCompat.startActivity( + requireContext(), + Intent(requireContext(), ProfileActivity::class.java).putExtra("userId", int), + null + ) + } + private fun loading(load: Boolean) { binding.repliesRefresh.isVisible = load binding.repliesRecyclerView.isVisible = !load diff --git a/app/src/main/java/ani/dantotsu/home/status/Stories.kt b/app/src/main/java/ani/dantotsu/home/status/Stories.kt index 815960b0a4..f0d3cf2b2e 100644 --- a/app/src/main/java/ani/dantotsu/home/status/Stories.kt +++ b/app/src/main/java/ani/dantotsu/home/status/Stories.kt @@ -382,12 +382,13 @@ class Stories @JvmOverloads constructor( it.toString() } } - } ${story.progress ?: story.media?.title?.userPreferred} " + if (story.status?.contains( - "completed" - ) == false && !story.status.contains("plans") && !story.status.contains( - "repeating" + } ${story.progress ?: story.media?.title?.userPreferred} " + + if ( + story.status?.contains("completed") == false && + !story.status.contains("plans") && + !story.status.contains("repeating") ) - ) { + { "of ${story.media?.title?.userPreferred}" } else { "" @@ -446,12 +447,7 @@ class Stories @JvmOverloads constructor( binding.activityRepliesContainer.setOnClickListener { RepliesBottomDialog.newInstance(story.id).show(activity.supportFragmentManager, "replies") } - if (story.replyCount > 0) { - binding.replyCount.text = story.replyCount.toString() - binding.replyCount.visibility = View.VISIBLE - } else { - binding.replyCount.visibility = View.GONE - } + binding.replyCount.text = story.replyCount.toString() binding.activityLikeCount.text = story.likeCount.toString() binding.activityLike.setColorFilter(if (story.isLiked == true) likeColor else notLikeColor) binding.activityLikeContainer.setOnClickListener { diff --git a/app/src/main/java/ani/dantotsu/media/MediaListViewActivity.kt b/app/src/main/java/ani/dantotsu/media/MediaListViewActivity.kt index d1c004aee6..32011d0fff 100644 --- a/app/src/main/java/ani/dantotsu/media/MediaListViewActivity.kt +++ b/app/src/main/java/ani/dantotsu/media/MediaListViewActivity.kt @@ -77,8 +77,8 @@ class MediaListViewActivity: AppCompatActivity() { binding.mediaGrid.setOnClickListener { changeView(0, binding.mediaGrid) } - - binding.listTitle.text = intent.getStringExtra("title") + val text = "${intent.getStringExtra("title")} (${mediaList.count()})" + binding.listTitle.text = text binding.mediaRecyclerView.adapter = MediaAdaptor(view, mediaList, this) binding.mediaRecyclerView.layoutManager = GridLayoutManager( this, diff --git a/app/src/main/java/ani/dantotsu/profile/activity/NotificationActivity.kt b/app/src/main/java/ani/dantotsu/profile/activity/NotificationActivity.kt index 3707be5755..ae27260ba5 100644 --- a/app/src/main/java/ani/dantotsu/profile/activity/NotificationActivity.kt +++ b/app/src/main/java/ani/dantotsu/profile/activity/NotificationActivity.kt @@ -9,6 +9,7 @@ import android.view.ViewGroup import android.widget.CheckBox import android.widget.ImageButton import android.widget.LinearLayout +import android.widget.TextView import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AppCompatActivity import androidx.core.content.ContextCompat @@ -73,6 +74,8 @@ class NotificationActivity : AppCompatActivity() { val dialogView = LayoutInflater.from(currContext()).inflate(R.layout.custom_dialog_layout, null) val checkboxContainer = dialogView.findViewById(R.id.checkboxContainer) val tickAllButton = dialogView.findViewById(R.id.toggleButton) + val title = dialogView.findViewById(R.id.scantitle) + title.visibility = ViewGroup.GONE fun getToggleImageResource(container: ViewGroup): Int { var allChecked = true var allUnchecked = true diff --git a/app/src/main/java/ani/dantotsu/settings/SettingsActivity.kt b/app/src/main/java/ani/dantotsu/settings/SettingsActivity.kt index 9f7bc7f896..2022fac101 100644 --- a/app/src/main/java/ani/dantotsu/settings/SettingsActivity.kt +++ b/app/src/main/java/ani/dantotsu/settings/SettingsActivity.kt @@ -57,7 +57,7 @@ class SettingsActivity : AppCompatActivity() { settingsVersion.apply { text = getString(R.string.version_current, BuildConfig.VERSION_NAME) - settingsVersion.setOnLongClickListener { + setOnLongClickListener { copyToClipboard(getDeviceInfo(), false) toast(getString(R.string.copied_device_info)) return@setOnLongClickListener true diff --git a/app/src/main/res/layout/bottom_sheet_recycler.xml b/app/src/main/res/layout/bottom_sheet_recycler.xml index 90c6e4b689..ac33ef73c1 100644 --- a/app/src/main/res/layout/bottom_sheet_recycler.xml +++ b/app/src/main/res/layout/bottom_sheet_recycler.xml @@ -1,55 +1,62 @@ - + android:orientation="vertical"> - + + + + + - + + + android:visibility="gone" /> + tools:listitem="@layout/item_activity_reply" /> - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/custom_dialog_layout.xml b/app/src/main/res/layout/custom_dialog_layout.xml index d71dde398d..b1f8ada450 100644 --- a/app/src/main/res/layout/custom_dialog_layout.xml +++ b/app/src/main/res/layout/custom_dialog_layout.xml @@ -8,6 +8,7 @@ android:padding="16dp"> - - - - - - - + + + + + + + + + + diff --git a/app/src/main/res/layout/item_activity_reply.xml b/app/src/main/res/layout/item_activity_reply.xml index ff079d25d2..69c992f602 100644 --- a/app/src/main/res/layout/item_activity_reply.xml +++ b/app/src/main/res/layout/item_activity_reply.xml @@ -6,7 +6,6 @@ android:layout_height="wrap_content" android:layout_marginStart="8dp" android:layout_marginTop="16dp" - android:background="?attr/colorSurface" android:orientation="vertical">