mirror of
https://github.com/home-assistant/android
synced 2024-10-15 12:32:54 +00:00
Make conversation activity launchable (#3254)
* Make conversation activity launchable * Use better launcher icons per review comments * Review comments
This commit is contained in:
parent
96cf4f82a3
commit
65696e891b
|
@ -1013,4 +1013,6 @@
|
|||
<string name="no_conversation_support">You must be at least on Home Assistant 2023.1 and have the conversation integration enabled</string>
|
||||
<string name="conversation">Conversation</string>
|
||||
<string name="assist">Assist</string>
|
||||
<string name="not_registered">Please launch the Home Assistant app and login before you can use the assist feature.</string>
|
||||
<string name="ha_assist">HA: Assist</string>
|
||||
</resources>
|
||||
|
|
5
wear/src/debug/res/mipmap-anydpi-v26/ic_assist_launcher.xml
Executable file
5
wear/src/debug/res/mipmap-anydpi-v26/ic_assist_launcher.xml
Executable file
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@android:color/holo_red_dark"/>
|
||||
<foreground android:drawable="@drawable/ic_assist_launcher_foreground"/>
|
||||
</adaptive-icon>
|
|
@ -87,7 +87,15 @@
|
|||
|
||||
<activity
|
||||
android:name=".conversation.ConversationActivity"
|
||||
android:exported="true" />
|
||||
android:icon="@mipmap/ic_assist_launcher"
|
||||
android:label="@string/ha_assist"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<!-- Tiles -->
|
||||
<service
|
||||
android:name=".tiles.ShortcutsTile"
|
||||
|
@ -117,7 +125,7 @@
|
|||
</service>
|
||||
<service
|
||||
android:name=".tiles.ConversationTile"
|
||||
android:label="@string/conversation"
|
||||
android:label="@string/assist"
|
||||
android:permission="com.google.android.wearable.permission.BIND_TILE_PROVIDER"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
|
|
|
@ -33,6 +33,9 @@ class ConversationViewModel @Inject constructor(
|
|||
var isHapticEnabled = mutableStateOf(false)
|
||||
private set
|
||||
|
||||
var isRegistered by mutableStateOf(false)
|
||||
private set
|
||||
|
||||
fun getConversation() {
|
||||
viewModelScope.launch {
|
||||
conversationResult = integrationUseCase.getConversation(speechResult) ?: ""
|
||||
|
@ -40,6 +43,7 @@ class ConversationViewModel @Inject constructor(
|
|||
}
|
||||
|
||||
suspend fun isSupportConversation() {
|
||||
isRegistered = integrationUseCase.isRegistered()
|
||||
supportsConversation =
|
||||
integrationUseCase.isHomeAssistantVersionAtLeast(2023, 1, 0) &&
|
||||
webSocketRepository.getConfig()?.components?.contains("conversation") == true
|
||||
|
|
|
@ -55,10 +55,11 @@ fun ConversationResultView(
|
|||
Spacer(Modifier.padding(24.dp))
|
||||
SpeechBubble(
|
||||
text = conversationViewModel.speechResult.ifEmpty {
|
||||
if (conversationViewModel.supportsConversation)
|
||||
stringResource(R.string.no_results)
|
||||
else
|
||||
stringResource(R.string.no_conversation_support)
|
||||
when {
|
||||
(conversationViewModel.supportsConversation) -> stringResource(R.string.no_results)
|
||||
(!conversationViewModel.isRegistered) -> stringResource(R.string.not_registered)
|
||||
else -> stringResource(R.string.no_conversation_support)
|
||||
}
|
||||
},
|
||||
false
|
||||
)
|
||||
|
|
13
wear/src/main/res/drawable/ic_assist_launcher_foreground.xml
Executable file
13
wear/src/main/res/drawable/ic_assist_launcher_foreground.xml
Executable file
|
@ -0,0 +1,13 @@
|
|||
<!-- drawable/comment_processing_outline.xml -->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<group android:scaleX="0.45466667"
|
||||
android:scaleY="0.45466667"
|
||||
android:translateX="6.544"
|
||||
android:translateY="6.544">
|
||||
<path android:fillColor="#fff" android:pathData="M9,22A1,1 0 0,1 8,21V18H4A2,2 0 0,1 2,16V4C2,2.89 2.9,2 4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H13.9L10.2,21.71C10,21.9 9.75,22 9.5,22V22H9M10,16V19.08L13.08,16H20V4H4V16H10M17,11H15V9H17V11M13,11H11V9H13V11M9,11H7V9H9V11Z" />
|
||||
</group>
|
||||
</vector>
|
5
wear/src/main/res/mipmap-anydpi-v26/ic_assist_launcher.xml
Executable file
5
wear/src/main/res/mipmap-anydpi-v26/ic_assist_launcher.xml
Executable file
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/colorAccent"/>
|
||||
<foreground android:drawable="@drawable/ic_assist_launcher_foreground"/>
|
||||
</adaptive-icon>
|
Loading…
Reference in a new issue