Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
aayush262 2024-03-30 02:40:04 +05:30
commit eff0a34c54
9 changed files with 216 additions and 104 deletions

View file

@ -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,18 +438,18 @@ 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(
mediaInfoSequel.visibility = View.VISIBLE
mediaInfoSequelImage.loadImage(
media.sequel!!.banner ?: media.sequel!!.cover
)
bind.mediaInfoSequel.setSafeOnClickListener {
mediaInfoSequel.setSafeOnClickListener {
ContextCompat.startActivity(
requireContext(),
Intent(
@ -463,11 +463,11 @@ class MediaInfoFragment : Fragment() {
}
}
if (media.prequel != null) {
bind.mediaInfoPrequel.visibility = View.VISIBLE
bind.mediaInfoPrequelImage.loadImage(
mediaInfoPrequel.visibility = View.VISIBLE
mediaInfoPrequelImage.loadImage(
media.prequel!!.banner ?: media.prequel!!.cover
)
bind.mediaInfoPrequel.setSafeOnClickListener {
mediaInfoPrequel.setSafeOnClickListener {
ContextCompat.startActivity(
requireContext(),
Intent(
@ -480,71 +480,96 @@ class MediaInfoFragment : Fragment() {
)
}
}
parent.addView(bind.root)
parent.addView(root)
}
val bindi = ItemTitleRecyclerBinding.inflate(
ItemTitleSearchBinding.inflate(
LayoutInflater.from(context),
parent,
false
)
).apply {
bindi.itemRecycler.adapter =
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)
}
}
ItemTitleRecyclerBinding.inflate(
LayoutInflater.from(context),
parent,
false
).apply {
itemRecycler.adapter =
MediaAdaptor(0, media.relations!!, requireActivity())
bindi.itemRecycler.layoutManager = LinearLayoutManager(
itemRecycler.layoutManager = LinearLayoutManager(
requireContext(),
LinearLayoutManager.HORIZONTAL,
false
)
parent.addView(bindi.root)
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 =
).apply {
itemTitle.setText(R.string.characters)
itemRecycler.adapter =
CharacterAdapter(media.characters!!)
bind.itemRecycler.layoutManager = LinearLayoutManager(
itemRecycler.layoutManager = LinearLayoutManager(
requireContext(),
LinearLayoutManager.HORIZONTAL,
false
)
parent.addView(bind.root)
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 =
).apply {
itemTitle.setText(R.string.staff)
itemRecycler.adapter =
AuthorAdapter(media.staff!!)
bind.itemRecycler.layoutManager = LinearLayoutManager(
itemRecycler.layoutManager = LinearLayoutManager(
requireContext(),
LinearLayoutManager.HORIZONTAL,
false
)
parent.addView(bind.root)
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 =
).apply {
itemTitle.setText(R.string.recommended)
itemRecycler.adapter =
MediaAdaptor(0, media.recommendations!!, requireActivity())
bind.itemRecycler.layoutManager = LinearLayoutManager(
itemRecycler.layoutManager = LinearLayoutManager(
requireContext(),
LinearLayoutManager.HORIZONTAL,
false
)
parent.addView(bind.root)
parent.addView(root)
}
}
}
}
@ -569,6 +594,7 @@ class MediaInfoFragment : Fragment() {
}
}
}
super.onViewCreated(view, null)
}

View file

@ -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"),

View file

@ -113,10 +113,8 @@ class ProfileStatsWidget : AppWidgetProvider() {
launchIO {
val userPref = PrefManager.getVal(PrefName.AnilistUserId, "")
val userId = if (userPref.isNotEmpty()) userPref.toInt() else Anilist.userid
?: if (Anilist.query.getUserData()) Anilist.userid else null
userId?.let {
val respond = Anilist.query.getUserProfile(it)
if (userPref.isNotEmpty()) {
val respond = Anilist.query.getUserProfile(userPref.toInt())
respond?.data?.user?.let { user ->
withContext(Dispatchers.Main) {
val views = RemoteViews(context.packageName, R.layout.statistics_widget).apply {
@ -195,7 +193,7 @@ class ProfileStatsWidget : AppWidgetProvider() {
)
val intent = Intent(context, ProfileActivity::class.java)
.putExtra("userId", it)
.putExtra("userId", userPref.toInt())
val pendingIntent = PendingIntent.getActivity(
context, 0, intent, PendingIntent.FLAG_IMMUTABLE
)
@ -205,7 +203,7 @@ class ProfileStatsWidget : AppWidgetProvider() {
appWidgetManager.updateAppWidget(appWidgetId, views)
}
} ?: showLoginCascade(context, appWidgetManager, appWidgetId)
} ?: showLoginCascade(context, appWidgetManager, appWidgetId)
} else showLoginCascade(context, appWidgetManager, appWidgetId)
}
}

View file

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle">
<corners
android:topLeftRadius="28dp"
android:topRightRadius="28dp"
android:bottomLeftRadius="0dp"
android:bottomRightRadius="0dp"/>
</shape>
</item>
<item
android:left="-3dp"
android:right="-3dp"
android:bottom="-50dp">
<shape>
<stroke android:width="2dp" android:color="@color/bg_white" />
<corners
android:topLeftRadius="28dp"
android:topRightRadius="28dp"
android:bottomLeftRadius="0dp"
android:bottomRightRadius="0dp"/>
</shape>
</item>
</layer-list>

View file

@ -14,7 +14,7 @@
android:right="-3dp"
android:bottom="-50dp">
<shape>
<stroke android:width="2dp" android:color="@color/bg_white" />
<stroke android:width="2dp" android:color="@color/bg_black" />
<corners
android:topLeftRadius="28dp"
android:topRightRadius="28dp"

View file

@ -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">
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingStart="32dp"
android:paddingHorizontal="32dp"
android:paddingTop="16dp"
android:paddingEnd="32dp"
android:paddingBottom="16dp">
<TableRow
@ -397,8 +391,7 @@
android:id="@+id/mediaInfoDescriptionText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
android:layout_marginHorizontal="32dp"
android:fontFamily="@font/poppins_bold"
android:text="@string/description"
android:textSize="16sp" />
@ -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"

View file

@ -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">
<com.google.android.material.card.MaterialCardView

View file

@ -0,0 +1,67 @@
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/titleSearchContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="8dp"
android:layout_marginHorizontal="24dp"
android:layout_marginBottom="16dp">
<com.google.android.material.card.MaterialCardView
android:id="@+id/titleSearchCard"
android:layout_width="match_parent"
android:layout_height="72dp"
android:layout_margin="8dp"
app:cardCornerRadius="16dp"
app:layout_constrainedWidth="true"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<ImageView
android:id="@+id/titleSearchImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
tools:ignore="ContentDescription"
tools:src="@tools:sample/backgrounds/scenic" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.75"
android:background="@color/bg_black" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/titleSearchText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="4dp"
android:layout_gravity="center"
android:gravity="center"
android:maxLines="2"
android:ellipsize="end"
android:fontFamily="@font/poppins_bold"
android:text="@string/search"
android:textAllCaps="true"
android:textColor="@color/bg_white"
android:textSize="14sp" />
<View
android:layout_width="64dp"
android:layout_height="2dp"
android:layout_gravity="center"
android:background="?attr/colorSecondary" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -49,10 +49,10 @@
<string name="popular_manga">Popular Manga</string>
<string name="username">Username</string>
<string name="chapters_read">"Chapters Read "</string>
<string name="chapters_read_n">"Chapters\nRead "</string>
<string name="episodes_watched">"Episodes Watched "</string>
<string name="episodes_watched_n">"Episodes\nWatched "</string>
<string name="chapters_read">Chapters Read</string>
<string name="chapters_read_n">Chapters\nRead</string>
<string name="episodes_watched">Episodes Watched</string>
<string name="episodes_watched_n">Episodes\nWatched</string>
<string name="continue_reading">Continue Reading</string>
<string name="continue_watching">Continue Watching</string>
<string name="recommended">Recommended</string>
@ -823,6 +823,8 @@ Non quae tempore quo provident laudantium qui illo dolor vel quia dolor et exerc
<string name="do_it">Do it!</string>
<string name="password">Password</string>
<string name="search_title">Search %1$s</string>
<string name="profile_stats_widget">Track progress directly from your home screen</string>
<string name="anime_watched">Anime\nWatched</string>
<string name="manga_read">Manga\nRead</string>