kopia lustrzana https://github.com/ge0rg/aprsdroid
Maps: Google Maps v2 integration
rodzic
8a733af793
commit
65c82c2e4e
|
@ -29,6 +29,9 @@
|
|||
android:usesCleartextTraffic="true"
|
||||
android:theme="@style/DefaultTheme" >
|
||||
|
||||
<meta-data
|
||||
android:name="com.google.android.geo.API_KEY"
|
||||
android:value="@string/google_maps_key" />
|
||||
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
|
||||
<activity android:name=".APRSdroid"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||
|
@ -80,7 +83,13 @@
|
|||
android:parentActivityName=".PrefsAct"
|
||||
android:launchMode="singleTop"
|
||||
/>
|
||||
<activity android:name=".MapAct" android:label="@string/app_map"
|
||||
<activity android:name=".GoogleMapAct" android:label="@string/app_map"
|
||||
android:launchMode="singleTop"
|
||||
android:parentActivityName=".HubActivity"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||
android:theme="@style/MapViewTheme" >
|
||||
</activity>
|
||||
<activity android:name=".MapAct" android:label="@string/app_map"
|
||||
android:launchMode="singleTop"
|
||||
android:parentActivityName=".HubActivity"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||
|
@ -153,4 +162,4 @@
|
|||
</intent-filter>
|
||||
</receiver>
|
||||
</application>
|
||||
</manifest>
|
||||
</manifest>
|
||||
|
|
|
@ -63,6 +63,9 @@ android {
|
|||
resValue "string", "build_revision", "$build_revision"
|
||||
resValue "string", "build_date", "$build_date"
|
||||
resValue "string", "build_version", "$build_version"
|
||||
|
||||
// the google_maps_key is restricted to ge0rg's signing keys and can't be used by other builds!
|
||||
resValue "string", "google_maps_key", "AIzaSyA12R_iI_upYQ33FWnPU_8GlMKrEmjDxiQ"
|
||||
}
|
||||
useLibrary 'org.apache.http.legacy'
|
||||
compileOptions {
|
||||
|
@ -117,5 +120,5 @@ dependencies {
|
|||
implementation "org.scala-lang:scala-library:2.11.12"
|
||||
//compile 'com.google.android.gms:play-services-maps:6.5.87'
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
implementation 'com.google.android.gms:play-services-maps:16.1.0'
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
>
|
||||
<com.google.android.gms.maps.MapView
|
||||
android:id="@+id/mapview"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
/>
|
||||
<ProgressBar
|
||||
style="@android:style/Widget.ProgressBar.Large.Inverse"
|
||||
android:id="@+id/loading"
|
||||
android:padding="10sp"
|
||||
android:layout_width="76dip"
|
||||
android:layout_height="76dip"
|
||||
android:gravity="right|top"
|
||||
android:indeterminate="true"
|
||||
/>
|
||||
</FrameLayout>
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="MapCallSign">
|
||||
<item name="android:typeface">monospace</item>
|
||||
<item name="android:textSize">18sp</item>
|
||||
<item name="android:textColor">#ff000000</item>
|
||||
<item name="android:shadowColor">#80c8ffc8</item>
|
||||
<item name="android:shadowRadius">3</item>
|
||||
<item name="android:shadowDx">0</item>
|
||||
<item name="android:shadowDy">0</item>
|
||||
<item name="android:padding">0sp</item>
|
||||
</style>
|
||||
</resources>
|
|
@ -0,0 +1,63 @@
|
|||
package org.aprsdroid.app
|
||||
|
||||
import android.app.Activity
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
|
||||
import com.google.android.gms.maps.MapView
|
||||
|
||||
class GoogleMapAct extends Activity with UIHelper {
|
||||
lazy val loading = findViewById(R.id.loading).asInstanceOf[View]
|
||||
lazy val mapview = findViewById(R.id.mapview).asInstanceOf[MapView]
|
||||
|
||||
override def onCreate(savedInstanceState: Bundle) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.googlemapview)
|
||||
|
||||
mapview.onCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
override def onLowMemory(): Unit = {
|
||||
super.onLowMemory()
|
||||
mapview.onLowMemory()
|
||||
}
|
||||
|
||||
override def onStart(): Unit = {
|
||||
super.onStart()
|
||||
mapview.onStart()
|
||||
}
|
||||
|
||||
override def onResume(): Unit = {
|
||||
super.onResume()
|
||||
mapview.onResume()
|
||||
}
|
||||
|
||||
override def onSaveInstanceState(outState: Bundle): Unit = {
|
||||
super.onSaveInstanceState(outState)
|
||||
mapview.onSaveInstanceState(outState)
|
||||
}
|
||||
|
||||
override def onPause(): Unit = {
|
||||
super.onPause()
|
||||
mapview.onPause()
|
||||
}
|
||||
|
||||
override def onStop(): Unit = {
|
||||
super.onStop()
|
||||
mapview.onStop()
|
||||
}
|
||||
|
||||
override def onDestroy(): Unit = {
|
||||
super.onDestroy()
|
||||
mapview.onDestroy()
|
||||
}
|
||||
|
||||
override def onStartLoading() {
|
||||
loading.setVisibility(View.VISIBLE)
|
||||
}
|
||||
|
||||
override def onStopLoading() {
|
||||
loading.setVisibility(View.GONE)
|
||||
}
|
||||
}
|
||||
|
|
@ -321,7 +321,7 @@ trait UIHelper extends Activity
|
|||
startActivity(new Intent(this, classOf[HubActivity]).addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT));
|
||||
true
|
||||
case R.id.map =>
|
||||
startActivity(new Intent(this, classOf[MapAct]).addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT));
|
||||
startActivity(new Intent(this, classOf[GoogleMapAct]).addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT));
|
||||
true
|
||||
case R.id.log =>
|
||||
startActivity(new Intent(this, classOf[LogActivity]).addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT));
|
||||
|
|
Ładowanie…
Reference in New Issue