1
0
Форкнуть 0
surface-duo-window-manager-.../TwoDo
Craig Dunn c14d6a4258
update to 1.0.0 stable release (#32)
* update to 1.0.0 stable release

and slidingpanelayout-1.2.0 stable release

* update README
2022-01-26 16:59:02 -08:00
..
app update to 1.0.0 stable release (#32) 2022-01-26 16:59:02 -08:00
gradle/wrapper TwoDo - dual screen todo list app (#8) 2021-07-28 15:51:02 -07:00
screenshots TwoDo - dual screen todo list app (#8) 2021-07-28 15:51:02 -07:00
.gitignore TwoDo - dual screen todo list app (#8) 2021-07-28 15:51:02 -07:00
README.md TwoDo - dual screen todo list app (#8) 2021-07-28 15:51:02 -07:00
build.gradle update to rc01 (#31) 2021-12-16 14:52:26 -08:00
gradle.properties TwoDo - dual screen todo list app (#8) 2021-07-28 15:51:02 -07:00
gradlew TwoDo - dual screen todo list app (#8) 2021-07-28 15:51:02 -07:00
gradlew.bat TwoDo - dual screen todo list app (#8) 2021-07-28 15:51:02 -07:00
ktlint.gradle TwoDo - dual screen todo list app (#8) 2021-07-28 15:51:02 -07:00
settings.gradle TwoDo - dual screen todo list app (#8) 2021-07-28 15:51:02 -07:00

README.md

TwoDo - A Dual-screen Todo list

This sample app is a todo list built for dual-screen devices like Surface Duo. It has the ability to view tasks on one screen, and create/edit tasks on the other screen.

Technical Details

The app has two activities: a splash activity (MainActivity.kt), and the TwoDo activity (TwoDoActivity.kt). The splash activity serves as a "welcome" screen for TwoDo, while the TwoDo activity is the actual todo list.

Splash Activity - Jetpack WM, MotionLayout, and ReactiveGuide

The splash activity shows how to create a dual-screen app in its simplest form. The welcome message appears normally, but when spanned, a logo screen appears on the other screen. This is done with Jetpack WM, MotionLayout, and ReactiveGuide. A relevant explanation of this technique can be found in another sample: FoldingVideo.

TwoDo Activity - SlidingPaneLayout and Room

The TwoDo activity leverages SlidingPaneLayout for is dual-screen capabilities, and Android Room for it's storage.

The layout associated with this activity, activity_two_do.xml, has a SlidingPaneLayout root view. The root view has two children: a Relativelayout and a FragmentContainerView. The RelativeLayout contains the title text and button, as well as the RecyclerView that loads the tasks. The FragmentContainerView loads the new/edit task fragment or the logo fragment if we are not creating or editing a task.

Tasks are stored using Andorid Room. A task consists of four data fields: uid, name, notes, and complete (boolean). The uid is autogenerated as the primary key for the database table. Task table query, insert, update, and delete are ultimately available through a TaskViewModel instance that is shared between the activity and the fragments. A list of tasks are queried and provided to the RecyclerView's TaskAdapter to render the list of tasks.

Surface Duo Examples

Splash activity when the app is spanned: Splash activity

TwoDo activity in dual-portrait mode: TwoDo Dual Portrait

TwoDo activity in dual-landscape mode: TwoDo Dual Landscape