mirror of
https://github.com/rebelonion/Dantotsu.git
synced 2026-01-29 21:51:04 +00:00
feat: search on home + setting
This commit is contained in:
@@ -20,6 +20,7 @@ import androidx.viewpager2.widget.ViewPager2
|
||||
import ani.dantotsu.MediaPageTransformer
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.connections.anilist.Anilist
|
||||
import ani.dantotsu.connections.anilist.AnilistSearch.SearchType.Companion.toAnilistString
|
||||
import ani.dantotsu.databinding.ItemAnimePageBinding
|
||||
import ani.dantotsu.databinding.LayoutTrendingBinding
|
||||
import ani.dantotsu.getAppString
|
||||
@@ -30,6 +31,7 @@ import ani.dantotsu.media.GenreActivity
|
||||
import ani.dantotsu.media.Media
|
||||
import ani.dantotsu.media.MediaAdaptor
|
||||
import ani.dantotsu.media.MediaListViewActivity
|
||||
import ani.dantotsu.media.SearchActivity
|
||||
import ani.dantotsu.profile.ProfileActivity
|
||||
import ani.dantotsu.px
|
||||
import ani.dantotsu.setSafeOnClickListener
|
||||
@@ -82,10 +84,19 @@ class AnimePageAdapter : RecyclerView.Adapter<AnimePageAdapter.AnimePageViewHold
|
||||
|
||||
trendingBinding.searchBar.hint = binding.root.context.getString(R.string.search)
|
||||
trendingBinding.searchBarText.setOnClickListener {
|
||||
SearchBottomSheet.newInstance().show(
|
||||
(binding.root.context as AppCompatActivity).supportFragmentManager,
|
||||
"search"
|
||||
)
|
||||
val context = binding.root.context
|
||||
if (PrefManager.getVal(PrefName.AniMangaSearchDirect) && Anilist.token != null) {
|
||||
ContextCompat.startActivity(
|
||||
context,
|
||||
Intent(context, SearchActivity::class.java).putExtra("type", "ANIME"),
|
||||
null
|
||||
)
|
||||
} else {
|
||||
SearchBottomSheet.newInstance().show(
|
||||
(context as AppCompatActivity).supportFragmentManager,
|
||||
"search"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
trendingBinding.userAvatar.setSafeOnClickListener {
|
||||
|
||||
@@ -133,6 +133,12 @@ class HomeFragment : Fragment() {
|
||||
"dialog"
|
||||
)
|
||||
}
|
||||
binding.searchImageContainer.setSafeOnClickListener {
|
||||
SearchBottomSheet.newInstance().show(
|
||||
(it.context as androidx.appcompat.app.AppCompatActivity).supportFragmentManager,
|
||||
"search"
|
||||
)
|
||||
}
|
||||
binding.homeUserAvatarContainer.setOnLongClickListener {
|
||||
it.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS)
|
||||
ContextCompat.startActivity(
|
||||
|
||||
@@ -84,10 +84,19 @@ class MangaPageAdapter : RecyclerView.Adapter<MangaPageAdapter.MangaPageViewHold
|
||||
trendingBinding.notificationCount.text = Anilist.unreadNotificationCount.toString()
|
||||
trendingBinding.searchBar.hint = binding.root.context.getString(R.string.search)
|
||||
trendingBinding.searchBarText.setOnClickListener {
|
||||
SearchBottomSheet.newInstance().show(
|
||||
(binding.root.context as AppCompatActivity).supportFragmentManager,
|
||||
"search"
|
||||
)
|
||||
val context = binding.root.context
|
||||
if (PrefManager.getVal(PrefName.AniMangaSearchDirect) && Anilist.token != null) {
|
||||
ContextCompat.startActivity(
|
||||
context,
|
||||
Intent(context, SearchActivity::class.java).putExtra("type", "MANGA"),
|
||||
null
|
||||
)
|
||||
} else {
|
||||
SearchBottomSheet.newInstance().show(
|
||||
(context as AppCompatActivity).supportFragmentManager,
|
||||
"search"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
trendingBinding.userAvatar.setSafeOnClickListener {
|
||||
|
||||
Reference in New Issue
Block a user