pull/2/head
qiuwb 2 years ago
parent 88d696845c
commit 76e718536a

File diff suppressed because one or more lines are too long

@ -1,18 +0,0 @@
import pygame
def init():
pygame.init()
win = pygame.display.set_mode((400, 400))
def getKey(keyName):
ans = False
for eve in pygame.event.get(): pass
keyInput = pygame.key.get_pressed()
myKey = getattr(pygame,'K_{}'.format(keyName))
if keyInput[myKey]:
ans = True
pygame.display.update()
return ans
if __name__ == '__main__':
init()

@ -1,12 +0,0 @@
import requests
def Map(origin, destination):
params = {'key': 'f3f31ecbd5286f1d375707a2c8186dba',
'origin': origin,
'destination': destination,
}
r = requests.get('https://restapi.amap.com/v3/direction/walking', params=params)
steps = r.json()['route']['paths'][0]['steps']
print(steps)
return steps
# Map('116.481028,39.989643', '116.434446,39.90816')

@ -1,93 +0,0 @@
import cv2
import socket
import threading
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import numpy as np
class VideoCaptureTransfer:
def __init__(self, source=0, dest_ip='127.0.0.1', dest_port=8000):
self.capture = cv2.VideoCapture(source)
self.dest_ip = dest_ip
self.dest_port = dest_port
self.frame = None
self.save_video = False
self.lock = threading.Lock()
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.thread = threading.Thread(target=self._capture_send)
self.thread.start()
def _capture_send(self):
while self.capture.isOpened():
ret, frame = self.capture.read()
if not ret:
break
frame = cv2.resize(frame, (640, 480))
if self.save_video:
self.output.write(frame)
with self.lock:
self.frame = frame.copy()
_, data = cv2.imencode('.jpg', frame, [int(cv2.IMWRITE_JPEG_QUALITY), 50])
self.sock.sendto(data.tobytes(), (self.dest_ip, self.dest_port))
self.capture.release()
cv2.destroyAllWindows()
self.output.release()
def start_recording(self, filename="output.avi", fmt="XVID"):
fourcc = cv2.VideoWriter_fourcc(*fmt)
fps = int(self.capture.get(cv2.CAP_PROP_FPS))
frame_size = (int(self.capture.get(cv2.CAP_PROP_FRAME_WIDTH)), int(self.capture.get(cv2.CAP_PROP_FRAME_HEIGHT)))
self.output = cv2.VideoWriter(filename, fourcc, fps, frame_size)
self.save_video = True
def stop_recording(self):
self.save_video = False
def read(self):
with self.lock:
return self.frame
def release(self):
self.thread.join()
self.sock.close()
if __name__ == '__main__':
vct = VideoCaptureTransfer(0,"192.168.43.18",9999)
def on_key_press(event):
if event.key == ' ':
if not vct.save_video:
vct.start_recording()
def on_key_release(event):
if event.key == ' ':
if vct.save_video:
vct.stop_recording()
fig, ax = plt.subplots()
im = ax.imshow(np.zeros((480, 640, 3), dtype=np.uint8))
def update_frame(_):
frame = vct.read()
im.set_data(frame)
return [im]
ani = animation.FuncAnimation(fig, update_frame, interval=50, blit=True)
fig.canvas.mpl_connect('key_press_event', on_key_press)
fig.canvas.mpl_connect('key_release_event', on_key_release)
plt.show()
vct.release()

File diff suppressed because it is too large Load Diff

@ -1,42 +0,0 @@
'''
Author: 柒上夏OPO
Date: 2022-01-10 12:31:28
LastEditTime: 2022-01-14 14:51:00
LastEditors: CloudSir
Description:
'''
import numpy as np
import cv2
from socket import *
# 127.0.0.1表示本机的IP用于测试使用时需要改为服务端的ip
addr = ('192.168.39.219', 9999)
cap = cv2.VideoCapture(0)
# 设置镜头分辨率默认是640x480
cap.set(cv2.CAP_PROP_FRAME_WIDTH, 640)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 480)
s = socket(AF_INET, SOCK_DGRAM) # 创建UDP套接字
while True:
_, img = cap.read()
img = cv2.flip(img, 1)
# 压缩图片
_, send_data = cv2.imencode('.jpg', img, [cv2.IMWRITE_JPEG_QUALITY, 50])
s.sendto(send_data, addr)
# print(f'正在发送数据,大小:{img.size} Byte')
cv2.putText(img, "client", (50, 50), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 0, 0), 2)
cv2.imshow('client', img)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
s.close()
cv2.destroyAllWindows()

@ -1,32 +0,0 @@
# '''
# Author: 柒上夏OPO
# Date: 2022-01-10 12:31:24
# LastEditTime: 2022-01-14 14:52:54
# LastEditors: CloudSir
# Description:
# '''
#
# import numpy as np
# import cv2
# from socket import *
#
#
# s = socket(AF_INET, SOCK_DGRAM) # 创建UDP套接字
# addr = ('', 8888) # 0.0.0.0表示本机
# s.bind(addr)
#
# s.setblocking(0) # 设置为非阻塞模式
#
# while True:
# data = None
# try:
# data= s.recv(65535)
# if data:
# print(data)
# except BlockingIOError as e:
# pass
#
#
# sockt udp接收端
#
# import socket

@ -1 +0,0 @@
srouce code

@ -1,15 +0,0 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties

@ -1,3 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="11" />
</component>
</project>

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<targetSelectedWithDropDown>
<Target>
<type value="QUICK_BOOT_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="C:\Users\zqy04\.android\avd\Pixel_XL_API_31.avd" />
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2023-03-28T17:08:46.341846900Z" />
</component>
</project>

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DesignSurface">
<option name="filePathToZoomLevelMap">
<map>
<entry key="..\:/MiNote_maintain/new_MiCode/src/sixaunyi/app/src/main/res/drawable/icon_favorite_red.xml" value="0.12" />
<entry key="..\:/MiNote_maintain/new_MiCode/src/sixaunyi/app/src/main/res/layout/activity_detect.xml" value="0.1" />
<entry key="..\:/MiNote_maintain/new_MiCode/src/sixaunyi/app/src/main/res/layout/activity_main.xml" value="0.1" />
<entry key="..\:/MiNote_maintain/new_MiCode/src/sixaunyi/app/src/main/res/layout/activity_map.xml" value="0.1125" />
<entry key="..\:/MiNote_maintain/new_MiCode/src/sixaunyi/app/src/main/res/layout/activity_video.xml" value="0.1" />
<entry key="..\:/MiNote_maintain/new_MiCode/src/sixaunyi/app/src/main/res/layout/content_detect.xml" value="0.1358695652173913" />
<entry key="..\:/MiNote_maintain/new_MiCode/src/sixaunyi/app/src/main/res/layout/fragment_first.xml" value="0.1358695652173913" />
<entry key="..\:/MiNote_maintain/new_MiCode/src/sixaunyi/app/src/main/res/layout/fragment_second.xml" value="0.1358695652173913" />
</map>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

@ -1,5 +0,0 @@
C
java:S1604"(Make this anonymous inner class a lambda(ìäÔéùÿÿÿÿ
P
java:S1161":Add the "@Override" annotation above this method signature(¼²Á÷

@ -1,5 +0,0 @@
>
java:S1604"(Make this anonymous inner class a lambda(ʆ<C38A>õ
P
java:S1161":Add the "@Override" annotation above this method signature(¼²Á÷

@ -1,32 +0,0 @@
C
java:S1604Z"(Make this anonymous inner class a lambda(ƒø…Òÿÿÿÿÿ
>
java:S1604c"(Make this anonymous inner class a lambda(›³äª
t java:S115!"ZRename this constant name to match the regular expression '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.(­“ïÍøÿÿÿÿ
o java:S115""ZRename this constant name to match the regular expression '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.(šŸåå
t java:S116O"ZRename this field "Trans_to_Detect" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(¾¥Âöûÿÿÿÿ
y
java:S1450O"^Remove the "Trans_to_Detect" field and declare it as a local variable in the relevant methods.(¾¥Âöûÿÿÿÿ
m
java:S1450Q"RRemove the "btn" field and declare it as a local variable in the relevant methods.(ãȧ<C388>üÿÿÿÿ
`
java:S1124!"EReorder the modifiers to comply with the Java Language Specification.(­“ïÍøÿÿÿÿ
[
java:S1124""EReorder the modifiers to comply with the Java Language Specification.(šŸåå
[
java:S1124#"EReorder the modifiers to comply with the Java Language Specification.(ß×á
[
java:S1124$"EReorder the modifiers to comply with the Java Language Specification.(Ó¾þá
V java:S125]"<This block of commented-out lines of code should be removed.(è·¿¯ùÿÿÿÿ
C
java:S1185~"(Remove this method to simply inherit it.(ñ‰ÿÜýÿÿÿÿ
W java:S125"<This block of commented-out lines of code should be removed.(<28>­éäøÿÿÿÿ
W java:S125"<This block of commented-out lines of code should be removed.(çéŸþÿÿÿÿ
F
java:S2093<18>"*Change this "try" to a try-with-resources.(ç£ê<C2A3>úÿÿÿÿ
W java:S125Í"<This block of commented-out lines of code should be removed.(òœô˜úÿÿÿÿ
9
java:S1128"Remove this duplicated import.(°þÊóøÿÿÿÿ
L
java:S1068*"1Remove this unused "receiveSocket" private field.(ÜÁ‰Óúÿÿÿÿ

@ -1,54 +0,0 @@
p
java:S11049"[Make mLocationClient a static final constant or non-public and provide accessors if needed.(òó•L
q
java:S1104;"[Make mLocationOption a static final constant or non-public and provide accessors if needed.(ÈÀ‚§
k
java:S2259ê"MA "NullPointerException" could be thrown; "mLocationClient" is nullable here.(Ô¹¤<C2B9>8üÀ±•‡1
z java:S116>"YRename this field "Current_latlng" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(æàÁÆÿÿÿÿÿ8ýÀ±•‡1
v java:S116P"ZRename this field "ClearMarker_btn" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(ëþ¥È8ýÀ±•‡1
y java:S116R"XRename this field "ChangeAct_btn" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(ÂîœÃúÿÿÿÿ8ýÀ±•‡1
Ÿ
java:S1186Å"€Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation.(±€¿ë8Á±•‡1
~
java:S1450R"\Remove the "ChangeAct_btn" field and declare it as a local variable in the relevant methods.(ÂîœÃúÿÿÿÿ8ƒÁ±•‡1
i
java:S1450="SRemove the "city" field and declare it as a local variable in the relevant methods.(“øÌà
t
java:S1450L"WRemove the "cityCode" field and declare it as a local variable in the relevant methods.(êýð†8ƒÁ±•‡1
N
java:S1874H"1Remove this use of "PoiSearch"; it is deprecated.(–ƒëÖ8ŒÁ±•‡1
S
java:S1874J"1Remove this use of "PoiSearch"; it is deprecated.(²¹·‘ÿÿÿÿÿ8<>Á±•‡1
] java:S125e"<This block of commented-out lines of code should be removed.(¤¯¿Îúÿÿÿÿ8˜Á±•‡1
m
java:S1874 "JDon't override a deprecated method or explicitly mark it as "@Deprecated".(Ó»×¶þÿÿÿÿ8œÁ±•‡1
Y java:S125Ö"<This block of commented-out lines of code should be removed.(©áèè8¤Á±•‡1
`
java:S1854"=Remove this useless assignment to local variable "longitude".(ËàÅ€ûÿÿÿÿ8¨Á±•‡1
_
java:S1854"<Remove this useless assignment to local variable "latitude".(û‘áäùÿÿÿÿ8©Á±•‡1
P
java:S1481"-Remove this unused "latitude" local variable.(û‘áäùÿÿÿÿ8«Á±•‡1
Q
java:S1481".Remove this unused "longitude" local variable.(ËàÅ€ûÿÿÿÿ8«Á±•‡1
Y java:S125Ä"<This block of commented-out lines of code should be removed.(É–Ö­8ÔŸÈ•‡1
N
java:S1172ç"+Remove this unused method parameter "view".(çÑ¢‰ýÿÿÿÿ8²Á±•‡1
\
java:S1155è">Use isEmpty() to check whether the collection is empty or not.(”ó±’8²Á±•‡1
N
java:S1172ð"+Remove this unused method parameter "view".(•É‘Îûÿÿÿÿ8³Á±•‡1
X java:S125"<This block of commented-out lines of code should be removed.(Ÿ…¦Q8¸Á±•‡1
\
java:S1117±"9Rename "query" which hides the field declared at line 72.(˜Ž“áûÿÿÿÿ8»Á±•‡1
^ java:S125Ê"<This block of commented-out lines of code should be removed.(±<>öîýÿÿÿÿ8½Á±•‡1
Y java:S125Õ"<This block of commented-out lines of code should be removed.(ÎÞ<C38E>û8½Á±•‡1
>
java:S1068="(Remove this unused "city" private field.(“øÌà
F
java:S1068H")Remove this unused "query" private field.(–ƒëÖ8¾Á±•‡1
O
java:S1068J"-Remove this unused "poiSearch" private field.(²¹·‘ÿÿÿÿÿ8¾Á±•‡1
I
java:S1068L",Remove this unused "cityCode" private field.(êýð†8¾Á±•‡1

