mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
style: replace Pair() usage with explicit values
This commit is contained in:
parent
377c6a18e0
commit
cdc76155d9
4 changed files with 12 additions and 27 deletions
|
|
@ -160,10 +160,7 @@ class MainActivity : AppCompatActivity(), Logging {
|
|||
private val tabsAdapter = object : FragmentStateAdapter(supportFragmentManager, lifecycle) {
|
||||
|
||||
override fun getItemCount(): Int = tabInfos.size
|
||||
|
||||
override fun createFragment(position: Int): Fragment {
|
||||
return tabInfos[position].content
|
||||
}
|
||||
override fun createFragment(position: Int): Fragment = tabInfos[position].content
|
||||
}
|
||||
|
||||
private val isInTestLab: Boolean by lazy {
|
||||
|
|
@ -217,20 +214,12 @@ class MainActivity : AppCompatActivity(), Logging {
|
|||
}
|
||||
|
||||
private fun updateConnectionStatusImage(connected: MeshService.ConnectionState) {
|
||||
|
||||
if (model.actionBarMenu == null)
|
||||
return
|
||||
if (model.actionBarMenu == null) return
|
||||
|
||||
val (image, tooltip) = when (connected) {
|
||||
MeshService.ConnectionState.CONNECTED -> Pair(R.drawable.cloud_on, R.string.connected)
|
||||
MeshService.ConnectionState.DEVICE_SLEEP -> Pair(
|
||||
R.drawable.ic_twotone_cloud_upload_24,
|
||||
R.string.device_sleeping
|
||||
)
|
||||
MeshService.ConnectionState.DISCONNECTED -> Pair(
|
||||
R.drawable.cloud_off,
|
||||
R.string.disconnected
|
||||
)
|
||||
MeshService.ConnectionState.CONNECTED -> R.drawable.cloud_on to R.string.connected
|
||||
MeshService.ConnectionState.DEVICE_SLEEP -> R.drawable.ic_twotone_cloud_upload_24 to R.string.device_sleeping
|
||||
MeshService.ConnectionState.DISCONNECTED -> R.drawable.cloud_off to R.string.disconnected
|
||||
}
|
||||
|
||||
val item = model.actionBarMenu?.findItem(R.id.connectStatusImage)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue