neoagent 2.3.1-beta.20 → 2.3.1-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/flutter_app/.metadata +42 -0
- package/flutter_app/README.md +21 -0
- package/flutter_app/analysis_options.yaml +32 -0
- package/flutter_app/android/app/build.gradle.kts +109 -0
- package/flutter_app/android/app/src/debug/AndroidManifest.xml +7 -0
- package/flutter_app/android/app/src/main/AndroidManifest.xml +147 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/MainActivity.kt +747 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/health/HealthConnectGateway.kt +280 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/health/HealthSyncNotifications.kt +113 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/health/HealthSyncPayload.kt +57 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/health/HealthSyncScheduler.kt +78 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/health/HealthSyncWorker.kt +253 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/health/PermissionsRationaleActivity.kt +46 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/recording/RecordingBootReceiver.kt +21 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/recording/RecordingForegroundService.kt +586 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/recording/RecordingStateStore.kt +78 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/recording/RecordingUploadClient.kt +104 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/widgets/AiHomeWidgetProvider.kt +457 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/widgets/AiWidgetStore.kt +194 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/widgets/VoiceLaunchWidgetProvider.kt +67 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/widgets/WidgetConfigActivity.kt +228 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/widgets/WidgetSyncScheduler.kt +72 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/widgets/WidgetSyncWorker.kt +186 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/widgets/WidgetTaskRunWorker.kt +210 -0
- package/flutter_app/android/app/src/main/res/drawable/launch_background.xml +12 -0
- package/flutter_app/android/app/src/main/res/drawable/neoagent_ai_widget_bg.xml +11 -0
- package/flutter_app/android/app/src/main/res/drawable/neoagent_ai_widget_task_bg.xml +8 -0
- package/flutter_app/android/app/src/main/res/drawable-v21/launch_background.xml +12 -0
- package/flutter_app/android/app/src/main/res/layout/neoagent_ai_widget.xml +138 -0
- package/flutter_app/android/app/src/main/res/layout/neoagent_ai_widget_task_row.xml +52 -0
- package/flutter_app/android/app/src/main/res/layout/neoagent_voice_widget.xml +49 -0
- package/flutter_app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/flutter_app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/flutter_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/flutter_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/flutter_app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/flutter_app/android/app/src/main/res/values/strings.xml +12 -0
- package/flutter_app/android/app/src/main/res/values/styles.xml +18 -0
- package/flutter_app/android/app/src/main/res/values-night/styles.xml +18 -0
- package/flutter_app/android/app/src/main/res/xml/file_paths.xml +6 -0
- package/flutter_app/android/app/src/main/res/xml/neoagent_ai_widget_info.xml +12 -0
- package/flutter_app/android/app/src/main/res/xml/neoagent_voice_widget_info.xml +12 -0
- package/flutter_app/android/app/src/profile/AndroidManifest.xml +7 -0
- package/flutter_app/android/build.gradle.kts +24 -0
- package/flutter_app/android/ci-release.keystore +0 -0
- package/flutter_app/android/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/flutter_app/android/gradle.properties +3 -0
- package/flutter_app/android/key.properties +4 -0
- package/flutter_app/android/settings.gradle.kts +26 -0
- package/flutter_app/assets/branding/app_icon_1024.png +0 -0
- package/flutter_app/assets/branding/app_icon_128.png +0 -0
- package/flutter_app/assets/branding/app_icon_192.png +0 -0
- package/flutter_app/assets/branding/app_icon_256.png +0 -0
- package/flutter_app/assets/branding/app_icon_32.png +0 -0
- package/flutter_app/assets/branding/app_icon_512.png +0 -0
- package/flutter_app/assets/branding/app_icon_64.png +0 -0
- package/flutter_app/assets/branding/tray_icon_template.png +0 -0
- package/flutter_app/lib/features/location/location_service.dart +119 -0
- package/flutter_app/lib/features/notifications/notification_interceptor.dart +97 -0
- package/flutter_app/lib/main.dart +23057 -0
- package/flutter_app/lib/main_app_shell.dart +1682 -0
- package/flutter_app/lib/main_integrations.dart +931 -0
- package/flutter_app/lib/main_launcher.dart +959 -0
- package/flutter_app/lib/main_launcher_entry.dart +5 -0
- package/flutter_app/lib/main_models.dart +3473 -0
- package/flutter_app/lib/main_shared.dart +2861 -0
- package/flutter_app/lib/main_theme.dart +204 -0
- package/flutter_app/lib/main_voice_assistant.dart +831 -0
- package/flutter_app/lib/src/android_apk_drop_zone.dart +32 -0
- package/flutter_app/lib/src/android_apk_drop_zone_stub.dart +16 -0
- package/flutter_app/lib/src/android_apk_drop_zone_web.dart +348 -0
- package/flutter_app/lib/src/android_app_installer.dart +22 -0
- package/flutter_app/lib/src/android_app_installer_io.dart +122 -0
- package/flutter_app/lib/src/android_app_installer_stub.dart +21 -0
- package/flutter_app/lib/src/android_launcher_bridge.dart +239 -0
- package/flutter_app/lib/src/app_launch_bridge.dart +29 -0
- package/flutter_app/lib/src/app_release_updater.dart +511 -0
- package/flutter_app/lib/src/backend_client.dart +1833 -0
- package/flutter_app/lib/src/desktop_companion.dart +2 -0
- package/flutter_app/lib/src/desktop_companion_actions.dart +586 -0
- package/flutter_app/lib/src/desktop_companion_io.dart +538 -0
- package/flutter_app/lib/src/desktop_companion_stub.dart +59 -0
- package/flutter_app/lib/src/desktop_native_bridge.dart +91 -0
- package/flutter_app/lib/src/desktop_screen_capture.dart +21 -0
- package/flutter_app/lib/src/desktop_screen_capture_io.dart +142 -0
- package/flutter_app/lib/src/desktop_screen_capture_stub.dart +12 -0
- package/flutter_app/lib/src/diagnostics_logger.dart +119 -0
- package/flutter_app/lib/src/health_bridge.dart +136 -0
- package/flutter_app/lib/src/live_voice_capture.dart +85 -0
- package/flutter_app/lib/src/messaging_access_summary.dart +46 -0
- package/flutter_app/lib/src/network/app_http_client.dart +53 -0
- package/flutter_app/lib/src/network/app_http_client_factory.dart +6 -0
- package/flutter_app/lib/src/network/app_http_client_io.dart +138 -0
- package/flutter_app/lib/src/network/app_http_client_stub.dart +3 -0
- package/flutter_app/lib/src/network/app_http_client_web.dart +94 -0
- package/flutter_app/lib/src/oauth_launcher.dart +33 -0
- package/flutter_app/lib/src/oauth_launcher_io.dart +77 -0
- package/flutter_app/lib/src/oauth_launcher_stub.dart +33 -0
- package/flutter_app/lib/src/oauth_launcher_web.dart +107 -0
- package/flutter_app/lib/src/recording_bridge.dart +232 -0
- package/flutter_app/lib/src/recording_bridge_io.dart +1019 -0
- package/flutter_app/lib/src/recording_bridge_stub.dart +120 -0
- package/flutter_app/lib/src/recording_bridge_web.dart +689 -0
- package/flutter_app/lib/src/recording_payloads.dart +86 -0
- package/flutter_app/lib/src/theme/palette.dart +81 -0
- package/flutter_app/lib/src/widget_bridge.dart +49 -0
- package/flutter_app/linux/CMakeLists.txt +128 -0
- package/flutter_app/linux/flutter/CMakeLists.txt +88 -0
- package/flutter_app/linux/flutter/generated_plugin_registrant.cc +43 -0
- package/flutter_app/linux/flutter/generated_plugin_registrant.h +15 -0
- package/flutter_app/linux/flutter/generated_plugins.cmake +31 -0
- package/flutter_app/linux/runner/CMakeLists.txt +26 -0
- package/flutter_app/linux/runner/main.cc +6 -0
- package/flutter_app/linux/runner/my_application.cc +144 -0
- package/flutter_app/linux/runner/my_application.h +18 -0
- package/flutter_app/linux/runner/resources/app_icon.png +0 -0
- package/flutter_app/macos/Flutter/Flutter-Debug.xcconfig +2 -0
- package/flutter_app/macos/Flutter/Flutter-Release.xcconfig +2 -0
- package/flutter_app/macos/Flutter/GeneratedPluginRegistrant.swift +40 -0
- package/flutter_app/macos/Podfile +42 -0
- package/flutter_app/macos/Podfile.lock +87 -0
- package/flutter_app/macos/Runner/AppDelegate.swift +576 -0
- package/flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +68 -0
- package/flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png +0 -0
- package/flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png +0 -0
- package/flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png +0 -0
- package/flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png +0 -0
- package/flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png +0 -0
- package/flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png +0 -0
- package/flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png +0 -0
- package/flutter_app/macos/Runner/Base.lproj/MainMenu.xib +342 -0
- package/flutter_app/macos/Runner/Configs/AppInfo.xcconfig +14 -0
- package/flutter_app/macos/Runner/Configs/Debug.xcconfig +2 -0
- package/flutter_app/macos/Runner/Configs/Release.xcconfig +2 -0
- package/flutter_app/macos/Runner/Configs/Warnings.xcconfig +13 -0
- package/flutter_app/macos/Runner/DebugProfile.entitlements +16 -0
- package/flutter_app/macos/Runner/Info.plist +36 -0
- package/flutter_app/macos/Runner/MainFlutterWindow.swift +19 -0
- package/flutter_app/macos/Runner/Release.entitlements +12 -0
- package/flutter_app/macos/Runner.xcodeproj/project.pbxproj +801 -0
- package/flutter_app/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/flutter_app/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +99 -0
- package/flutter_app/macos/Runner.xcworkspace/contents.xcworkspacedata +10 -0
- package/flutter_app/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/flutter_app/macos/RunnerTests/RunnerTests.swift +12 -0
- package/flutter_app/patch_strings.py +12 -0
- package/flutter_app/pubspec.lock +1088 -0
- package/flutter_app/pubspec.yaml +53 -0
- package/flutter_app/test/messaging_access_summary_test.dart +22 -0
- package/flutter_app/test/recording_payloads_test.dart +53 -0
- package/flutter_app/third_party/desktop_audio_capture/LICENSE +21 -0
- package/flutter_app/third_party/desktop_audio_capture/README.md +262 -0
- package/flutter_app/third_party/desktop_audio_capture/lib/audio_capture.dart +65 -0
- package/flutter_app/third_party/desktop_audio_capture/lib/config/mic_audio_config.dart +153 -0
- package/flutter_app/third_party/desktop_audio_capture/lib/config/system_adudio_config.dart +110 -0
- package/flutter_app/third_party/desktop_audio_capture/lib/mic/mic_audio_capture.dart +461 -0
- package/flutter_app/third_party/desktop_audio_capture/lib/model/audio_status.dart +91 -0
- package/flutter_app/third_party/desktop_audio_capture/lib/model/decibel_data.dart +106 -0
- package/flutter_app/third_party/desktop_audio_capture/lib/model/input_device_type.dart +219 -0
- package/flutter_app/third_party/desktop_audio_capture/lib/system/system_audio_capture.dart +336 -0
- package/flutter_app/third_party/desktop_audio_capture/linux/CMakeLists.txt +101 -0
- package/flutter_app/third_party/desktop_audio_capture/linux/audio_capture_plugin.cc +692 -0
- package/flutter_app/third_party/desktop_audio_capture/linux/include/audio_capture/audio_capture_plugin.h +35 -0
- package/flutter_app/third_party/desktop_audio_capture/linux/include/audio_capture/mic_capture_plugin.h +36 -0
- package/flutter_app/third_party/desktop_audio_capture/linux/include/desktop_audio_capture/audio_capture_plugin.h +32 -0
- package/flutter_app/third_party/desktop_audio_capture/linux/include/desktop_audio_capture/mic_capture_plugin.h +32 -0
- package/flutter_app/third_party/desktop_audio_capture/linux/mic_capture_plugin.cc +878 -0
- package/flutter_app/third_party/desktop_audio_capture/macos/Classes/AudioCapturePlugin.swift +27 -0
- package/flutter_app/third_party/desktop_audio_capture/macos/Classes/MicCapturePlugin.swift +1172 -0
- package/flutter_app/third_party/desktop_audio_capture/macos/Classes/SystemCapturePlugin.swift +655 -0
- package/flutter_app/third_party/desktop_audio_capture/macos/Resources/PrivacyInfo.xcprivacy +12 -0
- package/flutter_app/third_party/desktop_audio_capture/macos/desktop_audio_capture.podspec +30 -0
- package/flutter_app/third_party/desktop_audio_capture/pubspec.yaml +87 -0
- package/flutter_app/third_party/desktop_audio_capture/windows/CMakeLists.txt +105 -0
- package/flutter_app/third_party/desktop_audio_capture/windows/audio_capture_plugin.cpp +80 -0
- package/flutter_app/third_party/desktop_audio_capture/windows/audio_capture_plugin.h +31 -0
- package/flutter_app/third_party/desktop_audio_capture/windows/audio_capture_plugin_c_api.cpp +12 -0
- package/flutter_app/third_party/desktop_audio_capture/windows/include/audio_capture/audio_capture_plugin_c_api.h +23 -0
- package/flutter_app/third_party/desktop_audio_capture/windows/include/desktop_audio_capture/audio_capture_plugin.h +25 -0
- package/flutter_app/third_party/desktop_audio_capture/windows/mic_capture_plugin.cpp +1117 -0
- package/flutter_app/third_party/desktop_audio_capture/windows/mic_capture_plugin.h +115 -0
- package/flutter_app/third_party/desktop_audio_capture/windows/system_audio_capture_plugin.cpp +777 -0
- package/flutter_app/third_party/desktop_audio_capture/windows/system_audio_capture_plugin.h +87 -0
- package/flutter_app/third_party/flutter_secure_storage_linux/linux/CMakeLists.txt +30 -0
- package/flutter_app/third_party/flutter_secure_storage_linux/linux/flutter_secure_storage_linux_plugin.cc +215 -0
- package/flutter_app/third_party/flutter_secure_storage_linux/linux/include/flutter_secure_storage_linux/flutter_secure_storage_linux_plugin.h +27 -0
- package/flutter_app/third_party/flutter_secure_storage_linux/pubspec.yaml +20 -0
- package/flutter_app/tool/generate_desktop_branding.py +219 -0
- package/flutter_app/web/favicon.png +0 -0
- package/flutter_app/web/favicon.svg +12 -0
- package/flutter_app/web/icons/Icon-192.png +0 -0
- package/flutter_app/web/icons/Icon-512.png +0 -0
- package/flutter_app/web/icons/Icon-maskable-192.png +0 -0
- package/flutter_app/web/icons/Icon-maskable-512.png +0 -0
- package/flutter_app/web/index.html +39 -0
- package/flutter_app/web/manifest.json +35 -0
- package/flutter_app/windows/CMakeLists.txt +108 -0
- package/flutter_app/windows/flutter/CMakeLists.txt +109 -0
- package/flutter_app/windows/flutter/generated_plugin_registrant.cc +47 -0
- package/flutter_app/windows/flutter/generated_plugin_registrant.h +15 -0
- package/flutter_app/windows/flutter/generated_plugins.cmake +35 -0
- package/flutter_app/windows/runner/CMakeLists.txt +41 -0
- package/flutter_app/windows/runner/Runner.rc +121 -0
- package/flutter_app/windows/runner/flutter_window.cpp +533 -0
- package/flutter_app/windows/runner/flutter_window.h +37 -0
- package/flutter_app/windows/runner/main.cpp +53 -0
- package/flutter_app/windows/runner/resource.h +16 -0
- package/flutter_app/windows/runner/resources/app_icon.ico +0 -0
- package/flutter_app/windows/runner/runner.exe.manifest +14 -0
- package/flutter_app/windows/runner/utils.cpp +65 -0
- package/flutter_app/windows/runner/utils.h +19 -0
- package/flutter_app/windows/runner/win32_window.cpp +299 -0
- package/flutter_app/windows/runner/win32_window.h +102 -0
- package/package.json +2 -1
- package/server/public/flutter_bootstrap.js +1 -1
package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/widgets/WidgetSyncWorker.kt
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
package com.neoagent.flutter_app.widgets
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import android.util.Log
|
|
5
|
+
import androidx.security.crypto.EncryptedSharedPreferences
|
|
6
|
+
import androidx.security.crypto.MasterKey
|
|
7
|
+
import androidx.work.CoroutineWorker
|
|
8
|
+
import androidx.work.WorkerParameters
|
|
9
|
+
import org.json.JSONObject
|
|
10
|
+
import java.net.HttpURLConnection
|
|
11
|
+
import java.net.URI
|
|
12
|
+
import java.net.URL
|
|
13
|
+
|
|
14
|
+
class WidgetSyncWorker(
|
|
15
|
+
appContext: Context,
|
|
16
|
+
params: WorkerParameters,
|
|
17
|
+
) : CoroutineWorker(appContext, params) {
|
|
18
|
+
|
|
19
|
+
override suspend fun doWork(): Result {
|
|
20
|
+
val store = AiWidgetStore(applicationContext)
|
|
21
|
+
if (!store.isEnabled()) {
|
|
22
|
+
return Result.success()
|
|
23
|
+
}
|
|
24
|
+
val backendUrl = store.backendUrl()
|
|
25
|
+
var cookie = store.sessionCookie()
|
|
26
|
+
if (backendUrl.isBlank() || cookie.isBlank()) {
|
|
27
|
+
return Result.success()
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return try {
|
|
31
|
+
var response = request(
|
|
32
|
+
method = "GET",
|
|
33
|
+
baseUrl = backendUrl,
|
|
34
|
+
path = "/api/widgets?all=true",
|
|
35
|
+
cookie = cookie,
|
|
36
|
+
)
|
|
37
|
+
if (response.code == HttpURLConnection.HTTP_UNAUTHORIZED) {
|
|
38
|
+
cookie = ensureSessionCookie(backendUrl, "") ?: return Result.retry()
|
|
39
|
+
response = request(
|
|
40
|
+
method = "GET",
|
|
41
|
+
baseUrl = backendUrl,
|
|
42
|
+
path = "/api/widgets?all=true",
|
|
43
|
+
cookie = cookie,
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
if (response.code !in 200..299) {
|
|
47
|
+
store.setLastError("Widget sync failed (${response.code}).")
|
|
48
|
+
return if (response.code >= 500) Result.retry() else Result.failure()
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
store.saveConfig(
|
|
52
|
+
enabled = true,
|
|
53
|
+
backendUrl = backendUrl,
|
|
54
|
+
sessionCookie = cookie,
|
|
55
|
+
)
|
|
56
|
+
store.saveCachedWidgets(response.body)
|
|
57
|
+
AiHomeWidgetProvider.refreshAll(applicationContext)
|
|
58
|
+
Result.success()
|
|
59
|
+
} catch (err: Exception) {
|
|
60
|
+
store.setLastError(err.message ?: err.javaClass.simpleName)
|
|
61
|
+
Result.retry()
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
private fun ensureSessionCookie(
|
|
66
|
+
backendUrl: String,
|
|
67
|
+
currentCookie: String,
|
|
68
|
+
): String? {
|
|
69
|
+
if (currentCookie.isNotBlank()) {
|
|
70
|
+
return currentCookie
|
|
71
|
+
}
|
|
72
|
+
if (!isHttpsUrl(backendUrl)) {
|
|
73
|
+
Log.e(TAG, "Refusing widget login over non-HTTPS backend URL: $backendUrl")
|
|
74
|
+
return null
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
val flutterPrefs = encryptedFlutterPrefs() ?: return null
|
|
78
|
+
val username = flutterPrefs.getString("flutter.username", "")?.trim().orEmpty()
|
|
79
|
+
val password = flutterPrefs.getString("flutter.password", "")?.trim().orEmpty()
|
|
80
|
+
if (username.isBlank() || password.isBlank()) {
|
|
81
|
+
return null
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
val response = request(
|
|
85
|
+
method = "POST",
|
|
86
|
+
baseUrl = backendUrl,
|
|
87
|
+
path = "/api/auth/login",
|
|
88
|
+
jsonBody =
|
|
89
|
+
JSONObject()
|
|
90
|
+
.put("username", username)
|
|
91
|
+
.put("password", password)
|
|
92
|
+
.toString(),
|
|
93
|
+
)
|
|
94
|
+
if (response.code !in 200..299 || response.cookie.isNullOrBlank()) {
|
|
95
|
+
return null
|
|
96
|
+
}
|
|
97
|
+
return response.cookie.substringBefore(";")
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
private fun request(
|
|
101
|
+
method: String,
|
|
102
|
+
baseUrl: String,
|
|
103
|
+
path: String,
|
|
104
|
+
cookie: String? = null,
|
|
105
|
+
jsonBody: String? = null,
|
|
106
|
+
): HttpResponse {
|
|
107
|
+
val url = resolveUrl(baseUrl, path)
|
|
108
|
+
val connection = (url.openConnection() as HttpURLConnection).apply {
|
|
109
|
+
requestMethod = method
|
|
110
|
+
connectTimeout = 15_000
|
|
111
|
+
readTimeout = 20_000
|
|
112
|
+
doInput = true
|
|
113
|
+
instanceFollowRedirects = false
|
|
114
|
+
setRequestProperty("Accept", "application/json")
|
|
115
|
+
if (!cookie.isNullOrBlank()) {
|
|
116
|
+
setRequestProperty("Cookie", cookie)
|
|
117
|
+
}
|
|
118
|
+
if (jsonBody != null) {
|
|
119
|
+
doOutput = true
|
|
120
|
+
setRequestProperty("Content-Type", "application/json")
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return try {
|
|
125
|
+
if (jsonBody != null) {
|
|
126
|
+
connection.outputStream.use { stream ->
|
|
127
|
+
stream.write(jsonBody.toByteArray(Charsets.UTF_8))
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
val code = connection.responseCode
|
|
131
|
+
val body = (if (code in 200..299) connection.inputStream else connection.errorStream)
|
|
132
|
+
?.bufferedReader()
|
|
133
|
+
?.use { it.readText() }
|
|
134
|
+
.orEmpty()
|
|
135
|
+
HttpResponse(
|
|
136
|
+
code = code,
|
|
137
|
+
body = body,
|
|
138
|
+
cookie = connection.getHeaderField("Set-Cookie"),
|
|
139
|
+
)
|
|
140
|
+
} finally {
|
|
141
|
+
connection.disconnect()
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
private fun resolveUrl(baseUrl: String, path: String): URL {
|
|
146
|
+
return URI(baseUrl.trim().ifBlank { "http://localhost:3333" })
|
|
147
|
+
.resolve(path)
|
|
148
|
+
.toURL()
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
private fun encryptedFlutterPrefs() =
|
|
152
|
+
try {
|
|
153
|
+
val key =
|
|
154
|
+
MasterKey.Builder(applicationContext)
|
|
155
|
+
.setKeyScheme(MasterKey.KeyScheme.AES256_GCM)
|
|
156
|
+
.build()
|
|
157
|
+
EncryptedSharedPreferences.create(
|
|
158
|
+
applicationContext,
|
|
159
|
+
"FlutterSharedPreferences",
|
|
160
|
+
key,
|
|
161
|
+
EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,
|
|
162
|
+
EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM,
|
|
163
|
+
)
|
|
164
|
+
} catch (err: Exception) {
|
|
165
|
+
Log.e(TAG, "Failed to access encrypted Flutter credentials.", err)
|
|
166
|
+
null
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
private fun isHttpsUrl(url: String): Boolean {
|
|
170
|
+
return try {
|
|
171
|
+
URI(url.trim()).scheme.equals("https", ignoreCase = true)
|
|
172
|
+
} catch (_: Exception) {
|
|
173
|
+
false
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
private data class HttpResponse(
|
|
178
|
+
val code: Int,
|
|
179
|
+
val body: String,
|
|
180
|
+
val cookie: String? = null,
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
companion object {
|
|
184
|
+
private const val TAG = "WidgetSyncWorker"
|
|
185
|
+
}
|
|
186
|
+
}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
package com.neoagent.flutter_app.widgets
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import android.util.Log
|
|
5
|
+
import androidx.security.crypto.EncryptedSharedPreferences
|
|
6
|
+
import androidx.security.crypto.MasterKey
|
|
7
|
+
import androidx.work.Constraints
|
|
8
|
+
import androidx.work.CoroutineWorker
|
|
9
|
+
import androidx.work.Data
|
|
10
|
+
import androidx.work.NetworkType
|
|
11
|
+
import androidx.work.OneTimeWorkRequestBuilder
|
|
12
|
+
import androidx.work.WorkManager
|
|
13
|
+
import androidx.work.WorkerParameters
|
|
14
|
+
import org.json.JSONObject
|
|
15
|
+
import java.net.HttpURLConnection
|
|
16
|
+
import java.net.URI
|
|
17
|
+
import java.net.URL
|
|
18
|
+
|
|
19
|
+
class WidgetTaskRunWorker(
|
|
20
|
+
appContext: Context,
|
|
21
|
+
params: WorkerParameters,
|
|
22
|
+
) : CoroutineWorker(appContext, params) {
|
|
23
|
+
|
|
24
|
+
override suspend fun doWork(): Result {
|
|
25
|
+
val taskId = inputData.getString(KEY_TASK_ID) ?: return Result.failure()
|
|
26
|
+
|
|
27
|
+
val store = AiWidgetStore(applicationContext)
|
|
28
|
+
if (!store.isEnabled()) {
|
|
29
|
+
return Result.success()
|
|
30
|
+
}
|
|
31
|
+
val backendUrl = store.backendUrl()
|
|
32
|
+
var cookie = store.sessionCookie()
|
|
33
|
+
if (backendUrl.isBlank() || cookie.isBlank()) {
|
|
34
|
+
return Result.success()
|
|
35
|
+
}
|
|
36
|
+
if (!isHttpsUrl(backendUrl)) {
|
|
37
|
+
Log.e(TAG, "Refusing task run over non-HTTPS backend URL: $backendUrl")
|
|
38
|
+
return Result.failure()
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return try {
|
|
42
|
+
var response = request(
|
|
43
|
+
method = "POST",
|
|
44
|
+
baseUrl = backendUrl,
|
|
45
|
+
path = "/api/tasks/$taskId/run",
|
|
46
|
+
cookie = cookie,
|
|
47
|
+
jsonBody = JSONObject().toString(),
|
|
48
|
+
)
|
|
49
|
+
if (response.code == HttpURLConnection.HTTP_UNAUTHORIZED) {
|
|
50
|
+
cookie = ensureSessionCookie(backendUrl, "") ?: return Result.retry()
|
|
51
|
+
response = request(
|
|
52
|
+
method = "POST",
|
|
53
|
+
baseUrl = backendUrl,
|
|
54
|
+
path = "/api/tasks/$taskId/run",
|
|
55
|
+
cookie = cookie,
|
|
56
|
+
jsonBody = JSONObject().toString(),
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
if (response.code !in 200..299) {
|
|
60
|
+
return if (response.code >= 500) Result.retry() else Result.failure()
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
store.saveConfig(
|
|
64
|
+
enabled = true,
|
|
65
|
+
backendUrl = backendUrl,
|
|
66
|
+
sessionCookie = cookie,
|
|
67
|
+
)
|
|
68
|
+
Result.success()
|
|
69
|
+
} catch (err: Exception) {
|
|
70
|
+
Log.e(TAG, "Failed to run task $taskId", err)
|
|
71
|
+
Result.retry()
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
private fun ensureSessionCookie(
|
|
76
|
+
backendUrl: String,
|
|
77
|
+
currentCookie: String,
|
|
78
|
+
): String? {
|
|
79
|
+
if (currentCookie.isNotBlank()) {
|
|
80
|
+
return currentCookie
|
|
81
|
+
}
|
|
82
|
+
if (!isHttpsUrl(backendUrl)) {
|
|
83
|
+
Log.e(TAG, "Refusing login over non-HTTPS backend URL: $backendUrl")
|
|
84
|
+
return null
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
val flutterPrefs = encryptedFlutterPrefs() ?: return null
|
|
88
|
+
val username = flutterPrefs.getString("flutter.username", "")?.trim().orEmpty()
|
|
89
|
+
val password = flutterPrefs.getString("flutter.password", "")?.trim().orEmpty()
|
|
90
|
+
if (username.isBlank() || password.isBlank()) {
|
|
91
|
+
return null
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
val response = request(
|
|
95
|
+
method = "POST",
|
|
96
|
+
baseUrl = backendUrl,
|
|
97
|
+
path = "/api/auth/login",
|
|
98
|
+
jsonBody =
|
|
99
|
+
JSONObject()
|
|
100
|
+
.put("username", username)
|
|
101
|
+
.put("password", password)
|
|
102
|
+
.toString(),
|
|
103
|
+
)
|
|
104
|
+
if (response.code !in 200..299 || response.cookie.isNullOrBlank()) {
|
|
105
|
+
return null
|
|
106
|
+
}
|
|
107
|
+
return response.cookie.substringBefore(";")
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
private fun request(
|
|
111
|
+
method: String,
|
|
112
|
+
baseUrl: String,
|
|
113
|
+
path: String,
|
|
114
|
+
cookie: String? = null,
|
|
115
|
+
jsonBody: String? = null,
|
|
116
|
+
): HttpResponse {
|
|
117
|
+
val url = resolveUrl(baseUrl, path)
|
|
118
|
+
val connection = (url.openConnection() as HttpURLConnection).apply {
|
|
119
|
+
requestMethod = method
|
|
120
|
+
connectTimeout = 15_000
|
|
121
|
+
readTimeout = 20_000
|
|
122
|
+
doInput = true
|
|
123
|
+
instanceFollowRedirects = false
|
|
124
|
+
setRequestProperty("Accept", "application/json")
|
|
125
|
+
if (!cookie.isNullOrBlank()) {
|
|
126
|
+
setRequestProperty("Cookie", cookie)
|
|
127
|
+
}
|
|
128
|
+
if (jsonBody != null) {
|
|
129
|
+
doOutput = true
|
|
130
|
+
setRequestProperty("Content-Type", "application/json")
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return try {
|
|
135
|
+
if (jsonBody != null) {
|
|
136
|
+
connection.outputStream.use { stream ->
|
|
137
|
+
stream.write(jsonBody.toByteArray(Charsets.UTF_8))
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
val code = connection.responseCode
|
|
141
|
+
val body = (if (code in 200..299) connection.inputStream else connection.errorStream)
|
|
142
|
+
?.bufferedReader()
|
|
143
|
+
?.use { it.readText() }
|
|
144
|
+
.orEmpty()
|
|
145
|
+
HttpResponse(
|
|
146
|
+
code = code,
|
|
147
|
+
body = body,
|
|
148
|
+
cookie = connection.getHeaderField("Set-Cookie"),
|
|
149
|
+
)
|
|
150
|
+
} finally {
|
|
151
|
+
connection.disconnect()
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
private fun resolveUrl(baseUrl: String, path: String): URL {
|
|
156
|
+
return URI(baseUrl.trim().ifBlank { "http://localhost:3333" })
|
|
157
|
+
.resolve(path)
|
|
158
|
+
.toURL()
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
private fun encryptedFlutterPrefs() =
|
|
162
|
+
try {
|
|
163
|
+
val key =
|
|
164
|
+
MasterKey.Builder(applicationContext)
|
|
165
|
+
.setKeyScheme(MasterKey.KeyScheme.AES256_GCM)
|
|
166
|
+
.build()
|
|
167
|
+
EncryptedSharedPreferences.create(
|
|
168
|
+
applicationContext,
|
|
169
|
+
"FlutterSharedPreferences",
|
|
170
|
+
key,
|
|
171
|
+
EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,
|
|
172
|
+
EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM,
|
|
173
|
+
)
|
|
174
|
+
} catch (err: Exception) {
|
|
175
|
+
Log.e(TAG, "Failed to access encrypted Flutter credentials.", err)
|
|
176
|
+
null
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
private fun isHttpsUrl(url: String): Boolean {
|
|
180
|
+
return try {
|
|
181
|
+
URI(url.trim()).scheme.equals("https", ignoreCase = true)
|
|
182
|
+
} catch (_: Exception) {
|
|
183
|
+
false
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
private data class HttpResponse(
|
|
188
|
+
val code: Int,
|
|
189
|
+
val body: String,
|
|
190
|
+
val cookie: String? = null,
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
companion object {
|
|
194
|
+
private const val TAG = "WidgetTaskRunWorker"
|
|
195
|
+
const val KEY_TASK_ID = "task_id"
|
|
196
|
+
|
|
197
|
+
fun enqueue(context: Context, taskId: String) {
|
|
198
|
+
val constraints = Constraints.Builder()
|
|
199
|
+
.setRequiredNetworkType(NetworkType.CONNECTED)
|
|
200
|
+
.build()
|
|
201
|
+
|
|
202
|
+
val work = OneTimeWorkRequestBuilder<WidgetTaskRunWorker>()
|
|
203
|
+
.setConstraints(constraints)
|
|
204
|
+
.setInputData(Data.Builder().putString(KEY_TASK_ID, taskId).build())
|
|
205
|
+
.build()
|
|
206
|
+
|
|
207
|
+
WorkManager.getInstance(context).enqueue(work)
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!-- Modify this file to customize your launch splash screen -->
|
|
3
|
+
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
4
|
+
<item android:drawable="@android:color/white" />
|
|
5
|
+
|
|
6
|
+
<!-- You can insert your own image assets here -->
|
|
7
|
+
<!-- <item>
|
|
8
|
+
<bitmap
|
|
9
|
+
android:gravity="center"
|
|
10
|
+
android:src="@mipmap/launch_image" />
|
|
11
|
+
</item> -->
|
|
12
|
+
</layer-list>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
|
3
|
+
<corners android:radius="28dp" />
|
|
4
|
+
<gradient
|
|
5
|
+
android:angle="315"
|
|
6
|
+
android:endColor="#0E1420"
|
|
7
|
+
android:startColor="#1A2638" />
|
|
8
|
+
<stroke
|
|
9
|
+
android:width="1dp"
|
|
10
|
+
android:color="#1FFFFFFF" />
|
|
11
|
+
</shape>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!-- Modify this file to customize your launch splash screen -->
|
|
3
|
+
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
4
|
+
<item android:drawable="?android:colorBackground" />
|
|
5
|
+
|
|
6
|
+
<!-- You can insert your own image assets here -->
|
|
7
|
+
<!-- <item>
|
|
8
|
+
<bitmap
|
|
9
|
+
android:gravity="center"
|
|
10
|
+
android:src="@mipmap/launch_image" />
|
|
11
|
+
</item> -->
|
|
12
|
+
</layer-list>
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
+
android:id="@+id/widget_root"
|
|
4
|
+
android:layout_width="match_parent"
|
|
5
|
+
android:layout_height="match_parent"
|
|
6
|
+
android:background="@drawable/neoagent_ai_widget_bg"
|
|
7
|
+
android:contentDescription="@string/widget_description"
|
|
8
|
+
android:gravity="center_vertical"
|
|
9
|
+
android:orientation="vertical"
|
|
10
|
+
android:padding="16dp">
|
|
11
|
+
|
|
12
|
+
<TextView
|
|
13
|
+
android:id="@+id/widget_title"
|
|
14
|
+
android:layout_width="match_parent"
|
|
15
|
+
android:layout_height="wrap_content"
|
|
16
|
+
android:ellipsize="end"
|
|
17
|
+
android:maxLines="1"
|
|
18
|
+
android:textColor="#FFFFFF"
|
|
19
|
+
android:textSize="16sp"
|
|
20
|
+
android:textStyle="bold" />
|
|
21
|
+
|
|
22
|
+
<TextView
|
|
23
|
+
android:id="@+id/widget_subtitle"
|
|
24
|
+
android:layout_width="match_parent"
|
|
25
|
+
android:layout_height="wrap_content"
|
|
26
|
+
android:layout_marginTop="4dp"
|
|
27
|
+
android:ellipsize="end"
|
|
28
|
+
android:maxLines="1"
|
|
29
|
+
android:textColor="#D1D8E6"
|
|
30
|
+
android:textSize="12sp" />
|
|
31
|
+
|
|
32
|
+
<TextView
|
|
33
|
+
android:id="@+id/widget_metric"
|
|
34
|
+
android:layout_width="match_parent"
|
|
35
|
+
android:layout_height="wrap_content"
|
|
36
|
+
android:layout_marginTop="12dp"
|
|
37
|
+
android:ellipsize="end"
|
|
38
|
+
android:maxLines="1"
|
|
39
|
+
android:textColor="#7BC4FF"
|
|
40
|
+
android:textSize="28sp"
|
|
41
|
+
android:textStyle="bold" />
|
|
42
|
+
|
|
43
|
+
<TextView
|
|
44
|
+
android:id="@+id/widget_body"
|
|
45
|
+
android:layout_width="match_parent"
|
|
46
|
+
android:layout_height="wrap_content"
|
|
47
|
+
android:layout_marginTop="10dp"
|
|
48
|
+
android:ellipsize="end"
|
|
49
|
+
android:maxLines="4"
|
|
50
|
+
android:textColor="#F4F6FA"
|
|
51
|
+
android:textSize="13sp" />
|
|
52
|
+
|
|
53
|
+
<LinearLayout
|
|
54
|
+
android:id="@+id/widget_rows_group"
|
|
55
|
+
android:layout_width="match_parent"
|
|
56
|
+
android:layout_height="wrap_content"
|
|
57
|
+
android:layout_marginTop="10dp"
|
|
58
|
+
android:orientation="vertical">
|
|
59
|
+
|
|
60
|
+
<TextView
|
|
61
|
+
android:id="@+id/widget_row_1"
|
|
62
|
+
android:layout_width="match_parent"
|
|
63
|
+
android:layout_height="wrap_content"
|
|
64
|
+
android:ellipsize="end"
|
|
65
|
+
android:maxLines="1"
|
|
66
|
+
android:textColor="#DCE3F2"
|
|
67
|
+
android:textSize="12sp" />
|
|
68
|
+
|
|
69
|
+
<TextView
|
|
70
|
+
android:id="@+id/widget_row_2"
|
|
71
|
+
android:layout_width="match_parent"
|
|
72
|
+
android:layout_height="wrap_content"
|
|
73
|
+
android:layout_marginTop="4dp"
|
|
74
|
+
android:ellipsize="end"
|
|
75
|
+
android:maxLines="1"
|
|
76
|
+
android:textColor="#DCE3F2"
|
|
77
|
+
android:textSize="12sp" />
|
|
78
|
+
|
|
79
|
+
<TextView
|
|
80
|
+
android:id="@+id/widget_row_3"
|
|
81
|
+
android:layout_width="match_parent"
|
|
82
|
+
android:layout_height="wrap_content"
|
|
83
|
+
android:layout_marginTop="4dp"
|
|
84
|
+
android:ellipsize="end"
|
|
85
|
+
android:maxLines="1"
|
|
86
|
+
android:textColor="#DCE3F2"
|
|
87
|
+
android:textSize="12sp" />
|
|
88
|
+
</LinearLayout>
|
|
89
|
+
|
|
90
|
+
<TextView
|
|
91
|
+
android:id="@+id/widget_meta"
|
|
92
|
+
android:layout_width="match_parent"
|
|
93
|
+
android:layout_height="wrap_content"
|
|
94
|
+
android:layout_marginTop="12dp"
|
|
95
|
+
android:ellipsize="end"
|
|
96
|
+
android:maxLines="1"
|
|
97
|
+
android:textColor="#92A1BA"
|
|
98
|
+
android:textSize="11sp" />
|
|
99
|
+
|
|
100
|
+
<TextView
|
|
101
|
+
android:id="@+id/widget_status"
|
|
102
|
+
android:layout_width="match_parent"
|
|
103
|
+
android:layout_height="wrap_content"
|
|
104
|
+
android:layout_marginTop="4dp"
|
|
105
|
+
android:ellipsize="end"
|
|
106
|
+
android:maxLines="2"
|
|
107
|
+
android:textColor="#8EE0AF"
|
|
108
|
+
android:textSize="11sp" />
|
|
109
|
+
|
|
110
|
+
<LinearLayout
|
|
111
|
+
android:id="@+id/widget_tasks_toggle_group"
|
|
112
|
+
android:layout_width="match_parent"
|
|
113
|
+
android:layout_height="wrap_content"
|
|
114
|
+
android:layout_marginTop="12dp"
|
|
115
|
+
android:background="?android:attr/selectableItemBackground"
|
|
116
|
+
android:orientation="horizontal"
|
|
117
|
+
android:visibility="gone">
|
|
118
|
+
|
|
119
|
+
<TextView
|
|
120
|
+
android:id="@+id/widget_tasks_toggle_text"
|
|
121
|
+
android:layout_width="0dp"
|
|
122
|
+
android:layout_height="wrap_content"
|
|
123
|
+
android:layout_weight="1"
|
|
124
|
+
android:text="@string/widget_tasks_label"
|
|
125
|
+
android:textColor="#7BC4FF"
|
|
126
|
+
android:textSize="14sp"
|
|
127
|
+
android:textStyle="bold" />
|
|
128
|
+
</LinearLayout>
|
|
129
|
+
|
|
130
|
+
<LinearLayout
|
|
131
|
+
android:id="@+id/widget_tasks_container"
|
|
132
|
+
android:layout_width="match_parent"
|
|
133
|
+
android:layout_height="wrap_content"
|
|
134
|
+
android:layout_marginTop="4dp"
|
|
135
|
+
android:orientation="vertical"
|
|
136
|
+
android:visibility="gone" />
|
|
137
|
+
|
|
138
|
+
</LinearLayout>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
+
android:layout_width="match_parent"
|
|
4
|
+
android:layout_height="wrap_content"
|
|
5
|
+
android:layout_marginTop="8dp"
|
|
6
|
+
android:background="@drawable/neoagent_ai_widget_task_bg"
|
|
7
|
+
android:orientation="horizontal"
|
|
8
|
+
android:padding="8dp">
|
|
9
|
+
|
|
10
|
+
<LinearLayout
|
|
11
|
+
android:layout_width="0dp"
|
|
12
|
+
android:layout_height="wrap_content"
|
|
13
|
+
android:layout_weight="1"
|
|
14
|
+
android:orientation="vertical">
|
|
15
|
+
|
|
16
|
+
<TextView
|
|
17
|
+
android:id="@+id/task_name"
|
|
18
|
+
android:layout_width="match_parent"
|
|
19
|
+
android:layout_height="wrap_content"
|
|
20
|
+
android:ellipsize="end"
|
|
21
|
+
android:maxLines="1"
|
|
22
|
+
android:textColor="#FFFFFF"
|
|
23
|
+
android:textSize="14sp"
|
|
24
|
+
android:textStyle="bold" />
|
|
25
|
+
|
|
26
|
+
<TextView
|
|
27
|
+
android:id="@+id/task_schedule"
|
|
28
|
+
android:layout_width="match_parent"
|
|
29
|
+
android:layout_height="wrap_content"
|
|
30
|
+
android:layout_marginTop="2dp"
|
|
31
|
+
android:ellipsize="end"
|
|
32
|
+
android:maxLines="1"
|
|
33
|
+
android:textColor="#D1D8E6"
|
|
34
|
+
android:textSize="11sp" />
|
|
35
|
+
</LinearLayout>
|
|
36
|
+
|
|
37
|
+
<Button
|
|
38
|
+
android:id="@+id/task_run_btn"
|
|
39
|
+
android:layout_width="wrap_content"
|
|
40
|
+
android:layout_height="wrap_content"
|
|
41
|
+
android:layout_marginStart="8dp"
|
|
42
|
+
android:backgroundTint="#7BC4FF"
|
|
43
|
+
android:minWidth="0dp"
|
|
44
|
+
android:minHeight="0dp"
|
|
45
|
+
android:paddingLeft="12dp" android:paddingRight="12dp"
|
|
46
|
+
android:paddingTop="6dp" android:paddingBottom="6dp"
|
|
47
|
+
android:text="@string/task_run_now"
|
|
48
|
+
android:textAllCaps="false"
|
|
49
|
+
android:textColor="#000000"
|
|
50
|
+
android:textSize="12sp" />
|
|
51
|
+
|
|
52
|
+
</LinearLayout>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
+
android:id="@+id/voice_widget_root"
|
|
4
|
+
android:layout_width="match_parent"
|
|
5
|
+
android:layout_height="match_parent"
|
|
6
|
+
android:background="@drawable/neoagent_ai_widget_bg"
|
|
7
|
+
android:contentDescription="@string/voice_widget_description"
|
|
8
|
+
android:gravity="center_vertical"
|
|
9
|
+
android:orientation="horizontal"
|
|
10
|
+
android:padding="16dp">
|
|
11
|
+
|
|
12
|
+
<ImageView
|
|
13
|
+
android:id="@+id/voice_widget_icon"
|
|
14
|
+
android:layout_width="44dp"
|
|
15
|
+
android:layout_height="44dp"
|
|
16
|
+
android:contentDescription="@null"
|
|
17
|
+
android:src="@mipmap/ic_launcher"
|
|
18
|
+
android:tint="#8FB8FF" />
|
|
19
|
+
|
|
20
|
+
<LinearLayout
|
|
21
|
+
android:layout_width="0dp"
|
|
22
|
+
android:layout_height="wrap_content"
|
|
23
|
+
android:layout_marginStart="14dp"
|
|
24
|
+
android:layout_weight="1"
|
|
25
|
+
android:orientation="vertical">
|
|
26
|
+
|
|
27
|
+
<TextView
|
|
28
|
+
android:id="@+id/voice_widget_title"
|
|
29
|
+
android:layout_width="match_parent"
|
|
30
|
+
android:layout_height="wrap_content"
|
|
31
|
+
android:ellipsize="end"
|
|
32
|
+
android:maxLines="1"
|
|
33
|
+
android:text="@string/voice_widget_title"
|
|
34
|
+
android:textColor="#FFFFFF"
|
|
35
|
+
android:textSize="16sp"
|
|
36
|
+
android:textStyle="bold" />
|
|
37
|
+
|
|
38
|
+
<TextView
|
|
39
|
+
android:id="@+id/voice_widget_subtitle"
|
|
40
|
+
android:layout_width="match_parent"
|
|
41
|
+
android:layout_height="wrap_content"
|
|
42
|
+
android:layout_marginTop="4dp"
|
|
43
|
+
android:ellipsize="end"
|
|
44
|
+
android:maxLines="2"
|
|
45
|
+
android:text="@string/voice_widget_subtitle"
|
|
46
|
+
android:textColor="#C7D0E0"
|
|
47
|
+
android:textSize="12sp" />
|
|
48
|
+
</LinearLayout>
|
|
49
|
+
</LinearLayout>
|
|
Binary file
|
|
Binary file
|