Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
HTAnticollision
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
马乐
HTAnticollision
Commits
caa4d969
Commit
caa4d969
authored
May 19, 2023
by
马乐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.增加地图annotation
parent
552c8ce0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
637 additions
and
81 deletions
+637
-81
build.gradle
app/build.gradle
+6
-4
mapBoxStyle.json
app/src/main/assets/mapBoxStyle.json
+29
-0
style.json
app/src/main/assets/style.json
+40
-0
style.json
app/src/main/assets/styles/Dark/style.json
+46
-0
style.json
app/src/main/assets/styles/SatelliteStreets/style.json
+40
-0
style.json
app/src/main/assets/styles/Street/style.json
+39
-0
MapDataSourceWrapper.kt
...va/com/waytous/anticollision/bean/MapDataSourceWrapper.kt
+2
-2
MapDataDao.kt
...ain/java/com/waytous/anticollision/database/MapDataDao.kt
+1
-1
MainRepository.kt
...va/com/waytous/anticollision/repository/MainRepository.kt
+0
-0
BaseFragment.kt
...rc/main/java/com/waytous/anticollision/ui/BaseFragment.kt
+115
-14
MainViewModel.kt
...c/main/java/com/waytous/anticollision/ui/MainViewModel.kt
+26
-14
MapBoxLayout.kt
...rc/main/java/com/waytous/anticollision/ui/MapBoxLayout.kt
+0
-0
HomeFragment.kt
...in/java/com/waytous/anticollision/ui/home/HomeFragment.kt
+46
-40
BitmapUtils.kt
.../main/java/com/waytous/anticollision/utils/BitmapUtils.kt
+43
-0
Extensions.kt
...c/main/java/com/waytous/anticollision/utils/Extensions.kt
+0
-0
VehicleAnnotation.kt
...in/java/com/waytous/anticollision/vo/VehicleAnnotation.kt
+6
-0
background_view_annotation_current_vehicle.xml
...able-night/background_view_annotation_current_vehicle.xml
+8
-0
background_view_annotation_other_vehicle.xml
...awable-night/background_view_annotation_other_vehicle.xml
+8
-0
background_view_annotation_other_vehicle_distance.xml
...ght/background_view_annotation_other_vehicle_distance.xml
+8
-0
background_view_annotation_other_vehicle_speed.xml
...-night/background_view_annotation_other_vehicle_speed.xml
+8
-0
background_view_annotation_current_vehicle.xml
...s/drawable/background_view_annotation_current_vehicle.xml
+8
-0
background_view_annotation_other_vehicle.xml
...res/drawable/background_view_annotation_other_vehicle.xml
+8
-0
background_view_annotation_other_vehicle_distance.xml
...ble/background_view_annotation_other_vehicle_distance.xml
+8
-0
background_view_annotation_other_vehicle_speed.xml
...awable/background_view_annotation_other_vehicle_speed.xml
+8
-0
current_vehicle_view_annotation_layout.xml
...ain/res/layout/current_vehicle_view_annotation_layout.xml
+25
-0
fragment_home.xml
app/src/main/res/layout/fragment_home.xml
+2
-1
other_vehicle_view_annotation_layout.xml
.../main/res/layout/other_vehicle_view_annotation_layout.xml
+69
-0
themes.xml
app/src/main/res/values-night/themes.xml
+7
-0
colors.xml
app/src/main/res/values/colors.xml
+13
-0
strings.xml
app/src/main/res/values/strings.xml
+3
-0
themes.xml
app/src/main/res/values/themes.xml
+7
-0
build.gradle
build.gradle
+3
-2
gradle.properties
gradle.properties
+4
-2
gradle-wrapper.properties
gradle/wrapper/gradle-wrapper.properties
+1
-1
No files found.
app/build.gradle
View file @
caa4d969
...
...
@@ -35,18 +35,20 @@ android {
}
}
compileOptions
{
sourceCompatibility
JavaVersion
.
VERSION_1
_8
targetCompatibility
JavaVersion
.
VERSION_1
_8
sourceCompatibility
JavaVersion
.
VERSION_1
7
targetCompatibility
JavaVersion
.
VERSION_1
7
}
kotlinOptions
{
jvmTarget
=
'1
.8
'
jvmTarget
=
'1
7
'
}
buildFeatures
{
viewBinding
true
dataBinding
true
}
packagingOptions
{
exclude
'META-INF/io.netty.versions.properties'
resources
{
excludes
+=
[
'META-INF/io.netty.versions.properties'
]
}
}
}
...
...
app/src/main/assets/mapBoxStyle.json
0 → 100644
View file @
caa4d969
{
"draft"
:
false
,
"glyphs"
:
"http://192.168.9.152:8089/map/glyphs/{fontstack}/{range}.pbf"
,
"id"
:
"pk.eyJ1IjoibWFybGxlciIsImEiOiJjbGVhMXlmeXIwdmRzM29vNmM4aDA1M202In0.tfLD_AOs1OPmg5rLERcbfw"
,
"layers"
:
[
{
"id"
:
"background"
,
"interactive"
:
true
,
"paint"
:
{
"background-color"
:
"black"
},
"type"
:
"background"
}
],
"metadata"
:
{
"mapbox:autocomposite"
:
true
,
"mapbox:sdk-support"
:
{
"android"
:
"10.11.0"
,
"ios"
:
"4.0.0"
,
"js"
:
"0.46.0"
},
"mapbox:type"
:
"default"
},
"name"
:
"Dark"
,
"owner"
:
"HT"
,
"sprite"
:
"http://192.168.9.152:8089/map/sprite/street/sprite"
,
"version"
:
8
,
"visibility"
:
"private"
}
app/src/main/assets/style.json
0 → 100644
View file @
caa4d969
{
"version"
:
8
,
"name"
:
"Satellite"
,
"metadata"
:
{
"mapbox:autocomposite"
:
true
,
"mapbox:type"
:
"default"
},
"sources"
:
{
"composite"
:
{
"tiles"
:
[
"https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"
],
"type"
:
"raster"
,
"tileSize"
:
256
}
},
"sprite"
:
"http://192.168.9.152:8089/map/sprite/street/sprite"
,
"glyphs"
:
"http://192.168.9.152:8089/map/glyphs/{fontstack}/{range}.pbf"
,
"layers"
:
[{
"id"
:
"background"
,
"type"
:
"background"
,
"paint"
:
{
"background-color"
:
"#3c3d3f"
},
"interactive"
:
true
},
{
"id"
:
"satellite"
,
"type"
:
"raster"
,
"source"
:
"composite"
,
"interactive"
:
true
}],
"created"
:
"2019-02-22T17:58:57.291Z"
,
"id"
:
"sk.eyJ1IjoibWFybGxlciIsImEiOiJjbGVjNHZhdWgwd3U4M29uMjJrY3BqYXpkIn0.cqcw1CHYVGwESBqsfWcm7w"
,
"modified"
:
"2019-02-22T17:58:57.291Z"
,
"owner"
:
"scfjp"
,
"visibility"
:
"private"
,
"draft"
:
false
}
\ No newline at end of file
app/src/main/assets/styles/Dark/style.json
0 → 100644
View file @
caa4d969
{
"version"
:
8
,
"name"
:
"Dark"
,
"metadata"
:
{
"mapbox:autocomposite"
:
true
,
"mapbox:type"
:
"default"
,
"mapbox:sdk-support"
:
{
"js"
:
"0.46.0"
,
"android"
:
"6.0.0"
,
"ios"
:
"4.0.0"
}
},
"sources"
:
{
},
"sprite"
:
"http://192.168.9.198:8089/map/sprite/street/sprite"
,
"glyphs"
:
"http://192.168.9.198:8089/map/glyphs/{fontstack}/{range}.pbf"
,
"layers"
:
[{
"id"
:
"background"
,
"type"
:
"background"
,
"layout"
:
{},
"paint"
:
{
"background-color"
:
{
"base"
:
1
,
"stops"
:
[
[
6
,
"hsl(215, 17%, 35%)"
],
[
8
,
"#030b22"
]
]
}
},
"interactive"
:
true
}],
"created"
:
"2018-07-25T01:43:01.085Z"
,
"id"
:
"cjk0gss0a1n872rlia7papueg"
,
"modified"
:
"2018-07-25T01:43:01.085Z"
,
"owner"
:
"scfjp"
,
"visibility"
:
"private"
,
"draft"
:
false
}
\ No newline at end of file
app/src/main/assets/styles/SatelliteStreets/style.json
0 → 100644
View file @
caa4d969
{
"version"
:
8
,
"name"
:
"Satellite"
,
"metadata"
:
{
"mapbox:autocomposite"
:
true
,
"mapbox:type"
:
"default"
},
"sources"
:
{
"composite"
:
{
"tiles"
:
[
"https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"
],
"type"
:
"raster"
,
"tileSize"
:
256
}
},
"sprite"
:
"http://192.168.9.198:8089/map/sprite/street/sprite"
,
"glyphs"
:
"http://192.168.9.198:8089/map/glyphs/{fontstack}/{range}.pbf"
,
"layers"
:
[{
"id"
:
"background"
,
"type"
:
"background"
,
"paint"
:
{
"background-color"
:
"#3c3d3f"
},
"interactive"
:
true
},
{
"id"
:
"satellite"
,
"type"
:
"raster"
,
"source"
:
"composite"
,
"interactive"
:
true
}],
"created"
:
"2019-02-22T17:58:57.291Z"
,
"id"
:
"cjsgd0f6w0ndu1fo4trxeh4na"
,
"modified"
:
"2019-02-22T17:58:57.291Z"
,
"owner"
:
"scfjp"
,
"visibility"
:
"private"
,
"draft"
:
false
}
\ No newline at end of file
app/src/main/assets/styles/Street/style.json
0 → 100644
View file @
caa4d969
{
"version"
:
8
,
"name"
:
"Street"
,
"metadata"
:
{
"mapbox:origin"
:
"basic-template-v1"
,
"mapbox:autocomposite"
:
true
,
"mapbox:type"
:
"template"
,
"mapbox:sdk-support"
:
{
"js"
:
"0.50.0"
,
"android"
:
"6.7.0"
,
"ios"
:
"4.6.0"
}
},
"sources"
:
{},
"sprite"
:
"http://192.168.9.198:8089/map/sprite/street/sprite"
,
"glyphs"
:
"http://192.168.9.198:8089/map/glyphs/{fontstack}/{range}.pbf"
,
"layers"
:
[{
"id"
:
"background"
,
"type"
:
"background"
,
"layout"
:
{},
"paint"
:
{
"background-color"
:
[
"interpolate"
,
[
"linear"
],
[
"zoom"
],
5
,
"hsl(38, 43%, 89%)"
,
7
,
"hsl(38, 48%, 86%)"
]
}
}],
"created"
:
"2019-01-02T03:16:28.622Z"
,
"id"
:
"cjqem145mg5gh2sqi37v0gmhm"
,
"modified"
:
"2019-01-02T03:16:28.622Z"
,
"owner"
:
"scfjp"
,
"visibility"
:
"private"
,
"draft"
:
false
}
\ No newline at end of file
app/src/main/java/com/waytous/anticollision/bean/MapDataSourceWrapper.kt
View file @
caa4d969
package
com.waytous.anticollision.bean
data class
MapDataSourceWrapper
(
val
mapDataSource
:
MapDataSource
,
val
abort
:
Boolean
)
\ No newline at end of file
data class
MapDataSourceWrapper
(
val
mapDataSource
:
MapDataSource
?,
val
abort
:
Boolean
)
\ No newline at end of file
app/src/main/java/com/waytous/anticollision/database/MapDataDao.kt
View file @
caa4d969
...
...
@@ -7,7 +7,7 @@ import com.waytous.anticollision.bean.MapDataSource
interface
MapDataDao
{
@Query
(
"SELECT * FROM map_source WHERE sourceId = :sourceId"
)
suspend
fun
findById
(
sourceId
:
String
):
MapDataSource
suspend
fun
findById
(
sourceId
:
String
):
MapDataSource
?
@Insert
(
onConflict
=
OnConflictStrategy
.
REPLACE
)
suspend
fun
insertAll
(
vararg
sources
:
MapDataSource
)
...
...
app/src/main/java/com/waytous/anticollision/repository/MainRepository.kt
View file @
caa4d969
This diff is collapsed.
Click to expand it.
app/src/main/java/com/waytous/anticollision/ui/BaseFragment.kt
View file @
caa4d969
package
com.waytous.anticollision.ui
import
android.annotation.SuppressLint
import
android.graphics.Bitmap
import
android.graphics.Color
import
android.os.Bundle
import
androidx.core.graphics.scale
import
android.view.View
import
androidx.appcompat.widget.AppCompatTextView
import
androidx.fragment.app.Fragment
import
androidx.fragment.app.viewModels
import
androidx.lifecycle.lifecycleScope
...
...
@@ -11,6 +13,7 @@ import androidx.lifecycle.withStarted
import
com.mapbox.geojson.Point
import
com.mapbox.maps.CameraOptions
import
com.mapbox.maps.MapView
import
com.mapbox.maps.ViewAnnotationAnchor
import
com.mapbox.maps.extension.style.expressions.dsl.generated.get
import
com.mapbox.maps.extension.style.layers.generated.circleLayer
import
com.mapbox.maps.extension.style.layers.generated.fillLayer
...
...
@@ -24,11 +27,16 @@ import com.mapbox.maps.plugin.annotation.generated.PointAnnotation
import
com.mapbox.maps.plugin.annotation.generated.PointAnnotationManager
import
com.mapbox.maps.plugin.annotation.generated.PointAnnotationOptions
import
com.mapbox.maps.plugin.annotation.generated.createPointAnnotationManager
import
com.mapbox.maps.plugin.scalebar.scalebar
import
com.mapbox.maps.viewannotation.ViewAnnotationManager
import
com.mapbox.maps.viewannotation.viewAnnotationOptions
import
com.waytous.anticollision.R
import
com.waytous.anticollision.api.ApiService
import
com.waytous.anticollision.databinding.CurrentVehicleViewAnnotationLayoutBinding
import
com.waytous.anticollision.databinding.OtherVehicleViewAnnotationLayoutBinding
import
com.waytous.anticollision.repository.MainRepository
import
com.waytous.anticollision.utils.getBitmapFromVectorDrawable
import
com.waytous.anticollision.utils.BitmapUtils
import
com.waytous.anticollision.vo.VehicleAnnotation
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.launch
import
kotlinx.coroutines.withContext
...
...
@@ -39,16 +47,37 @@ open class BaseFragment : Fragment() {
MainViewModel
.
MainViewModelFactory
(
MainRepository
(
requireContext
()))
}
val
iconCurrentNormalVehicleBitmap
by
lazy
{
BitmapUtils
.
bitmapFromDrawableRes
(
requireContext
(),
R
.
drawable
.
my_vehicle_normal
)
}
private
val
iconOtherAlarmVehicleBitmap
by
lazy
{
BitmapUtils
.
bitmapFromDrawableRes
(
requireContext
(),
R
.
drawable
.
other_vehicle_normal
)
}
private
lateinit
var
viewAnnotation
:
View
private
lateinit
var
viewAnnotationManager
:
ViewAnnotationManager
private
lateinit
var
pointAnnotationManager
:
PointAnnotationManager
private
lateinit
var
pointAnnotation
:
PointAnnotation
companion
object
{
private
val
scaleLengths
=
listOf
(
5
,
10
,
20
,
50
,
100
,
200
,
500
,
1000
,
2000
,
5000
,
10000
,
20000
,
50000
,
100000
,
200000
,
500000
,
1000000
,
2000000
)
private
const
val
MINIMUM_ZOOM_LEVEL
=
11.0
private
const
val
MAXIMUM_ZOOM_LEVEL
=
26.0
}
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
}
fun
initAnnotationManager
(
mapView
:
MapView
){
viewAnnotationManager
=
mapView
.
viewAnnotationManager
pointAnnotationManager
=
mapView
.
annotations
.
createPointAnnotationManager
()
}
fun
updateMapBox
(
mapView
:
MapView
){
mapView
.
getMapboxMap
().
setCamera
(
CameraOptions
.
Builder
().
center
(
...
...
@@ -350,22 +379,93 @@ open class BaseFragment : Fragment() {
}
}
){
val
bitmap
:
Bitmap
?
=
activity
?.
getBitmapFromVectorDrawable
(
R
.
drawable
.
my_vehicle_normal
,
4
)
val
annotationPlugin
=
mapView
.
annotations
val
pointAnnotationOptions
:
PointAnnotationOptions
=
PointAnnotationOptions
()
.
withPoint
(
mapModel
.
center
.
value
!!
)
.
withIconImage
(
bitmap
!!
.
apply
{
scale
(
bitmap
.
width
/
4
,
bitmap
.
height
/
4
)
})
.
withIconAnchor
(
IconAnchor
.
BOTTOM
)
.
withDraggable
(
false
)
pointAnnotationManager
=
annotationPlugin
.
createPointAnnotationManager
()
pointAnnotation
=
pointAnnotationManager
.
create
(
pointAnnotationOptions
)
// prepareAnnotationMarker(mapView,iconCurrentNormalVehicleBitmap!!)
// prepareViewAnnotation()
val
otherAnnotation
=
VehicleAnnotation
(
"KK-01"
,
36
,
25
,
Point
.
fromLngLat
(
MainViewModel
.
LONGITUDE
,
MainViewModel
.
LATITUDE
),
true
)
addCurrentVehicleAnnotation
(
otherAnnotation
)
val
otherAnnotation1
=
VehicleAnnotation
(
"KK-02"
,
24
,
25
,
Point
.
fromLngLat
(
119.76019
,
49.37932
),
true
)
addOtherVehicleAnnotation
(
otherAnnotation1
)
val
otherAnnotation2
=
VehicleAnnotation
(
"KK-03"
,
36
,
20
,
Point
.
fromLngLat
(
119.75694
,
49.38632
),
true
)
addOtherVehicleAnnotation
(
otherAnnotation2
)
}
}
}
}
}
@SuppressLint
(
"SetTextI18n"
)
fun
prepareViewAnnotation
()
{
viewAnnotation
=
viewAnnotationManager
.
addViewAnnotation
(
resId
=
R
.
layout
.
current_vehicle_view_annotation_layout
,
options
=
viewAnnotationOptions
{
geometry
(
Point
.
fromLngLat
(
MainViewModel
.
LONGITUDE
,
MainViewModel
.
LATITUDE
))
associatedFeatureId
(
pointAnnotation
.
featureIdentifier
)
anchor
(
ViewAnnotationAnchor
.
BOTTOM
)
offsetY
((
pointAnnotation
.
iconImageBitmap
?.
height
!!
*
0.25
).
toInt
())
}
)
val
binding
=
CurrentVehicleViewAnnotationLayoutBinding
.
bind
(
viewAnnotation
)
binding
.
annotationCurrentVehicleNo
.
text
=
context
?.
getString
(
R
.
string
.
annotation_vehicle_no
,
"KK-001"
)
binding
.
annotationCurrentVehicleSpeed
.
text
=
context
?.
getString
(
R
.
string
.
annotation_vehicle_speed
,
36
)
}
fun
prepareAnnotationMarker
(
mapView
:
MapView
,
iconBitmap
:
Bitmap
)
{
val
annotationPlugin
=
mapView
.
annotations
val
pointAnnotationOptions
:
PointAnnotationOptions
=
PointAnnotationOptions
()
.
withPoint
(
Point
.
fromLngLat
(
MainViewModel
.
LONGITUDE
,
MainViewModel
.
LATITUDE
))
.
withIconImage
(
iconBitmap
)
.
withIconSize
(
0.25
)
.
withIconAnchor
(
IconAnchor
.
BOTTOM
)
.
withDraggable
(
false
)
pointAnnotationManager
=
annotationPlugin
.
createPointAnnotationManager
()
pointAnnotation
=
pointAnnotationManager
.
create
(
pointAnnotationOptions
)
}
fun
addCurrentVehicleAnnotation
(
otherAnnotation
:
VehicleAnnotation
){
val
pointAnnotationOptions
:
PointAnnotationOptions
=
PointAnnotationOptions
()
.
withPoint
(
Point
.
fromLngLat
(
MainViewModel
.
LONGITUDE
,
MainViewModel
.
LATITUDE
))
.
withIconImage
(
iconCurrentNormalVehicleBitmap
!!
)
.
withIconSize
(
0.25
)
.
withIconAnchor
(
IconAnchor
.
BOTTOM
)
.
withDraggable
(
false
)
val
pointAnnotation
=
pointAnnotationManager
.
create
(
pointAnnotationOptions
)
val
viewAnnotation
=
viewAnnotationManager
.
addViewAnnotation
(
resId
=
R
.
layout
.
current_vehicle_view_annotation_layout
,
options
=
viewAnnotationOptions
{
geometry
(
Point
.
fromLngLat
(
MainViewModel
.
LONGITUDE
,
MainViewModel
.
LATITUDE
))
associatedFeatureId
(
pointAnnotation
.
featureIdentifier
)
anchor
(
ViewAnnotationAnchor
.
BOTTOM
)
offsetY
((
pointAnnotation
.
iconImageBitmap
?.
height
!!
*
0.25
).
toInt
())
}
)
val
binding
=
CurrentVehicleViewAnnotationLayoutBinding
.
bind
(
viewAnnotation
)
binding
.
annotationCurrentVehicleNo
.
text
=
context
?.
getString
(
R
.
string
.
annotation_vehicle_no
,
"KK-001"
)
binding
.
annotationCurrentVehicleSpeed
.
text
=
context
?.
getString
(
R
.
string
.
annotation_vehicle_speed
,
36
)
}
fun
addOtherVehicleAnnotation
(
otherAnnotation
:
VehicleAnnotation
){
val
pointAnnotationOptions
:
PointAnnotationOptions
=
PointAnnotationOptions
()
.
withPoint
(
otherAnnotation
.
point
)
.
withIconImage
(
iconOtherAlarmVehicleBitmap
!!
)
.
withIconSize
(
0.25
)
.
withIconAnchor
(
IconAnchor
.
BOTTOM
)
.
withDraggable
(
false
)
val
pointAnnotation
=
pointAnnotationManager
.
create
(
pointAnnotationOptions
)
val
viewAnnotation
=
viewAnnotationManager
.
addViewAnnotation
(
resId
=
R
.
layout
.
other_vehicle_view_annotation_layout
,
options
=
viewAnnotationOptions
{
geometry
(
otherAnnotation
.
point
)
associatedFeatureId
(
otherAnnotation
.
vehicleNo
)
anchor
(
ViewAnnotationAnchor
.
BOTTOM
)
offsetY
((
pointAnnotation
.
iconImageBitmap
?.
height
!!
*
0.25
).
toInt
())
}
)
val
binding
=
OtherVehicleViewAnnotationLayoutBinding
.
bind
(
viewAnnotation
)
binding
.
annotationOtherVehicleNo
.
text
=
context
?.
getString
(
R
.
string
.
annotation_vehicle_no
,
otherAnnotation
.
vehicleNo
)
binding
.
annotationOtherVehicleSpeed
.
text
=
24
.
toString
()
binding
.
annotationOtherVehicleDistance
.
text
=
25
.
toString
()
}
}
\ No newline at end of file
app/src/main/java/com/waytous/anticollision/ui/MainViewModel.kt
View file @
caa4d969
...
...
@@ -4,6 +4,7 @@ import androidx.lifecycle.MutableLiveData
import
androidx.lifecycle.ViewModel
import
androidx.lifecycle.ViewModelProvider
import
androidx.lifecycle.viewmodel.CreationExtras
import
com.blankj.utilcode.util.LogUtils
import
com.mapbox.geojson.Point
import
com.waytous.anticollision.repository.MainRepository
import
kotlinx.coroutines.Dispatchers
...
...
@@ -28,24 +29,25 @@ class MainViewModel @Inject constructor(private val mainRepository: MainReposito
emit
(
it
.
mapDataSource
)
!
it
.
abort
}.
map
{
it
.
geojson
it
?
.
geojson
}.
flowOn
(
Dispatchers
.
IO
)
.
catch
{
LogUtils
.
e
(
it
.
message
)
emit
(
""
)
}
fun
electronicFenceSource
()
=
flowOf
(
mainRepository
.
localElectronicFenceVersion
(),
mainRepository
.
remoteElectronicFenceVersion
()
)
.
flattenMerge
()
).
flattenMerge
()
.
transformWhile
{
emit
(
it
.
mapDataSource
)
!
it
.
abort
}.
map
{
it
.
geojson
it
?
.
geojson
}.
flowOn
(
Dispatchers
.
IO
)
.
catch
{
LogUtils
.
e
(
it
.
message
)
emit
(
""
)
}
...
...
@@ -56,9 +58,10 @@ class MainViewModel @Inject constructor(private val mainRepository: MainReposito
emit
(
it
.
mapDataSource
)
!
it
.
abort
}.
map
{
it
.
geojson
it
?
.
geojson
}.
flowOn
(
Dispatchers
.
IO
)
.
catch
{
LogUtils
.
e
(
it
.
message
)
emit
(
""
)
}
...
...
@@ -69,9 +72,10 @@ class MainViewModel @Inject constructor(private val mainRepository: MainReposito
emit
(
it
.
mapDataSource
)
!
it
.
abort
}.
map
{
it
.
geojson
it
?
.
geojson
}.
flowOn
(
Dispatchers
.
IO
)
.
catch
{
LogUtils
.
e
(
it
.
message
)
emit
(
""
)
}
...
...
@@ -81,9 +85,10 @@ class MainViewModel @Inject constructor(private val mainRepository: MainReposito
emit
(
it
.
mapDataSource
)
!
it
.
abort
}.
map
{
it
.
geojson
it
?
.
geojson
}.
flowOn
(
Dispatchers
.
IO
)
.
catch
{
LogUtils
.
e
(
it
.
message
)
emit
(
""
)
}
...
...
@@ -95,9 +100,10 @@ class MainViewModel @Inject constructor(private val mainRepository: MainReposito
emit
(
it
.
mapDataSource
)
!
it
.
abort
}.
map
{
it
.
geojson
it
?
.
geojson
}.
flowOn
(
Dispatchers
.
IO
)
.
catch
{
LogUtils
.
e
(
it
.
message
)
emit
(
""
)
}
...
...
@@ -108,9 +114,10 @@ class MainViewModel @Inject constructor(private val mainRepository: MainReposito
emit
(
it
.
mapDataSource
)
!
it
.
abort
}.
map
{
it
.
geojson
it
?
.
geojson
}.
flowOn
(
Dispatchers
.
IO
)
.
catch
{
LogUtils
.
e
(
it
.
message
)
emit
(
""
)
}
...
...
@@ -122,9 +129,10 @@ class MainViewModel @Inject constructor(private val mainRepository: MainReposito
emit
(
it
.
mapDataSource
)
!
it
.
abort
}.
map
{
it
.
geojson
it
?
.
geojson
}.
flowOn
(
Dispatchers
.
IO
)
.
catch
{
LogUtils
.
e
(
it
.
message
)
emit
(
""
)
}
...
...
@@ -135,9 +143,10 @@ class MainViewModel @Inject constructor(private val mainRepository: MainReposito
emit
(
it
.
mapDataSource
)
!
it
.
abort
}.
map
{
it
.
geojson
it
?
.
geojson
}.
flowOn
(
Dispatchers
.
IO
)
.
catch
{
LogUtils
.
e
(
it
.
message
)
emit
(
""
)
}
...
...
@@ -148,9 +157,10 @@ class MainViewModel @Inject constructor(private val mainRepository: MainReposito
emit
(
it
.
mapDataSource
)
!
it
.
abort
}.
map
{
it
.
geojson
it
?
.
geojson
}.
flowOn
(
Dispatchers
.
IO
)
.
catch
{
LogUtils
.
e
(
it
.
message
)
emit
(
""
)
}
...
...
@@ -161,9 +171,10 @@ class MainViewModel @Inject constructor(private val mainRepository: MainReposito
emit
(
it
.
mapDataSource
)
!
it
.
abort
}.
map
{
it
.
geojson
it
?
.
geojson
}.
flowOn
(
Dispatchers
.
IO
)
.
catch
{
LogUtils
.
e
(
it
.
message
)
emit
(
""
)
}
...
...
@@ -175,9 +186,10 @@ class MainViewModel @Inject constructor(private val mainRepository: MainReposito
emit
(
it
.
mapDataSource
)
!
it
.
abort
}.
map
{
it
.
geojson
it
?
.
geojson
}.
flowOn
(
Dispatchers
.
IO
)
.
catch
{
LogUtils
.
e
(
it
.
message
)
emit
(
""
)
}
...
...
app/src/main/java/com/waytous/anticollision/ui/MapBoxLayout.kt
View file @
caa4d969
This diff is collapsed.
Click to expand it.
app/src/main/java/com/waytous/anticollision/ui/home/HomeFragment.kt
View file @
caa4d969
package
com.waytous.anticollision.ui.home
import
android.graphics.Color
import
android.os.Bundle
import
android.text.SpannableString
import
android.util.Log
import
android.view.Gravity
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
android.widget.FrameLayout
import
android.widget.ImageView
import
android.widget.TextView
import
androidx.fragment.app.viewModels
import
androidx.lifecycle.*
import
com.blankj.utilcode.util.LogUtils
import
com.mapbox.geojson.Point
import
com.mapbox.maps.CameraOptions
import
com.mapbox.maps.MapView
import
com.mapbox.maps.MapboxMap
import
com.mapbox.maps.extension.style.expressions.dsl.generated.get
import
com.mapbox.maps.extension.style.layers.generated.circleLayer
import
com.mapbox.maps.extension.style.layers.generated.fillLayer
import
com.mapbox.maps.extension.style.layers.generated.lineLayer
import
com.mapbox.maps.extension.style.layers.generated.symbolLayer
import
com.mapbox.maps.extension.style.layers.properties.generated.LineCap
import
com.mapbox.maps.extension.style.layers.properties.generated.LineJoin
import
com.mapbox.maps.extension.style.layers.properties.generated.TextAnchor
import
com.mapbox.maps.extension.style.layers.properties.generated.TextRotationAlignment
import
com.mapbox.maps.extension.style.layers.properties.generated.Visibility
import
com.mapbox.maps.extension.style.sources.generated.geoJsonSource
import
com.mapbox.maps.extension.style.style
import
com.mapbox.maps.plugin.annotation.generated.PointAnnotation
import
com.mapbox.maps.plugin.annotation.generated.PointAnnotationManager
import
com.mapbox.maps.plugin.attribution.attribution
import
com.mapbox.maps.plugin.compass.compass
import
com.mapbox.maps.plugin.logo.logo
import
com.mapbox.maps.plugin.scalebar.scalebar
import
com.mapbox.maps.viewannotation.ViewAnnotationManager
import
com.waytous.anticollision.R
import
com.waytous.anticollision.databinding.FragmentHomeBinding
...
...
@@ -24,7 +44,21 @@ import com.waytous.anticollision.ui.BaseFragment
import
com.waytous.anticollision.ui.MainViewModel
import
com.waytous.anticollision.ui.view.MoreFeaturesPopup
import
com.waytous.anticollision.ui.view.WorkStatusEditPopup
import
com.waytous.anticollision.utils.addBarricadeSource
import
com.waytous.anticollision.utils.addDiggingWorkAreaSource
import
com.waytous.anticollision.utils.addDumpAreaSource
import
com.waytous.anticollision.utils.addElectronicFenceSource
import
com.waytous.anticollision.utils.addLaneNodeSource
import
com.waytous.anticollision.utils.addLaneSource
import
com.waytous.anticollision.utils.addObstaclesSource
import
com.waytous.anticollision.utils.addParkSpotSource
import
com.waytous.anticollision.utils.addRunnableAreaSource
import
com.waytous.anticollision.utils.addStaticObjectsSource
import
com.waytous.anticollision.utils.addStationAreaSource
import
com.waytous.anticollision.utils.addTruckPathSource
import
com.waytous.anticollision.utils.addWetAreaSource
import
com.waytous.anticollision.utils.setTextSize
import
kotlinx.coroutines.flow.collect
import
kotlinx.coroutines.launch
class
HomeFragment
:
BaseFragment
()
{
...
...
@@ -35,27 +69,16 @@ class HomeFragment : BaseFragment() {
private
lateinit
var
mapView
:
MapView
private
lateinit
var
mapBox
:
MapboxMap
private
lateinit
var
viewAnnotationManager
:
ViewAnnotationManager
private
lateinit
var
pointAnnotationManager
:
PointAnnotationManager
private
lateinit
var
pointAnnotation
:
PointAnnotation
private
var
count
=
0
private
lateinit
var
moreFeaturesPopup
:
MoreFeaturesPopup
private
lateinit
var
workStatusEditPopup
:
WorkStatusEditPopup
private
val
mapModel
:
MainViewModel
by
viewModels
{
private
val
mapModel
:
MainViewModel
by
viewModels
{
MainViewModel
.
MainViewModelFactory
(
MainRepository
(
requireContext
()))
}
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
}
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
...
...
@@ -64,7 +87,7 @@ class HomeFragment : BaseFragment() {
val
homeViewModel
=
ViewModelProvider
(
this
)[
HomeViewModel
::
class
.
java
]
_binding
=
FragmentHomeBinding
.
inflate
(
inflater
,
container
,
false
)
context
?:
return
binding
.
root
context
?:
return
binding
.
root
workStatusEditPopup
=
WorkStatusEditPopup
(
context
).
also
{
it
.
setOutSideDismiss
(
true
)
it
.
popupGravity
=
Gravity
.
TOP
or
Gravity
.
CENTER
...
...
@@ -76,15 +99,16 @@ class HomeFragment : BaseFragment() {
it
.
maskOffsetY
=
20
it
.
setBackgroundColor
(
R
.
color
.
color_99000000
)
}
mapView
=
binding
.
root
.
findViewById
<
MapView
?>(
R
.
id
.
mapView
).
also
{
mapView
=
binding
.
root
.
findViewById
<
MapView
?>(
R
.
id
.
mapView
).
also
{
it
->
it
.
logo
.
enabled
=
false
it
.
compass
.
enabled
=
false
it
.
attribution
.
enabled
=
false
it
.
scalebar
.
enabled
=
false
}
viewAnnotationManager
=
mapView
.
viewAnnotationManager
initAnnotationManager
(
mapView
)
updateMapBox
(
mapView
)
mapView
.
addRendererSetupErrorListener
{
error
->
LogUtils
.
e
(
"RendererSetupErrorListener:${error}"
)
mapView
.
addRendererSetupErrorListener
{
error
->
LogUtils
.
e
(
"RendererSetupErrorListener:${error}"
)
}
setTodayCarriedNum
(
18
)
setTodayIllegallyNum
(
1
)
...
...
@@ -94,37 +118,19 @@ class HomeFragment : BaseFragment() {
binding
.
defaultToggleMore
.
setOnClickListener
{
moreFeaturesPopup
.
showPopupWindow
(
binding
.
defaultToggleMore
)
}
viewLifecycleOwner
.
lifecycleScope
.
launch
{
repeatOnLifecycle
(
Lifecycle
.
State
.
STARTED
){
mapModel
.
obstaclesSource
().
collect
{
binding
.
defaultMapLayout
.
addObstaclesSource
(
it
)}
mapModel
.
runnableAreaSource
().
collect
{
binding
.
defaultMapLayout
.
addRunnableAreaSource
(
it
)}
mapModel
.
laneSource
().
collect
{
binding
.
defaultMapLayout
.
addLaneSource
(
it
)}
mapModel
.
laneNodeSource
().
collect
{
binding
.
defaultMapLayout
.
addLaneNodeSource
(
it
)}
mapModel
.
staticObjectsSource
().
collect
{
binding
.
defaultMapLayout
.
addStaticObjectsSource
(
it
)}
mapModel
.
diggingWorkAreaSource
().
collect
{
binding
.
defaultMapLayout
.
addDiggingWorkAreaSource
(
it
)}
mapModel
.
barricadeSource
().
collect
{
binding
.
defaultMapLayout
.
addBarricadeSource
(
it
)}
mapModel
.
stationAreaSource
().
collect
{
binding
.
defaultMapLayout
.
addStationAreaSource
(
it
)}
mapModel
.
parkSpotSource
().
collect
{
binding
.
defaultMapLayout
.
addParkSpotSource
(
it
)}
mapModel
.
electronicFenceSource
().
collect
{
binding
.
defaultMapLayout
.
addElectronicFenceSource
(
it
)}
mapModel
.
wetAreaSource
().
collect
{
binding
.
defaultMapLayout
.
addWetAreaSource
(
it
)}
mapModel
.
dumpAreaSource
().
collect
{
binding
.
defaultMapLayout
.
addDumpAreaSource
(
it
)}
}
}
return
binding
.
root
}
private
fun
setTodayCarriedNum
(
num
:
Int
){
private
fun
setTodayCarriedNum
(
num
:
Int
)
{
val
templateString
=
getString
(
R
.
string
.
today_carried_text
,
num
)
val
spannableString
=
SpannableString
(
templateString
)
binding
.
todayCarried
.
setTextSize
(
spannableString
,
templateString
,
"今日运载(车)"
)
binding
.
todayCarried
.
setTextSize
(
spannableString
,
templateString
,
"今日运载(车)"
)
}
private
fun
setTodayIllegallyNum
(
num
:
Int
)
{
private
fun
setTodayIllegallyNum
(
num
:
Int
)
{
val
templateString
=
getString
(
R
.
string
.
today_illegally_text
,
num
)
val
spannableString
=
SpannableString
(
templateString
)
binding
.
illegallyNum
.
setTextSize
(
spannableString
,
templateString
,
"违章/警告(次)"
)
binding
.
illegallyNum
.
setTextSize
(
spannableString
,
templateString
,
"违章/警告(次)"
)
}
override
fun
onDestroyView
()
{
...
...
app/src/main/java/com/waytous/anticollision/utils/BitmapUtils.kt
0 → 100644
View file @
caa4d969
package
com.waytous.anticollision.utils
import
android.content.Context
import
android.graphics.Bitmap
import
android.graphics.Canvas
import
android.graphics.drawable.BitmapDrawable
import
android.graphics.drawable.Drawable
import
androidx.annotation.DrawableRes
import
androidx.appcompat.content.res.AppCompatResources
/**
* Utility class to work with bitmaps and drawables.
*/
object
BitmapUtils
{
/**
* Convert given drawable id to bitmap.
*/
fun
bitmapFromDrawableRes
(
context
:
Context
,
@DrawableRes
resourceId
:
Int
)
=
convertDrawableToBitmap
(
AppCompatResources
.
getDrawable
(
context
,
resourceId
))
private
fun
convertDrawableToBitmap
(
sourceDrawable
:
Drawable
?):
Bitmap
?
{
if
(
sourceDrawable
==
null
)
{
return
null
}
return
if
(
sourceDrawable
is
BitmapDrawable
)
{
sourceDrawable
.
bitmap
}
else
{
// copying drawable object to not manipulate on the same reference
val
constantState
=
sourceDrawable
.
constantState
?:
return
null
val
drawable
=
constantState
.
newDrawable
().
mutate
()
val
bitmap
:
Bitmap
=
Bitmap
.
createBitmap
(
drawable
.
intrinsicWidth
,
drawable
.
intrinsicHeight
,
Bitmap
.
Config
.
ARGB_8888
)
val
canvas
=
Canvas
(
bitmap
)
drawable
.
setBounds
(
0
,
0
,
canvas
.
width
,
canvas
.
height
)
drawable
.
draw
(
canvas
)
bitmap
}
}
}
\ No newline at end of file
app/src/main/java/com/waytous/anticollision/utils/Extensions.kt
View file @
caa4d969
This diff is collapsed.
Click to expand it.
app/src/main/java/com/waytous/anticollision/vo/VehicleAnnotation.kt
0 → 100644
View file @
caa4d969
package
com.waytous.anticollision.vo
import
com.mapbox.geojson.Point
data class
VehicleAnnotation
(
val
vehicleNo
:
String
,
val
speed
:
Int
,
val
distance
:
Int
,
val
point
:
Point
,
val
isShow
:
Boolean
)
\ No newline at end of file
app/src/main/res/drawable-night/background_view_annotation_current_vehicle.xml
0 → 100644
View file @
caa4d969
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<size
android:width=
"@dimen/dp_140"
android:height=
"@dimen/dp_54"
/>
<solid
android:color=
"@color/color_e6114da5"
/>
<corners
android:radius=
"@dimen/dp_6"
/>
</shape>
\ No newline at end of file
app/src/main/res/drawable-night/background_view_annotation_other_vehicle.xml
0 → 100644
View file @
caa4d969
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<size
android:width=
"@dimen/dp_140"
android:height=
"@dimen/dp_64"
/>
<solid
android:color=
"@color/color_cc1c1c1c"
/>
<corners
android:radius=
"@dimen/dp_6"
/>
</shape>
\ No newline at end of file
app/src/main/res/drawable-night/background_view_annotation_other_vehicle_distance.xml
0 → 100644
View file @
caa4d969
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<size
android:width=
"@dimen/dp_52"
android:height=
"@dimen/dp_26"
/>
<solid
android:color=
"@color/color_80f97c36"
/>
<corners
android:radius=
"@dimen/dp_6"
/>
</shape>
\ No newline at end of file
app/src/main/res/drawable-night/background_view_annotation_other_vehicle_speed.xml
0 → 100644
View file @
caa4d969
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<size
android:width=
"@dimen/dp_66"
android:height=
"@dimen/dp_26"
/>
<solid
android:color=
"@color/color_803684f9"
/>
<corners
android:radius=
"@dimen/dp_6"
/>
</shape>
\ No newline at end of file
app/src/main/res/drawable/background_view_annotation_current_vehicle.xml
0 → 100644
View file @
caa4d969
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<size
android:width=
"@dimen/dp_140"
android:height=
"@dimen/dp_54"
/>
<solid
android:color=
"@color/color_ff005aff"
/>
<corners
android:radius=
"@dimen/dp_6"
/>
</shape>
\ No newline at end of file
app/src/main/res/drawable/background_view_annotation_other_vehicle.xml
0 → 100644
View file @
caa4d969
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<size
android:width=
"@dimen/dp_140"
android:height=
"@dimen/dp_64"
/>
<solid
android:color=
"@color/color_ccffffff"
/>
<corners
android:radius=
"@dimen/dp_6"
/>
</shape>
\ No newline at end of file
app/src/main/res/drawable/background_view_annotation_other_vehicle_distance.xml
0 → 100644
View file @
caa4d969
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<size
android:width=
"@dimen/dp_52"
android:height=
"@dimen/dp_26"
/>
<solid
android:color=
"@color/color_33f97c36"
/>
<corners
android:radius=
"@dimen/dp_6"
/>
</shape>
\ No newline at end of file
app/src/main/res/drawable/background_view_annotation_other_vehicle_speed.xml
0 → 100644
View file @
caa4d969
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<size
android:width=
"@dimen/dp_66"
android:height=
"@dimen/dp_26"
/>
<solid
android:color=
"@color/color_333684f9"
/>
<corners
android:radius=
"@dimen/dp_6"
/>
</shape>
\ No newline at end of file
app/src/main/res/layout/current_vehicle_view_annotation_layout.xml
0 → 100644
View file @
caa4d969
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.LinearLayoutCompat
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:background=
"@drawable/background_view_annotation_current_vehicle"
>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/annotationCurrentVehicleNo"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"@dimen/dp_13"
android:layout_marginTop=
"@dimen/dp_4"
android:textColor=
"@color/white"
android:textSize=
"@dimen/sp_16"
android:text=
"@string/annotation_vehicle_no"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/annotationCurrentVehicleSpeed"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"@dimen/dp_13"
android:textColor=
"@color/white"
android:textSize=
"@dimen/sp_16"
android:text=
"@string/annotation_vehicle_speed"
/>
</androidx.appcompat.widget.LinearLayoutCompat>
\ No newline at end of file
app/src/main/res/layout/fragment_home.xml
View file @
caa4d969
...
...
@@ -282,8 +282,9 @@
app:layout_constraintTop_toTopOf=
"@id/defaultToggleMore"
app:layout_constraintEnd_toEndOf=
"@id/defaultMapLayout"
/>
<
com.waytous.anticollision.ui.MapBoxLayout
<
include
android:id=
"@+id/defaultMapLayout"
layout=
"@layout/layout_map_box"
android:layout_width=
"0dp"
android:layout_height=
"0dp"
android:layout_marginEnd=
"16dp"
...
...
app/src/main/res/layout/other_vehicle_view_annotation_layout.xml
0 → 100644
View file @
caa4d969
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.LinearLayoutCompat
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:background=
"@drawable/background_view_annotation_other_vehicle"
>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/annotationOtherVehicleNo"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"@dimen/dp_10"
android:layout_marginTop=
"@dimen/dp_7"
android:textColor=
"@color/color_ff333333"
android:textSize=
"@dimen/sp_16"
android:text=
"@string/annotation_vehicle_no"
/>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_2"
>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"@dimen/dp_10"
android:background=
"@drawable/background_view_annotation_other_vehicle_speed"
>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/annotationOtherVehicleSpeed"
style=
"@style/OtherVehicleSpeed"
android:layout_width=
"@dimen/dp_30"
android:layout_height=
"match_parent"
android:gravity=
"center_vertical"
android:layout_marginStart=
"@dimen/dp_8"
android:textSize=
"@dimen/sp_16"
android:text=
"24"
/>
<androidx.appcompat.widget.AppCompatTextView
style=
"@style/OtherVehicleSpeed"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:gravity=
"center_vertical"
android:textSize=
"@dimen/sp_10"
android:text=
"@string/current_speed_unit"
/>
</androidx.appcompat.widget.LinearLayoutCompat>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"@dimen/dp_5"
android:background=
"@drawable/background_view_annotation_other_vehicle_distance"
>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/annotationOtherVehicleDistance"
style=
"@style/OtherVehicleDistance"
android:layout_width=
"@dimen/dp_30"
android:layout_height=
"match_parent"
android:gravity=
"center_vertical"
android:layout_marginStart=
"@dimen/dp_8"
android:textSize=
"@dimen/sp_16"
android:text=
"25"
/>
<androidx.appcompat.widget.AppCompatTextView
style=
"@style/OtherVehicleDistance"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:gravity=
"center_vertical"
android:textSize=
"@dimen/sp_10"
android:text=
"@string/other_distance_unit"
/>
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.appcompat.widget.LinearLayoutCompat>
\ No newline at end of file
app/src/main/res/values-night/themes.xml
View file @
caa4d969
...
...
@@ -47,4 +47,10 @@
<item
name=
"android:maxLength"
>
8
</item>
<item
name=
"android:textSize"
>
10sp
</item>
</style>
<style
name=
"OtherVehicleSpeed"
parent=
"Theme.HTAnticollision"
>
<item
name=
"android:textColor"
>
@color/color_ffebf0ff
</item>
</style>
<style
name=
"OtherVehicleDistance"
parent=
"Theme.HTAnticollision"
>
<item
name=
"android:textColor"
>
@color/color_ffffdbc7
</item>
</style>
</resources>
\ No newline at end of file
app/src/main/res/values/colors.xml
View file @
caa4d969
...
...
@@ -33,4 +33,16 @@
<color
name=
"color_1a000000"
>
#1a000000
</color>
<color
name=
"color_ff3684F9"
>
#ff3684F9
</color>
<color
name=
"color_green"
>
#00ff00
</color>
<color
name=
"color_ff005aff"
>
#ff005aff
</color>
<color
name=
"color_e6114da5"
>
#e6114da5
</color>
<color
name=
"color_cc1c1c1c"
>
#cc1c1c1c
</color>
<color
name=
"color_333684f9"
>
#333684f9
</color>
<color
name=
"color_33f97c36"
>
#33f97c36
</color>
<color
name=
"color_803684f9"
>
#803684f9
</color>
<color
name=
"color_80f97c36"
>
#80f97c36
</color>
<color
name=
"color_1352C5"
>
#1352C5
</color>
<color
name=
"color_ffebf0ff"
>
#ffebf0ff
</color>
<color
name=
"color_fff06313"
>
#fff06313
</color>
<color
name=
"color_ffffdbc7"
>
#ffffdbc7
</color>
</resources>
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
caa4d969
...
...
@@ -19,6 +19,7 @@
<string
name=
"today_illegally_text"
>
%1d\n违章/警告(次)
</string>
<string
name=
"current_speed2"
>
32
</string>
<string
name=
"current_speed_unit"
>
km/h
</string>
<string
name=
"other_distance_unit"
>
m
</string>
<string
name=
"toggle_more"
>
toggle more
</string>
<string
name=
"work_status_edit"
>
修改
</string>
<string
name=
"work_status_mark"
>
当前
</string>
...
...
@@ -71,6 +72,8 @@
<string
name=
"collect_data_text"
>
采集状态:%1s 采集点数:%2d 速度:%3dKM/h 当前位置:%4f,%5f 高程:%6fm
</string>
<string
name=
"confirm"
>
确定
</string>
<string
name=
"cancel"
>
取消
</string>
<string
name=
"annotation_vehicle_no"
>
编号:%1s
</string>
<string
name=
"annotation_vehicle_speed"
>
时速:%1d km/h
</string>
<string-array
name=
"collectRange"
>
...
...
app/src/main/res/values/themes.xml
View file @
caa4d969
...
...
@@ -63,4 +63,10 @@
<item
name=
"android:clickable"
>
true
</item>
<item
name=
"android:focusable"
>
true
</item>
</style>
<style
name=
"OtherVehicleSpeed"
parent=
"Theme.HTAnticollision"
>
<item
name=
"android:textColor"
>
@color/color_1352C5
</item>
</style>
<style
name=
"OtherVehicleDistance"
parent=
"Theme.HTAnticollision"
>
<item
name=
"android:textColor"
>
@color/color_fff06313
</item>
</style>
</resources>
\ No newline at end of file
build.gradle
View file @
caa4d969
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins
{
id
'com.android.application'
version
'
7.4.2
'
apply
false
id
'com.android.library'
version
'
7.4.2
'
apply
false
id
'com.android.application'
version
'
8.0.1
'
apply
false
id
'com.android.library'
version
'
8.0.1
'
apply
false
id
'org.jetbrains.kotlin.android'
version
'1.8.0'
apply
false
id
'com.google.dagger.hilt.android'
version
'2.44'
apply
false
}
\ No newline at end of file
gradle.properties
View file @
caa4d969
...
...
@@ -22,4 +22,6 @@ kotlin.code.style=official
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass
=
true
MAPBOX_DOWNLOADS_TOKEN
=
sk.eyJ1IjoibWFybGxlciIsImEiOiJjbGVjNHZhdWgwd3U4M29uMjJrY3BqYXpkIn0.cqcw1CHYVGwESBqsfWcm7w
\ No newline at end of file
MAPBOX_DOWNLOADS_TOKEN
=
sk.eyJ1IjoibWFybGxlciIsImEiOiJjbGVjNHZhdWgwd3U4M29uMjJrY3BqYXpkIn0.cqcw1CHYVGwESBqsfWcm7w
android.defaults.buildfeatures.buildconfig
=
true
android.nonFinalResIds
=
false
\ No newline at end of file
gradle/wrapper/gradle-wrapper.properties
View file @
caa4d969
#Thu May 04 15:47:53 CST 2023
distributionBase
=
GRADLE_USER_HOME
distributionUrl
=
https
\:
//services.gradle.org/distributions/gradle-
7.5
-bin.zip
distributionUrl
=
https
\:
//services.gradle.org/distributions/gradle-
8.0
-bin.zip
distributionPath
=
wrapper/dists
zipStorePath
=
wrapper/dists
zipStoreBase
=
GRADLE_USER_HOME
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment