[android] - add ktlint, optimise code for ktlint validation
This commit is contained in:
@@ -32,11 +32,11 @@ class LatLngBoundsActivity : AppCompatActivity() {
|
||||
private lateinit var bounds: LatLngBounds
|
||||
|
||||
private val peekHeight by lazy {
|
||||
375.toPx(this) //375dp
|
||||
375.toPx(this) // 375dp
|
||||
}
|
||||
|
||||
private val additionalPadding by lazy {
|
||||
32.toPx(this) //32dp
|
||||
32.toPx(this) // 32dp
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
@@ -160,8 +160,6 @@ class LatLngBoundsActivity : AppCompatActivity() {
|
||||
super.onSaveInstanceState(outState)
|
||||
mapView.onSaveInstanceState(outState)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun Int.toPx(context: Context): Int = (this * context.resources.displayMetrics.density).toInt()
|
||||
|
||||
fun Int.toPx(context: Context): Int = (this * context.resources.displayMetrics.density).toInt()
|
||||
@@ -63,4 +63,4 @@ class PixelTestActivity : AppCompatActivity(), OnMapReadyCallback {
|
||||
super.onLowMemory()
|
||||
mapView.onLowMemory()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,6 @@ import android.widget.TextView
|
||||
import com.mapbox.mapboxsdk.camera.CameraPosition
|
||||
import com.mapbox.mapboxsdk.geometry.LatLng
|
||||
import com.mapbox.mapboxsdk.maps.MapboxMapOptions
|
||||
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback
|
||||
import com.mapbox.mapboxsdk.maps.Style
|
||||
import com.mapbox.mapboxsdk.maps.SupportMapFragment
|
||||
import com.mapbox.mapboxsdk.testapp.R
|
||||
@@ -127,7 +126,8 @@ class NestedViewPagerActivity : AppCompatActivity() {
|
||||
options.camera(CameraPosition.Builder().target(LatLng(62.326440, 92.764913)).zoom(3.0).build())
|
||||
val fragment = SupportMapFragment.newInstance(options)
|
||||
fragment.getMapAsync { mapboxMap -> mapboxMap.setStyle(Style.DARK) }
|
||||
return fragment }
|
||||
return fragment
|
||||
}
|
||||
3 -> {
|
||||
return EmptyFragment.newInstance()
|
||||
}
|
||||
@@ -135,7 +135,8 @@ class NestedViewPagerActivity : AppCompatActivity() {
|
||||
options.camera(CameraPosition.Builder().target(LatLng(-25.007786, 133.623852)).zoom(3.0).build())
|
||||
val fragment = SupportMapFragment.newInstance(options)
|
||||
fragment.getMapAsync { mapboxMap -> mapboxMap.setStyle(Style.SATELLITE) }
|
||||
return fragment }
|
||||
return fragment
|
||||
}
|
||||
5 -> {
|
||||
return EmptyFragment.newInstance()
|
||||
}
|
||||
@@ -162,4 +163,4 @@ class NestedViewPagerActivity : AppCompatActivity() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -83,7 +83,7 @@ class SnapshotActivity : AppCompatActivity(), OnMapReadyCallback {
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val TAG ="Mbgl-SnapshotActivity"
|
||||
const val TAG = "Mbgl-SnapshotActivity"
|
||||
const val LOG_MESSAGE = "OnSnapshot"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -119,7 +119,7 @@ class LocationFragmentActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
override fun onFailure(exception: Exception) {
|
||||
//noop
|
||||
// noop
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
@@ -172,4 +172,4 @@ class LocationFragmentActivity : AppCompatActivity() {
|
||||
return textView
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -151,4 +151,4 @@ open class GLSurfaceRecyclerViewActivity : AppCompatActivity() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -65,7 +65,7 @@ class OverlayMapActivity : AppCompatActivity() {
|
||||
class OverlayView(context: Context) : View(context) {
|
||||
|
||||
private lateinit var paint: Paint
|
||||
|
||||
|
||||
@SuppressLint("DrawAllocation") // only happens once
|
||||
override fun onDraw(canvas: Canvas?) {
|
||||
super.onDraw(canvas)
|
||||
@@ -83,4 +83,4 @@ class OverlayMapActivity : AppCompatActivity() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,4 +12,4 @@ class TextureRecyclerViewActivity : GLSurfaceRecyclerViewActivity() {
|
||||
override fun getMapItemLayoutId(): Int {
|
||||
return R.layout.item_map_texture
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@ class ChangeResourcesCachePathActivity : AppCompatActivity(),
|
||||
|
||||
offlineManager.listOfflineRegions(object : OfflineManager.ListOfflineRegionsCallback {
|
||||
override fun onList(offlineRegions: Array<out OfflineRegion>?) {
|
||||
Logger.i(TAG, "Number of saved offline regions in the new path: ${offlineRegions?.size.toString()}")
|
||||
Logger.i(TAG, "Number of saved offline regions in the new path: ${offlineRegions?.size}")
|
||||
}
|
||||
|
||||
override fun onError(error: String?) {
|
||||
|
||||
@@ -145,7 +145,8 @@ class DownloadRegionActivity : AppCompatActivity(), OfflineRegion.OfflineRegionO
|
||||
}
|
||||
|
||||
if (status.completedResourceCount > status.requiredResourceCount &&
|
||||
previousCompletedResourceCount <= status.requiredResourceCount) {
|
||||
previousCompletedResourceCount <= status.requiredResourceCount
|
||||
) {
|
||||
logMessage("FAILURE! Completed > required")
|
||||
}
|
||||
}
|
||||
@@ -279,11 +280,9 @@ class DownloadRegionActivity : AppCompatActivity(), OfflineRegion.OfflineRegionO
|
||||
}
|
||||
|
||||
override fun onStartTrackingTouch(seekBar: SeekBar) {
|
||||
|
||||
}
|
||||
|
||||
override fun onStopTrackingTouch(seekBar: SeekBar) {
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
@@ -293,17 +292,19 @@ class DownloadRegionActivity : AppCompatActivity(), OfflineRegion.OfflineRegionO
|
||||
}
|
||||
|
||||
override fun onStartTrackingTouch(seekBar: SeekBar) {
|
||||
|
||||
}
|
||||
|
||||
override fun onStopTrackingTouch(seekBar: SeekBar) {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun validCoordinates(latitudeNorth: Double, longitudeEast: Double, latitudeSouth: Double,
|
||||
longitudeWest: Double): Boolean {
|
||||
private fun validCoordinates(
|
||||
latitudeNorth: Double,
|
||||
longitudeEast: Double,
|
||||
latitudeSouth: Double,
|
||||
longitudeWest: Double
|
||||
): Boolean {
|
||||
if (latitudeNorth < -90 || latitudeNorth > 90) {
|
||||
return false
|
||||
} else if (longitudeEast < -180 || longitudeEast > 180) {
|
||||
@@ -315,4 +316,4 @@ class DownloadRegionActivity : AppCompatActivity(), OfflineRegion.OfflineRegionO
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -144,4 +144,4 @@ class MergeOfflineRegionsActivity : AppCompatActivity() {
|
||||
super.onSaveInstanceState(outState)
|
||||
mapView.onSaveInstanceState(outState)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import android.os.Looper
|
||||
import android.support.design.widget.Snackbar
|
||||
import android.support.v7.app.AppCompatActivity
|
||||
import com.mapbox.mapboxsdk.offline.OfflineManager
|
||||
import com.mapbox.mapboxsdk.storage.FileSource
|
||||
import com.mapbox.mapboxsdk.testapp.R
|
||||
import junit.framework.Assert.assertTrue
|
||||
import kotlinx.android.synthetic.main.activity_cache_management.*
|
||||
|
||||
@@ -171,11 +171,17 @@ class DraggableMarkerActivity : AppCompatActivity() {
|
||||
* @param touchAreaMaxX maximum value of X-axis motion event
|
||||
* @param touchAreaMaxY maximum value of Y-axis motion event
|
||||
*/
|
||||
class DraggableSymbolsManager(mapView: MapView, private val mapboxMap: MapboxMap,
|
||||
private val symbolsCollection: FeatureCollection,
|
||||
private val symbolsSource: GeoJsonSource, private val symbolsLayerId: String,
|
||||
private val touchAreaShiftX: Int = 0, private val touchAreaShiftY: Int = 0,
|
||||
private val touchAreaMaxX: Int = mapView.width, private val touchAreaMaxY: Int = mapView.height) {
|
||||
class DraggableSymbolsManager(
|
||||
mapView: MapView,
|
||||
private val mapboxMap: MapboxMap,
|
||||
private val symbolsCollection: FeatureCollection,
|
||||
private val symbolsSource: GeoJsonSource,
|
||||
private val symbolsLayerId: String,
|
||||
private val touchAreaShiftY: Int = 0,
|
||||
private val touchAreaShiftX: Int = 0,
|
||||
private val touchAreaMaxX: Int = mapView.width,
|
||||
private val touchAreaMaxY: Int = mapView.height
|
||||
) {
|
||||
|
||||
private val androidGesturesManager: AndroidGesturesManager = AndroidGesturesManager(mapView.context, false)
|
||||
private var draggedSymbolId: String? = null
|
||||
@@ -322,4 +328,4 @@ class DraggableMarkerActivity : AppCompatActivity() {
|
||||
|
||||
private fun MapboxMap.queryRenderedSymbols(latLng: LatLng, layerId: String): List<Feature> {
|
||||
return this.queryRenderedFeatures(this.projection.toScreenLocation(latLng), layerId)
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,6 @@ class FileUtils {
|
||||
override fun doInBackground(vararg strings: String): Boolean? {
|
||||
val assetName = strings[0]
|
||||
val destinationPath = strings[1]
|
||||
|
||||
contextWeakReference.get()?.let {
|
||||
try {
|
||||
copyAsset(it, assetName, destinationPath)
|
||||
|
||||
Reference in New Issue
Block a user