@ -1,33 +0,0 @@
o
java:S2293Z"YReplace the type specification in this constructor call with the diamond operator ("<>").(œœÕ¼
K
java:S1066<18>"/Merge this if statement with the enclosing one.(¦­Üˆûÿÿÿÿ
K
java:S1066"/Merge this if statement with the enclosing one.(þÆÅ÷üÿÿÿÿ
>
java:S1604"(Make this anonymous inner class a lambda(ô§ê
i
java:S1104%"SMake TV_show a static final constant or non-public and provide accessors if needed.(úÀŸõ
>
java:S2189±""Add an end condition to this loop.(˜ïˆžÿÿÿÿÿ
>
java:S2189""Add an end condition to this loop.(˜ïˆžÿÿÿÿÿ
k java:S116!"VRename this field "receive_Msg" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(ŒßÙú
g java:S116%"RRename this field "TV_show" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(úÀŸõ
^
java:S1659#"CDeclare "total1" and all following declarations on a separate line.(Æ‘ç¡üÿÿÿÿ
c java:S100<"NRename this method name to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(Íš“è
h
java:S3776~"RRefactor this method to reduce its Cognitive Complexity from 50 to the 15 allowed.(“–ýþ
u
java:S2142Œ"^Either re-interrupt this method or rethrow the "InterruptedException" that can be caught here.(<>í†
W java:S125"<This block of commented-out lines of code should be removed.(‹ãà‘úÿÿÿÿ
R java:S125"<This block of commented-out lines of code should be removed.(çÓ®Ë
U
java:S1155·">Use isEmpty() to check whether the collection is empty or not.(†”“”
u
java:S2142È"^Either re-interrupt this method or rethrow the "InterruptedException" that can be caught here.(ä ¹€
O java:S106×"9Replace this use of System.out or System.err by a logger.(ŒŸÍÞ
A
java:S1068$"+Remove this unused "button0" private field.(Îÿæ¡

@ -1,29 +0,0 @@
z
Japp/src/androidTest/java/com/example/sixaunyi/ExampleInstrumentedTest.java,7\e\7e2dc811cc280952b5bbbfb02aa0e4fa16a75d7c
F
app/proguard-rules.pro,9\e\9e08934d811afe28fbc77aaa3c0d747b94348db9
X
(gradle/wrapper/gradle-wrapper.properties,f\b\fbe448ebfc3eb2d4e308f6b8b043666f5b57235e
A
gradle.properties,2\a\2afbb999f001938c88fa43fc2ef52abf0f8213e4
k
;app/src/test/java/com/example/sixaunyi/ExampleUnitTest.java,8\9\892f839083a73d776402535dde27e522288853c9
i
9app/src/main/java/com/example/sixaunyi/FirstFragment.java,0\3\0336633037f72ee431c162e8d6cbc29d1cd6fa5d
j
:app/src/main/java/com/example/sixaunyi/SecondFragment.java,1\2\12963d86ac5c2888cc2a9ae459de5665bc06b01f
?
settings.gradle,0\5\05efc8b1657769a27696d478ded1e95f38737233
@
app/build.gradle,f\4\f4a01d6a4fcb971362ec00a83903fd3902f52164
j
:app/src/main/java/com/example/sixaunyi/DetectActivity.java,9\6\9668392b13e33166876f2a7d3f10eb5405e757ad
i
9app/src/main/java/com/example/sixaunyi/VideoActivity.java,7\1\71fd1993763df2214bbdad8cfee650733993fe44
h
8app/src/main/java/com/example/sixaunyi/MainActivity.java,7\c\7c120b7216f76ce98d1573d90803ab36f481640c
P
app/src/main/AndroidManifest.xml,8\c\8c55c3ccc257e5907959013f99656e4c8ec3903e
k
;app/src/main/java/com/example/sixaunyi/ControlActivity.java,c\9\c99a584c2117ed2df42496451bb97ac1147f5ea0

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
</component>
</project>

@ -1 +0,0 @@
/build

@ -1,57 +0,0 @@
plugins {
id 'com.android.application'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.example.sixaunyi"
minSdk 22
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.navigation:navigation-fragment:2.3.5'
implementation 'androidx.navigation:navigation-ui:2.3.5'
implementation 'com.google.android.gms:play-services-maps:17.0.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
//GoogleEasyPermission
implementation 'pub.devrel:easypermissions:3.0.0'
//Material
implementation 'com.google.android.material:material:1.6.1'
//
/*implementation 'com.amap.api:location:latest.integration'
//
implementation 'com.amap.api:search:latest.integration'*/
}

@ -1,21 +0,0 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

@ -1,20 +0,0 @@
{
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.example.sixaunyi",
"variantName": "release",
"elements": [
{
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 1,
"versionName": "1.0",
"outputFile": "app-release.apk"
}
],
"elementType": "File"
}

@ -1,26 +0,0 @@
package com.example.sixaunyi;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.sixaunyi", appContext.getPackageName());
}
}

@ -1,58 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.sixaunyi">
<!-- 用于访问网络,网络定位需要上网 -->
<uses-permission android:name="android.permission.INTERNET" /> <!-- 用于读取手机当前的状态 -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> <!-- 用于写入缓存数据到扩展存储卡 -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!-- 用于申请调用A-GPS模块 -->
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /> <!-- 用于进行网络定位 -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <!-- 用于访问GPS定位 -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <!-- 用于获取运营商信息,用于支持提供运营商信息相关的接口 -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- 用于访问wifi网络信息wifi信息会用于进行网络定位 -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <!-- 用于获取wifi的获取权限wifi信息会用来进行网络定位 -->
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<application
android:name=".MapApplication"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Sixaunyi"
tools:targetApi="31">
<activity
android:name=".ControlActivity"
android:screenOrientation="landscape"
android:exported="false" />
<!-- 定位service -->
<service android:name="com.amap.api.location.APSService" /> <!-- 设置高德Key -->
<meta-data
android:name="com.amap.api.v2.apikey"
android:value="530a964ff05e45d9efb905abc9480690" />
<activity
android:name=".VideoActivity"
android:exported="false" />
<activity
android:name=".DetectActivity"
android:exported="false"
android:label="@string/title_activity_detect"
android:theme="@style/Theme.Sixaunyi.NoActionBar" />
<activity
android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.AppCompat">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

@ -1,14 +0,0 @@
package com.example.sixaunyi;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class ControlActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_control);
}
}

