Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ Whenever you add or update dependencies in the project (whether through `gradle/
- **`:automotive`** - Android Automotive version (min SDK is defined in `gradle/libs.versions.toml` under the name `androidSdk-automotive-min`, reuses `:app` sources)
- **`:wear`** - Wear OS application (min SDK is defined in `gradle/libs.versions.toml` under the name `androidSdk-wear-min`, dedicated app requiring full mobile app for onboarding)
- **`:common`** - Shared code across all apps (data layer, sensors, utilities, WebSocket, REST API)
- **`:onboarding`** - Onboarding flow shared across apps
- **`:testing-unit`** - Shared test utilities (must remain independent from `:common`)
- **`:lint`** - Custom lint rules
- **`build-logic`** - Gradle convention plugins via `includeBuild`
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -247,23 +247,23 @@ jobs:
arch: x86_64
profile: "Nexus 5"
target: "google_apis"
gradle_target: ":app:connectedFullDebugAndroidTest :app:connectedMinimalDebugAndroidTest :common:connectedDebugAndroidTest :onboarding:connectedDebugAndroidTest"
gradle_target: ":app:connectedFullDebugAndroidTest :app:connectedMinimalDebugAndroidTest :common:connectedDebugAndroidTest"
- api-level: 36
arch: x86_64
profile: "pixel_7"
target: "google_apis"
gradle_target: ":app:connectedFullDebugAndroidTest :app:connectedMinimalDebugAndroidTest :common:connectedDebugAndroidTest :onboarding:connectedDebugAndroidTest"
gradle_target: ":app:connectedFullDebugAndroidTest :app:connectedMinimalDebugAndroidTest :common:connectedDebugAndroidTest"
- api-level: 33
arch: x86_64
profile: "automotive_1024p_landscape"
target: "android-automotive"
gradle_target: ":automotive:connectedFullDebugAndroidTest :automotive:connectedMinimalDebugAndroidTest :common:connectedDebugAndroidTest :onboarding:connectedDebugAndroidTest"
gradle_target: ":automotive:connectedFullDebugAndroidTest :automotive:connectedMinimalDebugAndroidTest :common:connectedDebugAndroidTest"
- api-level: "34"
system-image-api-level: "34-ext9"
arch: x86_64
profile: "automotive_1024p_landscape"
target: "android-automotive"
gradle_target: ":automotive:connectedFullDebugAndroidTest :automotive:connectedMinimalDebugAndroidTest :common:connectedDebugAndroidTest :onboarding:connectedDebugAndroidTest"
gradle_target: ":automotive:connectedFullDebugAndroidTest :automotive:connectedMinimalDebugAndroidTest :common:connectedDebugAndroidTest"
- api-level: 26
arch: x86
profile: "wearos_square"
Expand Down
1 change: 0 additions & 1 deletion .idea/runConfigurations/Unit_tests.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

75 changes: 42 additions & 33 deletions app/gradle.lockfile

Large diffs are not rendered by default.

1,797 changes: 1,718 additions & 79 deletions app/lint-baseline.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package io.homeassistant.companion.android.launch
package io.homeassistant.companion.android.launcher

import androidx.compose.ui.test.junit4.createAndroidComposeRule
import leakcanary.DetectLeaksAfterTestSuccess
import org.junit.Rule
import org.junit.Test

class LaunchActivityTest {
class LauncherActivityTest {
@get:Rule
val composeTestRule = createAndroidComposeRule<LaunchActivity>()
val composeTestRule = createAndroidComposeRule<LauncherActivity>()

@get:Rule
val ruleChain = DetectLeaksAfterTestSuccess()
Expand Down
11 changes: 9 additions & 2 deletions app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<application tools:ignore="MissingApplicationIcon">

<activity android:name=".launch.LaunchActivity">
<activity android:name=".launcher.LauncherActivity">
<meta-data android:name="android.app.shortcuts"
android:resource="@xml/shortcuts" />
</activity>
Expand All @@ -21,6 +21,13 @@
android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|keyboard|keyboardHidden|navigation"
tools:ignore="UnusedAttribute" />

<!--
Use a no-action-bar theme to prevent overlapping with the action bar during tests.
-->
<activity
android:theme="@android:style/Theme.Material.Light.NoActionBar"
android:name="io.homeassistant.companion.android.HiltComponentActivity"
/>
</application>

</manifest>
</manifest>
37 changes: 31 additions & 6 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,36 @@
tools:ignore="GoogleAppIndexingWarning,UnusedAttribute"
tools:targetApi="tiramisu">

<activity
android:name="io.homeassistant.companion.android.launcher.LauncherActivity"
android:exported="true"
android:windowSoftInputMode="adjustResize"
android:theme="@style/Theme.LaunchScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

<!-- TODO validate that new onboarding works properly on TV -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
</activity>

<activity-alias
android:name="io.homeassistant.companion.android.launcher.LauncherAlias"
android:enabled="false"
android:exported="true"
android:targetActivity="io.homeassistant.companion.android.launcher.LauncherActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity-alias>

<!-- Start things like SensorWorker on device boot -->
<receiver android:name=".websocket.WebsocketBroadcastReceiver"
android:exported="true">
Expand Down Expand Up @@ -311,7 +341,7 @@
</intent-filter>
</receiver>

<activity android:name=".launch.link.LinkActivity"
<activity android:name=".launcher.link.LinkActivity"
android:exported="true"
android:launchMode="singleTask">
<intent-filter android:autoVerify="true">
Expand Down Expand Up @@ -358,11 +388,6 @@
</intent-filter>
</activity>

<activity
android:name=".onboarding.OnboardingActivity"
android:configChanges="orientation|screenSize|keyboard|keyboardHidden|navigation"
android:theme="@style/Theme.HomeAssistant.Config" />

<activity
android:name=".settings.wear.SettingsWearActivity"
android:parentActivityName=".settings.SettingsActivity"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("ktlint-disable no-empty-file")

package io.homeassistant.companion.android

/**
Expand All @@ -11,11 +13,3 @@ package io.homeassistant.companion.android
*
* Feature flags should be removed from this file once the feature is fully released and stable.
*/

/**
* Enables the new onboarding from the `:onboarding` module.
* Currently only enabled in debug builds to allow testing before production release.
*
* Features tracked in https://github.com/home-assistant/android/issues/5980
*/
val USE_NEW_LAUNCHER by lazy { BuildConfig.DEBUG }
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import io.homeassistant.companion.android.BaseActivity
import io.homeassistant.companion.android.assist.ui.AssistSheetView
import io.homeassistant.companion.android.common.assist.AssistViewModelBase
import io.homeassistant.companion.android.common.data.servers.ServerManager
import io.homeassistant.companion.android.launch.LaunchActivity
import io.homeassistant.companion.android.launcher.LauncherActivity
import io.homeassistant.companion.android.util.compose.HomeAssistantAppTheme
import io.homeassistant.companion.android.webview.WebViewActivity
import kotlinx.coroutines.launch
Expand Down Expand Up @@ -64,7 +64,7 @@ class AssistActivity : BaseActivity() {
if (savedInstanceState == null) {
lifecycleScope.launch {
if (!viewModel.isRegistered()) {
startActivity(Intent(this@AssistActivity, LaunchActivity::class.java))
startActivity(Intent(this@AssistActivity, LauncherActivity::class.java))
finish()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavOptions
import androidx.navigation.get
import io.homeassistant.companion.android.HAStartDestinationRoute
import io.homeassistant.companion.android.launcher.HAStartDestinationRoute
import kotlinx.serialization.Serializable

@Serializable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import androidx.navigation.NavOptions
import androidx.navigation.compose.composable
import androidx.navigation.get
import androidx.navigation.toRoute
import io.homeassistant.companion.android.HAStartDestinationRoute
import io.homeassistant.companion.android.common.data.servers.ServerManager.Companion.SERVER_ID_ACTIVE
import io.homeassistant.companion.android.launcher.HAStartDestinationRoute
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,27 @@ package io.homeassistant.companion.android.improv.ui
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material.Button
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.material.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.mikepenz.iconics.compose.Image
import com.mikepenz.iconics.typeface.IIcon
import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
import io.homeassistant.companion.android.common.R as commonR
import io.homeassistant.companion.android.onboarding.OnboardingHeaderView
import io.homeassistant.companion.android.onboarding.OnboardingPermissionBullet
import io.homeassistant.companion.android.util.compose.ModalBottomSheet

@Composable
Expand All @@ -29,10 +34,7 @@ fun ImprovPermissionView(needsBluetooth: Boolean, needsLocation: Boolean, onCont
.padding(horizontal = 16.dp)
.padding(bottom = 16.dp),
) {
OnboardingHeaderView(
icon = CommunityMaterial.Icon3.cmd_radar,
title = stringResource(commonR.string.improv_permission_title),
)
Header()
Text(
text = stringResource(commonR.string.improv_permission_text),
textAlign = TextAlign.Center,
Expand All @@ -41,13 +43,13 @@ fun ImprovPermissionView(needsBluetooth: Boolean, needsLocation: Boolean, onCont
.align(Alignment.CenterHorizontally),
)
if (needsBluetooth) {
OnboardingPermissionBullet(
PermissionBullet(
icon = CommunityMaterial.Icon.cmd_bluetooth,
text = stringResource(commonR.string.improv_permission_bluetooth),
)
}
if (needsLocation) {
OnboardingPermissionBullet(
PermissionBullet(
icon = CommunityMaterial.Icon3.cmd_map_marker,
text = stringResource(commonR.string.improv_permission_location),
)
Expand All @@ -66,6 +68,49 @@ fun ImprovPermissionView(needsBluetooth: Boolean, needsLocation: Boolean, onCont
}
}

@Composable
private fun Header() {
Column(modifier = Modifier.fillMaxWidth()) {
Spacer(modifier = Modifier.height(32.dp))
Image(
asset = CommunityMaterial.Icon3.cmd_radar,
colorFilter = ColorFilter.tint(colorResource(commonR.color.colorAccent)),
contentDescription = null,
modifier = Modifier
.size(48.dp)
.align(Alignment.CenterHorizontally),
)
Text(
text = stringResource(commonR.string.improv_permission_title),
style = MaterialTheme.typography.h5,
textAlign = TextAlign.Center,
modifier = Modifier
.padding(vertical = 16.dp)
.align(Alignment.CenterHorizontally),
)
}
}

@Composable
private fun PermissionBullet(icon: IIcon, text: String) {
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier.padding(vertical = 12.dp),
) {
Image(
asset = icon,
colorFilter = ColorFilter.tint(MaterialTheme.colors.onSurface),
contentDescription = null,
)
Text(
text = text,
modifier = Modifier
.padding(start = 16.dp)
.fillMaxWidth(),
)
}
}

@Preview
@Composable
fun ImprovPermissionViewPreview() {
Expand Down
Loading
Loading