Implement MAC lookup (#68)
* Implement MAC lookup * Refine error processing * Use long to store MAC consistently * Link back to macvendors.co * Undo some havoc * Do not show mac spans for TV * Show MAC and IP in a consistent order * Add IP spans by ipinfo.io * Add SpanFormatter * Fix IPv6 ipinfo.io link * Refine SpanFormatter * Fix pressing the link
This commit is contained in:
@@ -2,12 +2,11 @@ package be.mygod.vpnhotspot.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import androidx.appcompat.widget.AppCompatTextView
|
||||
import androidx.core.view.isGone
|
||||
|
||||
class AutoCollapseTextView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = android.R.attr.textViewStyle) :
|
||||
AppCompatTextView(context, attrs, defStyleAttr) {
|
||||
LinkTextView(context, attrs, defStyleAttr) {
|
||||
override fun onTextChanged(text: CharSequence?, start: Int, lengthBefore: Int, lengthAfter: Int) {
|
||||
super.onTextChanged(text, start, lengthBefore, lengthAfter)
|
||||
isGone = text.isNullOrEmpty()
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package be.mygod.vpnhotspot.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.text.method.LinkMovementMethod
|
||||
import android.util.AttributeSet
|
||||
import androidx.appcompat.widget.AppCompatTextView
|
||||
|
||||
open class LinkTextView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = android.R.attr.textViewStyle) :
|
||||
AppCompatTextView(context, attrs, defStyleAttr) {
|
||||
override fun setTextIsSelectable(selectable: Boolean) {
|
||||
super.setTextIsSelectable(selectable)
|
||||
movementMethod = LinkMovementMethod.getInstance() // override what was set in setTextIsSelectable
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user