hide update function of inline (#415)

This commit is contained in:
ForestL 2025-02-19 18:15:58 +08:00 committed by GitHub
parent d344cc8e77
commit 356a845b69
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 6 deletions

View File

@ -55,8 +55,9 @@ class ProvidersDesign(
fun requestUpdateAll() {
adapter.states.filter { !it.updating }.forEachIndexed { index, state ->
state.updating = true
requests.trySend(Request.Update(index, state.provider))
if (state.provider.vehicleType != Provider.VehicleType.Inline) {
requests.trySend(Request.Update(index, state.provider))
}
}
}
}

View File

@ -55,10 +55,17 @@ class ProviderAdapter(
holder.binding.provider = state.provider
holder.binding.state = state
holder.binding.update = View.OnClickListener {
state.updating = true
requestUpdate(position, state.provider)
if (state.provider.vehicleType == Provider.VehicleType.Inline) {
holder.binding.endView.visibility = View.GONE
holder.binding.elapsedView.visibility = View.GONE
holder.binding.divider.visibility = View.GONE
} else {
holder.binding.endView.visibility = View.VISIBLE
holder.binding.elapsedView.visibility = View.VISIBLE
holder.binding.update = View.OnClickListener {
state.updating = true
requestUpdate(position, state.provider)
}
}
}

View File

@ -58,6 +58,7 @@
android:text="@{IntervalKt.elapsedIntervalString(currentTime.value - state.updatedAt, context)}" />
<View
android:id="@+id/divider"
android:layout_width="@dimen/divider_size"
android:layout_height="wrap_content"
android:layout_centerVertical="true"