2
.gitignore
vendored
2
.gitignore
vendored
@@ -20,4 +20,4 @@ gradle-app.setting
|
||||
.project
|
||||
# JDT-specific (Eclipse Java Development Tools)
|
||||
.classpath
|
||||
|
||||
.DS_Store
|
||||
|
||||
152
CLAUDE.md
Normal file
152
CLAUDE.md
Normal file
@@ -0,0 +1,152 @@
|
||||
# Development Guidelines
|
||||
|
||||
## Philosophy
|
||||
|
||||
### Core Beliefs
|
||||
|
||||
- **Incremental progress over big bangs** - Small changes that compile and pass tests
|
||||
- **Learning from existing code** - Study and plan before implementing
|
||||
- **Pragmatic over dogmatic** - Adapt to project reality
|
||||
- **Clear intent over clever code** - Be boring and obvious
|
||||
|
||||
### Simplicity Means
|
||||
|
||||
- Single responsibility per function/class
|
||||
- Avoid premature abstractions
|
||||
- No clever tricks - choose the boring solution
|
||||
- If you need to explain it, it's too complex
|
||||
|
||||
## Process
|
||||
|
||||
### 1. Planning & Staging
|
||||
|
||||
Break complex work into 3-5 stages. Document in `IMPLEMENTATION_PLAN.md`:
|
||||
|
||||
```markdown
|
||||
## Stage N: [Name]
|
||||
**Goal**: [Specific deliverable]
|
||||
**Success Criteria**: [Testable outcomes]
|
||||
**Tests**: [Specific test cases]
|
||||
**Status**: [Not Started|In Progress|Complete]
|
||||
```
|
||||
- Update status as you progress
|
||||
- Remove file when all stages are done
|
||||
|
||||
### 2. Implementation Flow
|
||||
|
||||
1. **Understand** - Study existing patterns in codebase
|
||||
2. **Test** - Write test first (red)
|
||||
3. **Implement** - Minimal code to pass (green)
|
||||
4. **Refactor** - Clean up with tests passing
|
||||
5. **Commit** - With clear message linking to plan
|
||||
|
||||
### 3. When Stuck (After 3 Attempts)
|
||||
|
||||
**CRITICAL**: Maximum 3 attempts per issue, then STOP.
|
||||
|
||||
1. **Document what failed**:
|
||||
- What you tried
|
||||
- Specific error messages
|
||||
- Why you think it failed
|
||||
|
||||
2. **Research alternatives**:
|
||||
- Find 2-3 similar implementations
|
||||
- Note different approaches used
|
||||
|
||||
3. **Question fundamentals**:
|
||||
- Is this the right abstraction level?
|
||||
- Can this be split into smaller problems?
|
||||
- Is there a simpler approach entirely?
|
||||
|
||||
4. **Try different angle**:
|
||||
- Different library/framework feature?
|
||||
- Different architectural pattern?
|
||||
- Remove abstraction instead of adding?
|
||||
|
||||
## Technical Standards
|
||||
|
||||
### Architecture Principles
|
||||
|
||||
- **Composition over inheritance** - Use dependency injection
|
||||
- **Interfaces over singletons** - Enable testing and flexibility
|
||||
- **Explicit over implicit** - Clear data flow and dependencies
|
||||
- **Test-driven when possible** - Never disable tests, fix them
|
||||
|
||||
### Code Quality
|
||||
|
||||
- **Every commit must**:
|
||||
- Compile successfully
|
||||
- Pass all existing tests
|
||||
- Include tests for new functionality
|
||||
- Follow project formatting/linting
|
||||
|
||||
- **Before committing**:
|
||||
- Run formatters/linters
|
||||
- Self-review changes
|
||||
- Ensure commit message explains "why"
|
||||
|
||||
### Error Handling
|
||||
|
||||
- Fail fast with descriptive messages
|
||||
- Include context for debugging
|
||||
- Handle errors at appropriate level
|
||||
- Never silently swallow exceptions
|
||||
|
||||
## Decision Framework
|
||||
|
||||
When multiple valid approaches exist, choose based on:
|
||||
|
||||
1. **Testability** - Can I easily test this?
|
||||
2. **Readability** - Will someone understand this in 6 months?
|
||||
3. **Consistency** - Does this match project patterns?
|
||||
4. **Simplicity** - Is this the simplest solution that works?
|
||||
5. **Reversibility** - How hard to change later?
|
||||
|
||||
## Project Integration
|
||||
|
||||
### Learning the Codebase
|
||||
|
||||
- Find 3 similar features/components
|
||||
- Identify common patterns and conventions
|
||||
- Use same libraries/utilities when possible
|
||||
- Follow existing test patterns
|
||||
|
||||
### Tooling
|
||||
|
||||
- Use project's existing build system
|
||||
- Use project's test framework
|
||||
- Use project's formatter/linter settings
|
||||
- Don't introduce new tools without strong justification
|
||||
|
||||
## Quality Gates
|
||||
|
||||
### Definition of Done
|
||||
|
||||
- [ ] Tests written and passing
|
||||
- [ ] Code follows project conventions
|
||||
- [ ] No linter/formatter warnings
|
||||
- [ ] Commit messages are clear
|
||||
- [ ] Implementation matches plan
|
||||
- [ ] No TODOs without issue numbers
|
||||
|
||||
### Test Guidelines
|
||||
|
||||
- Test behavior, not implementation
|
||||
- One assertion per test when possible
|
||||
- Clear test names describing scenario
|
||||
- Use existing test utilities/helpers
|
||||
- Tests should be deterministic
|
||||
|
||||
## Important Reminders
|
||||
|
||||
**NEVER**:
|
||||
- Use `--no-verify` to bypass commit hooks
|
||||
- Disable tests instead of fixing them
|
||||
- Commit code that doesn't compile
|
||||
- Make assumptions - verify with existing code
|
||||
|
||||
**ALWAYS**:
|
||||
- Commit working code incrementally
|
||||
- Update plan documentation as you go
|
||||
- Learn from existing implementations
|
||||
- Stop after 3 failed attempts and reassess
|
||||
3
app/.idea/.gitignore
generated
vendored
Normal file
3
app/.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
6
app/.idea/AndroidProjectSystem.xml
generated
Normal file
6
app/.idea/AndroidProjectSystem.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AndroidProjectSystem">
|
||||
<option name="providerId" value="com.android.tools.idea.GradleProjectSystem" />
|
||||
</component>
|
||||
</project>
|
||||
13
app/.idea/deviceManager.xml
generated
Normal file
13
app/.idea/deviceManager.xml
generated
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DeviceTable">
|
||||
<option name="columnSorters">
|
||||
<list>
|
||||
<ColumnSorterState>
|
||||
<option name="column" value="Name" />
|
||||
<option name="order" value="ASCENDING" />
|
||||
</ColumnSorterState>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
12
app/.idea/gradle.xml
generated
Normal file
12
app/.idea/gradle.xml
generated
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="testRunner" value="CHOOSE_PER_TEST" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
10
app/.idea/migrations.xml
generated
Normal file
10
app/.idea/migrations.xml
generated
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectMigrations">
|
||||
<option name="MigrateToGradleLocalJavaHome">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
10
app/.idea/misc.xml
generated
Normal file
10
app/.idea/misc.xml
generated
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
<option name="id" value="Android" />
|
||||
</component>
|
||||
</project>
|
||||
17
app/.idea/runConfigurations.xml
generated
Normal file
17
app/.idea/runConfigurations.xml
generated
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RunConfigurationProducerService">
|
||||
<option name="ignoredProducers">
|
||||
<set>
|
||||
<option value="com.intellij.execution.junit.AbstractAllInDirectoryConfigurationProducer" />
|
||||
<option value="com.intellij.execution.junit.AllInPackageConfigurationProducer" />
|
||||
<option value="com.intellij.execution.junit.PatternConfigurationProducer" />
|
||||
<option value="com.intellij.execution.junit.TestInClassConfigurationProducer" />
|
||||
<option value="com.intellij.execution.junit.UniqueIdConfigurationProducer" />
|
||||
<option value="com.intellij.execution.junit.testDiscovery.JUnitTestDiscoveryConfigurationProducer" />
|
||||
<option value="org.jetbrains.kotlin.idea.junit.KotlinJUnitRunConfigurationProducer" />
|
||||
<option value="org.jetbrains.kotlin.idea.junit.KotlinPatternConfigurationProducer" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
68
app/build.gradle
Normal file
68
app/build.gradle
Normal file
@@ -0,0 +1,68 @@
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
id 'org.jetbrains.kotlin.android'
|
||||
}
|
||||
|
||||
android {
|
||||
namespace 'com.xsynergy.android'
|
||||
compileSdk 34
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.xsynergy.android"
|
||||
minSdk 26
|
||||
targetSdk 34
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables {
|
||||
useSupportLibrary true
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_17
|
||||
targetCompatibility JavaVersion.VERSION_17
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = '17'
|
||||
}
|
||||
buildFeatures {
|
||||
compose true
|
||||
}
|
||||
composeOptions {
|
||||
kotlinCompilerExtensionVersion '1.5.14'
|
||||
}
|
||||
packaging {
|
||||
resources {
|
||||
excludes += '/META-INF/{AL2.0,LGPL2.1}'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'androidx.core:core-ktx:1.13.1'
|
||||
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.4'
|
||||
implementation 'androidx.activity:activity-compose:1.9.1'
|
||||
implementation platform('androidx.compose:compose-bom:2024.06.00')
|
||||
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.lifecycle:lifecycle-viewmodel-compose:2.8.4'
|
||||
implementation 'androidx.navigation:navigation-compose:2.7.7'
|
||||
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
|
||||
androidTestImplementation platform('androidx.compose:compose-bom:2024.06.00')
|
||||
androidTestImplementation 'androidx.compose.ui:ui-test-junit4'
|
||||
debugImplementation 'androidx.compose.ui:ui-tooling'
|
||||
debugImplementation 'androidx.compose.ui:ui-test-manifest'
|
||||
}
|
||||
8
app/local.properties
Normal file
8
app/local.properties
Normal file
@@ -0,0 +1,8 @@
|
||||
## This file must *NOT* be checked into Version Control Systems,
|
||||
# as it contains information specific to your local configuration.
|
||||
#
|
||||
# Location of the SDK. This is only used by Gradle.
|
||||
# For customization when using a Version Control System, please read the
|
||||
# header note.
|
||||
#Thu Sep 04 21:24:19 CST 2025
|
||||
sdk.dir=/Users/qianchao/Library/Android/sdk
|
||||
21
app/proguard-rules.pro
vendored
Normal file
21
app/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# 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
|
||||
31
app/src/main/AndroidManifest.xml
Normal file
31
app/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_SMS" />
|
||||
|
||||
<application
|
||||
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"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.XSynergy"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/Theme.XSynergy">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
38
app/src/main/java/com/xsynergy/android/MainActivity.kt
Normal file
38
app/src/main/java/com/xsynergy/android/MainActivity.kt
Normal file
@@ -0,0 +1,38 @@
|
||||
package com.xsynergy.android
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Modifier
|
||||
import com.xsynergy.android.ui.theme.XSynergyTheme
|
||||
import com.xsynergy.android.ui.screens.LoginScreen
|
||||
import com.xsynergy.android.ui.screens.MainScreen
|
||||
|
||||
class MainActivity : ComponentActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContent {
|
||||
XSynergyTheme {
|
||||
Surface(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
color = MaterialTheme.colorScheme.background
|
||||
) {
|
||||
var isLoggedIn by remember { mutableStateOf(false) }
|
||||
|
||||
if (!isLoggedIn) {
|
||||
LoginScreen(
|
||||
onLoginSuccess = {
|
||||
isLoggedIn = true
|
||||
}
|
||||
)
|
||||
} else {
|
||||
MainScreen()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.xsynergy.android.ui.navigation
|
||||
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.*
|
||||
import androidx.compose.material.icons.outlined.*
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
|
||||
sealed class BottomNavItem(
|
||||
val route: String,
|
||||
val title: String,
|
||||
val icon: ImageVector
|
||||
) {
|
||||
object Dashboard : BottomNavItem("dashboard", "首页", Icons.Default.Home)
|
||||
object History : BottomNavItem("history", "历史", Icons.Default.List)
|
||||
object AR : BottomNavItem("ar", "AR", Icons.Default.Build)
|
||||
object ARSession : BottomNavItem("arsession", "AR会话", Icons.Default.Call)
|
||||
object Contacts : BottomNavItem("contacts", "联系人", Icons.Default.Person)
|
||||
object Settings : BottomNavItem("settings", "设置", Icons.Default.Settings)
|
||||
object Profile : BottomNavItem("profile", "我的", Icons.Default.AccountCircle)
|
||||
}
|
||||
|
||||
val bottomNavItems = listOf(
|
||||
BottomNavItem.Dashboard,
|
||||
BottomNavItem.History,
|
||||
BottomNavItem.ARSession,
|
||||
BottomNavItem.Contacts,
|
||||
BottomNavItem.Profile
|
||||
)
|
||||
@@ -0,0 +1,237 @@
|
||||
package com.xsynergy.android.ui.screens
|
||||
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.*
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.xsynergy.android.ui.theme.XSynergyTheme
|
||||
|
||||
@Composable
|
||||
fun ARSessionScreen(
|
||||
sessionId: String = "会话12345",
|
||||
participants: List<String> = listOf("李明", "王工程师", "张主管"),
|
||||
onEndSession: () -> Unit = {},
|
||||
onAddAnnotation: () -> Unit = {},
|
||||
onToggleAudio: () -> Unit = {},
|
||||
onToggleVideo: () -> Unit = {},
|
||||
onShareScreen: () -> Unit = {}
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(horizontal = 20.dp)
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(top = 20.dp, bottom = 16.dp),
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Text(
|
||||
text = "AR协作会话",
|
||||
fontSize = 24.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = MaterialTheme.colorScheme.onBackground
|
||||
)
|
||||
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
Text(
|
||||
text = "会话ID: $sessionId",
|
||||
fontSize = 14.sp,
|
||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.6f)
|
||||
)
|
||||
|
||||
Surface(
|
||||
color = MaterialTheme.colorScheme.error,
|
||||
shape = MaterialTheme.shapes.small
|
||||
) {
|
||||
Text(
|
||||
text = "直播中",
|
||||
fontSize = 12.sp,
|
||||
color = MaterialTheme.colorScheme.onError,
|
||||
modifier = Modifier.padding(horizontal = 8.dp, vertical = 2.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Card(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.weight(1f),
|
||||
colors = CardDefaults.cardColors(
|
||||
containerColor = MaterialTheme.colorScheme.surface
|
||||
),
|
||||
elevation = CardDefaults.cardElevation(defaultElevation = 4.dp)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Column(
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.Center
|
||||
) {
|
||||
Text(
|
||||
text = "AR摄像头视图",
|
||||
fontSize = 18.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = MaterialTheme.colorScheme.onSurface
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
Text(
|
||||
text = "正在显示实时AR内容",
|
||||
fontSize = 14.sp,
|
||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.6f)
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(24.dp))
|
||||
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.spacedBy(16.dp)
|
||||
) {
|
||||
AssistChip(
|
||||
onClick = { /* TODO: Toggle AR mode */ },
|
||||
label = { Text("3D模型") },
|
||||
leadingIcon = { Icon(Icons.Default.Build, contentDescription = null) }
|
||||
)
|
||||
|
||||
AssistChip(
|
||||
onClick = { /* TODO: Toggle measurement */ },
|
||||
label = { Text("测量") },
|
||||
leadingIcon = { Icon(Icons.Default.Edit, contentDescription = null) }
|
||||
)
|
||||
|
||||
AssistChip(
|
||||
onClick = { /* TODO: Toggle annotation */ },
|
||||
label = { Text("标注") },
|
||||
leadingIcon = { Icon(Icons.Default.Edit, contentDescription = null) }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
Card(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
colors = CardDefaults.cardColors(
|
||||
containerColor = MaterialTheme.colorScheme.surface
|
||||
),
|
||||
elevation = CardDefaults.cardElevation(defaultElevation = 2.dp)
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier.padding(16.dp)
|
||||
) {
|
||||
Text(
|
||||
text = "参与者 (${participants.size})",
|
||||
fontSize = 16.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = MaterialTheme.colorScheme.onSurface
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
|
||||
Row {
|
||||
participants.forEach { participant ->
|
||||
AssistChip(
|
||||
onClick = { /* TODO: Focus on participant */ },
|
||||
label = { Text(participant) },
|
||||
modifier = Modifier.padding(end = 8.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.SpaceEvenly
|
||||
) {
|
||||
IconButton(
|
||||
onClick = onToggleAudio,
|
||||
modifier = Modifier.size(48.dp)
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.Call,
|
||||
contentDescription = "麦克风",
|
||||
tint = MaterialTheme.colorScheme.primary
|
||||
)
|
||||
}
|
||||
|
||||
IconButton(
|
||||
onClick = onToggleVideo,
|
||||
modifier = Modifier.size(48.dp)
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.Call,
|
||||
contentDescription = "摄像头",
|
||||
tint = MaterialTheme.colorScheme.primary
|
||||
)
|
||||
}
|
||||
|
||||
IconButton(
|
||||
onClick = onShareScreen,
|
||||
modifier = Modifier.size(48.dp)
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.Call,
|
||||
contentDescription = "屏幕共享",
|
||||
tint = MaterialTheme.colorScheme.primary
|
||||
)
|
||||
}
|
||||
|
||||
IconButton(
|
||||
onClick = onAddAnnotation,
|
||||
modifier = Modifier.size(48.dp)
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.Edit,
|
||||
contentDescription = "添加标注",
|
||||
tint = MaterialTheme.colorScheme.primary
|
||||
)
|
||||
}
|
||||
|
||||
Button(
|
||||
onClick = onEndSession,
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
containerColor = MaterialTheme.colorScheme.error
|
||||
),
|
||||
modifier = Modifier.height(48.dp)
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.Close,
|
||||
contentDescription = "结束会话",
|
||||
tint = MaterialTheme.colorScheme.onError
|
||||
)
|
||||
Spacer(modifier = Modifier.width(8.dp))
|
||||
Text("结束", color = MaterialTheme.colorScheme.onError)
|
||||
}
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(20.dp))
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
fun ARSessionScreenPreview() {
|
||||
XSynergyTheme {
|
||||
Surface {
|
||||
ARSessionScreen()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,199 @@
|
||||
package com.xsynergy.android.ui.screens
|
||||
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.xsynergy.android.ui.theme.XSynergyTheme
|
||||
|
||||
data class Contact(
|
||||
val id: String,
|
||||
val name: String,
|
||||
val role: String,
|
||||
val department: String,
|
||||
val isOnline: Boolean
|
||||
)
|
||||
|
||||
@Composable
|
||||
fun ContactsScreen() {
|
||||
val contacts = remember {
|
||||
listOf(
|
||||
Contact(
|
||||
id = "1",
|
||||
name = "王工程师",
|
||||
role = "高级工程师",
|
||||
department = "设备部",
|
||||
isOnline = true
|
||||
),
|
||||
Contact(
|
||||
id = "2",
|
||||
name = "李设计师",
|
||||
role = "UI设计师",
|
||||
department = "设计部",
|
||||
isOnline = true
|
||||
),
|
||||
Contact(
|
||||
id = "3",
|
||||
name = "张主管",
|
||||
role = "技术主管",
|
||||
department = "技术部",
|
||||
isOnline = false
|
||||
),
|
||||
Contact(
|
||||
id = "4",
|
||||
name = "刘经理",
|
||||
role = "项目经理",
|
||||
department = "项目部",
|
||||
isOnline = true
|
||||
),
|
||||
Contact(
|
||||
id = "5",
|
||||
name = "陈技术员",
|
||||
role = "技术员",
|
||||
department = "运维部",
|
||||
isOnline = false
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(horizontal = 20.dp)
|
||||
) {
|
||||
Text(
|
||||
text = "联系人",
|
||||
fontSize = 24.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
modifier = Modifier.padding(top = 20.dp, bottom = 24.dp)
|
||||
)
|
||||
|
||||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
verticalArrangement = Arrangement.spacedBy(12.dp)
|
||||
) {
|
||||
items(contacts) { contact ->
|
||||
ContactCard(contact)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun ContactCard(contact: Contact) {
|
||||
Card(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
colors = CardDefaults.cardColors(
|
||||
containerColor = MaterialTheme.colorScheme.surface
|
||||
),
|
||||
elevation = CardDefaults.cardElevation(defaultElevation = 2.dp)
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(16.dp),
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.spacedBy(12.dp),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Surface(
|
||||
modifier = Modifier.size(48.dp),
|
||||
shape = CircleShape,
|
||||
color = MaterialTheme.colorScheme.primaryContainer
|
||||
) {
|
||||
Box(contentAlignment = Alignment.Center) {
|
||||
Text(
|
||||
text = contact.name.first().toString(),
|
||||
fontSize = 20.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = MaterialTheme.colorScheme.onPrimaryContainer
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
Text(
|
||||
text = contact.name,
|
||||
fontSize = 16.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = MaterialTheme.colorScheme.onSurface
|
||||
)
|
||||
Text(
|
||||
text = contact.role,
|
||||
fontSize = 14.sp,
|
||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.6f)
|
||||
)
|
||||
Text(
|
||||
text = contact.department,
|
||||
fontSize = 12.sp,
|
||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.4f)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
if (contact.isOnline) {
|
||||
Surface(
|
||||
color = MaterialTheme.colorScheme.secondaryContainer,
|
||||
shape = MaterialTheme.shapes.small
|
||||
) {
|
||||
Text(
|
||||
text = "在线",
|
||||
fontSize = 12.sp,
|
||||
color = MaterialTheme.colorScheme.onSecondaryContainer,
|
||||
modifier = Modifier.padding(horizontal = 8.dp, vertical = 4.dp)
|
||||
)
|
||||
}
|
||||
} else {
|
||||
Surface(
|
||||
color = MaterialTheme.colorScheme.surfaceVariant,
|
||||
shape = MaterialTheme.shapes.small
|
||||
) {
|
||||
Text(
|
||||
text = "离线",
|
||||
fontSize = 12.sp,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
modifier = Modifier.padding(horizontal = 8.dp, vertical = 4.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.width(8.dp))
|
||||
|
||||
Button(
|
||||
onClick = { /* TODO: Handle call action */ },
|
||||
modifier = Modifier.height(32.dp),
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
containerColor = MaterialTheme.colorScheme.primary,
|
||||
contentColor = MaterialTheme.colorScheme.onPrimary
|
||||
)
|
||||
) {
|
||||
Text(text = "联系", fontSize = 12.sp)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
fun ContactsScreenPreview() {
|
||||
XSynergyTheme {
|
||||
Surface {
|
||||
ContactsScreen()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,234 @@
|
||||
package com.xsynergy.android.ui.screens
|
||||
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.xsynergy.android.ui.theme.XSynergyTheme
|
||||
|
||||
@Composable
|
||||
fun DashboardScreen(
|
||||
userName: String = "李明",
|
||||
onStartCollaboration: () -> Unit = {},
|
||||
onJoinCollaboration: () -> Unit = {},
|
||||
onScheduleCollaboration: () -> Unit = {}
|
||||
) {
|
||||
val meetings = remember {
|
||||
listOf(
|
||||
Meeting(
|
||||
title = "设备检修会议",
|
||||
time = "14:30 - 15:30",
|
||||
organizer = "王工",
|
||||
status = "即将开始"
|
||||
),
|
||||
Meeting(
|
||||
title = "项目评审会议",
|
||||
time = "16:00 - 17:00",
|
||||
organizer = "张总",
|
||||
status = "已预约"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(horizontal = 20.dp)
|
||||
) {
|
||||
// Greeting
|
||||
Text(
|
||||
text = "你好,$userName",
|
||||
fontSize = 24.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
modifier = Modifier.padding(top = 20.dp, bottom = 32.dp)
|
||||
)
|
||||
|
||||
// Action Section
|
||||
Column(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
verticalArrangement = Arrangement.spacedBy(16.dp)
|
||||
) {
|
||||
// Start Collaboration Button
|
||||
Button(
|
||||
onClick = onStartCollaboration,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(60.dp),
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
containerColor = MaterialTheme.colorScheme.primary
|
||||
)
|
||||
) {
|
||||
Text(
|
||||
text = "发起协作",
|
||||
fontSize = 18.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
}
|
||||
|
||||
// Join Collaboration Button
|
||||
OutlinedButton(
|
||||
onClick = onJoinCollaboration,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(48.dp),
|
||||
colors = ButtonDefaults.outlinedButtonColors(
|
||||
contentColor = MaterialTheme.colorScheme.primary
|
||||
)
|
||||
) {
|
||||
Text(
|
||||
text = "加入协作",
|
||||
fontSize = 16.sp
|
||||
)
|
||||
}
|
||||
|
||||
// Schedule Collaboration Text Button
|
||||
TextButton(
|
||||
onClick = onScheduleCollaboration,
|
||||
modifier = Modifier.align(Alignment.CenterHorizontally)
|
||||
) {
|
||||
Text(
|
||||
text = "预约协作",
|
||||
fontSize = 16.sp,
|
||||
color = MaterialTheme.colorScheme.primary
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(40.dp))
|
||||
|
||||
// Today's Schedule Section
|
||||
Text(
|
||||
text = "今日预约",
|
||||
fontSize = 18.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
modifier = Modifier.padding(bottom = 16.dp)
|
||||
)
|
||||
|
||||
// Meetings List
|
||||
LazyColumn(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
verticalArrangement = Arrangement.spacedBy(12.dp)
|
||||
) {
|
||||
items(meetings) { meeting ->
|
||||
MeetingCard(meeting)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun MeetingCard(meeting: Meeting) {
|
||||
Card(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
colors = CardDefaults.cardColors(
|
||||
containerColor = MaterialTheme.colorScheme.surface
|
||||
),
|
||||
elevation = CardDefaults.cardElevation(defaultElevation = 2.dp)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier.padding(16.dp)
|
||||
) {
|
||||
// Status Badge
|
||||
if (meeting.status == "即将开始") {
|
||||
Surface(
|
||||
modifier = Modifier
|
||||
.align(Alignment.TopEnd),
|
||||
color = MaterialTheme.colorScheme.secondaryContainer,
|
||||
shape = MaterialTheme.shapes.small
|
||||
) {
|
||||
Text(
|
||||
text = meeting.status,
|
||||
fontSize = 12.sp,
|
||||
fontWeight = FontWeight.Medium,
|
||||
color = MaterialTheme.colorScheme.onSecondaryContainer,
|
||||
modifier = Modifier.padding(horizontal = 8.dp, vertical = 4.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Column(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp)
|
||||
) {
|
||||
// Meeting Title
|
||||
Text(
|
||||
text = meeting.title,
|
||||
fontSize = 16.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = MaterialTheme.colorScheme.onSurface
|
||||
)
|
||||
|
||||
// Meeting Meta
|
||||
Text(
|
||||
text = "${meeting.time} | 发起人:${meeting.organizer}",
|
||||
fontSize = 14.sp,
|
||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.6f)
|
||||
)
|
||||
|
||||
// Join Button (only for active meetings)
|
||||
if (meeting.status == "即将开始") {
|
||||
Button(
|
||||
onClick = { /* TODO: Handle join meeting */ },
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(36.dp),
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
containerColor = MaterialTheme.colorScheme.secondaryContainer,
|
||||
contentColor = MaterialTheme.colorScheme.onSecondaryContainer
|
||||
)
|
||||
) {
|
||||
Text(
|
||||
text = "立即加入",
|
||||
fontSize = 14.sp
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
fun DashboardScreenPreview() {
|
||||
XSynergyTheme {
|
||||
Surface {
|
||||
DashboardScreen()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
fun MeetingCardPreview() {
|
||||
XSynergyTheme {
|
||||
Surface {
|
||||
MeetingCard(
|
||||
Meeting(
|
||||
title = "设备检修会议",
|
||||
time = "14:30 - 15:30",
|
||||
organizer = "王工",
|
||||
status = "即将开始"
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data class Meeting(
|
||||
val title: String,
|
||||
val time: String,
|
||||
val organizer: String,
|
||||
val status: String
|
||||
)
|
||||
@@ -0,0 +1,310 @@
|
||||
package com.xsynergy.android.ui.screens
|
||||
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.*
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.xsynergy.android.ui.theme.XSynergyTheme
|
||||
|
||||
@Composable
|
||||
fun ARScreen() {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(horizontal = 20.dp)
|
||||
) {
|
||||
Text(
|
||||
text = "AR协作",
|
||||
fontSize = 24.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
modifier = Modifier.padding(top = 20.dp, bottom = 24.dp)
|
||||
)
|
||||
|
||||
Card(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.weight(1f),
|
||||
colors = CardDefaults.cardColors(
|
||||
containerColor = MaterialTheme.colorScheme.surface
|
||||
),
|
||||
elevation = CardDefaults.cardElevation(defaultElevation = 4.dp)
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(24.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.Center
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.Build,
|
||||
contentDescription = "AR",
|
||||
modifier = Modifier.size(64.dp),
|
||||
tint = MaterialTheme.colorScheme.primary
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
Text(
|
||||
text = "AR协作功能",
|
||||
fontSize = 20.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = MaterialTheme.colorScheme.onSurface
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
|
||||
Text(
|
||||
text = "开始使用增强现实技术进行\n远程协作",
|
||||
fontSize = 16.sp,
|
||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.6f),
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(24.dp))
|
||||
|
||||
Button(
|
||||
onClick = { /* TODO: Start AR session */ },
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(48.dp)
|
||||
) {
|
||||
Text("开始AR会话")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun SettingsScreen() {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(horizontal = 20.dp)
|
||||
) {
|
||||
Text(
|
||||
text = "设置",
|
||||
fontSize = 24.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
modifier = Modifier.padding(top = 20.dp, bottom = 24.dp)
|
||||
)
|
||||
|
||||
Card(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
colors = CardDefaults.cardColors(
|
||||
containerColor = MaterialTheme.colorScheme.surface
|
||||
),
|
||||
elevation = CardDefaults.cardElevation(defaultElevation = 2.dp)
|
||||
) {
|
||||
Column(modifier = Modifier.padding(16.dp)) {
|
||||
SettingsItem("通知设置", "管理应用通知")
|
||||
SettingsItem("隐私设置", "管理隐私权限")
|
||||
SettingsItem("账户设置", "管理账户信息")
|
||||
SettingsItem("关于应用", "版本信息和帮助")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun SettingsItem(title: String, description: String) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(vertical = 12.dp),
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Column {
|
||||
Text(
|
||||
text = title,
|
||||
fontSize = 16.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = MaterialTheme.colorScheme.onSurface
|
||||
)
|
||||
Text(
|
||||
text = description,
|
||||
fontSize = 14.sp,
|
||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.6f)
|
||||
)
|
||||
}
|
||||
Icon(
|
||||
imageVector = Icons.Default.ArrowForward,
|
||||
contentDescription = null,
|
||||
tint = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.4f)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun ProfileScreen() {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(horizontal = 20.dp)
|
||||
) {
|
||||
Text(
|
||||
text = "个人中心",
|
||||
fontSize = 24.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
modifier = Modifier.padding(top = 20.dp, bottom = 24.dp)
|
||||
)
|
||||
|
||||
Card(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(bottom = 16.dp),
|
||||
colors = CardDefaults.cardColors(
|
||||
containerColor = MaterialTheme.colorScheme.surface
|
||||
),
|
||||
elevation = CardDefaults.cardElevation(defaultElevation = 2.dp)
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier.padding(16.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Surface(
|
||||
modifier = Modifier.size(80.dp),
|
||||
color = MaterialTheme.colorScheme.primaryContainer,
|
||||
shape = CircleShape
|
||||
) {
|
||||
Box(contentAlignment = Alignment.Center) {
|
||||
Text(
|
||||
text = "李明",
|
||||
fontSize = 32.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = MaterialTheme.colorScheme.onPrimaryContainer
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(12.dp))
|
||||
|
||||
Text(
|
||||
text = "李明",
|
||||
fontSize = 20.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = MaterialTheme.colorScheme.onSurface
|
||||
)
|
||||
|
||||
Text(
|
||||
text = "高级工程师",
|
||||
fontSize = 14.sp,
|
||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.6f)
|
||||
)
|
||||
|
||||
Text(
|
||||
text = "设备部",
|
||||
fontSize = 14.sp,
|
||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.6f)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Card(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
colors = CardDefaults.cardColors(
|
||||
containerColor = MaterialTheme.colorScheme.surface
|
||||
),
|
||||
elevation = CardDefaults.cardElevation(defaultElevation = 2.dp)
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier.padding(16.dp)
|
||||
) {
|
||||
Text(
|
||||
text = "个人信息",
|
||||
fontSize = 16.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
modifier = Modifier.padding(bottom = 8.dp)
|
||||
)
|
||||
|
||||
ProfileItem("手机号", "138****1234")
|
||||
ProfileItem("邮箱", "liming@example.com")
|
||||
ProfileItem("工号", "A001234")
|
||||
ProfileItem("部门", "设备部")
|
||||
ProfileItem("职位", "高级工程师")
|
||||
}
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
Button(
|
||||
onClick = { /* TODO: Handle logout */ },
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(48.dp),
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
containerColor = MaterialTheme.colorScheme.error
|
||||
)
|
||||
) {
|
||||
Text(text = "退出登录", fontSize = 16.sp)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun ProfileItem(label: String, value: String) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(vertical = 8.dp),
|
||||
horizontalArrangement = Arrangement.SpaceBetween
|
||||
) {
|
||||
Text(
|
||||
text = label,
|
||||
fontSize = 14.sp,
|
||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.6f)
|
||||
)
|
||||
Text(
|
||||
text = value,
|
||||
fontSize = 14.sp,
|
||||
color = MaterialTheme.colorScheme.onSurface
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
fun ARScreenPreview() {
|
||||
XSynergyTheme {
|
||||
Surface {
|
||||
ARScreen()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
fun SettingsScreenPreview() {
|
||||
XSynergyTheme {
|
||||
Surface {
|
||||
SettingsScreen()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
fun ProfileScreenPreview() {
|
||||
XSynergyTheme {
|
||||
Surface {
|
||||
ProfileScreen()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
package com.xsynergy.android.ui.screens
|
||||
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.xsynergy.android.ui.theme.XSynergyTheme
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
data class HistoryItem(
|
||||
val id: String,
|
||||
val title: String,
|
||||
val date: Date,
|
||||
val duration: String,
|
||||
val participants: List<String>
|
||||
)
|
||||
|
||||
@Composable
|
||||
fun HistoryScreen() {
|
||||
val historyItems = remember {
|
||||
listOf(
|
||||
HistoryItem(
|
||||
id = "1",
|
||||
title = "设备检修会议",
|
||||
date = Calendar.getInstance().apply {
|
||||
set(Calendar.DAY_OF_MONTH, 15)
|
||||
set(Calendar.MONTH, Calendar.SEPTEMBER)
|
||||
set(Calendar.YEAR, 2024)
|
||||
}.time,
|
||||
duration = "45分钟",
|
||||
participants = listOf("王工", "李工程师", "张主管")
|
||||
),
|
||||
HistoryItem(
|
||||
id = "2",
|
||||
title = "项目评审会议",
|
||||
date = Calendar.getInstance().apply {
|
||||
set(Calendar.DAY_OF_MONTH, 14)
|
||||
set(Calendar.MONTH, Calendar.SEPTEMBER)
|
||||
set(Calendar.YEAR, 2024)
|
||||
}.time,
|
||||
duration = "60分钟",
|
||||
participants = listOf("张总", "王工程师", "李设计师")
|
||||
),
|
||||
HistoryItem(
|
||||
id = "3",
|
||||
title = "技术培训",
|
||||
date = Calendar.getInstance().apply {
|
||||
set(Calendar.DAY_OF_MONTH, 13)
|
||||
set(Calendar.MONTH, Calendar.SEPTEMBER)
|
||||
set(Calendar.YEAR, 2024)
|
||||
}.time,
|
||||
duration = "90分钟",
|
||||
participants = listOf("全体成员")
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(horizontal = 20.dp)
|
||||
) {
|
||||
Text(
|
||||
text = "历史记录",
|
||||
fontSize = 24.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
modifier = Modifier.padding(top = 20.dp, bottom = 24.dp)
|
||||
)
|
||||
|
||||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
verticalArrangement = Arrangement.spacedBy(12.dp)
|
||||
) {
|
||||
items(historyItems.size) { index ->
|
||||
HistoryCard(historyItems[index])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun HistoryCard(item: HistoryItem) {
|
||||
val dateFormat = SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.getDefault())
|
||||
|
||||
Card(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
colors = CardDefaults.cardColors(
|
||||
containerColor = MaterialTheme.colorScheme.surface
|
||||
),
|
||||
elevation = CardDefaults.cardElevation(defaultElevation = 2.dp)
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(16.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp)
|
||||
) {
|
||||
Text(
|
||||
text = item.title,
|
||||
fontSize = 16.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = MaterialTheme.colorScheme.onSurface
|
||||
)
|
||||
|
||||
Text(
|
||||
text = dateFormat.format(item.date),
|
||||
fontSize = 14.sp,
|
||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.6f)
|
||||
)
|
||||
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.SpaceBetween
|
||||
) {
|
||||
Text(
|
||||
text = "时长: ${item.duration}",
|
||||
fontSize = 14.sp,
|
||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.6f)
|
||||
)
|
||||
|
||||
Text(
|
||||
text = "参与: ${item.participants.joinToString(", ")}",
|
||||
fontSize = 14.sp,
|
||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.6f)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
fun HistoryScreenPreview() {
|
||||
XSynergyTheme {
|
||||
Surface {
|
||||
HistoryScreen()
|
||||
}
|
||||
}
|
||||
}
|
||||
193
app/src/main/java/com/xsynergy/android/ui/screens/LoginScreen.kt
Normal file
193
app/src/main/java/com/xsynergy/android/ui/screens/LoginScreen.kt
Normal file
@@ -0,0 +1,193 @@
|
||||
package com.xsynergy.android.ui.screens
|
||||
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.input.KeyboardType
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||
import com.xsynergy.android.R
|
||||
import com.xsynergy.android.ui.theme.XSynergyTheme
|
||||
import com.xsynergy.android.viewmodel.LoginViewModel
|
||||
|
||||
@Composable
|
||||
fun LoginScreen(
|
||||
viewModel: LoginViewModel = viewModel(),
|
||||
onLoginSuccess: () -> Unit = {}
|
||||
) {
|
||||
var phoneNumber by remember { mutableStateOf(viewModel.phoneNumber) }
|
||||
var verificationCode by remember { mutableStateOf(viewModel.verificationCode) }
|
||||
var rememberMe by remember { mutableStateOf(viewModel.rememberMe) }
|
||||
|
||||
val isCodeSent by remember { derivedStateOf { viewModel.isCodeSent } }
|
||||
val isLoading by remember { derivedStateOf { viewModel.isLoading } }
|
||||
val errorMessage by remember { derivedStateOf { viewModel.errorMessage } }
|
||||
val countdown by remember { derivedStateOf { viewModel.countdown } }
|
||||
|
||||
// Sync state with ViewModel
|
||||
LaunchedEffect(phoneNumber) {
|
||||
viewModel.phoneNumber = phoneNumber
|
||||
}
|
||||
LaunchedEffect(verificationCode) {
|
||||
viewModel.verificationCode = verificationCode
|
||||
}
|
||||
LaunchedEffect(rememberMe) {
|
||||
viewModel.rememberMe = rememberMe
|
||||
}
|
||||
|
||||
// Show error message
|
||||
errorMessage?.let { message ->
|
||||
LaunchedEffect(message) {
|
||||
// You could show a Snackbar here
|
||||
viewModel.clearError()
|
||||
}
|
||||
}
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(horizontal = 32.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.Center
|
||||
) {
|
||||
// Logo
|
||||
Text(
|
||||
text = "XSynergy",
|
||||
style = MaterialTheme.typography.titleLarge,
|
||||
color = MaterialTheme.colorScheme.primary,
|
||||
modifier = Modifier.padding(bottom = 60.dp)
|
||||
)
|
||||
|
||||
// Error message
|
||||
errorMessage?.let { message ->
|
||||
Text(
|
||||
text = message,
|
||||
color = MaterialTheme.colorScheme.error,
|
||||
modifier = Modifier.padding(bottom = 16.dp),
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
}
|
||||
|
||||
// Phone Number Input
|
||||
OutlinedTextField(
|
||||
value = phoneNumber,
|
||||
onValueChange = {
|
||||
if (it.length <= 11) phoneNumber = it
|
||||
},
|
||||
label = { Text("手机号") },
|
||||
placeholder = { Text("请输入手机号") },
|
||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Phone),
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(bottom = 16.dp),
|
||||
singleLine = true,
|
||||
enabled = !isLoading
|
||||
)
|
||||
|
||||
// Verification Code Input
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.spacedBy(12.dp)
|
||||
) {
|
||||
OutlinedTextField(
|
||||
value = verificationCode,
|
||||
onValueChange = {
|
||||
if (it.length <= 6) verificationCode = it
|
||||
},
|
||||
label = { Text("验证码") },
|
||||
placeholder = { Text("请输入验证码") },
|
||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
|
||||
modifier = Modifier.weight(1f),
|
||||
singleLine = true,
|
||||
enabled = !isLoading
|
||||
)
|
||||
|
||||
Button(
|
||||
onClick = {
|
||||
viewModel.sendVerificationCode()
|
||||
},
|
||||
modifier = Modifier.height(56.dp),
|
||||
enabled = phoneNumber.isNotEmpty() && !isLoading && countdown == 0
|
||||
) {
|
||||
Text(
|
||||
if (countdown > 0) "${countdown}s"
|
||||
else if (isCodeSent) "重新获取"
|
||||
else "获取验证码"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(32.dp))
|
||||
|
||||
// Login Button
|
||||
Button(
|
||||
onClick = {
|
||||
viewModel.login(onLoginSuccess)
|
||||
},
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(48.dp),
|
||||
enabled = phoneNumber.isNotEmpty() && verificationCode.isNotEmpty() && !isLoading
|
||||
) {
|
||||
if (isLoading) {
|
||||
CircularProgressIndicator(
|
||||
modifier = Modifier.size(24.dp),
|
||||
color = MaterialTheme.colorScheme.onPrimary
|
||||
)
|
||||
} else {
|
||||
Text("登录")
|
||||
}
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
// Remember Me Checkbox
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Checkbox(
|
||||
checked = rememberMe,
|
||||
onCheckedChange = { rememberMe = it },
|
||||
enabled = !isLoading
|
||||
)
|
||||
Text("记住我")
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
// Links
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.SpaceBetween
|
||||
) {
|
||||
TextButton(
|
||||
onClick = { /* TODO: Forgot password */ },
|
||||
enabled = !isLoading
|
||||
) {
|
||||
Text("忘记密码")
|
||||
}
|
||||
TextButton(
|
||||
onClick = { /* TODO: SSO login */ },
|
||||
enabled = !isLoading
|
||||
) {
|
||||
Text("SSO登录")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
fun LoginScreenPreview() {
|
||||
XSynergyTheme {
|
||||
LoginScreen()
|
||||
}
|
||||
}
|
||||
100
app/src/main/java/com/xsynergy/android/ui/screens/MainScreen.kt
Normal file
100
app/src/main/java/com/xsynergy/android/ui/screens/MainScreen.kt
Normal file
@@ -0,0 +1,100 @@
|
||||
package com.xsynergy.android.ui.screens
|
||||
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.navigation.compose.NavHost
|
||||
import androidx.navigation.compose.composable
|
||||
import androidx.navigation.compose.currentBackStackEntryAsState
|
||||
import androidx.navigation.compose.rememberNavController
|
||||
import com.xsynergy.android.ui.navigation.BottomNavItem
|
||||
import com.xsynergy.android.ui.navigation.bottomNavItems
|
||||
|
||||
@Composable
|
||||
fun MainScreen() {
|
||||
val navController = rememberNavController()
|
||||
|
||||
Scaffold(
|
||||
bottomBar = {
|
||||
BottomAppBar(
|
||||
containerColor = MaterialTheme.colorScheme.surface,
|
||||
tonalElevation = 8.dp
|
||||
) {
|
||||
val navBackStackEntry by navController.currentBackStackEntryAsState()
|
||||
val currentRoute = navBackStackEntry?.destination?.route
|
||||
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 8.dp),
|
||||
horizontalArrangement = Arrangement.SpaceEvenly,
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
bottomNavItems.forEach { item ->
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.clickable {
|
||||
navController.navigate(item.route) {
|
||||
popUpTo(navController.graph.startDestinationId) {
|
||||
saveState = true
|
||||
}
|
||||
launchSingleTop = true
|
||||
restoreState = true
|
||||
}
|
||||
}
|
||||
.padding(vertical = 8.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Icon(
|
||||
imageVector = item.icon,
|
||||
contentDescription = item.title,
|
||||
tint = if (currentRoute == item.route)
|
||||
MaterialTheme.colorScheme.primary
|
||||
else
|
||||
MaterialTheme.colorScheme.onSurface.copy(alpha = 0.6f)
|
||||
)
|
||||
Text(
|
||||
text = item.title,
|
||||
fontSize = 12.sp,
|
||||
color = if (currentRoute == item.route)
|
||||
MaterialTheme.colorScheme.primary
|
||||
else
|
||||
MaterialTheme.colorScheme.onSurface.copy(alpha = 0.6f)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
) { paddingValues ->
|
||||
NavHost(
|
||||
navController = navController,
|
||||
startDestination = BottomNavItem.Dashboard.route,
|
||||
modifier = Modifier.padding(paddingValues)
|
||||
) {
|
||||
composable(BottomNavItem.Dashboard.route) {
|
||||
DashboardScreen()
|
||||
}
|
||||
composable(BottomNavItem.History.route) {
|
||||
HistoryScreen()
|
||||
}
|
||||
composable(BottomNavItem.ARSession.route) {
|
||||
ARSessionScreen()
|
||||
}
|
||||
composable(BottomNavItem.Contacts.route) {
|
||||
ContactsScreen()
|
||||
}
|
||||
composable(BottomNavItem.Settings.route) {
|
||||
SettingsScreen()
|
||||
}
|
||||
composable(BottomNavItem.Profile.route) {
|
||||
ProfileScreen()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
20
app/src/main/java/com/xsynergy/android/ui/theme/Color.kt
Normal file
20
app/src/main/java/com/xsynergy/android/ui/theme/Color.kt
Normal file
@@ -0,0 +1,20 @@
|
||||
package com.xsynergy.android.ui.theme
|
||||
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
||||
// Primary colors from UI design
|
||||
val Primary = Color(0xFF0A7CFF)
|
||||
val Secondary = Color(0xFFF0F8FF)
|
||||
val Accent = Color(0xFFFFD700)
|
||||
val Danger = Color(0xFFFF4D4F)
|
||||
val Success = Color(0xFF52C41A)
|
||||
|
||||
// Text colors
|
||||
val TextPrimary = Color(0xFF333333)
|
||||
val TextSecondary = Color(0xFF888888)
|
||||
val TextWhite = Color(0xFFFFFFFF)
|
||||
|
||||
// Background colors
|
||||
val Background = Color(0xFFF5F5F5)
|
||||
val Surface = Color(0xFFFFFFFF)
|
||||
val SurfaceVariant = Color(0xFFF8F9FA)
|
||||
53
app/src/main/java/com/xsynergy/android/ui/theme/Theme.kt
Normal file
53
app/src/main/java/com/xsynergy/android/ui/theme/Theme.kt
Normal file
@@ -0,0 +1,53 @@
|
||||
package com.xsynergy.android.ui.theme
|
||||
|
||||
import androidx.compose.foundation.isSystemInDarkTheme
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.darkColorScheme
|
||||
import androidx.compose.material3.lightColorScheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
||||
private val DarkColorScheme = darkColorScheme(
|
||||
primary = Primary,
|
||||
secondary = Secondary,
|
||||
tertiary = Accent,
|
||||
onPrimary = TextWhite,
|
||||
onSecondary = TextPrimary,
|
||||
background = Color(0xFF1C1C1C),
|
||||
onBackground = TextWhite,
|
||||
surface = Color(0xFF2C2C2C),
|
||||
onSurface = TextWhite,
|
||||
error = Danger,
|
||||
onError = TextWhite
|
||||
)
|
||||
|
||||
private val LightColorScheme = lightColorScheme(
|
||||
primary = Primary,
|
||||
secondary = Secondary,
|
||||
tertiary = Accent,
|
||||
onPrimary = TextWhite,
|
||||
onSecondary = TextPrimary,
|
||||
background = Background,
|
||||
onBackground = TextPrimary,
|
||||
surface = Surface,
|
||||
onSurface = TextPrimary,
|
||||
error = Danger,
|
||||
onError = TextWhite
|
||||
)
|
||||
|
||||
@Composable
|
||||
fun XSynergyTheme(
|
||||
darkTheme: Boolean = isSystemInDarkTheme(),
|
||||
content: @Composable () -> Unit
|
||||
) {
|
||||
val colorScheme = when {
|
||||
darkTheme -> DarkColorScheme
|
||||
else -> LightColorScheme
|
||||
}
|
||||
|
||||
MaterialTheme(
|
||||
colorScheme = colorScheme,
|
||||
typography = Typography,
|
||||
content = content
|
||||
)
|
||||
}
|
||||
32
app/src/main/java/com/xsynergy/android/ui/theme/Type.kt
Normal file
32
app/src/main/java/com/xsynergy/android/ui/theme/Type.kt
Normal file
@@ -0,0 +1,32 @@
|
||||
package com.xsynergy.android.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
|
||||
),
|
||||
titleLarge = TextStyle(
|
||||
fontFamily = FontFamily.Default,
|
||||
fontWeight = FontWeight.Bold,
|
||||
fontSize = 32.sp,
|
||||
lineHeight = 40.sp,
|
||||
letterSpacing = 0.sp
|
||||
),
|
||||
labelSmall = TextStyle(
|
||||
fontFamily = FontFamily.Default,
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontSize = 11.sp,
|
||||
lineHeight = 16.sp,
|
||||
letterSpacing = 0.5.sp
|
||||
)
|
||||
)
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.xsynergy.android.viewmodel
|
||||
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class LoginViewModel : ViewModel() {
|
||||
var phoneNumber by mutableStateOf("")
|
||||
var verificationCode by mutableStateOf("")
|
||||
var isCodeSent by mutableStateOf(false)
|
||||
var rememberMe by mutableStateOf(false)
|
||||
var isLoading by mutableStateOf(false)
|
||||
var errorMessage by mutableStateOf<String?>(null)
|
||||
var countdown by mutableStateOf(0)
|
||||
|
||||
fun sendVerificationCode() {
|
||||
if (phoneNumber.isEmpty() || !isValidPhoneNumber(phoneNumber)) {
|
||||
errorMessage = "请输入有效的手机号"
|
||||
return
|
||||
}
|
||||
|
||||
isLoading = true
|
||||
viewModelScope.launch {
|
||||
try {
|
||||
// Simulate network delay
|
||||
delay(1000)
|
||||
|
||||
// TODO: Implement actual Firebase SMS verification
|
||||
isCodeSent = true
|
||||
errorMessage = null
|
||||
startCountdown()
|
||||
} catch (e: Exception) {
|
||||
errorMessage = "发送验证码失败,请重试"
|
||||
} finally {
|
||||
isLoading = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun login(onLoginSuccess: () -> Unit) {
|
||||
if (phoneNumber.isEmpty() || !isValidPhoneNumber(phoneNumber)) {
|
||||
errorMessage = "请输入有效的手机号"
|
||||
return
|
||||
}
|
||||
|
||||
if (verificationCode.isEmpty() || verificationCode.length != 6) {
|
||||
errorMessage = "请输入6位验证码"
|
||||
return
|
||||
}
|
||||
|
||||
isLoading = true
|
||||
viewModelScope.launch {
|
||||
try {
|
||||
// Simulate network delay
|
||||
delay(1500)
|
||||
|
||||
// TODO: Implement actual Firebase verification
|
||||
if (verificationCode == "123456") { // Mock verification
|
||||
errorMessage = null
|
||||
onLoginSuccess()
|
||||
} else {
|
||||
errorMessage = "验证码错误"
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
errorMessage = "登录失败,请重试"
|
||||
} finally {
|
||||
isLoading = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun startCountdown() {
|
||||
countdown = 60
|
||||
viewModelScope.launch {
|
||||
while (countdown > 0) {
|
||||
delay(1000)
|
||||
countdown--
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun isValidPhoneNumber(phone: String): Boolean {
|
||||
return phone.matches(Regex("^1[3-9]\\d{9}$"))
|
||||
}
|
||||
|
||||
fun clearError() {
|
||||
errorMessage = null
|
||||
}
|
||||
}
|
||||
1
app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
1
app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
@@ -0,0 +1 @@
|
||||
iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==
|
||||
1
app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
1
app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
@@ -0,0 +1 @@
|
||||
iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==
|
||||
1
app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
1
app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
@@ -0,0 +1 @@
|
||||
iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==
|
||||
1
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
1
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
@@ -0,0 +1 @@
|
||||
iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==
|
||||
1
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
1
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
@@ -0,0 +1 @@
|
||||
iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==
|
||||
18
app/src/main/res/values/colors.xml
Normal file
18
app/src/main/res/values/colors.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="primary">#0A7CFF</color>
|
||||
<color name="primary_dark">#0066CC</color>
|
||||
<color name="primary_light">#E6F2FF</color>
|
||||
<color name="secondary">#F0F8FF</color>
|
||||
<color name="secondary_dark">#B3D9FF</color>
|
||||
<color name="accent">#FFD700</color>
|
||||
<color name="danger">#FF4D4F</color>
|
||||
<color name="success">#52C41A</color>
|
||||
<color name="text_primary">#333333</color>
|
||||
<color name="text_secondary">#888888</color>
|
||||
<color name="text_white">#FFFFFF</color>
|
||||
<color name="background">#F5F5F5</color>
|
||||
<color name="surface">#FFFFFF</color>
|
||||
<color name="white">#FFFFFF</color>
|
||||
<color name="black">#000000</color>
|
||||
</resources>
|
||||
16
app/src/main/res/values/strings.xml
Normal file
16
app/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">XSynergy</string>
|
||||
<string name="login_title">登录</string>
|
||||
<string name="phone_number_hint">请输入手机号</string>
|
||||
<string name="verification_code_hint">请输入验证码</string>
|
||||
<string name="get_verification_code">获取验证码</string>
|
||||
<string name="resend_verification_code">重新获取</string>
|
||||
<string name="login">登录</string>
|
||||
<string name="remember_me">记住我</string>
|
||||
<string name="forgot_password">忘记密码</string>
|
||||
<string name="sso_login">SSO登录</string>
|
||||
<string name="invalid_phone_number">请输入有效的手机号</string>
|
||||
<string name="invalid_verification_code">请输入有效的验证码</string>
|
||||
<string name="verification_code_sent">验证码已发送</string>
|
||||
</resources>
|
||||
12
app/src/main/res/values/themes.xml
Normal file
12
app/src/main/res/values/themes.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<style name="Theme.XSynergy" parent="android:Theme.Material.Light.NoActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="android:colorPrimary">@color/primary</item>
|
||||
<item name="android:colorPrimaryDark">@color/primary_dark</item>
|
||||
<item name="android:colorAccent">@color/primary</item>
|
||||
<item name="android:windowBackground">@color/background</item>
|
||||
<item name="android:statusBarColor">@color/primary_dark</item>
|
||||
<item name="android:windowLightStatusBar">true</item>
|
||||
</style>
|
||||
</resources>
|
||||
4
app/src/main/res/xml/backup_rules.xml
Normal file
4
app/src/main/res/xml/backup_rules.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<full-backup-content>
|
||||
<exclude domain="sharedpref" path="login_preferences.xml"/>
|
||||
</full-backup-content>
|
||||
10
app/src/main/res/xml/data_extraction_rules.xml
Normal file
10
app/src/main/res/xml/data_extraction_rules.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<data-extraction-rules>
|
||||
<locale-config allowBackup="true"/>
|
||||
<cloud-backup>
|
||||
<exclude domain="sharedpref" path="login_preferences.xml"/>
|
||||
</cloud-backup>
|
||||
<device-transfer>
|
||||
<exclude domain="sharedpref" path="login_preferences.xml"/>
|
||||
</device-transfer>
|
||||
</data-extraction-rules>
|
||||
23
build.gradle
Normal file
23
build.gradle
Normal file
@@ -0,0 +1,23 @@
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.9.24'
|
||||
ext.compose_version = '1.6.8'
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:8.5.0'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
13
gradle.properties
Normal file
13
gradle.properties
Normal file
@@ -0,0 +1,13 @@
|
||||
# Project-wide Gradle settings.
|
||||
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||
org.gradle.daemon=true
|
||||
org.gradle.parallel=true
|
||||
org.gradle.configureondemand=false
|
||||
|
||||
# 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
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
|
||||
# Kotlin code style for this project: "official" or "obsolete":
|
||||
kotlin.code.style=official
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
7
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
7
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
251
gradlew
vendored
Executable file
251
gradlew
vendored
Executable file
@@ -0,0 +1,251 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015 the original 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.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# 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 ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH="\\\"\\\""
|
||||
|
||||
|
||||
# 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
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
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
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# 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"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
94
gradlew.bat
vendored
Normal file
94
gradlew.bat
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
@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
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@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=.
|
||||
@rem This is normally unused
|
||||
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% equ 0 goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 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!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
1
local.properties
Normal file
1
local.properties
Normal file
@@ -0,0 +1 @@
|
||||
sdk.dir=/Users/qianchao/Library/Android/sdk
|
||||
167
prd.md
Normal file
167
prd.md
Normal file
@@ -0,0 +1,167 @@
|
||||
# **AR远程协作APP (代号:Synergy Lens) \- 产品需求文档 (PRD)**
|
||||
|
||||
### **1\. 产品概述 (Product Overview)**
|
||||
|
||||
### **1.1 产品简介**
|
||||
|
||||
XSynergy是一款面向企业用户的AR远程协作应用。它通过结合实时音视频、增强现实(AR)标注和人工智能(AI)技术,使一线现场人员能够与远程专家进行“身临其境”的互动,高效解决复杂问题,旨在打破地理限制,降低差旅成本,提升协作效率和知识传承。
|
||||
|
||||
### **1.2 目标用户 (Target Audience)**
|
||||
|
||||
* **一线现场人员 (Field Technician)**:如设备维修工程师、产线操作员、医疗巡检人员。他们需要实时、精准的远程指导。
|
||||
* **远程专家 (Remote Expert)**:如资深技术专家、产品设计师、医疗顾问。他们需要清晰地了解现场情况并提供精确指令。
|
||||
* **项目/团队管理者 (Manager)**:需要监督协作过程、回顾协作内容、管理团队知识。
|
||||
|
||||
### **1.3 核心目标 (Goals)**
|
||||
|
||||
* **提升问题解决效率**:通过AR标注和实时音视频,将专家指导的平均解决时间缩短30%。
|
||||
* **降低运营成本**:减少专家差旅需求,预计每年可为企业节省20%的相关费用。
|
||||
* **赋能一线员工**:通过AI知识库和会议回放,帮助一线人员快速成长,沉淀组织知识。
|
||||
|
||||
### **2\. 功能需求详述 (Functional Requirements)**
|
||||
|
||||
### **2.1 用户与账户模块 (User & Account)**
|
||||
|
||||
* **FR-2.1.1 用户登录**
|
||||
* **用户故事**:作为一名企业员工,我希望可以通过我的企业账号(如SSO、手机号/验证码)安全地登录APP,以便访问我的协作空间和组织信息。
|
||||
* **功能描述**:
|
||||
1. 支持手机号+验证码登录方式。
|
||||
2. 支持企业单点登录(SSO)。
|
||||
3. 提供“记住我”功能,保持登录状态。
|
||||
4. 包含“忘记密码”流程(针对非SSO用户)。
|
||||
* **验收标准**:用户可以成功登录并进入APP主界面;登录失败时有明确的错误提示。
|
||||
* **FR-2.1.2 用户登出**
|
||||
* **用户故事**:作为一名用户,我希望能从APP中安全退出登录,以保护我的账户信息。
|
||||
* **功能描述**:在“我的”或“设置”页面提供“退出登录”按钮,点击后清除本地登录凭证并返回登录页面。
|
||||
* **验收标准**:用户点击退出后,无法在未重新登录的情况下访问需要授权的页面。
|
||||
|
||||
### **2.2 协作会话模块 (Collaboration Session)**
|
||||
|
||||
* **FR-2.2.1 发起即时协作**
|
||||
* **用户故事**:作为一名现场技术员,当我遇到紧急问题时,我希望能立即向组织内的专家发起视频协作请求。
|
||||
* **功能描述**:
|
||||
1. 主界面提供“发起协作”入口。
|
||||
2. 用户可以从组织架构中选择一位或多位成员发起呼叫。
|
||||
3. 被呼叫方会收到系统推送通知,可选择接听或拒绝。
|
||||
* **验收标准**:呼叫成功发起,被叫方能收到通知并进行响应。
|
||||
* **FR-2.2.2 预约协作**
|
||||
* **用户故事**:作为一名项目经理,我希望能提前预约一个多方协作会议,并设定主题、时间和参与人,系统能自动提醒相关人员。
|
||||
* **功能描述**:
|
||||
1. 提供“预约协作”功能入口。
|
||||
2. 用户可设置会议主题、选择开始/结束时间、添加参会人员、填写会议描述。
|
||||
3. 预约成功后,系统向所有参会人发送日历邀请和APP内通知。
|
||||
4. 在会议开始前15分钟,系统再次发送提醒通知。(以日历提醒和APP内消息推送的方式)
|
||||
* **验收标准**:预约信息准确无误,所有参会人能按时收到通知和提醒。(考虑到国内安卓手机限制较多且接口不统一,APP内部推送消息无法在手机端弹出提醒的话,不视为功能实现失败。)
|
||||
* **FR-2.2.3 邀请与加入**
|
||||
* **用户故事**:作为会议发起人,我希望能通过链接或一个简单的会议码,快速邀请组织外或未在联系人列表中的人加入协作。
|
||||
* **功能描述**:
|
||||
1. 每个协作会话(即时或预约)都生成一个唯一的分享链接和一个6位数字的会议码。
|
||||
2. 用户可以通过社交应用(微信、钉钉等)分享链接(分享为链接复制,形式同腾讯会议)。
|
||||
3. APP主界面提供“加入协作”入口,用户可输入6位会议码加入。
|
||||
4. 通过链接加入时,自动拉起APP并进入会议。
|
||||
* **验收标准**:用户可以通过链接和会议码两种方式成功加入指定的协作会议。
|
||||
|
||||
### **2.3 协作中功能模块 (In-Session Features)**
|
||||
|
||||
* **FR-2.3.1 基础音视频控制**
|
||||
* **用户故事**:作为参会者,我希望能自由控制自己的麦克风和摄像头,以便在需要时静音或关闭画面。
|
||||
* **功能描述**:会议界面提供清晰的图标按钮,用于一键禁用/启用麦克风和摄像头。图标状态需明确反映当前设备状态(开/关)。
|
||||
* **验收标准**:用户可以随时开启或关闭自己的音视频输入,其他参会者能实时看到状态变化。
|
||||
* **FR-2.3.2 AR标注协作**
|
||||
* **用户故事**:作为远程专家,我希望能在我方屏幕上,对现场人员传输回来的实时视频画面进行3D空间标注(如画箭头、框选),且标注能稳定地附着在现实物体上,以便清晰地指示操作位置。
|
||||
* **功能描述**:
|
||||
1. 提供多种标注工具:箭头、自由曲线、矩形框。
|
||||
2. 支持选择不同颜色进行标注。
|
||||
3. 标注内容通过AR技术“冻结”在三维空间中,即使用户移动摄像头,标注也会停留在原来的物理位置上。
|
||||
4. 提供“清除”按钮,可清除自己或全部的标注。
|
||||
* **验收标准**:AR标注延迟低,跟踪稳定,在现场人员视角中清晰可见。
|
||||
* **FR-2.3.3 白板涂鸦协作**
|
||||
* **用户故事**:作为参会者,当我们需要讨论流程图或进行头脑风暴时,我希望能打开一个共享的虚拟白板,所有人都可以在上面实时涂鸦和书写。
|
||||
* **功能描述**:
|
||||
1. 会议中可开启“白板模式”,视频画面切换为共享白板。
|
||||
2. 提供画笔、文本输入、形状工具和橡皮擦。
|
||||
3. 所有参会者的操作实时同步。
|
||||
4. 支持白板内容截图保存。
|
||||
* **验收标准**:白板操作流畅,同步延迟低,所有用户看到的内容完全一致。
|
||||
* **FR-2.3.4 激光笔标注**
|
||||
* **用户故事**:作为远程专家,我希望能有一个激光笔工具,在我讲解时,可以在对方的视频画面上实时指示出我正在关注的点,而不会留下永久标记。
|
||||
* **功能描述**:提供“激光笔”工具。专家在自己屏幕上长按并移动手指(或在web端长按鼠标进行拖动),现场人员的屏幕上会实时显示一个跟随移动的光点或小图标。手指松开后光点消失。
|
||||
* **验收标准**:激光笔指示实时同步,无明显延迟,能准确传达专家意图。
|
||||
* **FR-2.3.5 屏幕共享**
|
||||
* **用户故事**:作为参会者,我希望能将我的手机屏幕内容共享给会议中的其他人,以便展示APP操作或数据图表。
|
||||
* **功能描述**:
|
||||
1. 提供“屏幕共享”功能按钮。
|
||||
2. 用户授权后,将其整个手机屏幕或指定应用画面作为视频流发送给其他参会者。
|
||||
3. 共享期间,屏幕边缘有明显提示(如红色边框),告知用户正在共享。
|
||||
* **验收标准**:屏幕共享画面清晰流畅,其他用户可以正常观看。
|
||||
* **FR-2.3.6 文件共享与播放**
|
||||
* **用户故事**:作为专家,我希望能向现场人员发送技术手册(PDF/Word)或操作演示视频(MP4),并能在会议中共同观看和讨论。
|
||||
* **功能描述**:
|
||||
1. 提供“发送文件”功能,支持从本地上传PDF, Word, MP4等格式文件。
|
||||
2. 文件发送给指定的一位或全部参会者。
|
||||
3. 接收方收到文件后可下载到本地。
|
||||
4. 发起方可以开启“共同播放”模式,所有人的界面上会同步播放该视频或展示该文档,并支持翻页、暂停等同步操作。(此功能需要讨论,非优先项)
|
||||
* **验收标准**:文件能成功发送和接收;共同播放/阅览时,所有人的视图保持同步。
|
||||
|
||||
### **2.4 AI能力模块 (AI Capabilities)**
|
||||
|
||||
* **FR-2.4.1 实时语音转文字与会议纪要**
|
||||
* **用户故事**:作为一名参会者,我希望能看到实时的语音转文字字幕,并在会后自动生成一份包含关键决策和待办事项的会议纪要,以减少我的记录工作。
|
||||
* **功能描述**:
|
||||
1. 会议中可开启“实时字幕”功能,将所有人的发言实时转化为文字显示在屏幕上。
|
||||
2. 会议结束后,AI自动处理录音,生成结构化的会议纪要,包括:会议摘要、议题列表、关键决策、待办事项(Action Items)及负责人。
|
||||
3. 会议纪要与会议回放关联,存储在历史记录中。
|
||||
* **验收标准**:语音转文字准确率不低于90%;会议纪要能准确提炼核心信息。
|
||||
* **FR-2.4.2 AI知识库查询**
|
||||
* **用户故事**:作为现场人员,在协作过程中,我希望能通过一个对话框,快速查询公司内部知识库(如设备故障手册、标准操作流程),以便快速找到参考信息。
|
||||
* **功能描述**:
|
||||
1. 会议界面提供一个“AI助手”入口,点击或语音激活后弹出对话框。
|
||||
2. 用户输入自然语言问题(如“E-101泵的常见故障代码及解决方案”)。
|
||||
3. AI助手基于后台接入的企业知识库进行检索,并以对话形式返回最相关的答案和文档链接。
|
||||
* **验收标准**:AI助手能理解用户意图,并从知识库中返回准确、相关的答案。
|
||||
|
||||
### **2.5 其他模块 (Miscellaneous)**
|
||||
|
||||
* **FR-2.5.1 会议回放**
|
||||
* **用户故事**:作为一名项目经理或未能参会的人员,我希望能随时查看历史会议的完整录像(包含AR标注),以便复盘问题或了解会议内容。
|
||||
* **功能描述**:
|
||||
1. 所有协作会话默认开启云端录制。
|
||||
2. 用户可以在“历史记录”中找到过去的会议列表。
|
||||
3. 点击即可播放会议录像,录像需完整重现当时的视频、音频、AR标注、白板、文件共享等所有协作信息。
|
||||
* **验收标准**:回放内容与实际协作过程完全一致,播放流畅。
|
||||
* **FR-2.5.2 组织架构查看**
|
||||
* **用户故事**:作为一名员工,我希望能方便地查看公司的组织架构树,快速找到并联系到我需要的同事。
|
||||
* **功能描述**:
|
||||
1. 提供“通讯录”或“组织”入口。
|
||||
2. 以树状结构展示公司部门和人员。
|
||||
3. 支持按姓名、部门、职位进行搜索。
|
||||
4. 点击人员可查看其联系方式并直接发起协作。
|
||||
* **验收标准**:组织架构数据准确,搜索功能可用,能快速定位到目标同事。
|
||||
|
||||
### **3\. 非功能性需求 (Non-Functional Requirements)**
|
||||
|
||||
* **NF-3.1 性能 (Performance)**
|
||||
* 音视频通话延迟低于200ms。
|
||||
* AR标注跟踪刷新率不低于30fps。
|
||||
* APP冷启动时间小于3秒。
|
||||
* **NF-3.2 兼容性 (Compatibility)**
|
||||
* 支持Android 8.0及以上版本。
|
||||
* 要求设备支持ARCore。
|
||||
* **NF-3.3 安全性 (Security)**
|
||||
* 所有通信数据(音视频、信令、文件)均采用端到端加密。
|
||||
* 用户数据存储符合GDPR或相关数据保护法规。
|
||||
* **NF-3.4 用户体验 (Usability)**
|
||||
* 界面设计简洁直观,关键操作按钮尺寸足够大,易于在移动或工业环境中单手操作。
|
||||
* 网络不稳定时,应优先保证音频清晰度,并有明确的网络状态提示。
|
||||
|
||||
### **4\. 设计与AI集成指南 (Design & AI Integration)**
|
||||
|
||||
* **UI/UE设计指南**:
|
||||
* **核心原则**:信息降噪,聚焦于协作视图。避免不必要的UI元素干扰现场人员的视线。
|
||||
* **AR交互**:AR标注工具栏应设计为可收缩式,默认最小化。标注的视觉效果应有足够的对比度,以适应各种复杂的现场环境光线。
|
||||
* **手势操作**:考虑引入简单的手势操作,如双击屏幕清除最后一次标注,以提升操作效率。
|
||||
* **AI模型集成指南**:
|
||||
* **语音转文字 (STT)**:需选用或训练针对特定行业术语(如机械、医疗)进行优化的模型,以提高识别准确率。模型需在端侧或低延迟的云端运行,保证实时性。
|
||||
* **会议纪要生成**:采用大语言模型(LLM)进行文本摘要和信息提取。模型需被调整以准确识别“决策”、“任务分配”等关键意图。
|
||||
* **知识库查询**:建议采用RAG(检索增强生成)架构。后端需建立高效的文档索引,前端AI助手通过语义搜索匹配最相关的知识片段,并由LLM整合后生成自然语言答案。
|
||||
|
||||
2
settings.gradle
Normal file
2
settings.gradle
Normal file
@@ -0,0 +1,2 @@
|
||||
include ':app'
|
||||
rootProject.name = "XSynergy"
|
||||
Reference in New Issue
Block a user