[android] - update dependencies, target SDK, support library (#15135)

This commit is contained in:
Tobrun
2019-07-19 11:46:38 +02:00
committed by GitHub
parent de667d2fe5
commit 79bdce6cd4
34 changed files with 409 additions and 236 deletions

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mapbox.mapboxsdk.testapp">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
package="com.mapbox.mapboxsdk.testapp">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
@@ -13,7 +13,9 @@
android:label="@string/app_name"
android:roundIcon="@drawable/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
tools:replace="android:appComponentFactory"
android:appComponentFactory="customComponentFactory">
<activity
android:name=".activity.FeatureOverviewActivity"

View File

@@ -19,8 +19,8 @@ import com.mapbox.mapboxsdk.style.sources.GeoJsonSource
import com.mapbox.mapboxsdk.testapp.R
import com.mapbox.mapboxsdk.testapp.utils.GeoParseUtil.loadStringFromAssets
import com.mapbox.mapboxsdk.utils.BitmapUtils
import kotlinx.android.synthetic.main.activity_latlngbounds.*
import java.net.URISyntaxException
import kotlinx.android.synthetic.main.activity_latlngbounds.*
/**
* Test activity showcasing using the LatLngBounds camera API.

View File

@@ -2,7 +2,6 @@ package com.mapbox.mapboxsdk.testapp.activity.fragment
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.view.View
import com.mapbox.mapboxsdk.maps.MapboxMap
import com.mapbox.mapboxsdk.maps.Style
import com.mapbox.mapboxsdk.maps.SupportMapFragment
@@ -28,7 +27,7 @@ class FragmentBackStackActivity : AppCompatActivity() {
add(R.id.container, mapFragment)
}.commit()
button.setOnClickListener { handleClick(it) }
button.setOnClickListener { handleClick() }
}
private fun initMap(mapboxMap: MapboxMap) {
@@ -37,7 +36,7 @@ class FragmentBackStackActivity : AppCompatActivity() {
}
}
private fun handleClick(button: View) {
private fun handleClick() {
supportFragmentManager.beginTransaction().apply {
replace(R.id.container, NestedViewPagerActivity.ItemAdapter.EmptyFragment())
addToBackStack("map_empty_fragment")

View File

@@ -40,7 +40,7 @@ class SnapshotActivity : AppCompatActivity(), OnMapReadyCallback {
override fun onMapReady(map: MapboxMap) {
mapboxMap = map
mapboxMap.setStyle(Style.Builder().fromUrl(Style.OUTDOORS)) { mapView.addOnDidFinishRenderingFrameListener(idleListener) }
mapboxMap.setStyle(Style.Builder().fromUri(Style.OUTDOORS)) { mapView.addOnDidFinishRenderingFrameListener(idleListener) }
}
override fun onStart() {

View File

@@ -1,8 +1,8 @@
package com.mapbox.mapboxsdk.testapp.activity.location
import android.annotation.SuppressLint
import android.app.Fragment
import android.os.Bundle
import android.support.v4.app.Fragment
import android.support.v7.app.AppCompatActivity
import android.view.LayoutInflater
import android.view.View
@@ -30,9 +30,9 @@ class LocationFragmentActivity : AppCompatActivity() {
setContentView(R.layout.activity_location_layer_fragment)
fab.setOnClickListener {
val fragment = fragmentManager.findFragmentByTag(EmptyFragment.TAG)
val fragment = supportFragmentManager.findFragmentByTag(EmptyFragment.TAG)
if (fragment == null) {
fragmentManager
supportFragmentManager
.beginTransaction()
.replace(R.id.container, EmptyFragment.newInstance(), EmptyFragment.TAG)
.addToBackStack("transaction2")
@@ -45,7 +45,7 @@ class LocationFragmentActivity : AppCompatActivity() {
if (PermissionsManager.areLocationPermissionsGranted(this)) {
if (savedInstanceState == null) {
fragmentManager
supportFragmentManager
.beginTransaction()
.replace(R.id.container, LocationFragment.newInstance(), LocationFragment.TAG)
.commit()
@@ -60,7 +60,7 @@ class LocationFragmentActivity : AppCompatActivity() {
override fun onPermissionResult(granted: Boolean) {
if (granted) {
if (savedInstanceState == null) {
fragmentManager
supportFragmentManager
.beginTransaction()
.replace(R.id.container, LocationFragment.newInstance(), LocationFragment.TAG)
.commit()
@@ -96,7 +96,8 @@ class LocationFragmentActivity : AppCompatActivity() {
}
@SuppressLint("MissingPermission")
override fun onViewCreated(view: View?, savedInstanceState: Bundle?) {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
mapView.onCreate(savedInstanceState)
mapView.getMapAsync {
mapboxMap = it
@@ -104,9 +105,9 @@ class LocationFragmentActivity : AppCompatActivity() {
val component = mapboxMap.locationComponent
component.activateLocationComponent(LocationComponentActivationOptions
.builder(activity, style)
.useDefaultLocationEngine(true)
.build())
.builder(activity!!, style)
.useDefaultLocationEngine(true)
.build())
component.isLocationComponentEnabled = true
component.locationEngine?.getLastLocation(this)
@@ -166,8 +167,8 @@ class LocationFragmentActivity : AppCompatActivity() {
}
}
override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View {
val textView = TextView(inflater?.context)
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val textView = TextView(inflater.context)
textView.text = "This is an empty Fragment"
return textView
}

View File

@@ -17,8 +17,8 @@ import com.mapbox.mapboxsdk.offline.OfflineManager
import com.mapbox.mapboxsdk.offline.OfflineRegion
import com.mapbox.mapboxsdk.storage.FileSource
import com.mapbox.mapboxsdk.testapp.R
import kotlinx.android.synthetic.main.activity_change_resources_cache_path.*
import java.io.File
import kotlinx.android.synthetic.main.activity_change_resources_cache_path.*
class ChangeResourcesCachePathActivity : AppCompatActivity(),
AdapterView.OnItemClickListener,

View File

@@ -14,10 +14,10 @@ import com.mapbox.mapboxsdk.geometry.LatLngBounds
import com.mapbox.mapboxsdk.maps.Style
import com.mapbox.mapboxsdk.offline.*
import com.mapbox.mapboxsdk.testapp.R
import kotlinx.android.synthetic.main.activity_region_download.*
import timber.log.Timber
import java.util.*
import java.util.concurrent.TimeUnit
import kotlinx.android.synthetic.main.activity_region_download.*
import timber.log.Timber
/**
* Example showcasing how to download an offline region headless, allows to test pausing and resuming the download.

View File

@@ -40,7 +40,7 @@ class MergeOfflineRegionsActivity : AppCompatActivity() {
private val onRegionMergedListener = object : OfflineManager.MergeOfflineRegionsCallback {
override fun onMerge(offlineRegions: Array<OfflineRegion>) {
mapView.getMapAsync {
it.setStyle(Style.Builder().fromUrl(TEST_STYLE))
it.setStyle(Style.Builder().fromUri(TEST_STYLE))
}
Toast.makeText(
this@MergeOfflineRegionsActivity,
@@ -91,7 +91,7 @@ class MergeOfflineRegionsActivity : AppCompatActivity() {
}
mapView.getMapAsync {
it.isDebugActive = true
it.setStyle(Style.Builder().fromUrl(TEST_STYLE))
it.setStyle(Style.Builder().fromUri(TEST_STYLE))
}
}

View File

@@ -6,7 +6,6 @@ import android.support.design.widget.Snackbar
import android.support.v7.app.AppCompatActivity
import com.mapbox.mapboxsdk.offline.OfflineManager
import com.mapbox.mapboxsdk.testapp.R
import junit.framework.Assert.assertTrue
import kotlinx.android.synthetic.main.activity_cache_management.*
/**
@@ -70,7 +69,7 @@ class CacheManagementActivity : AppCompatActivity() {
fun showSnackbar(message: String) {
// validate that all callbacks occur on main thread
assertTrue(Looper.myLooper() == Looper.getMainLooper())
assert(Looper.myLooper() == Looper.getMainLooper())
// show snackbar
Snackbar.make(container, message, Snackbar.LENGTH_SHORT).show()

View File

@@ -70,7 +70,7 @@ class DraggableMarkerActivity : AppCompatActivity() {
mapboxMap.setStyle(
Style.Builder()
.fromUrl(Style.MAPBOX_STREETS)
.fromUri(Style.MAPBOX_STREETS)
.withImage(markerImageId, IconFactory.getInstance(this).defaultMarker().bitmap)
.withSource(source)
.withLayer(layer)

View File

@@ -52,7 +52,7 @@ class PhysicalUnitCircleActivity : AppCompatActivity(), SeekBar.OnSeekBarChangeL
radiusBar.setOnSeekBarChangeListener(this)
mapboxMap.setStyle(Style.Builder()
.fromUrl(Style.SATELLITE_STREETS)
.fromUri(Style.SATELLITE_STREETS)
.withLayer(FillLayer(LAYER_ID, SOURCE_ID).withProperties(fillColor(interpolate(
exponential(0.5f), zoom(),
stop(8, color(Color.RED)),