mirror of
https://github.com/afollestad/nock-nock.git
synced 2025-04-20 19:45:17 +00:00
Main list shows 'Now' as the next check time if the status is pending
This commit is contained in:
parent
2d81575e4b
commit
c6307f5061
2 changed files with 19 additions and 12 deletions
|
@ -11,6 +11,7 @@ import android.view.ViewGroup
|
|||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.afollestad.nocknock.R
|
||||
import com.afollestad.nocknock.data.ServerModel
|
||||
import com.afollestad.nocknock.data.isPending
|
||||
import com.afollestad.nocknock.data.textRes
|
||||
import com.afollestad.nocknock.utilities.ui.onDebouncedClick
|
||||
import kotlinx.android.synthetic.main.list_item_server.view.iconStatus
|
||||
|
@ -46,13 +47,23 @@ class ServerVH constructor(
|
|||
itemView.textStatus.setText(statusText)
|
||||
}
|
||||
|
||||
if (model.disabled) {
|
||||
itemView.textInterval.setText(R.string.checks_disabled)
|
||||
} else {
|
||||
itemView.textInterval.text = itemView.resources.getString(
|
||||
R.string.next_check_x,
|
||||
model.intervalText()
|
||||
)
|
||||
val res = itemView.resources
|
||||
when {
|
||||
model.disabled -> {
|
||||
itemView.textInterval.setText(R.string.checks_disabled)
|
||||
}
|
||||
model.status.isPending() -> {
|
||||
itemView.textInterval.text = res.getString(
|
||||
R.string.next_check_x,
|
||||
res.getString(R.string.now)
|
||||
)
|
||||
}
|
||||
else -> {
|
||||
itemView.textInterval.text = res.getString(
|
||||
R.string.next_check_x,
|
||||
model.intervalText()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -116,11 +127,6 @@ class ServerAdapter(private val listener: Listener) : RecyclerView.Adapter<Serve
|
|||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
fun clear() {
|
||||
models.clear()
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(
|
||||
parent: ViewGroup,
|
||||
viewType: Int
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
<string name="last_check_result">Last Check Result</string>
|
||||
<string name="next_check">Next Check</string>
|
||||
<string name="next_check_x">Next Check: %1$s</string>
|
||||
<string name="now">Now</string>
|
||||
<string name="none_turned_off">None (turned off)</string>
|
||||
<string name="none">None</string>
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue