Remember 'sort' value

This commit is contained in:
aayush262
2024-01-04 20:53:04 +05:30
parent 75c186fb15
commit dee666c9d0
2 changed files with 9 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
package ani.dantotsu.connections.anilist
import android.app.Activity
import android.content.Context
import ani.dantotsu.R
import ani.dantotsu.checkGenreTime
import ani.dantotsu.checkId
@@ -410,8 +411,9 @@ class AnilistQueries {
sorted["Favourites"]?.sortWith(compareBy { it.userFavOrder })
sorted["All"] = all
val sort = sortOrder ?: options?.rowOrder
val listsort = currContext()?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)
?.getString("sort_order", "score")
val sort = listsort ?: sortOrder ?: options?.rowOrder
for (i in sorted.keys) {
when (sort) {
"score" -> sorted[i]?.sortWith { b, a ->

View File

@@ -1,6 +1,7 @@
package ani.dantotsu.media.user
import android.annotation.SuppressLint
import android.content.Context
import android.os.Bundle
import android.util.TypedValue
import android.view.View
@@ -14,9 +15,11 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.lifecycleScope
import ani.dantotsu.R
import ani.dantotsu.Refresh
import ani.dantotsu.currContext
import ani.dantotsu.databinding.ActivityListBinding
import ani.dantotsu.loadData
import ani.dantotsu.others.LangSet
import ani.dantotsu.saveData
import ani.dantotsu.settings.UserInterfaceSettings
import ani.dantotsu.themes.ThemeManager
import com.google.android.material.tabs.TabLayout
@@ -144,7 +147,8 @@ class ListActivity : AppCompatActivity() {
R.id.release -> "release"
else -> null
}
currContext()?.getSharedPreferences("Dantotsu", Context.MODE_PRIVATE)?.edit()
?.putString("sort_order", sort)?.apply()
binding.listProgressBar.visibility = View.VISIBLE
binding.listViewPager.adapter = null
scope.launch {