forked from recloudstream/cloudstream
sum UI
This commit is contained in:
parent
4cfb7c38c0
commit
f0df8ec391
7 changed files with 165 additions and 44 deletions
|
@ -5,19 +5,22 @@ import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.text.Spannable
|
||||||
|
import android.text.SpannableString
|
||||||
|
import android.text.SpannableStringBuilder
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.View.GONE
|
import android.view.View.GONE
|
||||||
import android.view.View.VISIBLE
|
import android.view.View.VISIBLE
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.FrameLayout
|
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
|
import androidx.core.text.color
|
||||||
import androidx.core.widget.NestedScrollView
|
import androidx.core.widget.NestedScrollView
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.FragmentActivity
|
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import androidx.recyclerview.widget.GridLayoutManager
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
@ -35,7 +38,6 @@ import com.lagradost.cloudstream3.UIHelper.fixPaddingStatusbar
|
||||||
import com.lagradost.cloudstream3.UIHelper.getStatusBarHeight
|
import com.lagradost.cloudstream3.UIHelper.getStatusBarHeight
|
||||||
import com.lagradost.cloudstream3.UIHelper.isCastApiAvailable
|
import com.lagradost.cloudstream3.UIHelper.isCastApiAvailable
|
||||||
import com.lagradost.cloudstream3.UIHelper.popCurrentPage
|
import com.lagradost.cloudstream3.UIHelper.popCurrentPage
|
||||||
import com.lagradost.cloudstream3.UIHelper.popupMenu
|
|
||||||
import com.lagradost.cloudstream3.UIHelper.popupMenuNoIcons
|
import com.lagradost.cloudstream3.UIHelper.popupMenuNoIcons
|
||||||
import com.lagradost.cloudstream3.mvvm.Resource
|
import com.lagradost.cloudstream3.mvvm.Resource
|
||||||
import com.lagradost.cloudstream3.mvvm.observe
|
import com.lagradost.cloudstream3.mvvm.observe
|
||||||
|
@ -246,10 +248,10 @@ class ResultFragment : Fragment() {
|
||||||
getApiFromName(apiName).instantLinkLoading
|
getApiFromName(apiName).instantLinkLoading
|
||||||
} else false
|
} else false
|
||||||
|
|
||||||
var dialog : AlertDialog? = null
|
var dialog: AlertDialog? = null
|
||||||
val currentLoad = currentLoadingCount
|
val currentLoad = currentLoadingCount
|
||||||
|
|
||||||
if(!skipLoading) {
|
if (!skipLoading) {
|
||||||
val builder = AlertDialog.Builder(requireContext(), R.style.AlertDialogCustomTransparent)
|
val builder = AlertDialog.Builder(requireContext(), R.style.AlertDialogCustomTransparent)
|
||||||
val customLayout = layoutInflater.inflate(R.layout.dialog_loading, null)
|
val customLayout = layoutInflater.inflate(R.layout.dialog_loading, null)
|
||||||
builder.setView(customLayout)
|
builder.setView(customLayout)
|
||||||
|
@ -384,11 +386,36 @@ class ResultFragment : Fragment() {
|
||||||
startActivity(Intent.createChooser(i, d.name))
|
startActivity(Intent.createChooser(i, d.name))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d.year != null) {
|
val metadataInfoArray = ArrayList<Pair<String, String>>()
|
||||||
result_year.visibility = VISIBLE
|
if (d is AnimeLoadResponse) {
|
||||||
result_year.text = d.year.toString()
|
val status = when (d.showStatus) {
|
||||||
|
null -> null
|
||||||
|
ShowStatus.Ongoing -> "Ongoing"
|
||||||
|
ShowStatus.Completed -> "Completed"
|
||||||
|
}
|
||||||
|
if (status != null) {
|
||||||
|
metadataInfoArray.add(Pair("Status", status))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (d.year != null) metadataInfoArray.add(Pair("Year", d.year.toString()))
|
||||||
|
val rating = d.rating
|
||||||
|
if (rating != null) metadataInfoArray.add(Pair("Rating",
|
||||||
|
"%.2f/10.0".format(rating.toFloat() / 10f).replace(",", ".")))
|
||||||
|
val duration = d.duration
|
||||||
|
if (duration != null) metadataInfoArray.add(Pair("Duration", duration))
|
||||||
|
|
||||||
|
if (metadataInfoArray.size > 0) {
|
||||||
|
result_metadata.visibility = VISIBLE
|
||||||
|
val text = SpannableStringBuilder()
|
||||||
|
val grayColor = ContextCompat.getColor(requireContext(), R.color.grayTextColor)
|
||||||
|
val textColor = ContextCompat.getColor(requireContext(), R.color.textColor)
|
||||||
|
for (meta in metadataInfoArray) {
|
||||||
|
text.color(grayColor) { append("${meta.first}: ") }
|
||||||
|
.color(textColor) { append("${meta.second}\n") }
|
||||||
|
}
|
||||||
|
result_metadata.text = text
|
||||||
} else {
|
} else {
|
||||||
result_year.visibility = GONE
|
result_metadata.visibility = GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d.posterUrl != null) {
|
if (d.posterUrl != null) {
|
||||||
|
@ -481,7 +508,7 @@ activity?.startActivityForResult(vlcIntent, REQUEST_CODE)
|
||||||
|
|
||||||
result_tag.removeAllViews()
|
result_tag.removeAllViews()
|
||||||
result_tag_holder.visibility = GONE
|
result_tag_holder.visibility = GONE
|
||||||
result_status.visibility = GONE
|
// result_status.visibility = GONE
|
||||||
|
|
||||||
val tags = d.tags
|
val tags = d.tags
|
||||||
if (tags == null) {
|
if (tags == null) {
|
||||||
|
@ -528,12 +555,6 @@ activity?.startActivityForResult(vlcIntent, REQUEST_CODE)
|
||||||
|
|
||||||
when (d) {
|
when (d) {
|
||||||
is AnimeLoadResponse -> {
|
is AnimeLoadResponse -> {
|
||||||
result_status.visibility = VISIBLE
|
|
||||||
result_status.text = when (d.showStatus) {
|
|
||||||
null -> ""
|
|
||||||
ShowStatus.Ongoing -> "Ongoing"
|
|
||||||
ShowStatus.Completed -> "Completed"
|
|
||||||
}
|
|
||||||
|
|
||||||
// val preferEnglish = true
|
// val preferEnglish = true
|
||||||
//val titleName = (if (preferEnglish) d.engName else d.japName) ?: d.name
|
//val titleName = (if (preferEnglish) d.engName else d.japName) ?: d.name
|
||||||
|
|
25
app/src/main/res/drawable/play_button.xml
Normal file
25
app/src/main/res/drawable/play_button.xml
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<vector
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:name="vector"
|
||||||
|
android:width="842dp"
|
||||||
|
android:height="842dp"
|
||||||
|
android:viewportWidth="842"
|
||||||
|
android:viewportHeight="842">
|
||||||
|
<!--70% https://stackoverflow.com/questions/11285961/how-to-make-a-background-20-transparent-on-android -->
|
||||||
|
<path
|
||||||
|
android:name="path"
|
||||||
|
android:pathData="M 421.44 17.5 C 336.15 17.5 253.011 44.513 184.01 94.646 C 115.009 144.778 63.626 215.5 37.27 296.616 C 10.914 377.732 10.914 465.148 37.27 546.264 C 63.626 627.38 115.009 698.102 184.01 748.234 C 253.011 798.367 336.15 825.38 421.44 825.38 C 506.73 825.38 589.869 798.367 658.87 748.234 C 727.871 698.102 779.254 627.38 805.61 546.264 C 831.966 465.148 831.966 377.732 805.61 296.616 C 779.254 215.5 727.871 144.778 658.87 94.646 C 589.869 44.513 506.73 17.5 421.44 17.5 Z"
|
||||||
|
android:fillColor="#B3000000"
|
||||||
|
android:strokeWidth="1"/>
|
||||||
|
<path
|
||||||
|
android:name="path_1"
|
||||||
|
android:pathData="M 421.44 17.5 C 336.15 17.5 253.011 44.513 184.01 94.646 C 115.009 144.778 63.626 215.5 37.27 296.616 C 10.914 377.732 10.914 465.148 37.27 546.264 C 63.626 627.38 115.009 698.102 184.01 748.234 C 253.011 798.367 336.15 825.38 421.44 825.38 C 506.73 825.38 589.869 798.367 658.87 748.234 C 727.871 698.102 779.254 627.38 805.61 546.264 C 831.966 465.148 831.966 377.732 805.61 296.616 C 779.254 215.5 727.871 144.778 658.87 94.646 C 589.869 44.513 506.73 17.5 421.44 17.5 Z"
|
||||||
|
android:strokeColor="#ffffff"
|
||||||
|
android:strokeWidth="35"
|
||||||
|
android:strokeMiterLimit="10"/>
|
||||||
|
<path
|
||||||
|
android:name="path_2"
|
||||||
|
android:pathData="M 598.91 419.24 L 333.91 266.24 L 333.91 572.24 L 598.91 419.24 Z"
|
||||||
|
android:fillColor="#ffffff"
|
||||||
|
android:strokeWidth="1"/>
|
||||||
|
</vector>
|
|
@ -63,7 +63,8 @@
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:visibility="visible"
|
tools:visibility="visible"
|
||||||
android:id="@+id/result_finish_loading" android:layout_width="match_parent"
|
android:id="@+id/result_finish_loading"
|
||||||
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
|
@ -82,7 +83,10 @@
|
||||||
</com.google.android.material.appbar.MaterialToolbar>
|
</com.google.android.material.appbar.MaterialToolbar>
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
<FrameLayout android:layout_width="match_parent" android:id="@+id/result_poster_blur_holder"
|
<FrameLayout
|
||||||
|
android:alpha="0"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:id="@+id/result_poster_blur_holder"
|
||||||
android:layout_height="180dp">
|
android:layout_height="180dp">
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -103,8 +107,8 @@
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="@dimen/result_padding"
|
||||||
android:layout_marginEnd="10dp"
|
android:layout_marginEnd="@dimen/result_padding"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
<!--
|
<!--
|
||||||
|
@ -116,7 +120,7 @@
|
||||||
</ImageView>
|
</ImageView>
|
||||||
</LinearLayout>-->
|
</LinearLayout>-->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="@dimen/result_padding"
|
||||||
android:orientation="horizontal" android:layout_width="match_parent"
|
android:orientation="horizontal" android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
@ -145,33 +149,33 @@
|
||||||
tools:text="The Perfect Run The Perfect Run The Perfect Run"
|
tools:text="The Perfect Run The Perfect Run The Perfect Run"
|
||||||
android:id="@+id/result_title"
|
android:id="@+id/result_title"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="normal"
|
||||||
android:textColor="?attr/textColor" android:layout_width="wrap_content"
|
android:textColor="?attr/textColor" android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
</TextView>
|
</TextView>
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/result_year"
|
android:id="@+id/result_metadata"
|
||||||
|
tools:text="2021\nda"
|
||||||
|
android:paddingTop="3sp"
|
||||||
|
android:lineSpacingExtra="3sp"
|
||||||
|
android:textStyle="normal"
|
||||||
|
android:textSize="15sp"
|
||||||
|
android:textColor="?attr/textColor" android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
</TextView>
|
||||||
|
<!--<TextView
|
||||||
|
android:id="@+id/result_rating"
|
||||||
tools:text="2021"
|
tools:text="2021"
|
||||||
android:textStyle="bold"
|
android:textStyle="normal"
|
||||||
android:textSize="15sp"
|
android:textSize="15sp"
|
||||||
android:textColor="?attr/textColor" android:layout_width="wrap_content"
|
android:textColor="?attr/textColor" android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
</TextView>
|
</TextView>-->
|
||||||
<TextView
|
|
||||||
android:id="@+id/result_status"
|
|
||||||
tools:text="Finished"
|
|
||||||
android:textSize="15sp"
|
|
||||||
android:textColor="?attr/textColor" android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
</TextView>
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<GridLayout android:layout_width="match_parent" android:layout_height="50dp">
|
<GridLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp">
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:visibility="visible"
|
android:visibility="visible"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
|
@ -353,7 +357,7 @@
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:layout_width="30dp"
|
android:layout_width="30dp"
|
||||||
android:layout_height="30dp"
|
android:layout_height="30dp"
|
||||||
android:layout_margin="10dp"
|
android:layout_margin="@dimen/result_padding"
|
||||||
android:layout_gravity="end"
|
android:layout_gravity="end"
|
||||||
android:tint="?attr/white"
|
android:tint="?attr/white"
|
||||||
android:src="@drawable/ic_baseline_clear_24"
|
android:src="@drawable/ic_baseline_clear_24"
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
</View>
|
</View>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<GridLayout android:layout_width="match_parent" android:layout_height="match_parent">
|
<GridLayout android:layout_width="match_parent" android:layout_height="match_parent">
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
|
@ -61,6 +60,4 @@
|
||||||
android:src="@drawable/ic_baseline_more_vert_24"
|
android:src="@drawable/ic_baseline_more_vert_24"
|
||||||
android:contentDescription="@string/episode_more_options_descript"/>
|
android:contentDescription="@string/episode_more_options_descript"/>
|
||||||
</GridLayout>
|
</GridLayout>
|
||||||
|
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
</androidx.cardview.widget.CardView>
|
71
app/src/main/res/layout/result_episode_large.xml
Normal file
71
app/src/main/res/layout/result_episode_large.xml
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
app:cardCornerRadius="@dimen/roundedImageRadius"
|
||||||
|
app:cardBackgroundColor="?attr/itemBackground"
|
||||||
|
android:id="@+id/episode_holder"
|
||||||
|
android:foreground="?android:attr/selectableItemBackgroundBorderless"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
>
|
||||||
|
<LinearLayout
|
||||||
|
android:padding="10dp"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<LinearLayout android:layout_width="match_parent" android:orientation="horizontal"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="126dp"
|
||||||
|
android:layout_height="72dp"
|
||||||
|
>
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/episode_poster"
|
||||||
|
tools:src="@drawable/example_poster"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:contentDescription="@string/episode_poster">
|
||||||
|
</ImageView>
|
||||||
|
<ImageView tools:src="@drawable/play_button"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_width="36dp"
|
||||||
|
android:layout_height="36dp"
|
||||||
|
android:contentDescription="@string/play_episode">
|
||||||
|
</ImageView>
|
||||||
|
<androidx.core.widget.ContentLoadingProgressBar
|
||||||
|
android:id="@+id/episode_progress"
|
||||||
|
style="@android:style/Widget.Material.ProgressBar.Horizontal"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
tools:progress="50"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
|
android:layout_height="5dp">
|
||||||
|
</androidx.core.widget.ContentLoadingProgressBar>
|
||||||
|
</FrameLayout>
|
||||||
|
<LinearLayout android:layout_marginStart="10dp" android:orientation="vertical"
|
||||||
|
android:layout_gravity="center" android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<TextView android:id="@+id/episode_text" tools:text="1. Jobless" android:textColor="?attr/textColor"
|
||||||
|
android:layout_width="wrap_content" android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
</TextView>
|
||||||
|
<TextView android:id="@+id/episode_rating"
|
||||||
|
tools:text="8.8"
|
||||||
|
android:textColor="?attr/grayTextColor"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
</TextView>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
<TextView
|
||||||
|
android:paddingTop="2.5dp"
|
||||||
|
android:id="@+id/episode_descript"
|
||||||
|
android:textColor="?attr/grayTextColor"
|
||||||
|
tools:text="Jon and Daenerys arrive in Winterfell and are met with skepticism. Sam learns about the fate of his family. Cersei gives Euron the reward he aims for. Theon follows his heart. "
|
||||||
|
android:layout_width="match_parent" android:layout_height="wrap_content">
|
||||||
|
</TextView>
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.cardview.widget.CardView>
|
|
@ -2,7 +2,8 @@
|
||||||
<!-- Default screen margins, per the Android Design guidelines. -->
|
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||||
<dimen name="roundedImageRadius">1dp</dimen>
|
<dimen name="roundedImageRadius">5dp</dimen>
|
||||||
<dimen name="navbarHeight">0dp</dimen>
|
<dimen name="navbarHeight">0dp</dimen>
|
||||||
<dimen name="card_corner_radius">2dp</dimen>
|
<dimen name="card_corner_radius">2dp</dimen>
|
||||||
|
<dimen name="result_padding">15dp</dimen>
|
||||||
</resources>
|
</resources>
|
|
@ -34,4 +34,6 @@
|
||||||
<string name="pick_source">Pick Source</string>
|
<string name="pick_source">Pick Source</string>
|
||||||
<string name="reload_error">Retry connection…</string>
|
<string name="reload_error">Retry connection…</string>
|
||||||
<string name="result_go_back">Go Back</string>
|
<string name="result_go_back">Go Back</string>
|
||||||
|
<string name="episode_poster">Episode Poster</string>
|
||||||
|
<string name="play_episode">Play Episode</string>
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in a new issue