mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Fixed scrolling up on bottom dialogs and removing stuff from AniList
This commit is contained in:
parent
3dd0fc6c8e
commit
aacd57cb5d
4 changed files with 69 additions and 45 deletions
|
@ -759,6 +759,11 @@ class AniListApi(index: Int) : AccountManager(index), SyncAPI {
|
||||||
return data != ""
|
return data != ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Used to query a saved MediaItem on the list to get the id for removal */
|
||||||
|
data class MediaListItemRoot(@JsonProperty("data") val data: MediaListItem? = null)
|
||||||
|
data class MediaListItem(@JsonProperty("MediaList") val MediaList: MediaListId? = null)
|
||||||
|
data class MediaListId(@JsonProperty("id") val id: Long? = null)
|
||||||
|
|
||||||
private suspend fun postDataAboutId(
|
private suspend fun postDataAboutId(
|
||||||
id: Int,
|
id: Int,
|
||||||
type: AniListStatusType,
|
type: AniListStatusType,
|
||||||
|
@ -766,6 +771,28 @@ class AniListApi(index: Int) : AccountManager(index), SyncAPI {
|
||||||
progress: Int?
|
progress: Int?
|
||||||
): Boolean {
|
): Boolean {
|
||||||
val q =
|
val q =
|
||||||
|
// Delete item if status type is None
|
||||||
|
if (type == AniListStatusType.None) {
|
||||||
|
val userID = getKey<AniListUser>(accountId, ANILIST_USER_KEY)?.id ?: return false
|
||||||
|
// Get list ID for deletion
|
||||||
|
val idQuery = """
|
||||||
|
query MediaList(${'$'}userId: Int = $userID, ${'$'}mediaId: Int = $id) {
|
||||||
|
MediaList(userId: ${'$'}userId, mediaId: ${'$'}mediaId) {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
val response = postApi(idQuery)
|
||||||
|
val listId =
|
||||||
|
tryParseJson<MediaListItemRoot>(response)?.data?.MediaList?.id ?: return false
|
||||||
|
"""
|
||||||
|
mutation(${'$'}id: Int = $listId) {
|
||||||
|
DeleteMediaListEntry(id: ${'$'}id) {
|
||||||
|
deleted
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
} else {
|
||||||
"""mutation (${'$'}id: Int = $id, ${'$'}status: MediaListStatus = ${
|
"""mutation (${'$'}id: Int = $id, ${'$'}status: MediaListStatus = ${
|
||||||
aniListStatusString[maxOf(
|
aniListStatusString[maxOf(
|
||||||
0,
|
0,
|
||||||
|
@ -779,6 +806,8 @@ class AniListApi(index: Int) : AccountManager(index), SyncAPI {
|
||||||
score
|
score
|
||||||
}
|
}
|
||||||
}"""
|
}"""
|
||||||
|
}
|
||||||
|
|
||||||
val data = postApi(q)
|
val data = postApi(q)
|
||||||
return data != ""
|
return data != ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -322,9 +322,7 @@ class ResultFragmentPhone : ResultFragment() {
|
||||||
// it?.dismiss()
|
// it?.dismiss()
|
||||||
//}
|
//}
|
||||||
builder.setCanceledOnTouchOutside(true)
|
builder.setCanceledOnTouchOutside(true)
|
||||||
|
|
||||||
builder.show()
|
builder.show()
|
||||||
|
|
||||||
builder
|
builder
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,8 +176,7 @@ class ResultFragmentTv : ResultFragment() {
|
||||||
loadingDialog = null
|
loadingDialog = null
|
||||||
}
|
}
|
||||||
loadingDialog = loadingDialog ?: context?.let { ctx ->
|
loadingDialog = loadingDialog ?: context?.let { ctx ->
|
||||||
val builder =
|
val builder = BottomSheetDialog(ctx)
|
||||||
BottomSheetDialog(ctx)
|
|
||||||
builder.setContentView(R.layout.bottom_loading)
|
builder.setContentView(R.layout.bottom_loading)
|
||||||
builder.setOnDismissListener {
|
builder.setOnDismissListener {
|
||||||
loadingDialog = null
|
loadingDialog = null
|
||||||
|
@ -187,9 +186,7 @@ class ResultFragmentTv : ResultFragment() {
|
||||||
// it?.dismiss()
|
// it?.dismiss()
|
||||||
//}
|
//}
|
||||||
builder.setCanceledOnTouchOutside(true)
|
builder.setCanceledOnTouchOutside(true)
|
||||||
|
|
||||||
builder.show()
|
builder.show()
|
||||||
|
|
||||||
builder
|
builder
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,34 +1,34 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/text1"
|
android:id="@+id/text1"
|
||||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
android:layout_width="match_parent"
|
||||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_rowWeight="1"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="20dp"
|
||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
android:textStyle="bold"
|
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||||
android:textSize="20sp"
|
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||||
android:textColor="?attr/textColor"
|
android:textColor="?attr/textColor"
|
||||||
android:layout_width="match_parent"
|
android:textSize="20sp"
|
||||||
android:layout_rowWeight="1"
|
android:textStyle="bold"
|
||||||
tools:text="Test"
|
tools:text="Test" />
|
||||||
android:layout_height="wrap_content" />
|
|
||||||
|
|
||||||
<ListView
|
<ListView
|
||||||
android:nextFocusRight="@id/cancel_btt"
|
|
||||||
android:nextFocusLeft="@id/apply_btt"
|
|
||||||
|
|
||||||
android:id="@+id/listview1"
|
android:id="@+id/listview1"
|
||||||
android:layout_marginBottom="60dp"
|
|
||||||
android:paddingTop="10dp"
|
|
||||||
android:requiresFadingEdge="vertical"
|
|
||||||
tools:listitem="@layout/sort_bottom_single_choice_no_checkmark"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_rowWeight="1" />
|
android:layout_rowWeight="1"
|
||||||
|
android:layout_marginBottom="60dp"
|
||||||
|
android:nestedScrollingEnabled="true"
|
||||||
|
android:nextFocusLeft="@id/apply_btt"
|
||||||
|
android:nextFocusRight="@id/cancel_btt"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:requiresFadingEdge="vertical"
|
||||||
|
tools:listitem="@layout/sort_bottom_single_choice_no_checkmark" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
Loading…
Reference in a new issue