kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
commit
fed2615d96
|
@ -123,8 +123,6 @@ class MainActivity : AppCompatActivity(), Logging,
|
|||
bluetoothManager.adapter
|
||||
}
|
||||
|
||||
private var actionBarMenu: Menu? = null
|
||||
|
||||
val model: UIViewModel by viewModels()
|
||||
|
||||
data class TabInfo(val text: String, val icon: Int, val content: Fragment)
|
||||
|
@ -421,7 +419,7 @@ class MainActivity : AppCompatActivity(), Logging,
|
|||
|
||||
private fun updateConnectionStatusImage(connected: MeshService.ConnectionState) {
|
||||
|
||||
if (actionBarMenu == null)
|
||||
if (model.actionBarMenu == null)
|
||||
return
|
||||
|
||||
val (image, tooltip) = when (connected) {
|
||||
|
@ -434,10 +432,9 @@ class MainActivity : AppCompatActivity(), Logging,
|
|||
R.drawable.cloud_off,
|
||||
R.string.disconnected
|
||||
)
|
||||
// else -> Pair(R.drawable.cloud_off, R.string.disconnected)
|
||||
}
|
||||
|
||||
val item = actionBarMenu?.findItem(R.id.connectStatusImage)
|
||||
val item = model.actionBarMenu?.findItem(R.id.connectStatusImage)
|
||||
if (item != null) {
|
||||
item.setIcon(image)
|
||||
item.setTitle(tooltip)
|
||||
|
@ -844,7 +841,10 @@ class MainActivity : AppCompatActivity(), Logging,
|
|||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
menuInflater.inflate(R.menu.menu_main, menu)
|
||||
actionBarMenu = menu
|
||||
model.actionBarMenu = menu
|
||||
|
||||
updateConnectionStatusImage(model.isConnected.value!!)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import android.content.Context
|
|||
import android.content.SharedPreferences
|
||||
import android.net.Uri
|
||||
import android.os.RemoteException
|
||||
import android.view.Menu
|
||||
import androidx.core.content.edit
|
||||
import androidx.lifecycle.AndroidViewModel
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
|
@ -50,6 +51,8 @@ class UIViewModel(app: Application) : AndroidViewModel(app), Logging {
|
|||
|
||||
private val context = app.applicationContext
|
||||
|
||||
var actionBarMenu: Menu? = null
|
||||
|
||||
var meshService: IMeshService? = null
|
||||
|
||||
val nodeDB = NodeDB(this)
|
||||
|
|
|
@ -87,7 +87,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:text="06/14 15h01 (13 min ago)"
|
||||
android:text="11h01 PM"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/lastCommIcon"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
|
Ładowanie…
Reference in New Issue