Fix selectable

This commit is contained in:
Mygod
2018-05-02 21:34:31 -07:00
parent 481eb60f87
commit 7e6f25d030
5 changed files with 7 additions and 5 deletions

View File

@@ -10,7 +10,7 @@ android {
minSdkVersion 21
targetSdkVersion 27
resConfigs "zh-rCN"
versionCode 18
versionCode 20
versionName "1.3.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

View File

@@ -66,12 +66,14 @@ class TetheringFragment : Fragment(), ServiceConnection {
val title: CharSequence
val text: CharSequence
val active: Boolean
val selectable: Boolean
}
inner class TetheredData(val iface: TetheredInterface) : Data {
override val icon: Int get() = TetherType.ofInterface(iface.name).icon
override val icon get() = TetherType.ofInterface(iface.name).icon
override val title get() = iface.name
override val text get() = iface.addresses
override val active = tetheringBinder?.isActive(iface.name) == true
override val selectable get() = true
}
inner class LocalHotspotData(private val lookup: Map<String, NetworkInterface>) : Data {
override val icon: Int get() {
@@ -86,6 +88,7 @@ class TetheringFragment : Fragment(), ServiceConnection {
"${configuration.SSID} - ${configuration.preSharedKey}\n${TetheredInterface(iface, lookup).addresses}"
}
override val active = hotspotBinder?.iface != null
override val selectable get() = active
}
private open class InterfaceViewHolder(val binding: ListitemInterfaceBinding) :

View File

@@ -71,7 +71,6 @@
android:layout_height="wrap_content"
android:layout_column="2"
android:layout_row="1"
android:focusable="false"
android:text="@{data.addresses}"
android:textIsSelectable="true"
tools:text="192.168.49.1/24\n01:23:45:ab:cd:ef"/>
@@ -93,7 +92,6 @@
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipeRefresher"
android:descendantFocusability="blocksDescendants"
android:layout_width="match_parent"
android:layout_height="match_parent">

View File

@@ -46,6 +46,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{client.description}"
android:textIsSelectable="true"
tools:text="Connected to p2p0"/>
</LinearLayout>
</LinearLayout>

View File

@@ -37,13 +37,13 @@
android:layout_height="wrap_content"
android:text="@{data.title}"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
android:textIsSelectable="true"
tools:text="wlan0"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{data.text}"
android:textIsSelectable="@{data.selectable}"
tools:text="192.168.43.1/24\n01:23:45:ab:cd:ef"/>
</LinearLayout>