@ -1,221 +0,0 @@
package com.example.sixaunyi;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.Socket;
import java.util.ArrayList;
public class DetectActivity extends AppCompatActivity {
/*接收发送定义的常量*/
private String mIp= "192.168.79.46"; //这里是NodeMCU的IP Address我们可以通过打开Arduino的串口监视器获取IP Address
private int mPort = 80; //WiFiServer server(80);建立网络服务器对象监听端口80这里的80是自定义的只要与Android中的socket一致就好。
private SendThread sendthread;
String receive_Msg;
String l;
String total0,total1,total2,total3;
private Button button0;
public TextView TV_show;
private DataHandler mHandler = new DataHandler();
/*****************************/
@Override
protected void onCreate(Bundle savedInstanceState) {
//onCreate必做事情继承父类super.onCreate设置当前试图setContentView
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detect);
TV_show = findViewById(R.id.show);
/***************连接*****************/
sendthread = new SendThread(mIp, mPort, mHandler);
create_Thread();
new Thread().start();
/**********************************/
}
/*接收线程*******************************************************************************/
/**
* socket线
*/
void create_Thread(){
new Thread(sendthread).start();//创建一个新线程
}
class DataHandler extends Handler {
@Override
public void handleMessage(Message msg)
{
super.handleMessage(msg);
if (msg.what == 0x00) {
Log.i("mr_收到的数据 ", msg.obj.toString());
receive_Msg = msg.obj.toString();
if(receive_Msg.indexOf("Humidity:")!=-1) {
String[] strArray = receive_Msg.split(" "); //处理接受到的数据并将他们显示在TextView中
TV_show.setText(strArray[3]);
}
}
}
}
class SendThread implements Runnable {
private String ip;
private int port;
BufferedReader in;
PrintWriter out; //打印流
Handler mainHandler;
Socket s;
private String receiveMsg;
ArrayList<String> list = new ArrayList<String>();
public SendThread(String ip,int port, Handler mainHandler) { //IP端口数据
this.ip = ip;
this.port=port;
this.mainHandler = mainHandler;
}
/**
*
*/
void open(){
try {
s = new Socket(ip, port);
//in收单片机发的数据
in = new BufferedReader(new InputStreamReader(s.getInputStream()));
out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(
s.getOutputStream())), true);
} catch (IOException e) {
e.printStackTrace();
}
}
/**
*
*/
void close(){
try {
s.close();
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public void run() {
//创建套接字
open();
//BufferedReader
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
while (true) {
try {
Thread.sleep(200);
close();
open();
} catch (InterruptedException e1) {
e1.printStackTrace();
}
if (!s.isClosed()) {
if (s.isConnected()) {
if (!s.isInputShutdown()) {
try {
Log.i("mr", "等待接收信息");
Message msg=mainHandler.obtainMessage();
char[] chars = new char[1024]; //byte[] bys = new byte[1024];
int len = 0; //int len = 0;
while((len = in.read(chars)) != -1){
receiveMsg = new String(chars, 0, len);
msg.what=0x00;
msg.obj=receiveMsg;
mainHandler.sendMessage(msg);
}
} catch (IOException e) {
Log.i("mr", e.getMessage());
try {
s.shutdownInput();
s.shutdownOutput();
s.close();
} catch (IOException e1) {
e1.printStackTrace();
}
e.printStackTrace();
}
}
}
}
}
}
});
thread.start();
while (true) {
//连接中
if (!s.isClosed()&&s.isConnected()&&!s.isInputShutdown()) {
// 如果消息集合有东西,并且发送线程在工作。
if (list.size() > 0 && !s.isOutputShutdown()) {
out.println(list.get(0));
list.remove(0);
}
Message msg=mainHandler.obtainMessage();
msg.what=0x01;
mainHandler.sendMessage(msg);
} else {
//连接中断了
Log.i("mr", "连接断开了");
Message msg=mainHandler.obtainMessage();
msg.what=0x02;
mainHandler.sendMessage(msg);
}
try {
Thread.sleep(200);
} catch (InterruptedException e) {
try {
out.close();
in.close();
s.close();
} catch (IOException e1) {
e1.printStackTrace();
}
e.printStackTrace();
}
}
}
public void send(String msg) {
System.out.println("msg的值为 " + msg);
list.add(msg);
}
}
}

@ -1,46 +0,0 @@
package com.example.sixaunyi;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.navigation.fragment.NavHostFragment;
import com.example.sixaunyi.databinding.FragmentFirstBinding;
public class FirstFragment extends Fragment {
private FragmentFirstBinding binding;
@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState
) {
binding = FragmentFirstBinding.inflate(inflater, container, false);
return binding.getRoot();
}
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
binding.buttonFirst.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
NavHostFragment.findNavController(FirstFragment.this)
.navigate(R.id.action_FirstFragment_to_SecondFragment);
}
});
}
@Override
public void onDestroyView() {
super.onDestroyView();
binding = null;
}
}

