diff --git a/app-compose/.gitignore b/app-compose/.gitignore
deleted file mode 100644
index 42afabf..0000000
--- a/app-compose/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
\ No newline at end of file
diff --git a/app-compose/build.gradle b/app-compose/build.gradle
deleted file mode 100644
index 978309f..0000000
--- a/app-compose/build.gradle
+++ /dev/null
@@ -1,62 +0,0 @@
-apply from: "${rootProject.rootDir}/buildCommon/commonLibConfig.gradle"
-project.ext.setAppDefaultConfig project
-
-android {
- namespace 'com.yinuo.safetywatcher'
-
- defaultConfig {
- applicationId "com.yinuo.safetywatcher"
- vectorDrawables {
- useSupportLibrary true
- }
- }
-
- buildFeatures {
- compose true
- }
- composeOptions {
- kotlinCompilerExtensionVersion '1.3.2'
- }
- packagingOptions {
- resources {
- excludes += '/META-INF/{AL2.0,LGPL2.1}'
- }
- }
-}
-
-dependencies {
- implementation 'androidx.core:core-ktx:1.8.0'
- implementation 'androidx.appcompat:appcompat:1.4.1'
-
- var lifeCycle_version = '2.5.1'
- implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifeCycle_version"
- implementation "androidx.lifecycle:lifecycle-viewmodel-compose:$lifeCycle_version"
-
- implementation platform('androidx.compose:compose-bom:2022.10.00')
- implementation 'androidx.activity:activity-compose:1.5.1'
- implementation 'androidx.compose.ui:ui'
- implementation 'androidx.compose.ui:ui-graphics'
- implementation 'androidx.compose.ui:ui-tooling-preview'
- implementation 'androidx.compose.material3:material3'
- implementation 'androidx.navigation:navigation-runtime-ktx:2.5.2'
- implementation "androidx.navigation:navigation-compose:2.4.0-rc01"
- implementation 'io.reactivex.rxjava2:rxjava:2.1.6'
- implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
-
- var accompanist_version = '0.30.1'
- implementation "com.google.accompanist:accompanist-permissions:$accompanist_version"
-
- //添加excel
- implementation rootProject.ext.dependencies.jxl
-
- implementation project(path: ':library-push')
- implementation project(path: ':library-ijkplayer')
-
- // documentfile 访问U盘
- implementation "androidx.documentfile:documentfile:1.0.1"
-
- implementation(name: 'libuvccamera-release', ext: 'aar') {
- exclude module: 'support-v4'
- exclude module: 'appcompat-v7'
- }
-}
\ No newline at end of file
diff --git a/app-compose/libs/libuvccamera-release.aar b/app-compose/libs/libuvccamera-release.aar
deleted file mode 100644
index 72faa87..0000000
Binary files a/app-compose/libs/libuvccamera-release.aar and /dev/null differ
diff --git a/app-compose/libs/sdkapi.jar b/app-compose/libs/sdkapi.jar
deleted file mode 100644
index c269276..0000000
Binary files a/app-compose/libs/sdkapi.jar and /dev/null differ
diff --git a/app-compose/proguard-rules.pro b/app-compose/proguard-rules.pro
deleted file mode 100644
index 481bb43..0000000
--- a/app-compose/proguard-rules.pro
+++ /dev/null
@@ -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
\ No newline at end of file
diff --git a/app-compose/src/main/AndroidManifest.xml b/app-compose/src/main/AndroidManifest.xml
deleted file mode 100644
index 2b983e7..0000000
--- a/app-compose/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app-compose/src/main/java/com/yinuo/safetywatcher/App.kt b/app-compose/src/main/java/com/yinuo/safetywatcher/App.kt
deleted file mode 100644
index a9c35e1..0000000
--- a/app-compose/src/main/java/com/yinuo/safetywatcher/App.kt
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.yinuo.safetywatcher
-
-import android.app.Application
-import com.lztek.toolkit.Lztek
-import com.yinuo.safetywatcher.utils.LztekUtil
-
-class App : Application() {
-
- override fun onCreate() {
- super.onCreate()
- LztekUtil.setObject(Lztek.create(this))
- }
-}
\ No newline at end of file
diff --git a/app-compose/src/main/java/com/yinuo/safetywatcher/MainActivity.kt b/app-compose/src/main/java/com/yinuo/safetywatcher/MainActivity.kt
deleted file mode 100644
index ab1ed7e..0000000
--- a/app-compose/src/main/java/com/yinuo/safetywatcher/MainActivity.kt
+++ /dev/null
@@ -1,68 +0,0 @@
-package com.yinuo.safetywatcher
-
-import android.content.Intent
-import android.os.Bundle
-import android.widget.Toast
-import androidx.activity.ComponentActivity
-import androidx.activity.OnBackPressedCallback
-import androidx.activity.compose.setContent
-import androidx.compose.foundation.layout.fillMaxSize
-import androidx.compose.material3.MaterialTheme
-import androidx.compose.material3.Surface
-import androidx.compose.ui.Modifier
-import androidx.lifecycle.viewmodel.compose.viewModel
-import androidx.navigation.compose.rememberNavController
-import com.yinuo.safetywatcher.navi.NavigationUtil
-import com.yinuo.safetywatcher.navi.NavigationView
-import com.yinuo.safetywatcher.ui.SplashView
-import com.yinuo.safetywatcher.ui.theme.EasypusherTheme
-import org.easydarwin.push.MediaStream
-
-class MainActivity : ComponentActivity() {
- var exitTime = 0L
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- startMediaService()
- setContent {
- EasypusherTheme {
- // A surface container using the 'background' color from the theme
- Surface(
- modifier = Modifier.fillMaxSize(),
- color = MaterialTheme.colorScheme.background
- ) {
- val viewModel: MainViewModel = viewModel()
- if (viewModel.isSplash) {
- SplashView { viewModel.isSplash = false }
- } else {
- NavigationUtil.navHostController = rememberNavController()
- NavigationView()
- }
- }
- }
- }
- addBackListener()
- }
-
- private fun startMediaService() {
- // 启动服务...
- val intent = Intent(this, MediaStream::class.java)
- startService(intent)
- }
-
- private fun addBackListener() {
- onBackPressedDispatcher.addCallback(object : OnBackPressedCallback(true) {
- override fun handleOnBackPressed() {
- //是主页
- if (System.currentTimeMillis() - exitTime > 2000) {
- Toast.makeText(this@MainActivity, "再点一次退出!", Toast.LENGTH_SHORT)
- .show()
- exitTime = System.currentTimeMillis()
- } else {
- finish()
- overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out)
- }
- }
- })
- }
-}
diff --git a/app-compose/src/main/java/com/yinuo/safetywatcher/MainViewModel.kt b/app-compose/src/main/java/com/yinuo/safetywatcher/MainViewModel.kt
deleted file mode 100644
index 3fe0e52..0000000
--- a/app-compose/src/main/java/com/yinuo/safetywatcher/MainViewModel.kt
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.yinuo.safetywatcher
-
-import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
-import androidx.compose.runtime.setValue
-import androidx.lifecycle.ViewModel
-
-class MainViewModel: ViewModel() {
- var isSplash by mutableStateOf(true)
-}
\ No newline at end of file
diff --git a/app-compose/src/main/java/com/yinuo/safetywatcher/navi/ModelPath.kt b/app-compose/src/main/java/com/yinuo/safetywatcher/navi/ModelPath.kt
deleted file mode 100644
index 0dfa6e6..0000000
--- a/app-compose/src/main/java/com/yinuo/safetywatcher/navi/ModelPath.kt
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.yinuo.safetywatcher.navi
-
-/**
- * @Description: todo
- * @CreateDate: 2022/1/5 9:42
- */
-sealed class ModelPath(val route: String) {
- object Home : ModelPath("home")
- object Setting : ModelPath("setting")
- object Cloud : ModelPath("cloud")
-}
\ No newline at end of file
diff --git a/app-compose/src/main/java/com/yinuo/safetywatcher/navi/Navigation.kt b/app-compose/src/main/java/com/yinuo/safetywatcher/navi/Navigation.kt
deleted file mode 100644
index ae32475..0000000
--- a/app-compose/src/main/java/com/yinuo/safetywatcher/navi/Navigation.kt
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.yinuo.safetywatcher.navi
-
-import androidx.compose.animation.core.tween
-import androidx.compose.animation.fadeIn
-import androidx.compose.animation.fadeOut
-import androidx.compose.foundation.background
-import androidx.compose.foundation.layout.fillMaxSize
-import androidx.compose.foundation.layout.navigationBarsPadding
-import androidx.compose.runtime.Composable
-import androidx.compose.ui.Modifier
-import androidx.navigation.compose.NavHost
-import androidx.navigation.compose.composable
-import com.yinuo.safetywatcher.ui.cloud.CloudView
-import com.yinuo.safetywatcher.ui.home.HomeView
-import com.yinuo.safetywatcher.ui.setting.SettingView
-
-/**
- * @Description: todo
- * @CreateDate: 2022/2/22 19:31
- */
-@Composable
-fun NavigationView() {
- NavHost(navController = NavigationUtil.navHostController,
- startDestination = ModelPath.Home.route) {
- composable(ModelPath.Home.route) {
- HomeView()
- }
- composable(ModelPath.Setting.route) {
- SettingView(Modifier.fillMaxSize())
- }
- composable(ModelPath.Cloud.route){
- CloudView()
- }
- }
-}
\ No newline at end of file
diff --git a/app-compose/src/main/java/com/yinuo/safetywatcher/navi/NavigationUtil.kt b/app-compose/src/main/java/com/yinuo/safetywatcher/navi/NavigationUtil.kt
deleted file mode 100644
index 323ebe3..0000000
--- a/app-compose/src/main/java/com/yinuo/safetywatcher/navi/NavigationUtil.kt
+++ /dev/null
@@ -1,53 +0,0 @@
-package com.yinuo.safetywatcher.navi
-
-import android.annotation.SuppressLint
-import android.os.Bundle
-import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateListOf
-import androidx.compose.runtime.mutableStateOf
-import androidx.compose.runtime.setValue
-import androidx.core.net.toUri
-import androidx.navigation.*
-
-/**
- * @CreateDate: 2021/8/27 10:06
- */
-object NavigationUtil {
-
- @SuppressLint("StaticFieldLeak")
- lateinit var navHostController: NavHostController
-
- /**
- * 跳转到某个页面
- */
- fun to(screenName: ModelPath) {
- navHostController.navigate(screenName.route)
- }
-
- /**
- * 跳转到某个页面带参数
- */
- fun toBundle(screenName: ModelPath, bundle: Bundle) {
- navHostController.navigate(screenName.route, bundle)
- }
-
- private fun NavController.navigate(
- route: String,
- args: Bundle,
- navOptions: NavOptions? = null,
- navigatorExtras: Navigator.Extras? = null
- ) {
- val routeLink = NavDeepLinkRequest.Builder.Companion.fromUri(
- NavDestination.Companion.createRoute(route).toUri())
- .build()
-
- val deepLinkMatch = graph.matchDeepLink(routeLink)
- if (deepLinkMatch != null) {
- val destination = deepLinkMatch.destination
- val id = destination.id
- navigate(id, args, navOptions, navigatorExtras)
- } else {
- navigate(route, navOptions, navigatorExtras)
- }
- }
-}
diff --git a/app-compose/src/main/java/com/yinuo/safetywatcher/ui/SplashView.kt b/app-compose/src/main/java/com/yinuo/safetywatcher/ui/SplashView.kt
deleted file mode 100644
index f870558..0000000
--- a/app-compose/src/main/java/com/yinuo/safetywatcher/ui/SplashView.kt
+++ /dev/null
@@ -1,55 +0,0 @@
-package com.yinuo.safetywatcher.ui
-
-import androidx.compose.animation.animateColorAsState
-import androidx.compose.animation.core.tween
-import androidx.compose.foundation.background
-import androidx.compose.foundation.layout.Box
-import androidx.compose.foundation.layout.fillMaxSize
-import androidx.compose.material3.MaterialTheme
-import androidx.compose.material3.Text
-import androidx.compose.runtime.*
-import androidx.compose.ui.Alignment
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.graphics.Color
-import kotlinx.coroutines.delay
-
-/**
- * @Description: todo
- * @Author: yshh
- * @CreateDate: 2022/2/22 14:19
- */
-
-@Composable
-fun SplashView(startMain: () -> Unit) {
- var enabled by remember { mutableStateOf(false) }
- val bgColor: Color by animateColorAsState(
- if (enabled) MaterialTheme.colorScheme.primary
- else MaterialTheme.colorScheme.primary.copy(alpha = 0.3f),
- animationSpec = tween(durationMillis = 2000)
- )
- val textColor: Color by animateColorAsState(
- if (enabled) Color.White
- else Color.White.copy(alpha = 0.3f),
- animationSpec = tween(durationMillis = 2000)
- )
- Box(
- Modifier
- .fillMaxSize()
- .background(Color.White)
- ) {
- Box(
- Modifier
- .fillMaxSize()
- .background(bgColor),
- contentAlignment = Alignment.Center
- ) {
- Text(text = "Safety Watcher", color = textColor)
- }
-
- }
- LaunchedEffect(Unit) {
- enabled = true
- delay(2000)
- startMain.invoke()
- }
-}
\ No newline at end of file
diff --git a/app-compose/src/main/java/com/yinuo/safetywatcher/ui/cloud/CloudView.kt b/app-compose/src/main/java/com/yinuo/safetywatcher/ui/cloud/CloudView.kt
deleted file mode 100644
index e98007e..0000000
--- a/app-compose/src/main/java/com/yinuo/safetywatcher/ui/cloud/CloudView.kt
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.yinuo.safetywatcher.ui.cloud
-
-import androidx.compose.foundation.layout.Arrangement
-import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.fillMaxSize
-import androidx.compose.material3.Button
-import androidx.compose.material3.Text
-import androidx.compose.runtime.Composable
-import androidx.compose.ui.Alignment
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.platform.LocalContext
-import androidx.lifecycle.viewmodel.compose.viewModel
-
-@Composable
-fun CloudView() {
-
-// rememberLauncherForActivityResult(contract = ActivityResultContracts.OpenDocumentTree(), onResult ={} )
-
- Column(
- modifier = Modifier.fillMaxSize(),
- verticalArrangement = Arrangement.Center,
- horizontalAlignment = Alignment.CenterHorizontally
- ) {
-
- val context = LocalContext.current;
- val viewModel: CloudViewModel = viewModel()
-
- Button(onClick = { viewModel.exportExcel(context) }) {
- Text(text = "导出数据")
- }
- }
-}
diff --git a/app-compose/src/main/java/com/yinuo/safetywatcher/ui/cloud/CloudViewModel.kt b/app-compose/src/main/java/com/yinuo/safetywatcher/ui/cloud/CloudViewModel.kt
deleted file mode 100644
index 1a92242..0000000
--- a/app-compose/src/main/java/com/yinuo/safetywatcher/ui/cloud/CloudViewModel.kt
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.yinuo.safetywatcher.ui.cloud
-
-import android.content.Context
-import androidx.lifecycle.ViewModel
-import com.yinuo.safetywatcher.xls.SimpleCellValue
-import com.yinuo.safetywatcher.xls.utils.ExcelUtils
-
-class CloudViewModel : ViewModel() {
-
- fun exportExcel(context: Context){
- val allData: MutableList> = ArrayList()
- val row1: MutableList = ArrayList()
- row1.add(SimpleCellValue("5.22"))
- row1.add(SimpleCellValue("1"))
- row1.add(SimpleCellValue("2"))
- row1.add(SimpleCellValue("3"))
- val row2: MutableList = ArrayList()
- row2.add(SimpleCellValue("5.23"))
- row2.add(SimpleCellValue("4"))
- row2.add(SimpleCellValue("5"))
- row2.add(SimpleCellValue("6"))
-
- allData.add(row1)
- allData.add(row2)
-
- ExcelUtils.writeStringListToExcel(allData, context)
- }
-}
\ No newline at end of file
diff --git a/app-compose/src/main/java/com/yinuo/safetywatcher/ui/home/HomeView.kt b/app-compose/src/main/java/com/yinuo/safetywatcher/ui/home/HomeView.kt
deleted file mode 100644
index d531d6a..0000000
--- a/app-compose/src/main/java/com/yinuo/safetywatcher/ui/home/HomeView.kt
+++ /dev/null
@@ -1,64 +0,0 @@
-package com.yinuo.safetywatcher.ui.home
-
-import android.view.TextureView
-import androidx.compose.foundation.background
-import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.Row
-import androidx.compose.foundation.layout.fillMaxHeight
-import androidx.compose.foundation.layout.fillMaxSize
-import androidx.compose.foundation.layout.width
-import androidx.compose.material3.Button
-import androidx.compose.material3.Text
-import androidx.compose.runtime.Composable
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.graphics.Color
-import androidx.compose.ui.platform.LocalContext
-import androidx.compose.ui.unit.dp
-import androidx.compose.ui.viewinterop.AndroidView
-import androidx.lifecycle.viewmodel.compose.viewModel
-import com.google.accompanist.permissions.ExperimentalPermissionsApi
-import com.yinuo.safetywatcher.navi.ModelPath
-import com.yinuo.safetywatcher.navi.NavigationUtil
-
-@OptIn(ExperimentalPermissionsApi::class)
-@Composable
-fun HomeView() {
- // 权限
-// val permissionsState = rememberMultiplePermissionsState(
-// permissions = listOf(
-// android.Manifest.permission.MANAGE_EXTERNAL_STORAGE,
-// android.Manifest.permission.CAMERA,
-// )
-// )
-// if (permissionsState.allPermissionsGranted) {
- val viewModel: HomeViewModel = viewModel()
- val context = LocalContext.current
- Row(modifier = Modifier.fillMaxSize()) {
- AndroidView(factory = {
- TextureView(it)
- }, modifier = Modifier
- .fillMaxHeight()
- .width(200.dp), update = {
- viewModel.setTextureView(it, context);
- })
-
- Column(
- modifier = Modifier
- .width(150.dp)
- .fillMaxHeight()
- .background(Color.Red)
- ) {
- Button(onClick = { NavigationUtil.to(ModelPath.Setting) }) {
- Text(text = "设置")
- }
- Button(onClick = { NavigationUtil.to(ModelPath.Cloud) }) {
- Text(text = "云平台")
- }
- }
- }
-// } else {
-// LaunchedEffect(Unit) {
-// permissionsState.launchMultiplePermissionRequest()
-// }
-// }
-}
diff --git a/app-compose/src/main/java/com/yinuo/safetywatcher/ui/home/HomeViewModel.kt b/app-compose/src/main/java/com/yinuo/safetywatcher/ui/home/HomeViewModel.kt
deleted file mode 100644
index 615480d..0000000
--- a/app-compose/src/main/java/com/yinuo/safetywatcher/ui/home/HomeViewModel.kt
+++ /dev/null
@@ -1,61 +0,0 @@
-package com.yinuo.safetywatcher.ui.home
-
-import android.annotation.SuppressLint
-import android.content.Context
-import android.graphics.SurfaceTexture
-import android.util.Log
-import android.view.TextureView
-import androidx.activity.ComponentActivity
-import androidx.lifecycle.LifecycleOwner
-import androidx.lifecycle.ViewModel
-import com.yinuo.safetywatcher.utils.RxHelper
-import com.yinuo.safetywatcher.utils.SurfaceTextureListenerWrapper
-import io.reactivex.Single
-import org.easydarwin.push.MediaStream
-
-class HomeViewModel : ViewModel() {
- @SuppressLint("StaticFieldLeak")
- private var mediaStream: MediaStream? = null
-
- private fun getMediaStream(context: Context, owner: LifecycleOwner): Single? {
- val single: Single =
- RxHelper.single(MediaStream.getBindedMediaStream(context, owner), mediaStream)
- return if (mediaStream == null) {
- single.doOnSuccess { ms -> mediaStream = ms }
- } else {
- single
- }
- }
-
- @SuppressLint("CheckResult")
- fun setTextureView(it: TextureView, context: Context) {
- if (context is ComponentActivity) {
- val activity: ComponentActivity = context
- getMediaStream(context, activity)?.subscribe(
- { ms ->
- if (it.isAvailable) {
- ms?.setSurfaceTexture(it.surfaceTexture)
- } else {
- it.surfaceTextureListener = object : SurfaceTextureListenerWrapper() {
- override fun onSurfaceTextureAvailable(
- surfaceTexture: SurfaceTexture,
- i: Int,
- i1: Int
- ) {
- ms?.setSurfaceTexture(surfaceTexture)
- }
-
- override fun onSurfaceTextureDestroyed(surfaceTexture: SurfaceTexture): Boolean {
- ms?.setSurfaceTexture(null)
- return true
- }
- }
- }
- },
- {
- Log.w("HomeViewModel", "创建服务出错!" + it.message)
- })
- }
-
- }
-}
\ No newline at end of file
diff --git a/app-compose/src/main/java/com/yinuo/safetywatcher/ui/setting/SettingView.kt b/app-compose/src/main/java/com/yinuo/safetywatcher/ui/setting/SettingView.kt
deleted file mode 100644
index 1e0c6cd..0000000
--- a/app-compose/src/main/java/com/yinuo/safetywatcher/ui/setting/SettingView.kt
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.yinuo.safetywatcher.ui.setting
-
-import androidx.compose.foundation.layout.Box
-import androidx.compose.material3.Text
-import androidx.compose.runtime.Composable
-import androidx.compose.ui.Modifier
-
-@Composable
-fun SettingView(modifier: Modifier = Modifier) {
- Box(modifier = modifier){
- Text(text = "这是设置页面")
- }
-}
\ No newline at end of file
diff --git a/app-compose/src/main/java/com/yinuo/safetywatcher/ui/theme/Color.kt b/app-compose/src/main/java/com/yinuo/safetywatcher/ui/theme/Color.kt
deleted file mode 100644
index 8ad3839..0000000
--- a/app-compose/src/main/java/com/yinuo/safetywatcher/ui/theme/Color.kt
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.yinuo.safetywatcher.ui.theme
-
-import androidx.compose.ui.graphics.Color
-
-val Purple80 = Color(0xFFD0BCFF)
-val PurpleGrey80 = Color(0xFFCCC2DC)
-val Pink80 = Color(0xFFEFB8C8)
-
-val Purple40 = Color(0xFF6650a4)
-val PurpleGrey40 = Color(0xFF625b71)
-val Pink40 = Color(0xFF7D5260)
\ No newline at end of file
diff --git a/app-compose/src/main/java/com/yinuo/safetywatcher/ui/theme/Theme.kt b/app-compose/src/main/java/com/yinuo/safetywatcher/ui/theme/Theme.kt
deleted file mode 100644
index f563594..0000000
--- a/app-compose/src/main/java/com/yinuo/safetywatcher/ui/theme/Theme.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.yinuo.safetywatcher.ui.theme
-
-import androidx.compose.material3.MaterialTheme
-import androidx.compose.material3.lightColorScheme
-import androidx.compose.runtime.Composable
-
-
-private val LightColorScheme = lightColorScheme(
- primary = Purple40,
- secondary = PurpleGrey40,
- tertiary = Pink40
-)
-
-@Composable
-fun EasypusherTheme(
- content: @Composable () -> Unit
-) {
- val colorScheme = LightColorScheme
- MaterialTheme(
- colorScheme = colorScheme,
- typography = Typography,
- content = content
- )
-}
\ No newline at end of file
diff --git a/app-compose/src/main/java/com/yinuo/safetywatcher/ui/theme/Type.kt b/app-compose/src/main/java/com/yinuo/safetywatcher/ui/theme/Type.kt
deleted file mode 100644
index 28735bf..0000000
--- a/app-compose/src/main/java/com/yinuo/safetywatcher/ui/theme/Type.kt
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.yinuo.safetywatcher.ui.theme
-
-import androidx.compose.material3.Typography
-import androidx.compose.ui.text.TextStyle
-import androidx.compose.ui.text.font.FontFamily
-import androidx.compose.ui.text.font.FontWeight
-import androidx.compose.ui.unit.sp
-
-// Set of Material typography styles to start with
-val Typography = Typography(
- bodyLarge = TextStyle(
- fontFamily = FontFamily.Default,
- fontWeight = FontWeight.Normal,
- fontSize = 16.sp,
- lineHeight = 24.sp,
- letterSpacing = 0.5.sp
- )
- /* Other default text styles to override
- titleLarge = TextStyle(
- fontFamily = FontFamily.Default,
- fontWeight = FontWeight.Normal,
- fontSize = 22.sp,
- lineHeight = 28.sp,
- letterSpacing = 0.sp
- ),
- labelSmall = TextStyle(
- fontFamily = FontFamily.Default,
- fontWeight = FontWeight.Medium,
- fontSize = 11.sp,
- lineHeight = 16.sp,
- letterSpacing = 0.5.sp
- )
- */
-)
\ No newline at end of file
diff --git a/app-compose/src/main/java/com/yinuo/safetywatcher/utils/LztekUtil.kt b/app-compose/src/main/java/com/yinuo/safetywatcher/utils/LztekUtil.kt
deleted file mode 100644
index 099e8fa..0000000
--- a/app-compose/src/main/java/com/yinuo/safetywatcher/utils/LztekUtil.kt
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.yinuo.safetywatcher.utils
-
-import com.lztek.toolkit.Lztek
-
-object LztekUtil {
-
- private var mLztek: Lztek? = null;
-
- fun setObject(value: Lztek) {
- mLztek = value
- }
-
- fun getLztek(): Lztek {
- return mLztek!!
- }
-}
\ No newline at end of file
diff --git a/app-compose/src/main/java/com/yinuo/safetywatcher/utils/RxHelper.java b/app-compose/src/main/java/com/yinuo/safetywatcher/utils/RxHelper.java
deleted file mode 100644
index be7b0f0..0000000
--- a/app-compose/src/main/java/com/yinuo/safetywatcher/utils/RxHelper.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.yinuo.safetywatcher.utils;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-
-import org.easydarwin.util.AbstractSubscriber;
-import org.reactivestreams.Publisher;
-
-import io.reactivex.Single;
-import io.reactivex.subjects.PublishSubject;
-
-/**
- * Created by apple on 2017/12/22.
- */
-
-public class RxHelper {
- static boolean IGNORE_ERROR = false;
-
- public static Single single(@NonNull Publisher t, @Nullable T defaultValueIfNotNull){
- if (defaultValueIfNotNull != null) return Single.just(defaultValueIfNotNull);
- final PublishSubject sub = PublishSubject.create();
- t.subscribe(new AbstractSubscriber() {
- @Override
- public void onNext(T t) {
- super.onNext(t);
- sub.onNext(t);
- }
-
- @Override
- public void onError(Throwable t) {
- if (IGNORE_ERROR) {
- super.onError(t);
- sub.onComplete();
- }else {
- sub.onError(t);
- }
- }
-
- @Override
- public void onComplete() {
- super.onComplete();
- sub.onComplete();
- }
- });
- return sub.firstOrError();
- }
-}
diff --git a/app-compose/src/main/java/com/yinuo/safetywatcher/utils/SurfaceTextureListenerWrapper.java b/app-compose/src/main/java/com/yinuo/safetywatcher/utils/SurfaceTextureListenerWrapper.java
deleted file mode 100644
index d3d369b..0000000
--- a/app-compose/src/main/java/com/yinuo/safetywatcher/utils/SurfaceTextureListenerWrapper.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.yinuo.safetywatcher.utils;
-
-import android.graphics.SurfaceTexture;
-import android.view.TextureView;
-
-/**
- * Created by apple on 2017/9/11.
- */
-
-public abstract class SurfaceTextureListenerWrapper implements TextureView.SurfaceTextureListener{
-
- @Override
- public void onSurfaceTextureSizeChanged(SurfaceTexture surfaceTexture, int i, int i1) {
-
- }
-
- @Override
- public boolean onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture) {
-
- return true;
- }
-
- @Override
- public void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture) {
-
- }
-}
diff --git a/app-compose/src/main/java/com/yinuo/safetywatcher/xls/ICellValue.kt b/app-compose/src/main/java/com/yinuo/safetywatcher/xls/ICellValue.kt
deleted file mode 100644
index 8f9e953..0000000
--- a/app-compose/src/main/java/com/yinuo/safetywatcher/xls/ICellValue.kt
+++ /dev/null
@@ -1,5 +0,0 @@
-package com.yinuo.safetywatcher.xls
-
-interface ICellValue {
- fun getValue(): String
-}
\ No newline at end of file
diff --git a/app-compose/src/main/java/com/yinuo/safetywatcher/xls/SimpleCellValue.kt b/app-compose/src/main/java/com/yinuo/safetywatcher/xls/SimpleCellValue.kt
deleted file mode 100644
index 44f95c1..0000000
--- a/app-compose/src/main/java/com/yinuo/safetywatcher/xls/SimpleCellValue.kt
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.yinuo.safetywatcher.xls
-
-data class SimpleCellValue(val content: String) : ICellValue {
- override fun getValue(): String {
- return content
- }
-}
diff --git a/app-compose/src/main/java/com/yinuo/safetywatcher/xls/utils/ExcelUtils.kt b/app-compose/src/main/java/com/yinuo/safetywatcher/xls/utils/ExcelUtils.kt
deleted file mode 100644
index 0a08b68..0000000
--- a/app-compose/src/main/java/com/yinuo/safetywatcher/xls/utils/ExcelUtils.kt
+++ /dev/null
@@ -1,138 +0,0 @@
-package com.yinuo.safetywatcher.xls.utils
-
-import android.content.Context
-import android.util.Log
-import com.yinuo.safetywatcher.xls.ICellValue
-import com.yinuo.safetywatcher.R
-import jxl.Workbook
-import jxl.WorkbookSettings
-import jxl.write.Label
-import jxl.write.WritableCellFormat
-import jxl.write.WritableFont
-import jxl.write.WritableWorkbook
-import jxl.write.WriteException
-import java.io.File
-import java.io.FileInputStream
-import java.io.InputStream
-
-
-/**
- * excel表格工具
- */
-object ExcelUtils {
- private const val TAG: String = "ExcelUtils"
- private const val UTF8_ENCODING = "UTF-8"
- private var arial12format: WritableCellFormat? = null
-
- private fun format() {
- try {
- val writableFont = WritableFont(WritableFont.ARIAL, 12)
- arial12format = WritableCellFormat(writableFont)
- arial12format?.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN)
- } catch (exception: WriteException) {
- Log.e(TAG, "format() e==" + exception.message)
- }
-
- }
-
- private fun makeDir(filePath: File) {
- if (!filePath.parentFile.exists()) {
- makeDir(filePath.parentFile)
- }
- filePath.mkdir()
- }
-
- private fun deleteByPath(filePath: String) {
- val file = File(filePath)
- if (file.exists()) {
- if (file.isFile || file.isDirectory) {
- file.delete()
- }
- }
- }
-
- private fun deleteExistFile(excelFilePath: String) {
- val file = File(excelFilePath)
- if (file.exists()) {
- val files: Array = file.listFiles()
- for (i in files.indices) {
- deleteByPath(files[i].absolutePath)
- }
- }
- }
-
- private fun initExcel(
- allColumNames: Array,
- filePath: String,
- sheetName: String
- ) {
- format()
-
- var workbook: WritableWorkbook? = null
- try {
- val file = File(filePath)
- if (!file.exists()) {
- file.createNewFile()
- }
- workbook = Workbook.createWorkbook(file)
- val sheet = workbook.createSheet(sheetName, 0)
-
- allColumNames.forEachIndexed { index, s ->
- sheet.addCell(Label(index, 0, s, arial12format))
- }
- workbook.write()
- } catch (e: Exception) {
- Log.e(TAG, "initExcel e==" + e.message)
- } finally {
- try {
- workbook?.close()
- } catch (e: Exception) {
- Log.e(TAG, "initExcel e==" + e.message)
- }
- }
- }
-
- fun writeStringListToExcel(
- allRowsData: List>,
- context: Context
- ): Boolean {
- val fileName = PathUtils.getNowTimeFormat(PathUtils.DATE_TO_STRING_LONG_PATTERN) + ".xls"
- PathUtils.EXCEL_EXPORT_NAME = fileName
- val filePath =
- PathUtils.getUDiskPath() + PathUtils.EXCEL_EXPORT_PATH + PathUtils.EXCEL_EXPORT_NAME
- deleteExistFile(PathUtils.getUDiskPath() + PathUtils.EXCEL_EXPORT_PATH)
- makeDir(File(PathUtils.getUDiskPath() + PathUtils.EXCEL_EXPORT_PATH))
-
- val columns = context.resources.getStringArray(R.array.excel_column)
- initExcel(columns, filePath, PathUtils.SHEET_NAME) //需要写入权限
-
- if (PathUtils.isListEmpty(allRowsData) || context == null)
- return false
-
- var writebook: WritableWorkbook? = null
- var inputStream: InputStream? = null
- try {
- val setEncode = WorkbookSettings()
- setEncode.encoding = UTF8_ENCODING
- inputStream = FileInputStream(File(filePath))
- val workbook = Workbook.getWorkbook(inputStream)
- val file = File(filePath)
- writebook = Workbook.createWorkbook(file, workbook)
- val sheet = writebook.getSheet(0)
- for ((row, item) in allRowsData.withIndex()) {
- item.forEachIndexed { index, cellValue ->
- sheet.addCell(Label(index, row + 1, cellValue.getValue(), arial12format))
- }
- }
- writebook.write()
- Log.i(TAG, "Excelel 写入成功")
- return true
- } catch (e: Exception) {
- Log.e(TAG, "writeStringListToExcel() e==" + e.message)
- } finally {
- writebook?.close()
- inputStream?.close()
- }
- return false
- }
-}
\ No newline at end of file
diff --git a/app-compose/src/main/java/com/yinuo/safetywatcher/xls/utils/PathUtils.kt b/app-compose/src/main/java/com/yinuo/safetywatcher/xls/utils/PathUtils.kt
deleted file mode 100644
index 0f66ae6..0000000
--- a/app-compose/src/main/java/com/yinuo/safetywatcher/xls/utils/PathUtils.kt
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.yinuo.safetywatcher.xls.utils
-
-import android.content.Context
-import android.os.Environment
-import com.yinuo.safetywatcher.utils.LztekUtil
-import java.text.SimpleDateFormat
-import java.util.Date
-import java.util.Locale
-
-/**
- * 基础工具类
- */
-object PathUtils {
- private const val TAG: String = "BaseUtils"
- const val SHEET_NAME = "表格1"
- const val EXCEL_EXPORT_PATH = "/ExportExcel/"
- lateinit var EXCEL_EXPORT_NAME: String
- const val DATE_TO_STRING_LONG_PATTERN: String = "yyyy_MM_dd_HH_mm_ss"
-
- fun isListEmpty(list: List?): Boolean {
- return list == null || list.isEmpty()
- }
-
- /**
- * 获取应用中文件存储
- */
- fun getExternalStoragePath(context: Context): String? {
- return context.getExternalFilesDir(null)?.path
- }
-
- /**
- * 获取U盘存储
- */
- fun getUDiskPath(): String {
- return LztekUtil.getLztek().usbStoragePath
- }
-
- fun getExternalStorageDirectory(context: Context): String? {
- return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).path
- }
-
- /**
- * 外部存储目录
- */
- fun getExternalStorageDirectory(): String? {
- return Environment.getExternalStorageDirectory().absolutePath
- }
-
- fun getNowTimeFormat(dateToStringLongPattern: String): String {
- return SimpleDateFormat(dateToStringLongPattern, Locale.ROOT).format(Date());
- }
-}
\ No newline at end of file
diff --git a/app-compose/src/main/jniLibs/arm64-v8a/libproffmpeg.so b/app-compose/src/main/jniLibs/arm64-v8a/libproffmpeg.so
deleted file mode 100644
index 48e7fcd..0000000
Binary files a/app-compose/src/main/jniLibs/arm64-v8a/libproffmpeg.so and /dev/null differ
diff --git a/app-compose/src/main/jniLibs/arm64-v8a/libproplayer.so b/app-compose/src/main/jniLibs/arm64-v8a/libproplayer.so
deleted file mode 100644
index bca8d82..0000000
Binary files a/app-compose/src/main/jniLibs/arm64-v8a/libproplayer.so and /dev/null differ
diff --git a/app-compose/src/main/jniLibs/arm64-v8a/libprosdl.so b/app-compose/src/main/jniLibs/arm64-v8a/libprosdl.so
deleted file mode 100644
index 82f09ef..0000000
Binary files a/app-compose/src/main/jniLibs/arm64-v8a/libprosdl.so and /dev/null differ
diff --git a/app-compose/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app-compose/src/main/res/drawable-v24/ic_launcher_foreground.xml
deleted file mode 100644
index 2b068d1..0000000
--- a/app-compose/src/main/res/drawable-v24/ic_launcher_foreground.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app-compose/src/main/res/drawable/ic_launcher_background.xml b/app-compose/src/main/res/drawable/ic_launcher_background.xml
deleted file mode 100644
index 07d5da9..0000000
--- a/app-compose/src/main/res/drawable/ic_launcher_background.xml
+++ /dev/null
@@ -1,170 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app-compose/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app-compose/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
deleted file mode 100644
index 6f3b755..0000000
--- a/app-compose/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app-compose/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app-compose/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
deleted file mode 100644
index 6f3b755..0000000
--- a/app-compose/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app-compose/src/main/res/mipmap-hdpi/ic_launcher.webp b/app-compose/src/main/res/mipmap-hdpi/ic_launcher.webp
deleted file mode 100644
index c209e78..0000000
Binary files a/app-compose/src/main/res/mipmap-hdpi/ic_launcher.webp and /dev/null differ
diff --git a/app-compose/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/app-compose/src/main/res/mipmap-hdpi/ic_launcher_round.webp
deleted file mode 100644
index b2dfe3d..0000000
Binary files a/app-compose/src/main/res/mipmap-hdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/app-compose/src/main/res/mipmap-mdpi/ic_launcher.webp b/app-compose/src/main/res/mipmap-mdpi/ic_launcher.webp
deleted file mode 100644
index 4f0f1d6..0000000
Binary files a/app-compose/src/main/res/mipmap-mdpi/ic_launcher.webp and /dev/null differ
diff --git a/app-compose/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/app-compose/src/main/res/mipmap-mdpi/ic_launcher_round.webp
deleted file mode 100644
index 62b611d..0000000
Binary files a/app-compose/src/main/res/mipmap-mdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/app-compose/src/main/res/mipmap-xhdpi/ic_launcher.webp b/app-compose/src/main/res/mipmap-xhdpi/ic_launcher.webp
deleted file mode 100644
index 948a307..0000000
Binary files a/app-compose/src/main/res/mipmap-xhdpi/ic_launcher.webp and /dev/null differ
diff --git a/app-compose/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/app-compose/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
deleted file mode 100644
index 1b9a695..0000000
Binary files a/app-compose/src/main/res/mipmap-xhdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/app-compose/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/app-compose/src/main/res/mipmap-xxhdpi/ic_launcher.webp
deleted file mode 100644
index 28d4b77..0000000
Binary files a/app-compose/src/main/res/mipmap-xxhdpi/ic_launcher.webp and /dev/null differ
diff --git a/app-compose/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/app-compose/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
deleted file mode 100644
index 9287f50..0000000
Binary files a/app-compose/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/app-compose/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/app-compose/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
deleted file mode 100644
index aa7d642..0000000
Binary files a/app-compose/src/main/res/mipmap-xxxhdpi/ic_launcher.webp and /dev/null differ
diff --git a/app-compose/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/app-compose/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
deleted file mode 100644
index 9126ae3..0000000
Binary files a/app-compose/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/app-compose/src/main/res/values/colors.xml b/app-compose/src/main/res/values/colors.xml
deleted file mode 100644
index f8c6127..0000000
--- a/app-compose/src/main/res/values/colors.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
- #FFBB86FC
- #FF6200EE
- #FF3700B3
- #FF03DAC5
- #FF018786
- #FF000000
- #FFFFFFFF
-
\ No newline at end of file
diff --git a/app-compose/src/main/res/values/strings.xml b/app-compose/src/main/res/values/strings.xml
deleted file mode 100644
index efb3f93..0000000
--- a/app-compose/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
- app-compose
-
-
-
- - 时间
- - 属性
- - 值
- - 单位
-
-
\ No newline at end of file
diff --git a/app-compose/src/main/res/values/themes.xml b/app-compose/src/main/res/values/themes.xml
deleted file mode 100644
index d7055e4..0000000
--- a/app-compose/src/main/res/values/themes.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/libs/libuvccamera-release.aar b/app/libs/libuvccamera-release.aar
deleted file mode 100644
index 72faa87..0000000
Binary files a/app/libs/libuvccamera-release.aar and /dev/null differ
diff --git a/app/src/main/java/com/yinuo/safetywatcher/MainActivity.java b/app/src/main/java/com/yinuo/safetywatcher/MainActivity.java
deleted file mode 100644
index e28bc34..0000000
--- a/app/src/main/java/com/yinuo/safetywatcher/MainActivity.java
+++ /dev/null
@@ -1,279 +0,0 @@
-package com.yinuo.safetywatcher;
-
-import android.Manifest;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.graphics.SurfaceTexture;
-import android.media.projection.MediaProjectionManager;
-import android.os.Build;
-import android.os.Bundle;
-import android.preference.PreferenceManager;
-import android.view.TextureView;
-import android.view.View;
-import android.widget.CheckBox;
-import android.widget.CompoundButton;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import androidx.annotation.Nullable;
-import androidx.appcompat.app.AppCompatActivity;
-import androidx.core.app.ActivityCompat;
-import androidx.lifecycle.Observer;
-
-import com.yinuo.safetywatcher.xls.SimpleCellValue;
-import com.yinuo.safetywatcher.xls.utils.ExcelUtils;
-
-import org.easydarwin.push.MediaStream;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import io.reactivex.Single;
-import io.reactivex.functions.Consumer;
-
-public class MainActivity extends AppCompatActivity {
-
- private static final int REQUEST_CAMERA_PERMISSION = 1000;
- private static final int REQUEST_MEDIA_PROJECTION = 1001;
- public static final String HOST = "192.168.51.189";
- private MediaStream mediaStream;
-
- private Single getMediaStream() {
- Single single = RxHelper.single(MediaStream.getBindedMediaStream(this, this), mediaStream);
- if (mediaStream == null) {
- return single.doOnSuccess(new Consumer() {
- @Override
- public void accept(MediaStream ms) throws Exception {
- mediaStream = ms;
- }
- });
- } else {
- return single;
- }
- }
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0);
-
- CheckBox hevc_enable = findViewById(R.id.enable_265);
- hevc_enable.setChecked(PreferenceManager.getDefaultSharedPreferences(this).getBoolean("try_265_encode", false));
- hevc_enable.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
- @Override
- public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
- PreferenceManager.getDefaultSharedPreferences(MainActivity.this).edit().putBoolean("try_265_encode", isChecked).apply();
- }
- });
-
- // 启动服务...
- Intent intent = new Intent(this, MediaStream.class);
- startService(intent);
-
- getMediaStream().subscribe(new Consumer() {
- @Override
- public void accept(final MediaStream ms) throws Exception {
- ms.observeCameraPreviewResolution(MainActivity.this, new Observer() {
- @Override
- public void onChanged(@Nullable int[] size) {
- Toast.makeText(MainActivity.this, "当前摄像头分辨率为:" + size[0] + "*" + size[1], Toast.LENGTH_SHORT).show();
- }
- });
- final TextView pushingStateText = findViewById(R.id.pushing_state);
- final TextView pushingBtn = findViewById(R.id.pushing);
- ms.observePushingState(MainActivity.this, new Observer() {
-
- @Override
- public void onChanged(@Nullable MediaStream.PushingState pushingState) {
- if (pushingState.screenPushing) {
- pushingStateText.setText("屏幕推送");
-
- // 更改屏幕推送按钮状态.
-
- TextView tview = findViewById(R.id.pushing_desktop);
- if (ms.isScreenPushing()) {
- tview.setText("取消推送");
- } else {
- tview.setText("推送屏幕");
- }
- findViewById(R.id.pushing_desktop).setEnabled(true);
- } else {
- pushingStateText.setText("推送");
- if (ms.isCameraPushing()) {
- pushingBtn.setText("停止");
- } else {
- pushingBtn.setText("推送");
- }
- }
-
- pushingStateText.append(":\t" + pushingState.msg);
- if (pushingState.state > 0) {
- pushingStateText.append(pushingState.url);
- pushingStateText.append("\n");
- if ("avc".equals(pushingState.videoCodec)) {
- pushingStateText.append("视频编码方式:" + "H264硬编码");
- } else if ("hevc".equals(pushingState.videoCodec)) {
- pushingStateText.append("视频编码方式:" + "H265硬编码");
- } else if ("x264".equals(pushingState.videoCodec)) {
- pushingStateText.append("视频编码方式:" + "x264");
- }
- }
-
- }
- });
- TextureView textureView = findViewById(R.id.texture_view);
- if (textureView.isAvailable()) {
- ms.setSurfaceTexture(textureView.getSurfaceTexture());
- } else {
- textureView.setSurfaceTextureListener(new SurfaceTextureListenerWrapper() {
- @Override
- public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i, int i1) {
- ms.setSurfaceTexture(surfaceTexture);
- }
-
- @Override
- public boolean onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture) {
- ms.setSurfaceTexture(null);
- return true;
- }
- });
- }
-
- if (ActivityCompat.checkSelfPermission(MainActivity.this, android.Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED ||
- ActivityCompat.checkSelfPermission(MainActivity.this, android.Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) {
- ActivityCompat.requestPermissions(MainActivity.this, new String[]{android.Manifest.permission.CAMERA, android.Manifest.permission.RECORD_AUDIO}, REQUEST_CAMERA_PERMISSION);
- }
- }
- }, new Consumer() {
- @Override
- public void accept(Throwable throwable) throws Exception {
- Toast.makeText(MainActivity.this, "创建服务出错!", Toast.LENGTH_SHORT).show();
- }
- });
- }
-
- public void onPushing(View view) {
- getMediaStream().subscribe(new Consumer() {
- @Override
- public void accept(MediaStream mediaStream) throws Exception {
- MediaStream.PushingState state = mediaStream.getPushingState();
- if (state != null && state.state > 0) { // 终止推送和预览
- mediaStream.stopStream();
- mediaStream.closeCameraPreview();
- } else { // 启动预览和推送.
- mediaStream.openCameraPreview();
- String id = PreferenceManager.getDefaultSharedPreferences(MainActivity.this).getString("caemra-id", null);
- if (id == null) {
- double v = Math.random() * 1000;
- id = "c_" + (int) v;
- PreferenceManager.getDefaultSharedPreferences(MainActivity.this).edit().putString("caemra-id", id).apply();
- }
- mediaStream.startStream(HOST, "554", id);
- }
- }
- });
- }
-
-
- @Override
- public void onRequestPermissionsResult(int requestCode,
- String permissions[], int[] grantResults) {
- super.onRequestPermissionsResult(requestCode, permissions, grantResults);
- switch (requestCode) {
- case REQUEST_CAMERA_PERMISSION: {
- if (grantResults.length > 1
- && grantResults[0] == PackageManager.PERMISSION_GRANTED && grantResults[1] == PackageManager.PERMISSION_GRANTED) {
- getMediaStream().subscribe(new Consumer() {
- @Override
- public void accept(MediaStream mediaStream) throws Exception {
- mediaStream.notifyPermissionGranted();
- }
- });
- } else {
- finish();
- }
- break;
- }
- }
- }
-
- // 推送屏幕.
- public void onPushScreen(final View view) {
- getMediaStream().subscribe(new Consumer() {
- @Override
- public void accept(MediaStream mediaStream) {
- if (mediaStream.isScreenPushing()) { // 正在推送,那取消推送。
- // 取消推送。
- mediaStream.stopPushScreen();
- } else { // 没在推送,那启动推送。
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { // lollipop 以前版本不支持。
- return;
- }
- MediaProjectionManager mMpMngr = (MediaProjectionManager) getApplicationContext().getSystemService(MEDIA_PROJECTION_SERVICE);
- startActivityForResult(mMpMngr.createScreenCaptureIntent(), REQUEST_MEDIA_PROJECTION);
- // 防止点多次.
- view.setEnabled(false);
- }
- }
- });
- }
-
- @Override
- protected void onActivityResult(int requestCode, final int resultCode, final Intent data) {
- super.onActivityResult(requestCode, resultCode, data);
- if (requestCode == REQUEST_MEDIA_PROJECTION) {
- getMediaStream().subscribe(new Consumer() {
- @Override
- public void accept(MediaStream mediaStream) {
- mediaStream.pushScreen(resultCode, data, HOST, "554", "screen111");
- }
- });
- }
- }
-
- public void onSwitchCamera(View view) {
- getMediaStream().subscribe(new Consumer() {
- @Override
- public void accept(MediaStream mediaStream) throws Exception {
- mediaStream.switchCamera();
- }
- });
- }
-
- public void onUVCCamera(View view) {
- Intent intent = new Intent(this, UVCActivity.class);
-
-
-// Intent intent = new Intent(this, ProVideoActivity.class);
-// String path = Environment.getExternalStorageDirectory().getAbsolutePath() + "/mvtest.mp4";
-// intent.putExtra("videoPath", path);
- startActivity(intent);
-
-// List> allData = new ArrayList<>();
-// List row1 = new ArrayList<>();
-// row1.add(new SimpleCellValue("5.22"));
-// row1.add(new SimpleCellValue("1"));
-// row1.add(new SimpleCellValue("2"));
-// row1.add(new SimpleCellValue("3"));
-// List row2 = new ArrayList<>();
-// row2.add(new SimpleCellValue("5.23"));
-// row2.add(new SimpleCellValue("4"));
-// row2.add(new SimpleCellValue("5"));
-// row2.add(new SimpleCellValue("6"));
-//
-// allData.add(row1);
-// allData.add(row2);
-//
-// ExcelUtils.INSTANCE.writeStringListToExcel(allData, this);
- }
-
- public void OnSaveRecord(View view) {
- if (mediaStream.isRecording()) {
- mediaStream.stopRecord();
- } else {
- mediaStream.startRecord(this.getCacheDir().getAbsolutePath(), 10 * 1000);
- }
- }
-}
diff --git a/app/src/main/java/com/yinuo/safetywatcher/RxHelper.java b/app/src/main/java/com/yinuo/safetywatcher/RxHelper.java
deleted file mode 100644
index 9914c31..0000000
--- a/app/src/main/java/com/yinuo/safetywatcher/RxHelper.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.yinuo.safetywatcher;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-
-import org.easydarwin.util.AbstractSubscriber;
-import org.reactivestreams.Publisher;
-
-import io.reactivex.Single;
-import io.reactivex.subjects.PublishSubject;
-
-/**
- * Created by apple on 2017/12/22.
- */
-
-public class RxHelper {
- static boolean IGNORE_ERROR = false;
-
- public static Single single(@NonNull Publisher t, @Nullable T defaultValueIfNotNull){
- if (defaultValueIfNotNull != null) return Single.just(defaultValueIfNotNull);
- final PublishSubject sub = PublishSubject.create();
- t.subscribe(new AbstractSubscriber() {
- @Override
- public void onNext(T t) {
- super.onNext(t);
- sub.onNext(t);
- }
-
- @Override
- public void onError(Throwable t) {
- if (IGNORE_ERROR) {
- super.onError(t);
- sub.onComplete();
- }else {
- sub.onError(t);
- }
- }
-
- @Override
- public void onComplete() {
- super.onComplete();
- sub.onComplete();
- }
- });
- return sub.firstOrError();
- }
-}
diff --git a/app/src/main/java/com/yinuo/safetywatcher/SurfaceTextureListenerWrapper.java b/app/src/main/java/com/yinuo/safetywatcher/SurfaceTextureListenerWrapper.java
deleted file mode 100644
index 4815ea3..0000000
--- a/app/src/main/java/com/yinuo/safetywatcher/SurfaceTextureListenerWrapper.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.yinuo.safetywatcher;
-
-import android.graphics.SurfaceTexture;
-import android.view.TextureView;
-
-/**
- * Created by apple on 2017/9/11.
- */
-
-public abstract class SurfaceTextureListenerWrapper implements TextureView.SurfaceTextureListener{
-
- @Override
- public void onSurfaceTextureSizeChanged(SurfaceTexture surfaceTexture, int i, int i1) {
-
- }
-
- @Override
- public boolean onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture) {
-
- return true;
- }
-
- @Override
- public void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture) {
-
- }
-}
diff --git a/app/src/main/java/com/yinuo/safetywatcher/UVCActivity.java b/app/src/main/java/com/yinuo/safetywatcher/UVCActivity.java
deleted file mode 100644
index b58741e..0000000
--- a/app/src/main/java/com/yinuo/safetywatcher/UVCActivity.java
+++ /dev/null
@@ -1,208 +0,0 @@
-package com.yinuo.safetywatcher;
-
-import androidx.lifecycle.Observer;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.graphics.SurfaceTexture;
-import android.os.Environment;
-import android.preference.PreferenceManager;
-import androidx.annotation.Nullable;
-import androidx.core.app.ActivityCompat;
-import androidx.appcompat.app.AppCompatActivity;
-import android.os.Bundle;
-import android.view.TextureView;
-import android.view.View;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import org.easydarwin.push.MediaStream;
-
-import io.reactivex.Single;
-import io.reactivex.functions.Consumer;
-
-public class UVCActivity extends AppCompatActivity {
- private MediaStream mediaStream;
-
- private static final int REQUEST_CAMERA_PERMISSION = 1000;
- private Single getMediaStream() {
- Single single = RxHelper.single(MediaStream.getBindedMediaStream(this, this), mediaStream);
- if (mediaStream == null) {
- return single.doOnSuccess(new Consumer() {
- @Override
- public void accept(MediaStream ms) throws Exception {
- mediaStream = ms;
- }
- });
- } else {
- return single;
- }
- }
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_uvc);
-
- // 启动服务...
- Intent intent = new Intent(this, MediaStream.class);
- startService(intent);
-
- getMediaStream().subscribe(new Consumer() {
- @Override
- public void accept(final MediaStream ms) throws Exception {
-
- final TextView pushingStateText = findViewById(R.id.pushing_state);
- final TextView pushingBtn = findViewById(R.id.pushing);
- ms.observePushingState(UVCActivity.this, new Observer() {
-
- @Override
- public void onChanged(@Nullable MediaStream.PushingState pushingState) {
- if (pushingState.screenPushing) {
- pushingStateText.setText("屏幕推送");
- } else {
- pushingStateText.setText("推送");
-
- if (pushingState.state > 0) {
- pushingBtn.setText("停止");
- } else {
- pushingBtn.setText("推送");
- }
-
- }
- pushingStateText.append(":\t" + pushingState.msg);
- if (pushingState.state > 0) {
- pushingStateText.append(pushingState.url);
- }
-
- }
- });
- TextureView textureView = findViewById(R.id.texture_view);
- textureView.setSurfaceTextureListener(new SurfaceTextureListenerWrapper() {
- @Override
- public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i, int i1) {
- ms.setSurfaceTexture(surfaceTexture);
- }
- @Override
- public boolean onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture) {
- ms.setSurfaceTexture(null);
- return true;
- }
- });
-
-
- if (ActivityCompat.checkSelfPermission(UVCActivity.this, android.Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED ||
- ActivityCompat.checkSelfPermission(UVCActivity.this, android.Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) {
- ActivityCompat.requestPermissions(UVCActivity.this, new String[]{android.Manifest.permission.CAMERA, android.Manifest.permission.RECORD_AUDIO}, REQUEST_CAMERA_PERMISSION);
- }
- }
- }, new Consumer() {
- @Override
- public void accept(Throwable throwable) throws Exception {
- Toast.makeText(UVCActivity.this, "创建服务出错!", Toast.LENGTH_SHORT).show();
- }
- });
- }
-
-
- // 权限获取到了.
- @Override
- public void onRequestPermissionsResult(int requestCode,
- String permissions[], int[] grantResults) {
- switch (requestCode) {
- case REQUEST_CAMERA_PERMISSION: {
- if (grantResults.length > 1
- && grantResults[0] == PackageManager.PERMISSION_GRANTED && grantResults[1] == PackageManager.PERMISSION_GRANTED) {
- getMediaStream().subscribe(new Consumer() {
- @Override
- public void accept(MediaStream mediaStream) throws Exception {
- mediaStream.notifyPermissionGranted();
- }
- });
- } else {
- // 没有获取到权限,退出....
- Intent intent = new Intent(this, MediaStream.class);
- stopService(intent);
-
- finish();
- }
- break;
- }
- }
- }
-
- public void onPush(View view) {
-
- // 异步获取到MediaStream对象.
- getMediaStream().subscribe(new Consumer() {
- @Override
- public void accept(final MediaStream mediaStream) throws Exception {
- // 判断当前的推送状态.
- MediaStream.PushingState state = mediaStream.getPushingState();
- if (state != null && state.state > 0) { // 当前正在推送,那终止推送和预览
- mediaStream.stopStream();
- mediaStream.closeCameraPreview();
- }else{
- // switch 0表示后置,1表示前置,2表示UVC摄像头
- RxHelper.single(mediaStream.switchCamera(2), null).subscribe(new Consumer