mirror of
https://github.com/rebelonion/Dantotsu.git
synced 2026-01-27 09:01:02 +00:00
chore: unused variables and inbuilt toast
This commit is contained in:
@@ -49,8 +49,6 @@ object Anilist {
|
||||
var timezone: String? = null
|
||||
var animeCustomLists: List<String>? = null
|
||||
var mangaCustomLists: List<String>? = null
|
||||
var animeSplitCompletedSectionByFormat: Boolean = false
|
||||
var mangaSplitCompletedSectionByFormat: Boolean = false
|
||||
|
||||
val sortBy = listOf(
|
||||
"SCORE_DESC",
|
||||
|
||||
@@ -43,36 +43,8 @@ class AnilistQueries {
|
||||
suspend fun getUserData(): Boolean {
|
||||
val response: Query.Viewer?
|
||||
measureTimeMillis {
|
||||
response = executeQuery("""
|
||||
{
|
||||
Viewer {
|
||||
name
|
||||
options {
|
||||
timezone
|
||||
titleLanguage
|
||||
staffNameLanguage
|
||||
activityMergeTime
|
||||
airingNotifications
|
||||
displayAdultContent
|
||||
restrictMessagesToFollowing
|
||||
}
|
||||
avatar { medium }
|
||||
bannerImage
|
||||
id
|
||||
mediaListOptions {
|
||||
scoreFormat
|
||||
rowOrder
|
||||
animeList { sectionOrder customLists splitCompletedSectionByFormat }
|
||||
mangaList { sectionOrder customLists splitCompletedSectionByFormat }
|
||||
}
|
||||
statistics {
|
||||
anime { episodesWatched }
|
||||
manga { chaptersRead }
|
||||
}
|
||||
unreadNotificationCount
|
||||
}
|
||||
}
|
||||
""")
|
||||
response = executeQuery(
|
||||
"""{Viewer{name options{timezone titleLanguage staffNameLanguage activityMergeTime airingNotifications displayAdultContent restrictMessagesToFollowing} avatar{medium} bannerImage id mediaListOptions{scoreFormat rowOrder animeList{customLists} mangaList{customLists}} statistics{anime{episodesWatched} manga{chaptersRead}} unreadNotificationCount}}""")
|
||||
}.also { println("time : $it") }
|
||||
val user = response?.data?.user ?: return false
|
||||
|
||||
@@ -104,12 +76,10 @@ class AnilistQueries {
|
||||
|
||||
it.animeList?.let { animeList ->
|
||||
Anilist.animeCustomLists = animeList.customLists
|
||||
Anilist.animeSplitCompletedSectionByFormat = animeList.splitCompletedSectionByFormat ?: false
|
||||
}
|
||||
|
||||
it.mangaList?.let { mangaList ->
|
||||
Anilist.mangaCustomLists = mangaList.customLists
|
||||
Anilist.mangaSplitCompletedSectionByFormat = mangaList.splitCompletedSectionByFormat ?: false
|
||||
}
|
||||
}
|
||||
return true
|
||||
|
||||
@@ -215,8 +215,8 @@ data class MediaListTypeOptions(
|
||||
// The order each list should be displayed in
|
||||
@SerialName("sectionOrder") var sectionOrder: List<String>?,
|
||||
|
||||
// If the completed sections of the list should be separated by format
|
||||
@SerialName("splitCompletedSectionByFormat") var splitCompletedSectionByFormat: Boolean?,
|
||||
// // If the completed sections of the list should be separated by format
|
||||
// @SerialName("splitCompletedSectionByFormat") var splitCompletedSectionByFormat: Boolean?,
|
||||
|
||||
// The names of the user's custom lists
|
||||
@SerialName("customLists") var customLists: List<String>?,
|
||||
|
||||
@@ -4,7 +4,6 @@ import android.os.Bundle
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ArrayAdapter
|
||||
import android.widget.LinearLayout
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.children
|
||||
import androidx.core.view.updateLayoutParams
|
||||
@@ -25,6 +24,7 @@ import ani.dantotsu.restartApp
|
||||
import ani.dantotsu.statusBarHeight
|
||||
import ani.dantotsu.themes.ThemeManager
|
||||
import ani.dantotsu.toast
|
||||
import ani.dantotsu.util.customAlertDialog
|
||||
import com.google.android.material.textfield.TextInputEditText
|
||||
import com.google.android.material.textfield.TextInputLayout
|
||||
import kotlinx.coroutines.launch
|
||||
@@ -264,6 +264,7 @@ class SettingsAnilistActivity : AppCompatActivity() {
|
||||
LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
|
||||
|
||||
}
|
||||
|
||||
private fun addCustomListItem(listName: String, container: LinearLayout, isAnime: Boolean) {
|
||||
val customListItemView = layoutInflater.inflate(R.layout.item_custom_list, container, false)
|
||||
val textInputLayout = customListItemView.findViewById<TextInputLayout>(R.id.customListItem)
|
||||
@@ -279,15 +280,15 @@ class SettingsAnilistActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
if (listExists) {
|
||||
AlertDialog.Builder(this@SettingsAnilistActivity, R.style.MyPopup)
|
||||
.setTitle(getString(R.string.delete_custom_list))
|
||||
.setMessage(getString(R.string.delete_custom_list_confirm, name))
|
||||
.setPositiveButton(getString(R.string.delete)) { _, _ ->
|
||||
customAlertDialog().apply {
|
||||
setTitle(getString(R.string.delete_custom_list))
|
||||
setMessage(getString(R.string.delete_custom_list_confirm, name))
|
||||
setPosButton(getString(R.string.delete)) {
|
||||
deleteCustomList(name, isAnime)
|
||||
container.removeView(customListItemView)
|
||||
}
|
||||
.setNegativeButton(getString(R.string.cancel), null)
|
||||
.show()
|
||||
setNegButton(getString(R.string.cancel))
|
||||
}.show()
|
||||
} else {
|
||||
container.removeView(customListItemView)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user