Skip to content

Commit

Permalink
fix: After the pinned status changes, multiple items may be affected …
Browse files Browse the repository at this point in the history
…and all need to be updated.
  • Loading branch information
shitlime committed Jul 27, 2023
1 parent b3db9bd commit 19e33f6
Showing 1 changed file with 4 additions and 1 deletion.
@@ -1,5 +1,6 @@
package com.osfans.trime.ime.symbol

import android.annotation.SuppressLint
import android.os.Build
import android.view.LayoutInflater
import android.view.View
Expand Down Expand Up @@ -172,12 +173,14 @@ class FlexibleAdapter(
notifyItemRemoved(position)
}

@SuppressLint("NotifyDataSetChanged")
private fun setPinStatus(id: Int, pinned: Boolean) {
val position = mBeansId.getValue(id)
mBeans[position] = mBeans[position].copy(pinned = pinned)
notifyItemChanged(position)
// 置顶会改变条目的排列顺序
updateBeans(mBeans)
// 置顶状态改变后,可能影响多个条目,需要更新全部
notifyDataSetChanged()
}

// 添加回调
Expand Down

0 comments on commit 19e33f6

Please sign in to comment.