feat: moved "Play on youtube" to info page
This commit is contained in:
parent
b3de2f805f
commit
a73b049fd4
2 changed files with 30 additions and 10 deletions
|
@ -3,6 +3,7 @@ package ani.dantotsu.media
|
|||
import android.animation.ObjectAnimator
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.CountDownTimer
|
||||
|
@ -73,6 +74,15 @@ class MediaInfoFragment : Fragment() {
|
|||
model.getMedia().observe(viewLifecycleOwner) { media ->
|
||||
if (media != null && !loaded) {
|
||||
loaded = true
|
||||
|
||||
//Youtube
|
||||
if (media.anime!!.youtube != null && PrefManager.getVal(PrefName.ShowYtButton)) {
|
||||
binding.animeSourceYT.visibility = View.VISIBLE
|
||||
binding.animeSourceYT.setOnClickListener {
|
||||
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(media.anime.youtube))
|
||||
requireContext().startActivity(intent)
|
||||
}
|
||||
}
|
||||
binding.mediaInfoProgressBar.visibility = View.GONE
|
||||
binding.mediaInfoContainer.visibility = View.VISIBLE
|
||||
binding.mediaInfoName.text = "\t\t\t" + (media.name ?: media.nameRomaji)
|
||||
|
@ -504,16 +514,6 @@ class MediaInfoFragment : Fragment() {
|
|||
)
|
||||
parent.addView(bind.root)
|
||||
}
|
||||
// Comments Section
|
||||
if (!offline) {
|
||||
val bind = FragmentCommentsBinding.inflate(
|
||||
LayoutInflater.from(context),
|
||||
parent,
|
||||
false
|
||||
)
|
||||
bind.commentsList.adapter // rebel take over
|
||||
parent.addView(bind.root)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,26 @@
|
|||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<Button
|
||||
android:id="@+id/animeSourceYT"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginEnd="32dp"
|
||||
android:layout_marginStart="32dp"
|
||||
android:backgroundTint="@color/yt_red"
|
||||
android:fontFamily="@font/poppins_bold"
|
||||
android:insetTop="0dp"
|
||||
android:insetBottom="0dp"
|
||||
android:text="@string/play_yt"
|
||||
android:textColor="@color/bg_white"
|
||||
android:visibility="gone"
|
||||
app:cornerRadius="12dp"
|
||||
app:icon="@drawable/ic_round_play_circle_24"
|
||||
app:iconTint="@color/bg_white"
|
||||
tools:ignore="TextContrastCheck"
|
||||
tools:visibility="visible"/>
|
||||
|
||||
<TableLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue