Add a special view to replace descriptions for integrated and delegated sources!

As the integrated and delegated websites don't actually have descriptions, just info, I decided to make a special view for them! with all the info you need available to you in front of your face, there is now no need to go searching through the description! This is likely the most work I have put into 1 feature in the whole time I have been developing TachiyomiSY!
This commit is contained in:
Jobobby04
2020-07-25 21:04:13 -04:00
parent a38cb2ab5f
commit 3e9c8dbfd2
55 changed files with 2635 additions and 362 deletions
+14 -1
View File
@@ -8,6 +8,11 @@ import android.widget.FrameLayout
import androidx.annotation.Px
import com.google.android.material.chip.Chip
import com.google.android.material.chip.ChipGroup
import exh.EH_SOURCE_ID
import exh.EXH_SOURCE_ID
import exh.metadata.metadata.EHentaiSearchMetadata.Companion.TAG_TYPE_LIGHT
import exh.metadata.metadata.EHentaiSearchMetadata.Companion.TAG_TYPE_NORMAL
import exh.metadata.metadata.EHentaiSearchMetadata.Companion.TAG_TYPE_WEAK
inline val View.marginTop: Int
get() = (layoutParams as? ViewGroup.MarginLayoutParams)?.topMargin ?: 0
@@ -120,7 +125,7 @@ fun ChipGroup.setChipsExtended(items: List<String>?, onClick: (item: String) ->
}
}
fun makeSearchChip(item: String, onClick: (item: String) -> Unit = {}, onLongClick: (item: String) -> Unit = {}, sourceId: Long, context: Context, namespace: String? = null): Chip {
fun makeSearchChip(item: String, onClick: (item: String) -> Unit = {}, onLongClick: (item: String) -> Unit = {}, sourceId: Long, context: Context, namespace: String? = null, type: Int? = null): Chip {
return Chip(context).apply {
text = item
val search = (if (namespace != null) SourceTagsUtil().getWrappedTag(sourceId, namespace = namespace, tag = item) else SourceTagsUtil().getWrappedTag(sourceId, fullTag = item)) ?: item
@@ -129,5 +134,13 @@ fun makeSearchChip(item: String, onClick: (item: String) -> Unit = {}, onLongCli
onLongClick(search)
false
}
if (sourceId == EXH_SOURCE_ID || sourceId == EH_SOURCE_ID) {
chipStrokeWidth = when (type) {
TAG_TYPE_NORMAL -> 5F
TAG_TYPE_LIGHT -> 3F
TAG_TYPE_WEAK -> 0F
else -> chipStrokeWidth
}
}
}
}