diff --git a/app/src/main/java/ani/dantotsu/media/MediaInfoFragment.kt b/app/src/main/java/ani/dantotsu/media/MediaInfoFragment.kt index 00d3224d9d..a7d07b2edb 100644 --- a/app/src/main/java/ani/dantotsu/media/MediaInfoFragment.kt +++ b/app/src/main/java/ani/dantotsu/media/MediaInfoFragment.kt @@ -35,6 +35,7 @@ import ani.dantotsu.databinding.ItemChipBinding import ani.dantotsu.databinding.ItemQuelsBinding import ani.dantotsu.databinding.ItemTitleChipgroupBinding import ani.dantotsu.databinding.ItemTitleRecyclerBinding +import ani.dantotsu.databinding.ItemTitleSearchBinding import ani.dantotsu.databinding.ItemTitleTextBinding import ani.dantotsu.databinding.ItemTitleTrailerBinding import ani.dantotsu.loadImage @@ -91,7 +92,6 @@ class MediaInfoFragment : Fragment() { if (media != null && !loaded) { loaded = true - binding.mediaInfoProgressBar.visibility = View.GONE binding.mediaInfoContainer.visibility = View.VISIBLE val infoName = tripleTab + (media.name ?: media.nameRomaji) @@ -438,113 +438,138 @@ class MediaInfoFragment : Fragment() { if (!media.relations.isNullOrEmpty() && !offline) { if (media.sequel != null || media.prequel != null) { - val bind = ItemQuelsBinding.inflate( + ItemQuelsBinding.inflate( LayoutInflater.from(context), parent, false - ) + ).apply { - if (media.sequel != null) { - bind.mediaInfoSequel.visibility = View.VISIBLE - bind.mediaInfoSequelImage.loadImage( - media.sequel!!.banner ?: media.sequel!!.cover - ) - bind.mediaInfoSequel.setSafeOnClickListener { - ContextCompat.startActivity( - requireContext(), - Intent( + if (media.sequel != null) { + mediaInfoSequel.visibility = View.VISIBLE + mediaInfoSequelImage.loadImage( + media.sequel!!.banner ?: media.sequel!!.cover + ) + mediaInfoSequel.setSafeOnClickListener { + ContextCompat.startActivity( requireContext(), - MediaDetailsActivity::class.java - ).putExtra( - "media", - media.sequel as Serializable - ), null + Intent( + requireContext(), + MediaDetailsActivity::class.java + ).putExtra( + "media", + media.sequel as Serializable + ), null + ) + } + } + if (media.prequel != null) { + mediaInfoPrequel.visibility = View.VISIBLE + mediaInfoPrequelImage.loadImage( + media.prequel!!.banner ?: media.prequel!!.cover ) + mediaInfoPrequel.setSafeOnClickListener { + ContextCompat.startActivity( + requireContext(), + Intent( + requireContext(), + MediaDetailsActivity::class.java + ).putExtra( + "media", + media.prequel as Serializable + ), null + ) + } } + parent.addView(root) } - if (media.prequel != null) { - bind.mediaInfoPrequel.visibility = View.VISIBLE - bind.mediaInfoPrequelImage.loadImage( - media.prequel!!.banner ?: media.prequel!!.cover - ) - bind.mediaInfoPrequel.setSafeOnClickListener { - ContextCompat.startActivity( - requireContext(), - Intent( - requireContext(), - MediaDetailsActivity::class.java - ).putExtra( - "media", - media.prequel as Serializable - ), null - ) + + ItemTitleSearchBinding.inflate( + LayoutInflater.from(context), + parent, + false + ).apply { + + titleSearchImage.loadImage(media.banner ?: media.cover) + titleSearchText.text = + getString(R.string.search_title, media.mainName()) + titleSearchCard.setSafeOnClickListener { + val query = Intent(requireContext(), SearchActivity::class.java) + .putExtra("type", "ANIME") + .putExtra("query", media.mainName()) + .putExtra("search", true) + ContextCompat.startActivity(requireContext(), query, null) } + + parent.addView(root) } - parent.addView(bind.root) } - val bindi = ItemTitleRecyclerBinding.inflate( + ItemTitleRecyclerBinding.inflate( LayoutInflater.from(context), parent, false - ) + ).apply { - bindi.itemRecycler.adapter = - MediaAdaptor(0, media.relations!!, requireActivity()) - bindi.itemRecycler.layoutManager = LinearLayoutManager( - requireContext(), - LinearLayoutManager.HORIZONTAL, - false - ) - parent.addView(bindi.root) + itemRecycler.adapter = + MediaAdaptor(0, media.relations!!, requireActivity()) + itemRecycler.layoutManager = LinearLayoutManager( + requireContext(), + LinearLayoutManager.HORIZONTAL, + false + ) + parent.addView(root) + } } if (!media.characters.isNullOrEmpty() && !offline) { - val bind = ItemTitleRecyclerBinding.inflate( + ItemTitleRecyclerBinding.inflate( LayoutInflater.from(context), parent, false - ) - bind.itemTitle.setText(R.string.characters) - bind.itemRecycler.adapter = - CharacterAdapter(media.characters!!) - bind.itemRecycler.layoutManager = LinearLayoutManager( - requireContext(), - LinearLayoutManager.HORIZONTAL, - false - ) - parent.addView(bind.root) + ).apply { + itemTitle.setText(R.string.characters) + itemRecycler.adapter = + CharacterAdapter(media.characters!!) + itemRecycler.layoutManager = LinearLayoutManager( + requireContext(), + LinearLayoutManager.HORIZONTAL, + false + ) + parent.addView(root) + } } if (!media.staff.isNullOrEmpty() && !offline) { - val bind = ItemTitleRecyclerBinding.inflate( + ItemTitleRecyclerBinding.inflate( LayoutInflater.from(context), parent, false - ) - bind.itemTitle.setText(R.string.staff) - bind.itemRecycler.adapter = - AuthorAdapter(media.staff!!) - bind.itemRecycler.layoutManager = LinearLayoutManager( - requireContext(), - LinearLayoutManager.HORIZONTAL, - false - ) - parent.addView(bind.root) + ).apply { + itemTitle.setText(R.string.staff) + itemRecycler.adapter = + AuthorAdapter(media.staff!!) + itemRecycler.layoutManager = LinearLayoutManager( + requireContext(), + LinearLayoutManager.HORIZONTAL, + false + ) + parent.addView(root) + } } if (!media.recommendations.isNullOrEmpty() && !offline) { - val bind = ItemTitleRecyclerBinding.inflate( + ItemTitleRecyclerBinding.inflate( LayoutInflater.from(context), parent, false - ) - bind.itemTitle.setText(R.string.recommended) - bind.itemRecycler.adapter = - MediaAdaptor(0, media.recommendations!!, requireActivity()) - bind.itemRecycler.layoutManager = LinearLayoutManager( - requireContext(), - LinearLayoutManager.HORIZONTAL, - false - ) - parent.addView(bind.root) + ).apply { + itemTitle.setText(R.string.recommended) + itemRecycler.adapter = + MediaAdaptor(0, media.recommendations!!, requireActivity()) + itemRecycler.layoutManager = LinearLayoutManager( + requireContext(), + LinearLayoutManager.HORIZONTAL, + false + ) + parent.addView(root) + } } } } @@ -569,6 +594,7 @@ class MediaInfoFragment : Fragment() { } } } + super.onViewCreated(view, null) } diff --git a/app/src/main/java/ani/dantotsu/media/SearchActivity.kt b/app/src/main/java/ani/dantotsu/media/SearchActivity.kt index d2869be435..ca196269c4 100644 --- a/app/src/main/java/ani/dantotsu/media/SearchActivity.kt +++ b/app/src/main/java/ani/dantotsu/media/SearchActivity.kt @@ -70,6 +70,7 @@ class SearchActivity : AppCompatActivity() { intent.getStringExtra("type") ?: "ANIME", isAdult = if (Anilist.adult) intent.getBooleanExtra("hentai", false) else false, onList = listOnly, + search = intent.getStringExtra("query"), genres = intent.getStringExtra("genre")?.let { mutableListOf(it) }, tags = intent.getStringExtra("tag")?.let { mutableListOf(it) }, sort = intent.getStringExtra("sortBy"), diff --git a/app/src/main/res/layout/fragment_media_info.xml b/app/src/main/res/layout/fragment_media_info.xml index 29ae8ff9e7..fddf17678f 100644 --- a/app/src/main/res/layout/fragment_media_info.xml +++ b/app/src/main/res/layout/fragment_media_info.xml @@ -26,10 +26,7 @@ style="?android:attr/progressBarStyle" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginStart="32dp" - android:layout_marginTop="32dp" - android:layout_marginEnd="32dp" - android:layout_marginBottom="32dp" + android:layout_margin="32dp" android:indeterminate="true" android:visibility="gone" tools:visibility="gone" /> @@ -42,15 +39,12 @@ android:visibility="gone" tools:visibility="visible"> - - @@ -407,8 +400,7 @@ android:id="@+id/mediaInfoDescription" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginStart="16dp" - android:layout_marginEnd="16dp" + android:layout_marginHorizontal="16dp" android:ellipsize="end" android:maxLines="5" android:padding="16dp" diff --git a/app/src/main/res/layout/item_quels.xml b/app/src/main/res/layout/item_quels.xml index c0c0dde25c..7376738915 100644 --- a/app/src/main/res/layout/item_quels.xml +++ b/app/src/main/res/layout/item_quels.xml @@ -5,9 +5,8 @@ android:id="@+id/mediaInfoQuelContainer" android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_marginStart="24dp" android:layout_marginTop="8dp" - android:layout_marginEnd="24dp" + android:layout_marginHorizontal="24dp" android:layout_marginBottom="16dp"> + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5f02f550a6..1559189210 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -823,6 +823,8 @@ Non quae tempore quo provident laudantium qui illo dolor vel quia dolor et exerc Do it! Password + Search %1$s + Track progress directly from your home screen Anime\nWatched Manga\nRead