diff --git a/app/src/main/java/dev/lowrespalmtree/comet/PageAdapter.kt b/app/src/main/java/dev/lowrespalmtree/comet/PageAdapter.kt index ac44c1e..44751d7 100644 --- a/app/src/main/java/dev/lowrespalmtree/comet/PageAdapter.kt +++ b/app/src/main/java/dev/lowrespalmtree/comet/PageAdapter.kt @@ -154,10 +154,19 @@ class PageAdapter(private val listener: Listener) : } } is ContentBlock.Link -> { + val uri = Uri.parse(block.url) val label = block.label.ifBlank { block.url } (holder as ContentViewHolder.Link).binding.textView.text = label holder.binding.root.setOnClickListener { listener.onLinkClick(block.url) } + // Add the protocol on the right view if available and necessary (i.e. not Gemini). + if (uri.isAbsolute && uri.scheme != null && uri.scheme != "gemini") { + holder.binding.protocolView.text = uri.scheme + holder.binding.protocolView.visibility = View.VISIBLE + } else { + holder.binding.protocolView.visibility = View.GONE + } + // Color links differently if it has been already visited or not. val resources = holder.binding.root.context.resources holder.binding.textView.setTextColor( diff --git a/app/src/main/res/layout/gemtext_link.xml b/app/src/main/res/layout/gemtext_link.xml index a87096a..13a4b5f 100644 --- a/app/src/main/res/layout/gemtext_link.xml +++ b/app/src/main/res/layout/gemtext_link.xml @@ -1,6 +1,25 @@ - \ No newline at end of file + android:layout_height="wrap_content"> + + + + + +