@ -1,472 +0,0 @@
package com.example.sixaunyi;
import static androidx.constraintlayout.motion.utils.Oscillator.TAG;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.Manifest;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.nfc.Tag;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import com.amap.api.location.AMapLocation;
import com.amap.api.location.AMapLocationClient;
import com.amap.api.location.AMapLocationClientOption;
import com.amap.api.location.AMapLocationListener;
import com.amap.api.maps.AMap;
import com.amap.api.maps.AMapUtils;
import com.amap.api.maps.LocationSource;
import com.amap.api.maps.MapView;
import com.amap.api.maps.model.BitmapDescriptorFactory;
import com.amap.api.maps.model.LatLng;
import com.amap.api.maps.model.Marker;
import com.amap.api.maps.model.MarkerOptions;
import com.amap.api.services.core.AMapException;
import com.amap.api.services.core.LatLonPoint;
import com.amap.api.services.core.PoiItem;
import com.amap.api.services.geocoder.GeocodeResult;
import com.amap.api.services.geocoder.GeocodeSearch;
import com.amap.api.services.geocoder.RegeocodeAddress;
import com.amap.api.services.geocoder.RegeocodeQuery;
import com.amap.api.services.geocoder.RegeocodeResult;
import com.amap.api.services.poisearch.PoiResult;
import com.amap.api.services.poisearch.PoiSearch;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.util.ArrayList;
import java.util.List;
import pub.devrel.easypermissions.AfterPermissionGranted;
import pub.devrel.easypermissions.EasyPermissions;
public class MainActivity extends AppCompatActivity implements AMapLocationListener, LocationSource,
AMap.OnMapLongClickListener, GeocodeSearch.OnGeocodeSearchListener, AMap.OnMarkerDragListener,
AMap.OnMarkerClickListener{
//请求权限码
private static final int REQUEST_PERMISSIONS = 9527;
//声明AMapLocationClient类对象
public AMapLocationClient mLocationClient = null;
//声明AMapLocationClientOption对象
public AMapLocationClientOption mLocationOption = null;
private MapView mapView = null;
private String city;
private LatLng Current_latlng;
//地图控制器*********非常重要!!!!!!
private AMap aMap = null;
//位置更改监听
private LocationSource.OnLocationChangedListener mListener;
//地理编码搜索
private GeocodeSearch geocodeSearch;
//解析成功标识码
private static final int PARSE_SUCCESS_CODE = 1000;
//POI查询对象
private PoiSearch.Query query;
//POI搜索对象
private PoiSearch poiSearch;
//城市码
private String cityCode = null;
//浮动按钮
private FloatingActionButton fabPOI;
//浮动按钮 清空地图标点
private FloatingActionButton ClearMarker_btn;
//浮动按钮 更换活动
private FloatingActionButton ChangeAct_btn;
//标点列表
private List<Marker> markerList = new ArrayList<>();
//标识参数类
private MarkerOptions markerOption = new MarkerOptions();
@SuppressLint("MissingInflatedId")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
fabPOI = findViewById(R.id.fab_poi);
ClearMarker_btn = findViewById(R.id.clearMarker_btn);
ChangeAct_btn = findViewById(R.id.change_btn);
ChangeAct_btn.show();
//tvContent = findViewById(R.id.tv_content);
/*,
*
*/
initLocation();
//初始化地图
initMap(savedInstanceState);
//检查安卓版本
checkingAndroidVersion();
}
/**
* Android
*/
private void checkingAndroidVersion() {
//Android6.0及以上先获取权限再定位
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){
requestPermission();
}
//Android6.0以下直接定位
else {
//直接定位
mLocationClient.startLocation();
}
}
/**
*
*/
@AfterPermissionGranted(REQUEST_PERMISSIONS)
private void requestPermission() {
String[] permissions = {
Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.READ_PHONE_STATE,
Manifest.permission.WRITE_EXTERNAL_STORAGE
};
if (EasyPermissions.hasPermissions(this, permissions)) {
//有权限
//******
Log.d(TAG, "已获得权限,可以定位啦!");
showMsg("已获得权限,可以定位啦!");
//开始定位
mLocationClient.startLocation();
} else {
//false 无权限
EasyPermissions.requestPermissions(this, "需要权限", REQUEST_PERMISSIONS, permissions);
}
}
//提示框显示文本
private void showMsg(String msg) {
Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
}
/**
*
* @param requestCode
* @param permissions
* @param grantResults
*/
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
//设置请求到的权限结果
EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this);
}
/******** 初始化定位 *******/
private void initLocation() {
//初始化定位
try {
mLocationClient = new AMapLocationClient(getApplicationContext());
} catch (Exception e) {
e.printStackTrace();
}
if (mLocationClient != null) {
//设置定位回调监听
mLocationClient.setLocationListener(this);
//初始化AMapLocationClientOption对象
mLocationOption = new AMapLocationClientOption();
//设置定位模式为AMapLocationMode.Hight_Accuracy高精度模式。
mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy);
//获取最近3s内精度最高的一次定位结果
//设置setOnceLocationLatest(boolean b)接口为true启动定位时SDK会返回最近3s内精度最高的一次定位结果。如果设置其为truesetOnceLocation(boolean b)接口也会被设置为true反之不会默认为false。
mLocationOption.setOnceLocationLatest(true);
//设置是否返回地址信息(默认返回地址信息)
mLocationOption.setNeedAddress(true);
//设置定位请求超时时间单位是毫秒默认30000毫秒建议超时时间不要低于8000毫秒。
mLocationOption.setHttpTimeOut(20000);
//关闭缓存机制,高精度定位会产生缓存。
mLocationOption.setLocationCacheEnable(false);
//给定位客户端对象设置定位参数
mLocationClient.setLocationOption(mLocationOption);
}
}
/**
*
* @param savedInstanceState
*/
private void initMap(Bundle savedInstanceState) {
//因为mapView为null所以要加上这个括号不可常规的mapView.findViewById
mapView = (MapView) findViewById(R.id.map_view);
//在activity执行onCreate时执行mMapView.onCreate(savedInstanceState),创建地图
mapView.onCreate(savedInstanceState);
//初始化地图控制器对象
aMap = mapView.getMap();
// 设置定位监听
aMap.setLocationSource(this);
// 设置为true表示显示定位层并可触发定位false表示隐藏定位层并不可触发定位默认是false
aMap.setMyLocationEnabled(true);
//设置地图标志点击事件
aMap.setOnMarkerClickListener(this);
//设置地图标志拖拽事件
aMap.setOnMarkerDragListener(this);
//开启室内地图
//aMap.showIndoorMap(true);
//设置地图长按事件
aMap.setOnMapLongClickListener(this);
//构造 GeocodeSearch 对象
try {
geocodeSearch = new GeocodeSearch(this);
} catch (AMapException e) {
e.printStackTrace();
}
//设置监听
geocodeSearch.setOnGeocodeSearchListener(this);
}
/**
*
*/
@Override
public void activate(OnLocationChangedListener onLocationChangedListener) {
mListener = onLocationChangedListener;
if (mLocationClient == null) {
mLocationClient.startLocation();//启动定位
}
}
/**
*
*/
@Override
public void deactivate() {
mListener = null;
if (mLocationClient != null) {
mLocationClient.stopLocation();
mLocationClient.onDestroy();
}
mLocationClient = null;
}
@Override
public void onLocationChanged(AMapLocation aMapLocation) {
if (aMapLocation != null) {
//定位成功
if (aMapLocation.getErrorCode() == 0) {
//地址
String address = aMapLocation.getAddress();
//城市赋值
city = aMapLocation.getCity();
//当前位置经纬度坐标
Current_latlng = new LatLng(aMapLocation.getLatitude(), aMapLocation.getLongitude());
//获取纬度
double latitude = aMapLocation.getLatitude();
//获取经度
double longitude = aMapLocation.getLongitude();
Log.d("MainActivity", aMapLocation.getCity());
showMsg(address);
//停止定位后,本地定位服务并不会被销毁
mLocationClient.stopLocation();
if (mListener != null) {
// 显示系统图标
mListener.onLocationChanged(aMapLocation);
}
//显示浮动按钮
fabPOI.show();
//赋值
cityCode = aMapLocation.getCityCode();
}
else {
//定位失败时可通过ErrCode错误码信息来确定失败的原因errInfo是错误信息详见错误码表。
Log.e("AmapError", "location Error, ErrCode:"
+ aMapLocation.getErrorCode() + ", errInfo:"
+ aMapLocation.getErrorInfo());
}
}
}
/***********************Activity相关函数其中添加了保证mapView与activity同步相关函数******************/
@Override
protected void onResume() {
super.onResume();
//在activity执行onResume时执行mMapView.onResume (),重新绘制加载地图
mapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
//在activity执行onPause时执行mMapView.onPause (),暂停地图的绘制
mapView.onPause();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
//在activity执行onSaveInstanceState时执行mMapView.onSaveInstanceState (outState),保存地图当前的状态
mapView.onSaveInstanceState(outState);
}
@Override
protected void onDestroy() {
super.onDestroy();
//销毁定位客户端,同时销毁本地定位服务。
if (mLocationClient != null) {
mLocationClient.onDestroy();
}
//在activity执行onDestroy时执行mMapView.onDestroy(),销毁地图
mapView.onDestroy();
}
/******************************************************************/
/* * * 长按地图响应函数 * * */
//LatLng 为高德地图包自带的存储坐标对象
@Override
public void onMapLongClick(LatLng latLng) {
float distance = AMapUtils.calculateLineDistance(Current_latlng,latLng);
//showMsg("长按了地图,经度:"+latLng.longitude+",纬度:"+latLng.latitude);
showMsg("直线距离:"+distance+"米");
//坐标转地址
latlonToAddress(latLng);
//添加标点
addMarker(latLng);
}
/**
*
* @param latLng
*/
private void addMarker(LatLng latLng) {
//显示浮动按钮
ClearMarker_btn.show();
//添加标点
Marker marker = aMap.addMarker(markerOption
.position(latLng)
.draggable(true)
//标点图标
.icon(BitmapDescriptorFactory.
fromBitmap(BitmapFactory.decodeResource(getResources(),R.drawable.img)))
//备注
.title("路径点")
.snippet("距离:")
);
marker.showInfoWindow();
markerList.add(marker);
}
/**
* Marker
* @param view
*/
public void clearAllMarker(View view) {
if (markerList != null && markerList.size()>0){
for (Marker markerItem : markerList) {
markerItem.remove();
}
}
ClearMarker_btn.hide();
}
public void changeAct(View view) {
Intent intent = new Intent(MainActivity.this, VideoActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(intent);
}
/**
* Marker
*
* @param marker
* @return
*/
@Override
public boolean onMarkerClick(Marker marker) {
Log.d(TAG,"点击了标点");
//显示InfoWindow
/*
if (!marker.isInfoWindowShown()) {
//显示
marker.showInfoWindow();
} else {
//隐藏
marker.hideInfoWindow();
}
*/
return true;
}
/**
*
* @param marker
*/
@Override
public void onMarkerDragStart(Marker marker) {
Log.d(TAG,"开始拖动");
}
/**
*
* @param marker
*/
@Override
public void onMarkerDrag(Marker marker) {
Log.d(TAG,"拖动中");
}
/**
*
* @param marker
*/
@Override
public void onMarkerDragEnd(Marker marker) {
Log.d(TAG,"拖动完成");
}
/* * * * * *
*
* @param latLng
*/
private void latlonToAddress(LatLng latLng) {
//位置点 通过经纬度进行构建
LatLonPoint latLonPoint = new LatLonPoint(latLng.latitude, latLng.longitude);
//逆编码查询 第一个参数表示一个Latlng第二参数表示范围多少米第三个参数表示是火系坐标系还是GPS原生坐标系
RegeocodeQuery query = new RegeocodeQuery(latLonPoint, 20, GeocodeSearch.AMAP);
//异步获取地址信息
geocodeSearch.getFromLocationAsyn(query);
}
/*********************************************************
* @param regeocodeResult
* @param rCode
*/
@Override
public void onRegeocodeSearched(RegeocodeResult regeocodeResult, int rCode) {
if(rCode == PARSE_SUCCESS_CODE){
RegeocodeAddress regeocodeAddress = regeocodeResult.getRegeocodeAddress();
//显示解析后的地址
showMsg("地址:"+regeocodeAddress.getFormatAddress());
}else {
showMsg("获取地址失败");
}
}
@Override
public void onGeocodeSearched(GeocodeResult geocodeResult, int i) {
}
/*
@Override
public void onPoiSearched(PoiResult poiResult, int i) {
//解析result获取POI信息
//获取POI组数列表
ArrayList<PoiItem> poiItems = poiResult.getPois();
for (PoiItem poiItem : poiItems) {
Log.d("MainActivity", " Title" + poiItem.getTitle() + " Snippet" + poiItem.getSnippet());
}
}*/
/*
@Override
public void (PoiItem poiItem, int i) {
}*/
}

