chore: cleanup
This commit is contained in:
parent
c947dbdb70
commit
a573fbdc89
4 changed files with 75 additions and 96 deletions
|
@ -1667,7 +1667,7 @@ Page(page:$page,perPage:50) {
|
||||||
user.name ?: "",
|
user.name ?: "",
|
||||||
user.avatar?.medium,
|
user.avatar?.medium,
|
||||||
user.bannerImage,
|
user.bannerImage,
|
||||||
activity = userActivities.toList()
|
activity = userActivities.sortedBy { it.createdAt }.toList()
|
||||||
)
|
)
|
||||||
if (user.id == Anilist.userid) {
|
if (user.id == Anilist.userid) {
|
||||||
anilistActivities.add(0, userToAdd)
|
anilistActivities.add(0, userToAdd)
|
||||||
|
|
|
@ -76,7 +76,7 @@ class StatusActivity : AppCompatActivity(), StoriesCallback {
|
||||||
}
|
}
|
||||||
override fun onStoriesEnd() {
|
override fun onStoriesEnd() {
|
||||||
position += 1
|
position += 1
|
||||||
if (position < activity.size - 1) {
|
if (position < activity.size) {
|
||||||
val watchedActivity = PrefManager.getCustomVal<Set<Int>>("activities", setOf())
|
val watchedActivity = PrefManager.getCustomVal<Set<Int>>("activities", setOf())
|
||||||
val startFrom = findFirstNonMatch(watchedActivity, activity[position].activity )
|
val startFrom = findFirstNonMatch(watchedActivity, activity[position].activity )
|
||||||
val startIndex= if ( startFrom > 0) startFrom else 0
|
val startIndex= if ( startFrom > 0) startFrom else 0
|
||||||
|
@ -91,7 +91,8 @@ class StatusActivity : AppCompatActivity(), StoriesCallback {
|
||||||
override fun onStoriesStart() {
|
override fun onStoriesStart() {
|
||||||
position -= 1
|
position -= 1
|
||||||
if (position >= 0) {
|
if (position >= 0) {
|
||||||
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 startFrom = findFirstNonMatch(watchedActivity, activity[position].activity )
|
||||||
val startIndex = if ( startFrom > 0) startFrom else 0
|
val startIndex = if ( startFrom > 0) startFrom else 0
|
||||||
binding.stories.startAnimation(slideOutRight)
|
binding.stories.startAnimation(slideOutRight)
|
||||||
|
|
|
@ -5,7 +5,9 @@ import android.animation.ObjectAnimator
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.content.res.ColorStateList
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
|
import android.util.TypedValue
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.MotionEvent
|
import android.view.MotionEvent
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
@ -24,6 +26,7 @@ import ani.dantotsu.blurImage
|
||||||
import ani.dantotsu.buildMarkwon
|
import ani.dantotsu.buildMarkwon
|
||||||
import ani.dantotsu.connections.anilist.Anilist
|
import ani.dantotsu.connections.anilist.Anilist
|
||||||
import ani.dantotsu.connections.anilist.api.Activity
|
import ani.dantotsu.connections.anilist.api.Activity
|
||||||
|
import ani.dantotsu.databinding.FragmentStatusBinding
|
||||||
import ani.dantotsu.home.status.listener.StoriesCallback
|
import ani.dantotsu.home.status.listener.StoriesCallback
|
||||||
import ani.dantotsu.loadImage
|
import ani.dantotsu.loadImage
|
||||||
import ani.dantotsu.media.MediaDetailsActivity
|
import ani.dantotsu.media.MediaDetailsActivity
|
||||||
|
@ -48,30 +51,16 @@ class Stories @JvmOverloads
|
||||||
constructor(
|
constructor(
|
||||||
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
||||||
) : ConstraintLayout(context, attrs, defStyleAttr), View.OnTouchListener {
|
) : ConstraintLayout(context, attrs, defStyleAttr), View.OnTouchListener {
|
||||||
private lateinit var activityList: List<Activity>
|
private lateinit var activity: FragmentActivity
|
||||||
private lateinit var activ: FragmentActivity
|
private lateinit var binding: FragmentStatusBinding
|
||||||
private lateinit var loadingViewLayout: ConstraintLayout
|
|
||||||
private lateinit var leftTouchPanel: FrameLayout
|
|
||||||
private lateinit var rightTouchPanel: FrameLayout
|
|
||||||
private lateinit var statusUserContainer: LinearLayout
|
|
||||||
private lateinit var imageContentView: ImageView
|
|
||||||
private lateinit var imageContentViewKen: ImageView
|
|
||||||
private lateinit var loadingView: ProgressBar
|
|
||||||
private lateinit var activityLikeCount: TextView
|
|
||||||
private lateinit var textActivity: TextView
|
|
||||||
private lateinit var textActivityContainer: LinearLayout
|
|
||||||
private lateinit var activityLike: ImageView
|
|
||||||
private lateinit var activityLikeContainer: LinearLayout
|
|
||||||
private lateinit var userName: TextView
|
|
||||||
private lateinit var userAvatar: ImageView
|
|
||||||
private lateinit var time: TextView
|
|
||||||
private lateinit var infoText: TextView
|
|
||||||
private lateinit var coverImage: ImageView
|
|
||||||
private var storyDuration: String = "6"
|
|
||||||
private lateinit var animation: ObjectAnimator
|
private lateinit var animation: ObjectAnimator
|
||||||
private var storyIndex: Int = 1
|
private lateinit var activityList: List<Activity>
|
||||||
private var userClicked: Boolean = false
|
|
||||||
private lateinit var storiesListener: StoriesCallback
|
private lateinit var storiesListener: StoriesCallback
|
||||||
|
private var userClicked: Boolean = false
|
||||||
|
private var storyIndex: Int = 1
|
||||||
|
private var primaryColor : Int = 0
|
||||||
|
private var onPrimaryColor : Int = 0
|
||||||
|
private var storyDuration: Int = 6
|
||||||
|
|
||||||
init {
|
init {
|
||||||
initLayout()
|
initLayout()
|
||||||
|
@ -79,39 +68,26 @@ constructor(
|
||||||
@SuppressLint("ClickableViewAccessibility")
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
fun initLayout() {
|
fun initLayout() {
|
||||||
val inflater: LayoutInflater = LayoutInflater.from(context)
|
val inflater: LayoutInflater = LayoutInflater.from(context)
|
||||||
val view = inflater.inflate(R.layout.fragment_status, this, false)
|
binding = FragmentStatusBinding.inflate(inflater, this, false)
|
||||||
addView(view)
|
addView(binding.root)
|
||||||
|
val typedValue = TypedValue()
|
||||||
|
val typedValue1 = TypedValue()
|
||||||
|
context.theme.resolveAttribute(com.google.android.material.R.attr.colorPrimary, typedValue, true)
|
||||||
|
context.theme.resolveAttribute(com.google.android.material.R.attr.colorOnPrimary, typedValue1, true)
|
||||||
|
primaryColor = typedValue.data
|
||||||
|
onPrimaryColor = typedValue1.data
|
||||||
|
|
||||||
if (context is StoriesCallback)
|
if (context is StoriesCallback)
|
||||||
storiesListener = context as StoriesCallback
|
storiesListener = context as StoriesCallback
|
||||||
|
|
||||||
|
binding.leftTouchPanel.setOnTouchListener(this)
|
||||||
loadingViewLayout = findViewById(R.id.progressBarContainer)
|
binding.rightTouchPanel.setOnTouchListener(this)
|
||||||
leftTouchPanel = findViewById(R.id.leftTouchPanel)
|
|
||||||
rightTouchPanel = findViewById(R.id.rightTouchPanel)
|
|
||||||
imageContentView = findViewById(R.id.contentImageView)
|
|
||||||
imageContentViewKen = findViewById(R.id.contentImageViewKen)
|
|
||||||
statusUserContainer = findViewById(R.id.statusUserContainer)
|
|
||||||
loadingView = findViewById(R.id.androidStoriesLoadingView)
|
|
||||||
textActivityContainer = findViewById(R.id.textActivityContainer)
|
|
||||||
textActivity = findViewById(R.id.textActivity)
|
|
||||||
coverImage = findViewById(R.id.coverImage)
|
|
||||||
userName = findViewById(R.id.statusUserName)
|
|
||||||
userAvatar = findViewById(R.id.statusUserAvatar)
|
|
||||||
time = findViewById(R.id.statusUserTime)
|
|
||||||
infoText = findViewById(R.id.infoText)
|
|
||||||
activityLikeCount = findViewById(R.id.activityLikeCount)
|
|
||||||
activityLike = findViewById(R.id.activityLike)
|
|
||||||
activityLikeContainer = findViewById(R.id.statusUserActions)
|
|
||||||
|
|
||||||
leftTouchPanel.setOnTouchListener(this)
|
|
||||||
rightTouchPanel.setOnTouchListener(this)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun setStoriesList(activityList: List<Activity>, activity: FragmentActivity, startIndex : Int = 1) {
|
fun setStoriesList(activityList: List<Activity>, activity: FragmentActivity, startIndex : Int = 1) {
|
||||||
this.activityList = activityList
|
this.activityList = activityList
|
||||||
this.activ = activity
|
this.activity = activity
|
||||||
this.storyIndex = startIndex
|
this.storyIndex = startIndex
|
||||||
addLoadingViews(activityList)
|
addLoadingViews(activityList)
|
||||||
}
|
}
|
||||||
|
@ -119,19 +95,21 @@ constructor(
|
||||||
private fun addLoadingViews(storiesList: List<Activity>) {
|
private fun addLoadingViews(storiesList: List<Activity>) {
|
||||||
var idCounter = 1
|
var idCounter = 1
|
||||||
for (story in storiesList) {
|
for (story in storiesList) {
|
||||||
loadingViewLayout.removeView(findViewWithTag<ProgressBar>("story${idCounter}"))
|
binding.progressBarContainer.removeView(findViewWithTag<ProgressBar>("story${idCounter}"))
|
||||||
val progressBar = ProgressBar(context, null, android.R.attr.progressBarStyleHorizontal)
|
val progressBar = ProgressBar(context, null, android.R.attr.progressBarStyleHorizontal)
|
||||||
progressBar.visibility = View.VISIBLE
|
progressBar.visibility = View.VISIBLE
|
||||||
progressBar.id = idCounter
|
progressBar.id = idCounter
|
||||||
progressBar.tag = "story${idCounter++}"
|
progressBar.tag = "story${idCounter++}"
|
||||||
|
progressBar.progressBackgroundTintList = ColorStateList.valueOf(primaryColor)
|
||||||
|
progressBar.progressTintList = ColorStateList.valueOf(onPrimaryColor)
|
||||||
val params = LayoutParams(0, LayoutParams.WRAP_CONTENT)
|
val params = LayoutParams(0, LayoutParams.WRAP_CONTENT)
|
||||||
params.marginEnd = 5
|
params.marginEnd = 5
|
||||||
params.marginStart = 5
|
params.marginStart = 5
|
||||||
loadingViewLayout.addView(progressBar, params)
|
binding.progressBarContainer.addView(progressBar, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
val constraintSet = ConstraintSet()
|
val constraintSet = ConstraintSet()
|
||||||
constraintSet.clone(loadingViewLayout)
|
constraintSet.clone(binding.progressBarContainer)
|
||||||
|
|
||||||
var counter = storiesList.size
|
var counter = storiesList.size
|
||||||
for (story in storiesList) {
|
for (story in storiesList) {
|
||||||
|
@ -225,7 +203,7 @@ constructor(
|
||||||
}
|
}
|
||||||
counter--
|
counter--
|
||||||
}
|
}
|
||||||
constraintSet.applyTo(loadingViewLayout)
|
constraintSet.applyTo(binding.progressBarContainer)
|
||||||
startShowContent()
|
startShowContent()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,7 +216,7 @@ constructor(
|
||||||
completeProgressBar(storyIndex - 1)
|
completeProgressBar(storyIndex - 1)
|
||||||
}
|
}
|
||||||
val progressBar = findViewWithTag<ProgressBar>("story${storyIndex}")
|
val progressBar = findViewWithTag<ProgressBar>("story${storyIndex}")
|
||||||
loadingView.visibility = View.VISIBLE
|
binding.androidStoriesLoadingView.visibility = View.VISIBLE
|
||||||
animation = ObjectAnimator.ofInt(progressBar, "progress", 0, 100)
|
animation = ObjectAnimator.ofInt(progressBar, "progress", 0, 100)
|
||||||
animation.duration = secondsToMillis(storyDuration)
|
animation.duration = secondsToMillis(storyDuration)
|
||||||
animation.interpolator = LinearInterpolator()
|
animation.interpolator = LinearInterpolator()
|
||||||
|
@ -255,13 +233,13 @@ constructor(
|
||||||
showStory()
|
showStory()
|
||||||
} else {
|
} else {
|
||||||
// on stories end
|
// on stories end
|
||||||
loadingView.visibility = View.GONE
|
binding.androidStoriesLoadingView.visibility = View.GONE
|
||||||
onStoriesCompleted()
|
onStoriesCompleted()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// on stories end
|
// on stories end
|
||||||
loadingView.visibility = View.GONE
|
binding.androidStoriesLoadingView.visibility = View.GONE
|
||||||
onStoriesCompleted()
|
onStoriesCompleted()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -279,18 +257,16 @@ constructor(
|
||||||
return findViewWithTag<ProgressBar>(tag).id
|
return findViewWithTag<ProgressBar>(tag).id
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun secondsToMillis(seconds: String): Long {
|
private fun secondsToMillis(seconds: Int): Long {
|
||||||
return (seconds.toLongOrNull() ?: 3).times(1000)
|
return (seconds.toLong()).times(1000)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun resetProgressBar(storyIndex: Int) {
|
private fun resetProgressBar(storyIndex: Int) {
|
||||||
val currentProgressBar = findViewWithTag<ProgressBar>("story${storyIndex}")
|
for (i in storyIndex until activityList.size) {
|
||||||
val lastProgressBar = findViewWithTag<ProgressBar>("story${storyIndex - 1}")
|
val progressBar = findViewWithTag<ProgressBar>("story${i}")
|
||||||
currentProgressBar?.let {
|
progressBar?.let {
|
||||||
it.progress = 0
|
it.progress = 0
|
||||||
}
|
}
|
||||||
lastProgressBar?.let {
|
|
||||||
it.progress = 0
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,17 +357,15 @@ constructor(
|
||||||
animation.resume()
|
animation.resume()
|
||||||
}
|
}
|
||||||
private fun loadStory(story: Activity) {
|
private fun loadStory(story: Activity) {
|
||||||
loadingView.visibility = View.GONE
|
|
||||||
animation.start()
|
|
||||||
|
|
||||||
val key = "activities"
|
val key = "activities"
|
||||||
val set = PrefManager.getCustomVal<Set<Int>>(key, setOf()).plus((story.id))
|
val set = PrefManager.getCustomVal<Set<Int>>(key, setOf()).plus((story.id))
|
||||||
PrefManager.setCustomVal(key, set)
|
val newList = set.sorted().takeLast(120).toSet()
|
||||||
|
PrefManager.setCustomVal(key, newList)
|
||||||
userAvatar.loadImage(story.user?.avatar?.large)
|
binding.statusUserAvatar.loadImage(story.user?.avatar?.large)
|
||||||
userName.text = story.user?.name
|
binding.statusUserName.text = story.user?.name
|
||||||
time.text = ActivityItemBuilder.getDateTime(story.createdAt)
|
binding.statusUserTime.text = ActivityItemBuilder.getDateTime(story.createdAt)
|
||||||
statusUserContainer.setOnClickListener {
|
binding.statusUserContainer.setOnClickListener {
|
||||||
ContextCompat.startActivity(context, Intent(context, ProfileActivity::class.java)
|
ContextCompat.startActivity(context, Intent(context, ProfileActivity::class.java)
|
||||||
.putExtra("userId", story.userId),
|
.putExtra("userId", story.userId),
|
||||||
null)
|
null)
|
||||||
|
@ -400,14 +374,16 @@ constructor(
|
||||||
fun visible(isList: Boolean){
|
fun visible(isList: Boolean){
|
||||||
val visible = if (isList) View.VISIBLE else View.GONE
|
val visible = if (isList) View.VISIBLE else View.GONE
|
||||||
val gone = if (isList) View.GONE else View.VISIBLE
|
val gone = if (isList) View.GONE else View.VISIBLE
|
||||||
textActivity.visibility = gone
|
binding.textActivity.visibility = gone
|
||||||
textActivityContainer.visibility = gone
|
binding.textActivityContainer.visibility = gone
|
||||||
infoText.visibility = visible
|
binding.infoText.visibility = visible
|
||||||
coverImage.visibility = visible
|
binding.coverImage.visibility = visible
|
||||||
infoText.visibility = if (isList) View.VISIBLE else View.INVISIBLE
|
binding.infoText.visibility = if (isList) View.VISIBLE else View.INVISIBLE
|
||||||
imageContentViewKen.visibility = visible
|
binding.infoText.text = ""
|
||||||
imageContentView.visibility = visible
|
binding.contentImageViewKen.visibility = visible
|
||||||
|
binding.contentImageView.visibility = visible
|
||||||
}
|
}
|
||||||
|
|
||||||
when (story.typename){
|
when (story.typename){
|
||||||
"ListActivity" -> {
|
"ListActivity" -> {
|
||||||
visible(true)
|
visible(true)
|
||||||
|
@ -424,11 +400,11 @@ constructor(
|
||||||
}else {
|
}else {
|
||||||
""
|
""
|
||||||
}
|
}
|
||||||
infoText.text = text
|
binding.infoText.text = text
|
||||||
val bannerAnimations: Boolean = PrefManager.getVal(PrefName.BannerAnimations)
|
val bannerAnimations: Boolean = PrefManager.getVal(PrefName.BannerAnimations)
|
||||||
blurImage(if (bannerAnimations)imageContentViewKen else imageContentView, story.media?.bannerImage ?: story.media?.coverImage?.extraLarge)
|
blurImage(if (bannerAnimations)binding.contentImageViewKen else binding.contentImageView, story.media?.bannerImage ?: story.media?.coverImage?.extraLarge)
|
||||||
coverImage.loadImage(story.media?.coverImage?.extraLarge)
|
binding.coverImage.loadImage(story.media?.coverImage?.extraLarge)
|
||||||
coverImage.setOnClickListener{
|
binding.coverImage.setOnClickListener{
|
||||||
ContextCompat.startActivity(context, Intent(context, MediaDetailsActivity::class.java)
|
ContextCompat.startActivity(context, Intent(context, MediaDetailsActivity::class.java)
|
||||||
.putExtra("mediaId", story.media?.id),
|
.putExtra("mediaId", story.media?.id),
|
||||||
null)
|
null)
|
||||||
|
@ -441,7 +417,7 @@ constructor(
|
||||||
if (!(context as android.app.Activity).isDestroyed) {
|
if (!(context as android.app.Activity).isDestroyed) {
|
||||||
val markwon = buildMarkwon(context, false)
|
val markwon = buildMarkwon(context, false)
|
||||||
markwon.setMarkdown(
|
markwon.setMarkdown(
|
||||||
textActivity,
|
binding.textActivity,
|
||||||
AniMarkdown.getBasicAniHTML(story.text ?: "")
|
AniMarkdown.getBasicAniHTML(story.text ?: "")
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -451,7 +427,7 @@ constructor(
|
||||||
if (!(context as android.app.Activity).isDestroyed) {
|
if (!(context as android.app.Activity).isDestroyed) {
|
||||||
val markwon = buildMarkwon(context, false)
|
val markwon = buildMarkwon(context, false)
|
||||||
markwon.setMarkdown(
|
markwon.setMarkdown(
|
||||||
textActivity,
|
binding.textActivity,
|
||||||
AniMarkdown.getBasicAniHTML(story.message ?: "")
|
AniMarkdown.getBasicAniHTML(story.message ?: "")
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -465,18 +441,22 @@ constructor(
|
||||||
|
|
||||||
val likeColor = ContextCompat.getColor(context, R.color.yt_red)
|
val likeColor = ContextCompat.getColor(context, R.color.yt_red)
|
||||||
val notLikeColor = ContextCompat.getColor(context, R.color.bg_opp)
|
val notLikeColor = ContextCompat.getColor(context, R.color.bg_opp)
|
||||||
activityLikeCount.text = story.likeCount.toString()
|
binding.activityLikeCount.text = story.likeCount.toString()
|
||||||
activityLike.setColorFilter(if (story.isLiked == true) likeColor else notLikeColor)
|
binding.activityLike.setColorFilter(if (story.isLiked == true) likeColor else notLikeColor)
|
||||||
activityLikeContainer.setOnClickListener {
|
binding.statusUserActions.setOnClickListener {
|
||||||
like()
|
like()
|
||||||
}
|
}
|
||||||
activityLikeContainer.setOnLongClickListener {
|
|
||||||
|
binding.statusUserActions.setOnLongClickListener {
|
||||||
|
val context = activity
|
||||||
UsersDialogFragment().apply {
|
UsersDialogFragment().apply {
|
||||||
userList(userList)
|
userList(userList)
|
||||||
show(activ.supportFragmentManager, "dialog")
|
show(context.supportFragmentManager, "dialog")
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
binding.androidStoriesLoadingView.visibility = View.GONE
|
||||||
|
animation.start()
|
||||||
}
|
}
|
||||||
fun like(){
|
fun like(){
|
||||||
val story = activityList[storyIndex - 1]
|
val story = activityList[storyIndex - 1]
|
||||||
|
@ -492,9 +472,9 @@ constructor(
|
||||||
} else {
|
} else {
|
||||||
story.likeCount = story.likeCount?.plus(1)
|
story.likeCount = story.likeCount?.plus(1)
|
||||||
}
|
}
|
||||||
activityLikeCount.text = (story.likeCount ?: 0).toString()
|
binding.activityLikeCount.text = (story.likeCount ?: 0).toString()
|
||||||
story.isLiked = !story.isLiked!!
|
story.isLiked = !story.isLiked!!
|
||||||
activityLike.setColorFilter(if (story.isLiked == true) likeColor else notLikeColor)
|
binding.activityLike.setColorFilter(if (story.isLiked == true) likeColor else notLikeColor)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
snackString("Failed to like activity")
|
snackString("Failed to like activity")
|
||||||
|
|
|
@ -62,12 +62,10 @@ class UserStatusAdapter(private val user: ArrayList<User>) :
|
||||||
val user = user[position]
|
val user = user[position]
|
||||||
b.profileUserAvatar.loadImage(user.pfp)
|
b.profileUserAvatar.loadImage(user.pfp)
|
||||||
b.profileUserName.text = if (Anilist.userid == user.id) getAppString(R.string.your_story) else user.name
|
b.profileUserName.text = if (Anilist.userid == user.id) getAppString(R.string.your_story) else user.name
|
||||||
|
|
||||||
val watchedActivity = PrefManager.getCustomVal<Set<Int>>("activities", setOf())
|
val watchedActivity = PrefManager.getCustomVal<Set<Int>>("activities", setOf())
|
||||||
val booleanList = user.activity.map { watchedActivity.contains(it.id) }
|
val booleanList = user.activity.map { watchedActivity.contains(it.id) }
|
||||||
b.profileUserStatusIndicator.setParts(user.activity.size, booleanList, user.id == Anilist.userid)
|
b.profileUserStatusIndicator.setParts(user.activity.size, booleanList, user.id == Anilist.userid)
|
||||||
val newList = watchedActivity.sorted().takeLast(100)
|
|
||||||
PrefManager.setCustomVal("activities",newList.toSet())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getItemCount(): Int = user.size
|
override fun getItemCount(): Int = user.size
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue