mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Fix autolink #720
This commit is contained in:
@@ -5,6 +5,7 @@ KeePassDX(2.8.6)
|
||||
* Fix dialog background #717
|
||||
* Better domain recognition for autofill #702
|
||||
* Write custom data #651
|
||||
* Fix autolink #720
|
||||
|
||||
KeePassDX(2.8.5)
|
||||
* Fix Base 64 #708
|
||||
|
||||
@@ -96,11 +96,11 @@ class EntryContentsView @JvmOverloads constructor(context: Context,
|
||||
|
||||
urlFieldView = findViewById(R.id.entry_url_field)
|
||||
urlFieldView.setLabel(R.string.entry_url)
|
||||
urlFieldView.setValueAutoLink(true)
|
||||
urlFieldView.setLinkAll()
|
||||
|
||||
notesFieldView = findViewById(R.id.entry_notes_field)
|
||||
notesFieldView.setLabel(R.string.entry_notes)
|
||||
notesFieldView.setValueAutoLink(true)
|
||||
notesFieldView.setAutoLink()
|
||||
|
||||
extraFieldsContainerView = findViewById(R.id.extra_fields_container)
|
||||
extraFieldsListView = findViewById(R.id.extra_fields_list)
|
||||
@@ -304,7 +304,7 @@ class EntryContentsView @JvmOverloads constructor(context: Context,
|
||||
entryCustomField?.apply {
|
||||
setLabel(title)
|
||||
setValue(value.toString(), value.isProtected)
|
||||
setValueAutoLink(true)
|
||||
setAutoLink()
|
||||
activateCopyButton(allowCopy)
|
||||
assignCopyButtonClickListener(onCopyButtonClickListener)
|
||||
applyFontVisibility(fontInVisibility)
|
||||
|
||||
@@ -30,6 +30,7 @@ import android.widget.TextView
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.core.text.util.LinkifyCompat
|
||||
import com.kunzisoft.keepass.R
|
||||
import java.util.regex.Pattern
|
||||
|
||||
class EntryField @JvmOverloads constructor(context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
@@ -100,19 +101,27 @@ class EntryField @JvmOverloads constructor(context: Context,
|
||||
setTextIsSelectable(true)
|
||||
}
|
||||
applyHiddenStyle(isProtected && !showButtonView.isSelected)
|
||||
if (valueView.autoLinkMask == Linkify.ALL) {
|
||||
try {
|
||||
LinkifyCompat.addLinks(this, Linkify.ALL)
|
||||
} catch (e: Exception) {}
|
||||
if (valueView.autoLinkMask == LINKIFY_MASKS) {
|
||||
linkify()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun setValueAutoLink(autoLink: Boolean) {
|
||||
valueView.autoLinkMask = if (autoLink && !isProtected) Linkify.ALL else 0
|
||||
fun setAutoLink() {
|
||||
if (!isProtected) linkify()
|
||||
changeProtectedValueParameters()
|
||||
}
|
||||
|
||||
private fun linkify() {
|
||||
valueView.autoLinkMask = LINKIFY_MASKS
|
||||
LinkifyCompat.addLinks(valueView, LINKIFY_MASKS)
|
||||
}
|
||||
|
||||
fun setLinkAll() {
|
||||
valueView.autoLinkMask = LINKIFY_ALL
|
||||
LinkifyCompat.addLinks(valueView, LINKIFY_ALL)
|
||||
}
|
||||
|
||||
fun activateCopyButton(enable: Boolean) {
|
||||
// Reverse because isActivated show custom color and allow click
|
||||
copyButtonView.isActivated = !enable
|
||||
@@ -122,4 +131,8 @@ class EntryField @JvmOverloads constructor(context: Context,
|
||||
copyButtonView.setOnClickListener(onClickActionListener)
|
||||
copyButtonView.visibility = if (onClickActionListener == null) GONE else VISIBLE
|
||||
}
|
||||
companion object {
|
||||
private const val LINKIFY_MASKS = Linkify.WEB_URLS or Linkify.EMAIL_ADDRESSES
|
||||
private const val LINKIFY_ALL = Linkify.ALL
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,3 +4,4 @@
|
||||
* Fix dialog background #717
|
||||
* Better domain recognition for autofill #702
|
||||
* Write custom data #651
|
||||
* Fix autolink #720
|
||||
|
||||
@@ -4,3 +4,4 @@
|
||||
* Correction du fond des dialogues #717
|
||||
* Meilleure reconnaissance du domaine pour l'autofill #702
|
||||
* Ecriture des données customisées #651
|
||||
* Correction de l'autolink #720
|
||||
Reference in New Issue
Block a user