From 717c87122dc6f97f06b11311f356c3e1d666f2f9 Mon Sep 17 00:00:00 2001 From: Wally Hackenslacker Date: Wed, 18 Mar 2026 08:16:27 -0400 Subject: [PATCH] feat: scaffold boards drawer layout and UI resources --- .../kanbn4droid/app/BoardsFlowTest.kt | 37 +++++++ app/src/main/res/layout/activity_boards.xml | 103 ++++++++++-------- .../main/res/layout/item_workspace_drawer.xml | 20 ++++ .../main/res/layout/view_boards_drawer.xml | 60 ++++++++++ app/src/main/res/values/dimens.xml | 4 + app/src/main/res/values/strings.xml | 7 ++ 6 files changed, 186 insertions(+), 45 deletions(-) create mode 100644 app/src/main/res/layout/item_workspace_drawer.xml create mode 100644 app/src/main/res/layout/view_boards_drawer.xml create mode 100644 app/src/main/res/values/dimens.xml diff --git a/app/src/androidTest/java/space/hackenslacker/kanbn4droid/app/BoardsFlowTest.kt b/app/src/androidTest/java/space/hackenslacker/kanbn4droid/app/BoardsFlowTest.kt index 42e5eb1..8b69bbf 100644 --- a/app/src/androidTest/java/space/hackenslacker/kanbn4droid/app/BoardsFlowTest.kt +++ b/app/src/androidTest/java/space/hackenslacker/kanbn4droid/app/BoardsFlowTest.kt @@ -2,7 +2,11 @@ package space.hackenslacker.kanbn4droid.app import androidx.test.core.app.ActivityScenario import androidx.test.espresso.Espresso.onView +import androidx.test.espresso.ViewAction import androidx.test.espresso.action.ViewActions.click +import androidx.test.espresso.action.GeneralSwipeAction +import androidx.test.espresso.action.Press +import androidx.test.espresso.action.Swipe import androidx.test.espresso.action.ViewActions.longClick import androidx.test.espresso.action.ViewActions.replaceText import androidx.test.espresso.action.ViewActions.swipeDown @@ -16,6 +20,7 @@ import androidx.test.espresso.matcher.ViewMatchers.isDisplayed import androidx.test.espresso.matcher.ViewMatchers.withId import androidx.test.espresso.matcher.ViewMatchers.withText import androidx.test.ext.junit.runners.AndroidJUnit4 +import kotlin.math.roundToInt import org.junit.After import org.junit.Before import org.junit.Test @@ -117,6 +122,38 @@ class BoardsFlowTest { onView(withText("Alpha")).check(matches(isDisplayed())) } + @Test + fun drawerOpensAndShowsWorkspaceSection() { + MainActivity.dependencies.apiClientFactory = { + FakeBoardsApiClient( + boards = mutableListOf(BoardSummary("1", "Alpha")), + templates = emptyList(), + ) + } + + ActivityScenario.launch(BoardsActivity::class.java) + + onView(withId(android.R.id.content)).perform(swipeFromLeftEdge()) + + onView(withText("Workspaces")).check(matches(isDisplayed())) + onView(withText("Alpha")).check(matches(isDisplayed())) + } + + private fun swipeFromLeftEdge(): ViewAction { + return GeneralSwipeAction( + Swipe.FAST, + { view -> + val x = (view.width * 0.02f).roundToInt().toFloat() + floatArrayOf(x, view.height * 0.5f) + }, + { view -> + val x = (view.width * 0.8f).roundToInt().toFloat() + floatArrayOf(x, view.height * 0.5f) + }, + Press.FINGER, + ) + } + private class InMemorySessionStore( private var baseUrl: String? = null, ) : SessionStore { diff --git a/app/src/main/res/layout/activity_boards.xml b/app/src/main/res/layout/activity_boards.xml index cc31767..e292d47 100644 --- a/app/src/main/res/layout/activity_boards.xml +++ b/app/src/main/res/layout/activity_boards.xml @@ -1,60 +1,73 @@ - - + android:layout_height="match_parent"> - - - + android:layout_height="wrap_content" + android:theme="@style/ThemeOverlay.MaterialComponents.ActionBar" + app:title="@string/boards_title" /> - + + + > - + - - - + - + + + - + + + + + + diff --git a/app/src/main/res/layout/item_workspace_drawer.xml b/app/src/main/res/layout/item_workspace_drawer.xml new file mode 100644 index 0000000..766684e --- /dev/null +++ b/app/src/main/res/layout/item_workspace_drawer.xml @@ -0,0 +1,20 @@ + + + + + + diff --git a/app/src/main/res/layout/view_boards_drawer.xml b/app/src/main/res/layout/view_boards_drawer.xml new file mode 100644 index 0000000..20dc677 --- /dev/null +++ b/app/src/main/res/layout/view_boards_drawer.xml @@ -0,0 +1,60 @@ + + + + + + + +