絵文字ピッカーでカテゴリ開閉した後のスクロール動作を微妙に改善。NoteStock検索のメンションの扱いの改善。

This commit is contained in:
tateisu 2023-02-24 05:38:51 +09:00
parent 615c57db53
commit 5de2c73dd9
2 changed files with 19 additions and 18 deletions

View File

@ -48,17 +48,17 @@ class APTag(parser: TootParser, jsonArray: JsonArray?) {
"Hashtag" -> hashtags.add(TootTag.parse(parser, it))
"Mention" ->
Acct.parse(it.string("name")!!)
.let { acct ->
mentions.add(
TootMention(
id = EntityId.DEFAULT,
url = it.string("href")!!,
acct = acct, // may local
username = acct.username
)
it.string("name")?.trimStart('@')?.let { rawAcct ->
val acct = Acct.parse(rawAcct)
mentions.add(
TootMention(
id = EntityId.DEFAULT,
url = it.string("href")!!,
acct = acct, // may local
username = acct.username
)
}
)
}
}
} catch (ex: Throwable) {
log.e(ex, "APTag ctor failed.")

View File

@ -619,7 +619,7 @@ private class EmojiPicker(
this.canCollapse =
keywordLower.isNullOrEmpty() && (selectedCategory == null || selectedCategory == EmojiCategory.Custom)
val list = buildList {
adapter.list = buildList {
val filteredCategories = pickerCategries.filter {
selectedCategory == null || it.category == selectedCategory
}.mapNotNull { category ->
@ -648,13 +648,14 @@ private class EmojiPicker(
}
}
}
adapter.list = list
if (scrollToCategory) {
val idx =
list.indexOfFirst { (it as? PickerItemCategory)?.original == lastExpandCategory }
if (idx != -1) {
views.rvGrid.smoothScrollToPosition(idx)
}
val targetCategory = lastExpandCategory
if (scrollToCategory && targetCategory != null) {
views.root.handler?.postDelayed({
adapter.list.indexOfFirst { (it as? PickerItemCategory)?.original == targetCategory }
.takeIf { it != -1 }
?.let { views.rvGrid.smoothScrollToPosition(it) }
}, 100L)
}
for (it in views.llCategories.children) {