@ -1,27 +0,0 @@
package com.example.sixaunyi;
import android.app.Application;
import android.content.Context;
import com.amap.api.location.AMapLocationClient;
import com.amap.api.maps.MapsInitializer;
import com.amap.api.services.core.ServiceSettings;
public class MapApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
Context context = this;
//定位隐私政策同意
AMapLocationClient.updatePrivacyShow(context,true,true);
AMapLocationClient.updatePrivacyAgree(context,true);
//地图隐私政策同意
MapsInitializer.updatePrivacyShow(context,true,true);
MapsInitializer.updatePrivacyAgree(context,true);
//搜索隐私政策同意
ServiceSettings.updatePrivacyShow(context,true,true);
ServiceSettings.updatePrivacyAgree(context,true);
}
}

@ -1,46 +0,0 @@
package com.example.sixaunyi;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.navigation.fragment.NavHostFragment;
import com.example.sixaunyi.databinding.FragmentSecondBinding;
public class SecondFragment extends Fragment {
private FragmentSecondBinding binding;
@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState
) {
binding = FragmentSecondBinding.inflate(inflater, container, false);
return binding.getRoot();
}
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
binding.buttonSecond.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
NavHostFragment.findNavController(SecondFragment.this)
.navigate(R.id.action_SecondFragment_to_FirstFragment);
}
});
}
@Override
public void onDestroyView() {
super.onDestroyView();
binding = null;
}
}

