feat: something
This commit is contained in:
parent
b09f26ed34
commit
79742f415b
8 changed files with 40 additions and 29 deletions
|
@ -191,6 +191,7 @@ object Anilist {
|
||||||
)
|
)
|
||||||
val remaining = json.headers["X-RateLimit-Remaining"]?.toIntOrNull() ?: -1
|
val remaining = json.headers["X-RateLimit-Remaining"]?.toIntOrNull() ?: -1
|
||||||
Logger.log("Remaining requests: $remaining")
|
Logger.log("Remaining requests: $remaining")
|
||||||
|
println("Remaining requests: $remaining")
|
||||||
if (json.code == 429) {
|
if (json.code == 429) {
|
||||||
val retry = json.headers["Retry-After"]?.toIntOrNull() ?: -1
|
val retry = json.headers["Retry-After"]?.toIntOrNull() ?: -1
|
||||||
val passedLimitReset = json.headers["X-RateLimit-Reset"]?.toLongOrNull() ?: 0
|
val passedLimitReset = json.headers["X-RateLimit-Reset"]?.toLongOrNull() ?: 0
|
||||||
|
|
|
@ -38,6 +38,7 @@ import ani.dantotsu.snackString
|
||||||
import ani.dantotsu.statusBarHeight
|
import ani.dantotsu.statusBarHeight
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.async
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
@ -289,15 +290,20 @@ class AnimeFragment : Fragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
model.loaded = true
|
}
|
||||||
model.loadTrending(1)
|
model.loaded = true
|
||||||
model.loadAll()
|
val loadTrending = async(Dispatchers.IO) { model.loadTrending(1) }
|
||||||
|
val loadAll = async(Dispatchers.IO) { model.loadAll() }
|
||||||
|
val loadPopular = async(Dispatchers.IO) {
|
||||||
model.loadPopular(
|
model.loadPopular(
|
||||||
"ANIME", sort = Anilist.sortBy[1], onList = PrefManager.getVal(
|
"ANIME",
|
||||||
PrefName.PopularAnimeList
|
sort = Anilist.sortBy[1],
|
||||||
)
|
onList = PrefManager.getVal(PrefName.PopularAnimeList)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
loadTrending.await()
|
||||||
|
loadAll.await()
|
||||||
|
loadPopular.await()
|
||||||
live.postValue(false)
|
live.postValue(false)
|
||||||
_binding?.animeRefresh?.isRefreshing = false
|
_binding?.animeRefresh?.isRefreshing = false
|
||||||
running = false
|
running = false
|
||||||
|
|
|
@ -35,6 +35,7 @@ import ani.dantotsu.snackString
|
||||||
import ani.dantotsu.statusBarHeight
|
import ani.dantotsu.statusBarHeight
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.async
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
@ -274,15 +275,22 @@ class MangaFragment : Fragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
model.loaded = true
|
}
|
||||||
model.loadTrending()
|
model.loaded = true
|
||||||
model.loadAll()
|
val loadTrending = async(Dispatchers.IO) { model.loadTrending() }
|
||||||
|
val loadAll = async(Dispatchers.IO) { model.loadAll() }
|
||||||
|
val loadPopular = async(Dispatchers.IO) {
|
||||||
model.loadPopular(
|
model.loadPopular(
|
||||||
"MANGA", sort = Anilist.sortBy[1], onList = PrefManager.getVal(
|
"MANGA",
|
||||||
PrefName.PopularMangaList
|
sort = Anilist.sortBy[1],
|
||||||
)
|
onList = PrefManager.getVal(PrefName.PopularAnimeList)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadTrending.await()
|
||||||
|
loadAll.await()
|
||||||
|
loadPopular.await()
|
||||||
|
|
||||||
live.postValue(false)
|
live.postValue(false)
|
||||||
_binding?.mangaRefresh?.isRefreshing = false
|
_binding?.mangaRefresh?.isRefreshing = false
|
||||||
running = false
|
running = false
|
||||||
|
|
|
@ -79,8 +79,8 @@ class NotificationActivity : AppCompatActivity() {
|
||||||
override fun getItemCount(): Int = if (id != -1) 1 else 4
|
override fun getItemCount(): Int = if (id != -1) 1 else 4
|
||||||
|
|
||||||
override fun createFragment(position: Int): Fragment = when (position) {
|
override fun createFragment(position: Int): Fragment = when (position) {
|
||||||
0 -> newInstance(USER)
|
0 -> newInstance(if (id != -1) ONE else USER, id)
|
||||||
1 -> newInstance(if (id != -1) ONE else MEDIA, id)
|
1 -> newInstance(MEDIA)
|
||||||
2 -> newInstance(SUBSCRIPTION)
|
2 -> newInstance(SUBSCRIPTION)
|
||||||
3 -> newInstance(COMMENT)
|
3 -> newInstance(COMMENT)
|
||||||
else -> newInstance(MEDIA)
|
else -> newInstance(MEDIA)
|
||||||
|
|
|
@ -8,6 +8,7 @@ import android.view.ViewGroup
|
||||||
import ani.dantotsu.R
|
import ani.dantotsu.R
|
||||||
import ani.dantotsu.databinding.ItemExtensionBinding
|
import ani.dantotsu.databinding.ItemExtensionBinding
|
||||||
import ani.dantotsu.notifications.subscription.SubscriptionHelper
|
import ani.dantotsu.notifications.subscription.SubscriptionHelper
|
||||||
|
import ani.dantotsu.util.customAlertDialog
|
||||||
import com.xwray.groupie.GroupieAdapter
|
import com.xwray.groupie.GroupieAdapter
|
||||||
import com.xwray.groupie.viewbinding.BindableItem
|
import com.xwray.groupie.viewbinding.BindableItem
|
||||||
|
|
||||||
|
@ -26,14 +27,13 @@ class SubscriptionSource(
|
||||||
binding.extensionNameTextView.text = parserName
|
binding.extensionNameTextView.text = parserName
|
||||||
updateSubscriptionCount()
|
updateSubscriptionCount()
|
||||||
binding.extensionSubscriptions.visibility = View.VISIBLE
|
binding.extensionSubscriptions.visibility = View.VISIBLE
|
||||||
|
|
||||||
binding.extensionSubscriptions.setOnClickListener(null)
|
|
||||||
binding.root.setOnClickListener {
|
binding.root.setOnClickListener {
|
||||||
isExpanded = !isExpanded
|
isExpanded = !isExpanded
|
||||||
toggleSubscriptions()
|
toggleSubscriptions()
|
||||||
}
|
}
|
||||||
binding.subscriptionCount.setOnClickListener {
|
binding.root.setOnLongClickListener {
|
||||||
showRemoveAllSubscriptionsDialog(it.context)
|
showRemoveAllSubscriptionsDialog(it.context)
|
||||||
|
true
|
||||||
}
|
}
|
||||||
binding.extensionIconImageView.visibility = View.VISIBLE
|
binding.extensionIconImageView.visibility = View.VISIBLE
|
||||||
val layoutParams = binding.extensionIconImageView.layoutParams as ViewGroup.MarginLayoutParams
|
val layoutParams = binding.extensionIconImageView.layoutParams as ViewGroup.MarginLayoutParams
|
||||||
|
@ -58,14 +58,13 @@ class SubscriptionSource(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showRemoveAllSubscriptionsDialog(context: Context) {
|
private fun showRemoveAllSubscriptionsDialog(context: Context) {
|
||||||
AlertDialog.Builder(context, R.style.MyPopup)
|
context.customAlertDialog().apply{
|
||||||
.setTitle(R.string.remove_all_subscriptions)
|
setTitle(R.string.remove_all_subscriptions)
|
||||||
.setMessage(context.getString(R.string.remove_all_subscriptions_desc, parserName))
|
setMessage(R.string.remove_all_subscriptions_desc, parserName)
|
||||||
.setPositiveButton(R.string.apply) { _, _ ->
|
setPosButton(R.string.ok) { removeAllSubscriptions() }
|
||||||
removeAllSubscriptions()
|
setNegButton(R.string.cancel)
|
||||||
}
|
show()
|
||||||
.setNegativeButton(R.string.cancel, null)
|
}
|
||||||
.show()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun removeAllSubscriptions() {
|
private fun removeAllSubscriptions() {
|
||||||
|
|
|
@ -314,10 +314,9 @@
|
||||||
android:id="@+id/homeUserStatusContainer"
|
android:id="@+id/homeUserStatusContainer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:minHeight="100dp"
|
android:minHeight="120dp"
|
||||||
android:layout_marginVertical="8dp"
|
android:layout_marginVertical="8dp"
|
||||||
android:visibility="gone">
|
android:visibility="gone">
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:id="@+id/homeUserStatusProgressBar"
|
android:id="@+id/homeUserStatusProgressBar"
|
||||||
style="?android:attr/progressBarStyle"
|
style="?android:attr/progressBarStyle"
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
android:id="@+id/extensionCardView"
|
android:id="@+id/extensionCardView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/colorSurface"
|
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingTop="10dp"
|
android:paddingTop="10dp"
|
||||||
android:paddingBottom="10dp">
|
android:paddingBottom="10dp">
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
android:id="@+id/extensionCardView"
|
android:id="@+id/extensionCardView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/colorSurface"
|
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingTop="10dp"
|
android:paddingTop="10dp"
|
||||||
android:paddingBottom="10dp">
|
android:paddingBottom="10dp">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue