chore: cleanup

This commit is contained in:
aayush262 2024-04-29 03:04:51 +05:30
parent a573fbdc89
commit ea48809d07
10 changed files with 42 additions and 116 deletions

View file

@ -315,7 +315,7 @@ class HomeFragment : Fragment() {
binding.homeRecommendedEmpty,
binding.homeRecommended
)
binding.homeUserStatusContainer.visibility = if (PrefManager.getVal<List<Boolean>>(PrefName.HomeLayout)[7]) View.VISIBLE else View.GONE
binding.homeUserStatusContainer.visibility =View.VISIBLE
binding.homeUserStatusProgressBar.visibility = View.VISIBLE
binding.homeUserStatusRecyclerView.visibility = View.GONE
model.getUserStatus().observe(viewLifecycleOwner) {
@ -364,7 +364,8 @@ class HomeFragment : Fragment() {
"MangaContinue",
"MangaFav",
"MangaPlanned",
"Recommendation"
"Recommendation",
"UserStatus"
)
val containers = arrayOf(
@ -375,6 +376,7 @@ class HomeFragment : Fragment() {
binding.homeFavMangaContainer,
binding.homePlannedMangaContainer,
binding.homeRecommendedContainer,
binding.homeUserStatusContainer,
)
val live = Refresh.activity.getOrPut(1) { MutableLiveData(false) }

View file

@ -38,7 +38,7 @@ class CircleView(context: Context, attrs: AttributeSet?) : View(context, attrs)
val secondColor = typedValue1.data
fun setColor(int: Int) {
paint.color = if (int < booleanList.size && booleanList[int]) {
if (isUser) secondColor else Color.GRAY
Color.GRAY
} else {
if (isUser) secondColor else primaryColor
}

View file

@ -42,7 +42,8 @@ class StatusActivity : AppCompatActivity(), StoriesCallback {
slideOutLeft = AnimationUtils.loadAnimation(this, R.anim.slide_out_left)
slideInRight = AnimationUtils.loadAnimation(this, R.anim.slide_in_right)
val watchedActivity = PrefManager.getCustomVal<Set<Int>>("activities", setOf())
val key = "activities"
val watchedActivity = PrefManager.getCustomVal<Set<Int>>(key, setOf())
val startFrom = findFirstNonMatch(watchedActivity, activity[position].activity )
val startIndex = if ( startFrom > 0) startFrom else 0
binding.stories.setStoriesList(activity[position].activity, this, startIndex + 1)
@ -77,7 +78,8 @@ class StatusActivity : AppCompatActivity(), StoriesCallback {
override fun onStoriesEnd() {
position += 1
if (position < activity.size) {
val watchedActivity = PrefManager.getCustomVal<Set<Int>>("activities", setOf())
val key = "activities"
val watchedActivity = PrefManager.getCustomVal<Set<Int>>(key, setOf())
val startFrom = findFirstNonMatch(watchedActivity, activity[position].activity )
val startIndex= if ( startFrom > 0) startFrom else 0
binding.stories.startAnimation(slideOutLeft)

View file

@ -262,7 +262,7 @@ constructor(
}
private fun resetProgressBar(storyIndex: Int) {
for (i in storyIndex until activityList.size) {
for (i in storyIndex until activityList.size + 1) {
val progressBar = findViewWithTag<ProgressBar>("story${i}")
progressBar?.let {
it.progress = 0
@ -317,7 +317,7 @@ constructor(
}
userClicked = true
animation.end()
if (storyIndex < activityList.size)
if (storyIndex <= activityList.size)
storyIndex += 1
showStory()
}
@ -360,7 +360,7 @@ constructor(
val key = "activities"
val set = PrefManager.getCustomVal<Set<Int>>(key, setOf()).plus((story.id))
val newList = set.sorted().takeLast(120).toSet()
val newList = set.sorted().takeLast(200).toSet()
PrefManager.setCustomVal(key, newList)
binding.statusUserAvatar.loadImage(story.user?.avatar?.large)
binding.statusUserName.text = story.user?.name
@ -395,7 +395,7 @@ constructor(
it.toString()
}
}} ${story.progress ?: story.media?.title?.userPreferred} " +
if (story.status?.contains("completed") == false) {
if (story.status?.contains("completed") == false && !story.status.contains("plans") && !story.status.contains("repeating")) {
"of ${story.media?.title?.userPreferred}"
}else {
""

View file

@ -1,7 +1,6 @@
package ani.dantotsu.home.status.listener
interface StoriesCallback {
fun onStoriesEnd()
fun onStoriesStart()
}