mirror of
https://github.com/afollestad/nock-nock.git
synced 2025-08-05 15:48:37 +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 androidx.recyclerview.widget.RecyclerView
|
||||||
import com.afollestad.nocknock.R
|
import com.afollestad.nocknock.R
|
||||||
import com.afollestad.nocknock.data.ServerModel
|
import com.afollestad.nocknock.data.ServerModel
|
||||||
|
import com.afollestad.nocknock.data.isPending
|
||||||
import com.afollestad.nocknock.data.textRes
|
import com.afollestad.nocknock.data.textRes
|
||||||
import com.afollestad.nocknock.utilities.ui.onDebouncedClick
|
import com.afollestad.nocknock.utilities.ui.onDebouncedClick
|
||||||
import kotlinx.android.synthetic.main.list_item_server.view.iconStatus
|
import kotlinx.android.synthetic.main.list_item_server.view.iconStatus
|
||||||
|
@ -46,13 +47,23 @@ class ServerVH constructor(
|
||||||
itemView.textStatus.setText(statusText)
|
itemView.textStatus.setText(statusText)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.disabled) {
|
val res = itemView.resources
|
||||||
itemView.textInterval.setText(R.string.checks_disabled)
|
when {
|
||||||
} else {
|
model.disabled -> {
|
||||||
itemView.textInterval.text = itemView.resources.getString(
|
itemView.textInterval.setText(R.string.checks_disabled)
|
||||||
R.string.next_check_x,
|
}
|
||||||
model.intervalText()
|
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()
|
notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun clear() {
|
|
||||||
models.clear()
|
|
||||||
notifyDataSetChanged()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreateViewHolder(
|
override fun onCreateViewHolder(
|
||||||
parent: ViewGroup,
|
parent: ViewGroup,
|
||||||
viewType: Int
|
viewType: Int
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
<string name="last_check_result">Last Check Result</string>
|
<string name="last_check_result">Last Check Result</string>
|
||||||
<string name="next_check">Next Check</string>
|
<string name="next_check">Next Check</string>
|
||||||
<string name="next_check_x">Next Check: %1$s</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_turned_off">None (turned off)</string>
|
||||||
<string name="none">None</string>
|
<string name="none">None</string>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue