This commit is contained in:
rjb
2026-01-20 14:25:07 +08:00
12 changed files with 323 additions and 0 deletions

View File

@@ -1,4 +1,5 @@
plugins {
<<<<<<< HEAD
id 'com.android.application'
}
@@ -9,6 +10,19 @@ android {
defaultConfig {
applicationId "com.example.agentclient"
minSdk 24
=======
alias(libs.plugins.android.application)
id 'dagger.hilt.android.plugin'
}
android {
namespace 'com.example.demo'
compileSdk 34
defaultConfig {
applicationId "com.example.demo"
minSdk 26
>>>>>>> 7c5f94d47066e9f9fb4cd23e74fe34d53d326684
targetSdk 34
versionCode 1
versionName "1.0"
@@ -22,6 +36,7 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
<<<<<<< HEAD
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
@@ -30,10 +45,16 @@ android {
buildFeatures {
viewBinding true
=======
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
>>>>>>> 7c5f94d47066e9f9fb4cd23e74fe34d53d326684
}
}
dependencies {
<<<<<<< HEAD
// Android Core
implementation 'androidx.core:core:1.12.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
@@ -56,3 +77,37 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
=======
// 基础Android库
implementation libs.appcompat
implementation libs.material
// 生命周期和ViewModel
implementation libs.lifecycle.viewmodel
implementation libs.lifecycle.livedata
// Room数据库
implementation libs.room.runtime
annotationProcessor libs.room.compiler
// 网络库
implementation libs.retrofit
implementation libs.retrofit.gson
implementation libs.okhttp.logging
// 依赖注入
implementation libs.hilt.android
annotationProcessor libs.hilt.compiler
// 工作管理器
implementation libs.work.runtime
// 蓝牙库
implementation libs.ble
// 测试库
testImplementation libs.junit
androidTestImplementation libs.ext.junit
androidTestImplementation libs.espresso.core
}
>>>>>>> 7c5f94d47066e9f9fb4cd23e74fe34d53d326684

View File

@@ -1,6 +1,7 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
<<<<<<< HEAD
# Retrofit
-keepattributes Signature, InnerClasses, EnclosingMethod
@@ -31,3 +32,23 @@
# Keep model classes
-keep class com.example.agentclient.models.** { *; }
=======
#
# 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
>>>>>>> 7c5f94d47066e9f9fb4cd23e74fe34d53d326684

View File

@@ -2,16 +2,39 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<<<<<<< HEAD
<!-- -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
=======
<!-- OBD -->
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<!-- 针对Android 12+ -->
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
>>>>>>> 7c5f94d47066e9f9fb4cd23e74fe34d53d326684
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
<<<<<<< HEAD
android:theme="@style/Theme.AppCompat.Light.DarkActionBar"
android:usesCleartextTraffic="true"
tools:targetApi="31">
@@ -27,3 +50,28 @@
</application>
</manifest>
=======
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
android:usesCleartextTraffic="true"
android:networkSecurityConfig="@xml/network_security_config"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:exported="true"
android:theme="@style/Theme.AppCompat.Light.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".DeviceDiscoveryActivity"
android:exported="false"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
</application>
</manifest>
>>>>>>> 7c5f94d47066e9f9fb4cd23e74fe34d53d326684

View File

@@ -0,0 +1,22 @@
package com.example.demo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}

View File

@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<<<<<<< HEAD
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -73,3 +74,12 @@
</LinearLayout>
</LinearLayout>
=======
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
</RelativeLayout>
>>>>>>> 7c5f94d47066e9f9fb4cd23e74fe34d53d326684

View File

@@ -1,4 +1,33 @@
<<<<<<< HEAD
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Agent客户端</string>
</resources>
=======
<resources>
<string name="app_name">个人知库</string>
<string name="welcome_message">欢迎使用OBD诊断工具</string>
<string name="connect_bluetooth">连接蓝牙OBD设备</string>
<string name="connect_wifi">连接WiFi OBD</string>
<string name="settings">设置</string>
<string name="ready_status">准备就绪</string>
<string name="permission_bluetooth_required">需要蓝牙权限才能连接OBD设备</string>
<string name="permission_location_required">需要位置权限才能扫描蓝牙设备</string>
<string name="bluetooth_not_available">设备不支持蓝牙</string>
<string name="bluetooth_disabled">蓝牙未启用</string>
<string name="scanning_devices">正在搜索OBD设备...</string>
<!-- 数据采集相关 -->
<string name="start_collection">开始采集</string>
<string name="stop_collection">停止采集</string>
<string name="upload_data">上传数据</string>
<string name="view_history">查看历史</string>
<string name="collection_running">采集中...</string>
<string name="collection_stopped">已停止</string>
<string name="collection_paused">已暂停</string>
<string name="data_uploaded">数据已上传</string>
<string name="upload_failed">上传失败</string>
<string name="no_data_to_upload">没有数据需要上传</string>
<string name="bluetooth_settings_instruction">请在系统蓝牙设置中搜索并连接您的OBD设备然后返回应用</string>
</resources>
>>>>>>> 7c5f94d47066e9f9fb4cd23e74fe34d53d326684

View File

@@ -1,6 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<<<<<<< HEAD
<!-- HTTP使HTTPS -->
=======
<!-- 允许所有 HTTP 流量 -->
>>>>>>> 7c5f94d47066e9f9fb4cd23e74fe34d53d326684
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system" />