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
884a8b1c
Commit
884a8b1c
authored
Sep 08, 2023
by
马乐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.优化地图控制控件位置
2.增加权限申请
parent
eb0f3524
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
96 additions
and
34 deletions
+96
-34
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+14
-2
SplashActivity.kt
.../main/java/com/waytous/anticollision/ui/SplashActivity.kt
+29
-0
background_zoom_in.xml
app/src/main/res/drawable-night/background_zoom_in.xml
+0
-1
background_zoom_layout.xml
app/src/main/res/drawable-night/background_zoom_layout.xml
+7
-0
background_zoom_out.xml
app/src/main/res/drawable-night/background_zoom_out.xml
+0
-1
background_zoom_in.xml
app/src/main/res/drawable/background_zoom_in.xml
+0
-1
background_zoom_layout.xml
app/src/main/res/drawable/background_zoom_layout.xml
+7
-0
background_zoom_out.xml
app/src/main/res/drawable/background_zoom_out.xml
+0
-1
layout_map_box.xml
app/src/main/res/layout/layout_map_box.xml
+36
-26
colors.xml
app/src/main/res/values/colors.xml
+2
-1
strings.xml
app/src/main/res/values/strings.xml
+1
-1
No files found.
app/src/main/AndroidManifest.xml
View file @
884a8b1c
...
...
@@ -2,17 +2,29 @@
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
>
<uses-feature
android:name=
"android.hardware.camera.any"
/>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<!-- 文件权限 -->
<uses-permission
android:name=
"android.permission.READ_EXTERNAL_STORAGE"
/>
<uses-permission
android:name=
"android.permission.READ_EXTERNAL_STORAGE"
tools:ignore=
"ScopedStorage"
/>
<uses-permission
android:name=
"android.permission.WRITE_EXTERNAL_STORAGE"
tools:ignore=
"ScopedStorage"
/>
<uses-permission
android:name=
"android.permission.MOUNT_UNMOUNT_FILESYSTEMS"
tools:ignore=
"ProtectedPermissions"
/>
<!-- 定位权限 -->
tools:ignore=
"ProtectedPermissions"
/>
<!-- 定位权限 -->
<uses-permission
android:name=
"android.permission.ACCESS_FINE_LOCATION"
/>
<uses-permission
android:name=
"android.permission.ACCESS_COARSE_LOCATION"
/>
<uses-permission
android:name=
"android.permission.ACCESS_WIFI_STATE"
/>
<uses-permission
android:name=
"android.permission.CHANGE_WIFI_STATE"
/>
<uses-permission
android:name=
"android.permission.FOREGROUND_SERVICE"
/>
<uses-permission
android:name=
"android.permission.CAMERA"
/>
<uses-permission
android:name=
"android.permission.READ_PHONE_STATE"
/>
<uses-permission
android:name=
"android.permission.RECORD_AUDIO"
/>
<application
android:name=
".AntiCollisionApp"
android:allowBackup=
"true"
...
...
app/src/main/java/com/waytous/anticollision/ui/SplashActivity.kt
View file @
884a8b1c
package
com.waytous.anticollision.ui
import
android.Manifest
import
android.content.Intent
import
android.content.pm.PackageManager
import
android.os.Build
import
android.os.Bundle
import
androidx.appcompat.app.AppCompatActivity
import
androidx.core.app.ActivityCompat
import
androidx.core.content.ContextCompat
import
com.blankj.utilcode.util.BarUtils
import
com.blankj.utilcode.util.ScreenUtils
import
com.waytous.anticollision.R
...
...
@@ -19,6 +24,9 @@ class SplashActivity : AppCompatActivity() {
BarUtils
.
setNavBarVisibility
(
this
,
false
)
binding
=
ActivitySplashBinding
.
inflate
(
layoutInflater
)
setContentView
(
binding
.
root
)
if
(!
allPermissionsGranted
())
{
ActivityCompat
.
requestPermissions
(
this
,
REQUIRED_PERMISSIONS
,
REQUEST_CODE_PERMISSIONS
)
}
"${getString(R.string.text_progress, 57)}%"
.
also
{
binding
.
textProgress
.
text
=
it
}
binding
.
loadingProgressBar
.
progress
=
57
binding
.
loadingProgressBar
.
show
()
...
...
@@ -27,6 +35,26 @@ class SplashActivity : AppCompatActivity() {
},
2000
)
}
private
fun
allPermissionsGranted
()
=
REQUIRED_PERMISSIONS
.
all
{
ContextCompat
.
checkSelfPermission
(
baseContext
,
it
)
==
PackageManager
.
PERMISSION_GRANTED
}
companion
object
{
private
const
val
REQUEST_CODE_PERMISSIONS
=
10
private
val
REQUIRED_PERMISSIONS
=
mutableListOf
(
Manifest
.
permission
.
CAMERA
,
Manifest
.
permission
.
RECORD_AUDIO
,
Manifest
.
permission
.
READ_PHONE_STATE
,
Manifest
.
permission
.
ACCESS_WIFI_STATE
,
Manifest
.
permission
.
CHANGE_WIFI_STATE
).
apply
{
if
(
Build
.
VERSION
.
SDK_INT
<=
Build
.
VERSION_CODES
.
P
)
{
add
(
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
}
}.
toTypedArray
()
}
}
\ No newline at end of file
app/src/main/res/drawable-night/background_zoom_in.xml
View file @
884a8b1c
...
...
@@ -4,7 +4,6 @@
<layer-list>
<item
android:width=
"66dp"
android:height=
"70dp"
>
<shape>
<solid
android:color=
"@color/color_ff1c1c1c"
/>
<corners
android:bottomLeftRadius=
"40dp"
android:bottomRightRadius=
"40dp"
/>
</shape>
</item>
...
...
app/src/main/res/drawable-night/background_zoom_layout.xml
0 → 100644
View file @
884a8b1c
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<size
android:height=
"@dimen/dp_140"
android:width=
"@dimen/dp_66"
/>
<solid
android:color=
"@color/color_ff1c1c1c"
/>
<corners
android:radius=
"@dimen/dp_40"
/>
</shape>
\ No newline at end of file
app/src/main/res/drawable-night/background_zoom_out.xml
View file @
884a8b1c
...
...
@@ -4,7 +4,6 @@
<layer-list>
<item
android:width=
"66dp"
android:height=
"70dp"
>
<shape>
<solid
android:color=
"@color/white"
/>
<corners
android:topLeftRadius=
"40dp"
android:topRightRadius=
"40dp"
/>
</shape>
</item>
...
...
app/src/main/res/drawable/background_zoom_in.xml
View file @
884a8b1c
...
...
@@ -4,7 +4,6 @@
<layer-list>
<item
android:width=
"66dp"
android:height=
"70dp"
>
<shape>
<solid
android:color=
"@color/white"
/>
<corners
android:bottomLeftRadius=
"40dp"
android:bottomRightRadius=
"40dp"
/>
</shape>
</item>
...
...
app/src/main/res/drawable/background_zoom_layout.xml
0 → 100644
View file @
884a8b1c
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<size
android:height=
"@dimen/dp_140"
android:width=
"@dimen/dp_66"
/>
<solid
android:color=
"@color/white"
/>
<corners
android:radius=
"@dimen/dp_40"
/>
</shape>
\ No newline at end of file
app/src/main/res/drawable/background_zoom_out.xml
View file @
884a8b1c
...
...
@@ -4,7 +4,6 @@
<layer-list>
<item
android:width=
"66dp"
android:height=
"70dp"
>
<shape>
<solid
android:color=
"@color/white"
/>
<corners
android:topLeftRadius=
"40dp"
android:topRightRadius=
"40dp"
/>
</shape>
</item>
...
...
app/src/main/res/layout/layout_map_box.xml
View file @
884a8b1c
...
...
@@ -13,40 +13,29 @@
android:layout_margin=
"@dimen/dp_3"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"
0dp
"
android:layout_height=
"
@dimen/dp_0
"
app:layout_constraintBottom_toTopOf=
"@id/collectDataText"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
>
<com.mapbox.maps.MapView
android:id=
"@+id/mapView"
android:layout_width=
"
0dp
"
android:layout_height=
"
0dp
"
android:layout_width=
"
@dimen/dp_0
"
android:layout_height=
"
@dimen/dp_0
"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:mapbox_resourcesAccessToken=
"@string/map_box_public_key"
app:mapbox_scaleBarBorderWidth=
"0dp"
app:mapbox_scaleBarHeight=
"5dp"
app:mapbox_scaleBarGravity=
"bottom|right"
app:mapbox_scaleBarIsMetricUnits=
"true"
app:mapbox_scaleBarMarginBottom=
"38dp"
app:mapbox_scaleBarMarginRight=
"0dp"
app:mapbox_scaleBarPrimaryColor=
"@color/black"
app:mapbox_scaleBarSecondaryColor=
"@android:color/transparent"
app:mapbox_scaleBarShowTextBorder=
"false"
app:mapbox_scaleBarTextBarMargin=
"10dp"
app:mapbox_scaleBarTextColor=
"@android:color/black"
app:mapbox_scaleBarTextSize=
"10dp"
/>
app:mapbox_resourcesAccessToken=
"@string/mapbox_access_token"
app:mapbox_scaleBarEnabled=
"false"
/>
<androidx.appcompat.widget.AppCompatImageView
android:id=
"@+id/sos"
style=
"@style/MapBoxButtonStyle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"
30dp
"
android:layout_marginTop=
"
30dp
"
android:layout_marginStart=
"
@dimen/dp_24
"
android:layout_marginTop=
"
@dimen/dp_24
"
android:contentDescription=
"@string/sos"
android:src=
"@drawable/background_sos_btn"
app:layout_constraintStart_toStartOf=
"parent"
...
...
@@ -57,8 +46,8 @@
style=
"@style/MapBoxButtonStyle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"
25dp
"
android:layout_marginBottom=
"
25dp
"
android:layout_marginStart=
"
@dimen/dp_24
"
android:layout_marginBottom=
"
@dimen/dp_26
"
android:contentDescription=
"@string/emergency"
android:src=
"@mipmap/icon_driving_state_emergency"
app:layout_constraintBottom_toBottomOf=
"parent"
...
...
@@ -68,8 +57,9 @@
android:id=
"@+id/zoomLayout"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"24dp"
android:layout_marginEnd=
"28dp"
android:background=
"@drawable/background_zoom_layout"
android:layout_marginTop=
"@dimen/dp_24"
android:layout_marginEnd=
"@dimen/dp_26"
android:orientation=
"vertical"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
>
...
...
@@ -78,7 +68,7 @@
android:id=
"@+id/zoomOut"
style=
"@style/MapBoxButtonStyle"
android:layout_width=
"wrap_content"
android:layout_height=
"
0dp
"
android:layout_height=
"
@dimen/dp_0
"
android:layout_weight=
"1"
android:contentDescription=
"@string/zoom_out"
android:src=
"@drawable/background_zoom_out"
/>
...
...
@@ -94,7 +84,7 @@
android:id=
"@+id/zoomIn"
style=
"@style/MapBoxButtonStyle"
android:layout_width=
"wrap_content"
android:layout_height=
"
0dp
"
android:layout_height=
"
@dimen/dp_0
"
android:layout_weight=
"1"
android:contentDescription=
"@string/zoom_in"
android:src=
"@drawable/background_zoom_in"
/>
...
...
@@ -117,16 +107,36 @@
style=
"@style/MapBoxButtonStyle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"
34dp
"
android:layout_marginTop=
"
@dimen/dp_34
"
android:contentDescription=
"@string/toggle_safety_range"
android:src=
"@mipmap/icon_map_enable_safety_range_light"
app:layout_constraintEnd_toEndOf=
"@id/zoomLayout"
app:layout_constraintStart_toStartOf=
"@id/zoomLayout"
app:layout_constraintTop_toBottomOf=
"@id/locationTruck"
/>
<androidx.appcompat.widget.AppCompatImageView
android:id=
"@+id/scaleBar"
android:layout_width=
"@dimen/dp_64"
android:layout_height=
"@dimen/dp_5"
android:layout_marginEnd=
"@dimen/dp_26"
android:layout_marginBottom=
"@dimen/dp_42"
app:srcCompat=
"@drawable/icon_scale_bar"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/scaleText"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"@dimen/dp_4"
android:text=
"5米"
android:textColor=
"@color/color_2c2c2c"
android:textSize=
"@dimen/sp_18"
app:layout_constraintStart_toStartOf=
"@id/scaleBar"
app:layout_constraintEnd_toEndOf=
"@id/scaleBar"
app:layout_constraintBottom_toBottomOf=
"@id/scaleBar"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.appcompat.widget.AppCompatTextView
android:id=
"@+id/collectDataText"
android:layout_width=
"
0dp
"
android:layout_width=
"
@dimen/dp_0
"
android:layout_height=
"@dimen/dp_56"
android:layout_marginStart=
"@dimen/dp_3"
android:layout_marginEnd=
"@dimen/dp_3"
...
...
app/src/main/res/values/colors.xml
View file @
884a8b1c
...
...
@@ -52,5 +52,5 @@
<color
name=
"color_ff3785f8"
>
#ff3785f8
</color>
<color
name=
"color_803785f8"
>
#803785f8
</color>
<color
name=
"color_1a3684f9"
>
#1a3684f9
</color>
<color
name=
"color_2c2c2c"
>
#2c2c2c
</color>
</resources>
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
884a8b1c
...
...
@@ -3,7 +3,7 @@
<string
name=
"title_home"
>
Home
</string>
<string
name=
"title_dashboard"
>
Dashboard
</string>
<string
name=
"title_notifications"
>
Notifications
</string>
<string
name=
"map
_box_public_key
"
>
pk.eyJ1IjoibWFybGxlciIsImEiOiJjbGVhMXlmeXIwdmRzM29vNmM4aDA1M202In0.tfLD_AOs1OPmg5rLERcbfw
</string>
<string
name=
"map
box_access_token
"
>
pk.eyJ1IjoibWFybGxlciIsImEiOiJjbGVhMXlmeXIwdmRzM29vNmM4aDA1M202In0.tfLD_AOs1OPmg5rLERcbfw
</string>
<string
name=
"waytous_logo"
>
waytous
</string>
<string
name=
"status_bar_name"
>
矿卡车载管理系统
</string>
<string
name=
"loading"
>
Loading…
</string>
...
...
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