@ -1,278 +0,0 @@
package com.example.sixaunyi;
import static androidx.constraintlayout.motion.utils.Oscillator.TAG;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.*;
import android.os.Bundle;
public class VideoActivity extends AppCompatActivity {
private final static String SEND_to_IP = "192.168.43.165"; //填写接收方IP
private final static String Recieve_IP = "192.168.43.165";//填服务器IP
private final static int SEND_PORT = 8888; //发送端口号
private final static int RECEIVE_PORT = 9999; //接收端口号
private boolean listenStatus = true; //接收线程的循环标识
private byte[] buf;
Bitmap bp;
private DatagramSocket receiveSocket;
private DatagramSocket sendSocket;
private DatagramSocket reveSocket;
private InetAddress serverAddr;
private SendHandler sendHandler = new SendHandler();
private ReceiveHandler receiveHandler = new ReceiveHandler();
private Button Trans_to_Detect;
private ImageView imgShow;
private Button btn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video);
imgShow = findViewById(R.id.img_show);
btn = findViewById(R.id.btn_send);
Trans_to_Detect = findViewById(R.id.transfer_to_detect);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//new UdpSendThread().start();
new UdpReceiveThread().start();
Log.i(TAG, "onClick: 2222222222222222222222222");
}
});
Trans_to_Detect.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(VideoActivity.this, DetectActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(intent);
}
});
}
class ReceiveHandler extends Handler{
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
imgShow.setImageBitmap(bp);
}
}
class SendHandler extends Handler {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
}
}
/*
* UDP线
* */
public class UdpReceiveThread extends Thread
{
@Override
public void run()
{
try
{
reveSocket = new DatagramSocket(RECEIVE_PORT);
serverAddr = InetAddress.getByName(Recieve_IP);
//ByteArrayOutputStream out = new ByteArrayOutputStream();
while(listenStatus)
{
byte[] inBuf= new byte[1024*1024];
DatagramPacket inPacket=new DatagramPacket(inBuf,inBuf.length);
//out.write(inPacket.getData());
reveSocket.receive(inPacket);
if(!inPacket.getAddress().equals(serverAddr)){
throw new IOException("未知名的报文");
}
ByteArrayInputStream in = new ByteArrayInputStream(inPacket.getData());
receiveHandler.sendEmptyMessage(1);
bp = BitmapFactory.decodeStream(in);
}
} catch (Exception e)
{
e.printStackTrace();
}finally {
reveSocket.close();
}
}
}
/*
* UDP线
* */
public class UdpSendThread extends Thread {
@Override
public void run() {
try {
buf ="test".getBytes();
// 创建DatagramSocket对象使用端口8888
sendSocket = new DatagramSocket(8888);
serverAddr = InetAddress.getByName(SEND_to_IP);
DatagramPacket outPacket = new DatagramPacket(buf, buf.length, serverAddr, SEND_PORT);
sendSocket.send(outPacket);
sendSocket.close();
sendHandler.sendEmptyMessage(1);
Log.i(TAG, "run: 111111111111111111111111111111111111111111111111");
} catch (Exception e) {
e.printStackTrace();
}
}
}
//*************************************************************************************************
/*public class TelloControlDemo {
private DatagramSocket socket;
private InetAddress telloAddress;
private int port = 8889;
public void main(String[] args) throws IOException {
TelloControlDemo demo = new TelloControlDemo();
demo.start();
}
public void start() throws IOException {
// Create a UDP socket
socket = new DatagramSocket(9000);
telloAddress = InetAddress.getByName("192.168.10.1");
// Start the receiver thread
Thread receiverThread = new Thread(new Receiver());
receiverThread.start();
System.out.println("\r\n\r\nTello Java Demo.\r\n");
System.out.println("Tello: command takeoff land flip forward back left right \r\n" +
" up down cw ccw speed speed?\r\n");
System.out.println("end -- quit demo.\r\n");
while (true) {
try {
// Read user input from console
byte[] buffer = new byte[1024];
System.in.read(buffer);
String message = new String(buffer).trim();
if (message.equalsIgnoreCase("end")) {
System.out.println("...");
socket.close();
break;
}
// Send command to Tello drone
byte[] sendData = message.getBytes();
DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, telloAddress, port);
socket.send(sendPacket);
} catch (IOException e) {
e.printStackTrace();
}
}
}
private class Receiver implements Runnable {
@Override
public void run() {
byte[] receiveData = new byte[1024];
DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length);
while (true) {
try {
// Receive data from Tello drone
socket.receive(receivePacket);
String message = new String(receivePacket.getData(), 0, receivePacket.getLength());
System.out.println(message);
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}*/
}

@ -1,30 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 862 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

@ -1,170 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="#EF5350"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@android:color/white"
android:pathData="M13.35,20.13c-0.76,0.69 -1.93,0.69 -2.69,-0.01l-0.11,-0.1C5.3,15.27 1.87,12.16 2,8.28c0.06,-1.7 0.93,-3.33 2.34,-4.29 2.64,-1.8 5.9,-0.96 7.66,1.1 1.76,-2.06 5.02,-2.91 7.66,-1.1 1.41,0.96 2.28,2.59 2.34,4.29 0.14,3.88 -3.3,6.99 -8.55,11.76l-0.1,0.09z" />
</vector>

@ -1,155 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- 显示无人机回传图像的控件 -->
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="200dp"
android:scaleType="centerCrop"
/>
<!-- 左侧竖直轴按钮 -->
<RelativeLayout
android:id="@+id/left_vertical_button_layout"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:layout_below="@+id/imageView">
<!-- 上升按钮 -->
<ImageButton
android:id="@+id/up_button"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true"
android:background="@null"
android:contentDescription="@string/up_button"
android:src="@drawable/img" />
<!-- 下降按钮 -->
<ImageButton
android:id="@+id/down_button"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:background="@null"
android:contentDescription="@string/down_button"
android:src="@drawable/img" />
<!-- 左旋转按钮 -->
<ImageButton
android:id="@+id/rotate_left_button"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerVertical="true"
android:layout_alignParentStart="true"
android:background="@null"
android:contentDescription="@string/turn_left_button"
android:src="@drawable/img" />
<!-- 右旋转按钮 -->
<ImageButton
android:id="@+id/rotate_right_button"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
android:background="@null"
android:contentDescription="@string/turn_right_button"
android:src="@drawable/img" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/top_horizontal_button_layout"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_below="@+id/imageView"
android:layout_marginTop="20dp"
android:layout_marginRight="20dp"
android:layout_alignParentEnd="true">
<!-- 向左按钮 -->
<!-- 每一个与image相关都需要设置contentDescription对其进行描述-->
<ImageButton
android:id="@+id/left_button"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:background="@null"
android:contentDescription="@string/move_left_button"
android:src="@drawable/img" />
<!-- 向右按钮 -->
<ImageButton
android:id="@+id/right_button"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:background="@null"
android:contentDescription="@string/move_right_button"
android:src="@drawable/img" />
<!-- 向前移动按钮 -->
<ImageButton
android:id="@+id/forward_button"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerHorizontal="true"
android:background="@null"
android:contentDescription="@string/move_forward_button"
android:src="@drawable/img" />
<!-- 向后移动按钮 -->
<ImageButton
android:id="@+id/backward_button"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:contentDescription="@string/move_back_button"
android:layout_marginEnd="50dp"
android:background="@null"
android:src="@drawable/img" />
</RelativeLayout>
<LinearLayout
android:id="@+id/takeoff_landing_buttons_layout"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="20dp"
android:gravity="center_horizontal"
android:orientation="horizontal">
<!-- 降落按钮 -->
<Button
android:id="@+id/landing_button"
android:layout_width="80dp"
android:layout_height="61dp"
android:layout_gravity="left"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:text="降落" />
<!-- 起飞按钮 -->
<Button
android:id="@+id/takeoff_button"
android:layout_width="80dp"
android:layout_height="match_parent"
android:layout_gravity="right"
android:layout_weight="1"
android:text="起飞" />
</LinearLayout>
</RelativeLayout>

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
</androidx.constraintlayout.widget.ConstraintLayout>

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".DetectActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_margin="25dp"
android:gravity="center_horizontal"
android:orientation="vertical"
android:layout_height="match_parent"
android:background="@color/white">
<TextView
android:layout_width="226dp"
android:id="@+id/show"
android:layout_height="94dp"
android:gravity="center"
android:visibility="visible" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

