back to making maps work?

pull/8/head
geeksville 2020-03-30 10:26:16 -07:00
rodzic 40853723ab
commit d9ef6815ec
5 zmienionych plików z 26 dodań i 4 usunięć

Wyświetl plik

@ -14,7 +14,7 @@
* limitations under the License.
*/
package androidx.ui.androidview
package androidx.ui.fakeandroidview
import android.content.Context
import android.view.LayoutInflater
@ -41,8 +41,12 @@ fun AndroidView(@LayoutRes resId: Int, postInflationCallback: (View) -> Unit = {
val r = AndroidViewHolder(context)
r.postInflationCallback = postInflationCallback
r.resId = resId
// Hmm - how is merely creating an AndroidViewHolder sufficient to have it end up in the
// activities view hierarchy?
}
private class AndroidViewHolder(context: Context) : ViewGroup(context) {
var view: View? = null
set(value) {

Wyświetl plik

@ -185,6 +185,7 @@ class MainActivity : AppCompatActivity(), Logging,
val prefs = UIState.getPreferences(this)
UIState.ownerName = prefs.getString("owner", "")!!
UIState.meshService = null
UIState.savedInstanceState = savedInstanceState
// Ensures Bluetooth is available on the device and it is enabled. If not,
// displays a dialog requesting user permission to enable Bluetooth.

Wyświetl plik

@ -3,6 +3,7 @@ package com.geeksville.mesh.model
import android.content.Context
import android.content.SharedPreferences
import android.net.Uri
import android.os.Bundle
import android.os.RemoteException
import androidx.compose.mutableStateOf
import androidx.core.content.edit
@ -34,6 +35,8 @@ object UIState : Logging {
/// If the app was launched because we received a new channel intent, the Url will be here
var requestedChannelUrl: Uri? = null
var savedInstanceState: Bundle? = null
/**
* Return the current channel info
* FIXME, we should sim channels at the MeshService level if we are running on an emulator,

Wyświetl plik

@ -47,7 +47,7 @@ fun AppDrawer(
ScreenButton(Screen.messages)
ScreenButton(Screen.users)
// ScreenButton(Screen.map) // turn off for now
ScreenButton(Screen.map) // turn off for now
ScreenButton(Screen.channel)
ScreenButton(Screen.settings)
}

Wyświetl plik

@ -1,12 +1,18 @@
package com.geeksville.mesh.ui
import androidx.compose.Composable
import androidx.ui.androidview.AndroidView
import androidx.ui.core.ContextAmbient
import androidx.ui.core.Text
import androidx.ui.fakeandroidview.AndroidView
import androidx.ui.layout.Column
import androidx.ui.material.MaterialTheme
import androidx.ui.tooling.preview.Preview
import com.geeksville.android.Logging
import com.geeksville.mesh.R
import com.geeksville.mesh.model.UIState
import com.mapbox.mapboxsdk.maps.MapView
object mapLog : Logging
@Composable
fun MapContent() {
@ -15,7 +21,15 @@ fun MapContent() {
val typography = MaterialTheme.typography()
val context = ContextAmbient.current
AndroidView(R.layout.map_view) {
Column {
Text("hi")
AndroidView(R.layout.map_view) { view ->
view as MapView
view.onCreate(UIState.savedInstanceState)
view.getMapAsync {
mapLog.info("In getmap")
}
}
}
}