Use alpha to identity weak tags

This commit is contained in:
FooIbar authored and tarsin committed 2023-02-11 09:25:36 +08:00
1 parent 099d802a03
commit 7046e994d7
3 files changed
+15 -22

No files matched your search

@@ -23,16 +23,4 @@ class GalleryTagGroup(
private val mTagList: ArrayList<String> = arrayListOf(),
@JvmField
var groupName: String? = null
) : Parcelable {
fun addTag(tag: String) {
mTagList.add(tag)
}
fun size(): Int {
return mTagList.size
}
fun getTagAt(position: Int): String {
return mTagList[position]
}
}
) : Parcelable, MutableList<String> by mTagList
@@ -292,9 +292,12 @@ object GalleryDetailParser {
if (index >= 0) {
tag = tag.substring(0, index).trim()
}
group.addTag(tag)
if (it.className() == "gtw") {
tag = "_$tag" // weak tag
}
group.add(tag)
}
if (group.size() > 0) group else null
if (group.size > 0) group else null
} catch (e: Throwable) {
ExceptionUtils.throwIfFatal(e)
e.printStackTrace()
@@ -648,12 +648,15 @@ class GalleryDetailScene : CollapsingToolbarScene(), View.OnClickListener, Downl
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT
)
var j = 0
val z = tg.size()
while (j < z) {
tg.forEach {
val tag = inflater.inflate(R.layout.item_gallery_tag, awl, false) as TextView
awl.addView(tag)
val tagStr = tg.getTagAt(j)
val tagStr = if (it.startsWith('_')) {
tag.alpha = 0.5f
it.substring(1)
} else {
it
}
var readableTag: String? = null
if (ehTags != null && ehTags.isInitialized()) {
readableTag = ehTags.getTranslation(prefix, tagStr)
@@ -663,7 +666,6 @@ class GalleryDetailScene : CollapsingToolbarScene(), View.OnClickListener, Downl
tag.setTag(R.id.tag, tg.groupName + ":" + tagStr)
tag.setOnClickListener(this)
tag.setOnLongClickListener(this)
j++
}
}
}
@@ -1749,8 +1751,8 @@ class GalleryDetailScene : CollapsingToolbarScene(), View.OnClickListener, Downl
return null
}
for (tagGroup in tagGroups) {
if ("artist" == tagGroup.groupName && tagGroup.size() > 0) {
return tagGroup.getTagAt(0)
if ("artist" == tagGroup.groupName && tagGroup.size > 0) {
return tagGroup[0].removePrefix("_")
}
}
return null