@ -1,67 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
tools:context=".MainActivity">
<!--地图-->
<com.amap.api.maps.MapView
android:id="@+id/map_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!--浮动按钮-->
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab_poi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_margin="20dp"
android:clickable="true"
android:src="@drawable/icon_favorite_red"
android:visibility="gone"
app:backgroundTint="#FFF"
app:backgroundTintMode="screen"
app:hoveredFocusedTranslationZ="18dp"
app:pressedTranslationZ="18dp" />
<!--浮动按钮 清空marker-->
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/clearMarker_btn"
android:layout_width="wrap_content"
android:layout_above="@+id/fab_poi"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginEnd="20dp"
android:clickable="true"
android:onClick="clearAllMarker"
app:fabSize="normal"
android:src="@drawable/icon_clear"
app:backgroundTint="#FFF"
android:visibility="invisible"
app:backgroundTintMode="screen"
app:hoveredFocusedTranslationZ="18dp"
app:pressedTranslationZ="18dp" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/change_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginEnd="20dp"
android:clickable="true"
android:onClick="changeAct"
app:fabSize="normal"
android:src="@drawable/img"
app:backgroundTint="#FFF"
android:visibility="invisible"
app:backgroundTintMode="screen"
app:hoveredFocusedTranslationZ="18dp"
app:pressedTranslationZ="18dp" />
</RelativeLayout>

@ -1,39 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".VideoActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_margin="5dp"
android:gravity="center_horizontal"
android:orientation="vertical"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:id="@+id/img_show"
android:layout_marginTop="30dp"
android:background="#000000"
android:layout_height="300dp">
</ImageView>
<Button
android:layout_width="wrap_content"
android:layout_marginTop="10dp"
android:id="@+id/btn_send"
android:text="链接到服务器"
android:textSize="30sp"
android:layout_height="wrap_content">
</Button>
<Button
android:id="@+id/transfer_to_detect"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="切换" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<fragment
android:id="@+id/nav_host_fragment_content_detect"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:defaultNavHost="true"
app:navGraph="@navigation/nav_graph" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -1,41 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageView
android:id="@+id/badge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:adjustViewBounds="true" >
</ImageView>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:ellipsize="end"
android:singleLine="true"
android:textColor="#ff000000"
android:textSize="14dp"
android:textStyle="bold" />
<TextView
android:id="@+id/snippet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:textColor="#ff7f7f7f"
android:textSize="14dp" />
</LinearLayout>
</LinearLayout>

@ -1,41 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="@drawable/img"
android:orientation="horizontal" >
<ImageView
android:id="@+id/badge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp" >
</ImageView>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:ellipsize="end"
android:singleLine="true"
android:textColor="#ff000000"
android:textSize="14dp"
android:textStyle="bold" />
<TextView
android:id="@+id/snippet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:textColor="#ff7f7f7f"
android:textSize="14dp" />
</LinearLayout>
</LinearLayout>

@ -1,31 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".FirstFragment">
<TextView
android:id="@+id/textview_first"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_first_fragment"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@id/button_first"
/>
<Button
android:id="@+id/button_first"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/next"
app:layout_constraintTop_toBottomOf="@id/textview_first"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SecondFragment">
<TextView
android:id="@+id/textview_second"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@id/button_second"
/>
<Button
android:id="@+id/button_second"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/previous"
app:layout_constraintTop_toBottomOf="@id/textview_second"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 982 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/nav_graph"
app:startDestination="@id/FirstFragment">
<fragment
android:id="@+id/FirstFragment"
android:name="com.example.sixaunyi.FirstFragment"
android:label="@string/first_fragment_label"
tools:layout="@layout/fragment_first" >
<action
android:id="@+id/action_FirstFragment_to_SecondFragment"
app:destination="@id/SecondFragment" />
</fragment>
<fragment
android:id="@+id/SecondFragment"
android:name="com.example.sixaunyi.SecondFragment"
android:label="@string/second_fragment_label"
tools:layout="@layout/fragment_second" >
<action
android:id="@+id/action_SecondFragment_to_FirstFragment"
app:destination="@id/FirstFragment" />
</fragment>
</navigation>

@ -1,3 +0,0 @@
<resources>
<dimen name="fab_margin">48dp</dimen>
</resources>

@ -1,16 +0,0 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.Sixaunyi" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/black</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>

@ -1,3 +0,0 @@
<resources>
<dimen name="fab_margin">200dp</dimen>
</resources>

@ -1,3 +0,0 @@
<resources>
<dimen name="fab_margin">48dp</dimen>
</resources>

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
</resources>

@ -1,3 +0,0 @@
<resources>
<dimen name="fab_margin">16dp</dimen>
</resources>

@ -1,19 +0,0 @@
<resources>
<string name="app_name">sixaunyi</string>
<string name="title_activity_detect">DetectActivity</string>
<!-- Strings used for fragments for navigation -->
<string name="first_fragment_label">First Fragment</string>
<string name="second_fragment_label">Second Fragment</string>
<string name="next">Next</string>
<string name="previous">Previous</string>
<string name="down_button">下降按钮</string>
<string name="up_button">上升旋转</string>
<string name="move_left_button">向左按钮</string>
<string name="move_right_button">向右按钮</string>
<string name="move_forward_button">向前按钮</string>
<string name="move_back_button">向后按钮</string>
<string name="turn_left_button">向左旋转</string>
<string name="turn_right_button">向右旋转</string>
<string name="hello_first_fragment">Hello first fragment</string>
<string name="hello_second_fragment">Hello second fragment. Arg: %1$s</string>
</resources>

@ -1,22 +0,0 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.Sixaunyi" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
<style name="Theme.Sixaunyi.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="Theme.Sixaunyi.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="Theme.Sixaunyi.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources>

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample backup rules file; uncomment and customize as necessary.
See https://developer.android.com/guide/topics/data/autobackup
for details.
Note: This file is ignored for devices older that API 31
See https://developer.android.com/about/versions/12/backup-restore
-->
<full-backup-content>
<!--
<include domain="sharedpref" path="."/>
<exclude domain="sharedpref" path="device.xml"/>
-->
</full-backup-content>

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample data extraction rules file; uncomment and customize as necessary.
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
for details.
-->
<data-extraction-rules>
<cloud-backup>
<!-- TODO: Use <include> and <exclude> to control what is backed up.
<include .../>
<exclude .../>
-->
</cloud-backup>
<!--
<device-transfer>
<include .../>
<exclude .../>
</device-transfer>
-->
</data-extraction-rules>

@ -1,17 +0,0 @@
package com.example.sixaunyi;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}

@ -1,10 +0,0 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.2.2' apply false
id 'com.android.library' version '7.2.2' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}

@ -1,21 +0,0 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Enables namespacing of each library's R class so that its R class includes only the
# 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

Binary file not shown.

@ -1,6 +0,0 @@
#Wed Mar 29 00:41:14 CST 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

185
src/sixaunyi/gradlew vendored

@ -1,185 +0,0 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"

@ -1,89 +0,0 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

@ -1,16 +0,0 @@
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "sixaunyi"
include ':app'

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save