Skip to content

Commit 356a845

Browse files
authored
hide update function of inline (#415)
1 parent d344cc8 commit 356a845

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

design/src/main/java/com/github/kr328/clash/design/ProvidersDesign.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ class ProvidersDesign(
5555
fun requestUpdateAll() {
5656
adapter.states.filter { !it.updating }.forEachIndexed { index, state ->
5757
state.updating = true
58-
59-
requests.trySend(Request.Update(index, state.provider))
58+
if (state.provider.vehicleType != Provider.VehicleType.Inline) {
59+
requests.trySend(Request.Update(index, state.provider))
60+
}
6061
}
6162
}
6263
}

design/src/main/java/com/github/kr328/clash/design/adapter/ProviderAdapter.kt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,17 @@ class ProviderAdapter(
5555

5656
holder.binding.provider = state.provider
5757
holder.binding.state = state
58-
holder.binding.update = View.OnClickListener {
59-
state.updating = true
60-
61-
requestUpdate(position, state.provider)
58+
if (state.provider.vehicleType == Provider.VehicleType.Inline) {
59+
holder.binding.endView.visibility = View.GONE
60+
holder.binding.elapsedView.visibility = View.GONE
61+
holder.binding.divider.visibility = View.GONE
62+
} else {
63+
holder.binding.endView.visibility = View.VISIBLE
64+
holder.binding.elapsedView.visibility = View.VISIBLE
65+
holder.binding.update = View.OnClickListener {
66+
state.updating = true
67+
requestUpdate(position, state.provider)
68+
}
6269
}
6370
}
6471

design/src/main/res/layout/adapter_provider.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
android:text="@{IntervalKt.elapsedIntervalString(currentTime.value - state.updatedAt, context)}" />
5959

6060
<View
61+
android:id="@+id/divider"
6162
android:layout_width="@dimen/divider_size"
6263
android:layout_height="wrap_content"
6364
android:layout_centerVertical="true"

0 commit comments

Comments
 (0)