diff options
| author | Claude <noreply@anthropic.com> | 2026-04-11 02:27:51 +0000 |
|---|---|---|
| committer | Claude <noreply@anthropic.com> | 2026-04-11 02:27:51 +0000 |
| commit | 4a2d0298ab2caa3d62cfbd54c0071ae47eb89ccf (patch) | |
| tree | 78ae008c64934fadee7fb20f76b4d90237f67cf9 /android-app/app/src/main/res | |
| parent | a287abc937eb036271717e0867398fb68711c51e (diff) | |
Four features: outbound link markers, offline content, log text/photo, departure picker
Learn tab
- ic_open_in_new.xml: external link icon (box + arrow) applied to all browser-opening cards
- Migration guide cards retain internal › chevron; ASA/Flashcards cards show ↗ icon
- New REFERENCE section (offline, works without connectivity):
- ColRegs Rules of the Road → colregs_reference.md (rules 1–38, lights table,
sound signals, day shapes, memory aids)
- Sailing Quick Reference → sailing_reference.md (points of sail, Beaufort scale,
nav lights, knots, buoyage IALA-B, VHF channels, distress signals, tide rule of 12)
- ColRegs card moved from external ASA section to offline REFERENCE section
Log entry
- LogEntry: add photoPath field (absolute file path or content URI string)
- VoiceLogViewModel: replace confirmAndSave() with save(text, photoPath?) so the
fragment controls text (user may edit recognized speech before saving)
- VoiceLogFragment: redesigned layout with EditText (editable, voice fills it),
camera button (TakePicturePreview → JPEG in cacheDir), gallery button (GetContent),
photo thumbnail with remove button, Save / Clear row
- Manifest: add android.hardware.camera uses-feature (required=false)
Departure date/time picker (trip planning)
- ic_calendar.xml: calendar icon for the picker button
- PreTripReportViewModel: _departureMs StateFlow (default = now), setDeparture(ms)
- PreTripReportGenerator.generateReport(): departureDateTimeMs param;
findDepartureSlot() matches nearest UTC forecast item; condition window labels show
actual local times (e.g. "2 PM") when departure is not near-now; buildWatchList
uses departure hour for Kona trades warning instead of system clock
- fragment_pretrip_report.xml: DEPART card with label + calendar button above generate
- PreTripReportFragment: MaterialDatePicker (future dates only) → MaterialTimePicker
chain; auto-regenerates after picker confirms
https://claude.ai/code/session_01HXPjBsogsJVRwCiekDGkJX
Diffstat (limited to 'android-app/app/src/main/res')
5 files changed, 409 insertions, 85 deletions
diff --git a/android-app/app/src/main/res/drawable/ic_calendar.xml b/android-app/app/src/main/res/drawable/ic_calendar.xml new file mode 100644 index 0000000..dd8030c --- /dev/null +++ b/android-app/app/src/main/res/drawable/ic_calendar.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="utf-8"?> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <!-- Calendar outline --> + <path + android:fillColor="@android:color/transparent" + android:strokeColor="#FF000000" + android:strokeWidth="2" + android:strokeLineCap="round" + android:strokeLineJoin="round" + android:pathData="M19,4H5C3.895,4 3,4.895 3,6v14c0,1.105 0.895,2 2,2h14c1.105,0 2,-0.895 2,-2V6C21,4.895 20.105,4 19,4z" /> + <!-- Header bar --> + <path + android:fillColor="@android:color/transparent" + android:strokeColor="#FF000000" + android:strokeWidth="2" + android:pathData="M3,10h18" /> + <!-- Hanger lines --> + <path + android:fillColor="@android:color/transparent" + android:strokeColor="#FF000000" + android:strokeWidth="2" + android:strokeLineCap="round" + android:pathData="M8,2v4M16,2v4" /> + <!-- Day dots (3 representative) --> + <path + android:fillColor="#FF000000" + android:pathData="M8,14m-1,0a1,1 0,1,0 2,0a1,1 0,1,0 -2,0" /> + <path + android:fillColor="#FF000000" + android:pathData="M12,14m-1,0a1,1 0,1,0 2,0a1,1 0,1,0 -2,0" /> + <path + android:fillColor="#FF000000" + android:pathData="M16,14m-1,0a1,1 0,1,0 2,0a1,1 0,1,0 -2,0" /> + <path + android:fillColor="#FF000000" + android:pathData="M8,18m-1,0a1,1 0,1,0 2,0a1,1 0,1,0 -2,0" /> + <path + android:fillColor="#FF000000" + android:pathData="M12,18m-1,0a1,1 0,1,0 2,0a1,1 0,1,0 -2,0" /> +</vector> diff --git a/android-app/app/src/main/res/drawable/ic_open_in_new.xml b/android-app/app/src/main/res/drawable/ic_open_in_new.xml new file mode 100644 index 0000000..4645522 --- /dev/null +++ b/android-app/app/src/main/res/drawable/ic_open_in_new.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="18dp" + android:height="18dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <!-- Box outline with open top-right corner --> + <path + android:fillColor="@android:color/transparent" + android:strokeColor="#FF000000" + android:strokeWidth="2" + android:strokeLineCap="round" + android:strokeLineJoin="round" + android:pathData="M18,13v6a2,2 0,0 1,-2,2H5a2,2 0,0 1,-2,-2V8a2,2 0,0 1,2,-2h6" /> + <!-- Arrow pointing top-right --> + <path + android:fillColor="@android:color/transparent" + android:strokeColor="#FF000000" + android:strokeWidth="2" + android:strokeLineCap="round" + android:strokeLineJoin="round" + android:pathData="M15,3h6v6" /> + <path + android:fillColor="@android:color/transparent" + android:strokeColor="#FF000000" + android:strokeWidth="2" + android:strokeLineCap="round" + android:strokeLineJoin="round" + android:pathData="M10,14L21,3" /> +</vector> diff --git a/android-app/app/src/main/res/layout/fragment_learn.xml b/android-app/app/src/main/res/layout/fragment_learn.xml index f41e577..8813ba2 100644 --- a/android-app/app/src/main/res/layout/fragment_learn.xml +++ b/android-app/app/src/main/res/layout/fragment_learn.xml @@ -96,11 +96,11 @@ </LinearLayout> </com.google.android.material.card.MaterialCardView> - <!-- ── ASA Training & Practice ──────────────────────────────── --> + <!-- ── Reference (offline) ──────────────────────────────────── --> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="ASA TRAINING & PRACTICE" + android:text="REFERENCE" android:textSize="11sp" android:textAllCaps="true" android:letterSpacing="0.12" @@ -108,7 +108,7 @@ android:layout_marginBottom="8dp" /> <com.google.android.material.card.MaterialCardView - android:id="@+id/card_asa_courses" + android:id="@+id/card_colregs" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp" @@ -118,59 +118,102 @@ <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:orientation="vertical" - android:padding="16dp"> + android:orientation="horizontal" + android:padding="16dp" + android:gravity="center_vertical"> - <TextView - android:layout_width="wrap_content" + <LinearLayout + android:layout_width="0dp" android:layout_height="wrap_content" - android:text="ASA Course Catalog" - android:textAppearance="?attr/textAppearanceTitleSmall" /> + android:layout_weight="1" + android:orientation="vertical"> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="ColRegs — Rules of the Road" + android:textAppearance="?attr/textAppearanceTitleSmall" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="International collision regulations, rules 1–38" + android:textSize="12sp" + android:textColor="?attr/colorOnSurfaceVariant" + android:layout_marginTop="2dp" /> + + </LinearLayout> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="ASA 101–114: keelboat through offshore passagemaking" - android:textSize="12sp" - android:textColor="?attr/colorOnSurfaceVariant" - android:layout_marginTop="2dp" /> + android:text="›" + android:textSize="20sp" + android:textColor="?attr/colorOnSurfaceVariant" /> </LinearLayout> </com.google.android.material.card.MaterialCardView> <com.google.android.material.card.MaterialCardView - android:id="@+id/card_asa_online" + android:id="@+id/card_sailing_reference" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginBottom="8dp" + android:layout_marginBottom="24dp" app:cardCornerRadius="12dp" app:cardElevation="2dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:orientation="vertical" - android:padding="16dp"> + android:orientation="horizontal" + android:padding="16dp" + android:gravity="center_vertical"> - <TextView - android:layout_width="wrap_content" + <LinearLayout + android:layout_width="0dp" android:layout_height="wrap_content" - android:text="ASA Online Learning" - android:textAppearance="?attr/textAppearanceTitleSmall" /> + android:layout_weight="1" + android:orientation="vertical"> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Sailing Quick Reference" + android:textAppearance="?attr/textAppearanceTitleSmall" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Points of sail, lights & shapes, knots" + android:textSize="12sp" + android:textColor="?attr/colorOnSurfaceVariant" + android:layout_marginTop="2dp" /> + + </LinearLayout> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="Self-paced online courses and study guides" - android:textSize="12sp" - android:textColor="?attr/colorOnSurfaceVariant" - android:layout_marginTop="2dp" /> + android:text="›" + android:textSize="20sp" + android:textColor="?attr/colorOnSurfaceVariant" /> </LinearLayout> </com.google.android.material.card.MaterialCardView> + <!-- ── ASA Training & Practice (external links) ──────────── --> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="ASA TRAINING & PRACTICE" + android:textSize="11sp" + android:textAllCaps="true" + android:letterSpacing="0.12" + android:textColor="?attr/colorOnSurfaceVariant" + android:layout_marginBottom="8dp" /> + <com.google.android.material.card.MaterialCardView - android:id="@+id/card_colregs" + android:id="@+id/card_asa_courses" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp" @@ -180,22 +223,85 @@ <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:orientation="vertical" - android:padding="16dp"> + android:orientation="horizontal" + android:padding="16dp" + android:gravity="center_vertical"> - <TextView - android:layout_width="wrap_content" + <LinearLayout + android:layout_width="0dp" android:layout_height="wrap_content" - android:text="ColRegs — Rules of the Road" - android:textAppearance="?attr/textAppearanceTitleSmall" /> + android:layout_weight="1" + android:orientation="vertical"> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="ASA Course Catalog" + android:textAppearance="?attr/textAppearanceTitleSmall" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="ASA 101–114: keelboat through offshore passagemaking" + android:textSize="12sp" + android:textColor="?attr/colorOnSurfaceVariant" + android:layout_marginTop="2dp" /> + + </LinearLayout> + + <ImageView + android:layout_width="18dp" + android:layout_height="18dp" + android:src="@drawable/ic_open_in_new" + android:tint="?attr/colorOnSurfaceVariant" + android:contentDescription="Opens in browser" /> - <TextView - android:layout_width="wrap_content" + </LinearLayout> + </com.google.android.material.card.MaterialCardView> + + <com.google.android.material.card.MaterialCardView + android:id="@+id/card_asa_online" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="8dp" + app:cardCornerRadius="12dp" + app:cardElevation="2dp"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:padding="16dp" + android:gravity="center_vertical"> + + <LinearLayout + android:layout_width="0dp" android:layout_height="wrap_content" - android:text="USCG international collision regulations reference" - android:textSize="12sp" - android:textColor="?attr/colorOnSurfaceVariant" - android:layout_marginTop="2dp" /> + android:layout_weight="1" + android:orientation="vertical"> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="ASA Online Learning" + android:textAppearance="?attr/textAppearanceTitleSmall" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Self-paced online courses and study guides" + android:textSize="12sp" + android:textColor="?attr/colorOnSurfaceVariant" + android:layout_marginTop="2dp" /> + + </LinearLayout> + + <ImageView + android:layout_width="18dp" + android:layout_height="18dp" + android:src="@drawable/ic_open_in_new" + android:tint="?attr/colorOnSurfaceVariant" + android:contentDescription="Opens in browser" /> </LinearLayout> </com.google.android.material.card.MaterialCardView> @@ -211,22 +317,38 @@ <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:orientation="vertical" - android:padding="16dp"> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="Sailing Flashcards" - android:textAppearance="?attr/textAppearanceTitleSmall" /> + android:orientation="horizontal" + android:padding="16dp" + android:gravity="center_vertical"> - <TextView - android:layout_width="wrap_content" + <LinearLayout + android:layout_width="0dp" android:layout_height="wrap_content" - android:text="Quizlet decks for knots, rules, lights & signals" - android:textSize="12sp" - android:textColor="?attr/colorOnSurfaceVariant" - android:layout_marginTop="2dp" /> + android:layout_weight="1" + android:orientation="vertical"> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Sailing Flashcards" + android:textAppearance="?attr/textAppearanceTitleSmall" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Quizlet decks for knots, rules, lights & signals" + android:textSize="12sp" + android:textColor="?attr/colorOnSurfaceVariant" + android:layout_marginTop="2dp" /> + + </LinearLayout> + + <ImageView + android:layout_width="18dp" + android:layout_height="18dp" + android:src="@drawable/ic_open_in_new" + android:tint="?attr/colorOnSurfaceVariant" + android:contentDescription="Opens in browser" /> </LinearLayout> </com.google.android.material.card.MaterialCardView> diff --git a/android-app/app/src/main/res/layout/fragment_pretrip_report.xml b/android-app/app/src/main/res/layout/fragment_pretrip_report.xml index 510411b..8cb094a 100644 --- a/android-app/app/src/main/res/layout/fragment_pretrip_report.xml +++ b/android-app/app/src/main/res/layout/fragment_pretrip_report.xml @@ -54,6 +54,58 @@ </LinearLayout> </com.google.android.material.card.MaterialCardView> + <!-- ── Departure time picker ──────────────────────────────── --> + <com.google.android.material.card.MaterialCardView + android:id="@+id/card_departure" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="12dp" + app:cardElevation="2dp" + app:cardCornerRadius="12dp"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:padding="16dp" + android:gravity="center_vertical"> + + <LinearLayout + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:orientation="vertical"> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="DEPART" + android:textSize="11sp" + android:textAllCaps="true" + android:letterSpacing="0.12" + android:textColor="?attr/colorOnSurfaceVariant" + android:layout_marginBottom="4dp" /> + + <TextView + android:id="@+id/tv_departure_time" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Now" + android:textAppearance="?attr/textAppearanceTitleMedium" /> + + </LinearLayout> + + <com.google.android.material.button.MaterialButton + android:id="@+id/btn_pick_departure" + style="@style/Widget.Material3.Button.IconButton.Outlined" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:contentDescription="Pick departure date and time" + app:icon="@drawable/ic_calendar" /> + + </LinearLayout> + </com.google.android.material.card.MaterialCardView> + <!-- ── Generate button + progress ─────────────────────────── --> <LinearLayout android:layout_width="match_parent" diff --git a/android-app/app/src/main/res/layout/fragment_voice_log.xml b/android-app/app/src/main/res/layout/fragment_voice_log.xml index 6d136be..c1275a6 100644 --- a/android-app/app/src/main/res/layout/fragment_voice_log.xml +++ b/android-app/app/src/main/res/layout/fragment_voice_log.xml @@ -1,75 +1,150 @@ <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" - android:gravity="center" - android:padding="24dp"> + android:padding="20dp"> <TextView - android:id="@+id/tv_status" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="Tap microphone to log" - android:textSize="18sp" - android:textAlignment="center" + android:text="Log Entry" + android:textAppearance="?attr/textAppearanceHeadlineSmall" android:layout_marginBottom="16dp" /> - <TextView - android:id="@+id/tv_recognized" + <!-- Note text — voice fills this; user can also type directly --> + <com.google.android.material.textfield.TextInputLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="" - android:textSize="16sp" - android:textAlignment="center" - android:padding="12dp" - android:minHeight="80dp" - android:background="#F5F5F5" - android:layout_marginBottom="24dp" /> + android:layout_marginBottom="12dp" + style="@style/Widget.Material3.TextInputLayout.OutlinedBox"> + + <com.google.android.material.textfield.TextInputEditText + android:id="@+id/et_note" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:minLines="3" + android:maxLines="6" + android:gravity="top" + android:hint="Tap mic or type a note…" + android:inputType="textMultiLine|textCapSentences" + android:scrollbars="vertical" /> + + </com.google.android.material.textfield.TextInputLayout> + + <!-- Action row: mic, camera, gallery, status --> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:gravity="center_vertical" + android:layout_marginBottom="12dp"> + + <com.google.android.material.floatingactionbutton.FloatingActionButton + android:id="@+id/fab_mic" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + app:fabSize="mini" + android:src="@android:drawable/ic_btn_speak_now" + android:contentDescription="Start voice recognition" + android:layout_marginEnd="12dp" /> + + <com.google.android.material.button.MaterialButton + android:id="@+id/btn_camera" + style="@style/Widget.Material3.Button.IconButton.Outlined" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:contentDescription="Take photo" + app:icon="@android:drawable/ic_menu_camera" + android:layout_marginEnd="8dp" /> + + <com.google.android.material.button.MaterialButton + android:id="@+id/btn_gallery" + style="@style/Widget.Material3.Button.IconButton.Outlined" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:contentDescription="Attach photo from gallery" + app:icon="@android:drawable/ic_menu_gallery" + android:layout_marginEnd="12dp" /> + + <TextView + android:id="@+id/tv_status" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="" + android:textSize="14sp" + android:textColor="?attr/colorOnSurfaceVariant" /> + + </LinearLayout> - <com.google.android.material.floatingactionbutton.FloatingActionButton - android:id="@+id/fab_mic" + <!-- Photo thumbnail — hidden until a photo is attached --> + <FrameLayout + android:id="@+id/frame_photo" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:contentDescription="Start voice recognition" - android:src="@android:drawable/ic_btn_speak_now" - android:layout_marginBottom="16dp" /> + android:layout_marginBottom="12dp" + android:visibility="gone"> + + <ImageView + android:id="@+id/iv_photo" + android:layout_width="120dp" + android:layout_height="90dp" + android:scaleType="centerCrop" + android:contentDescription="Attached photo" /> + + <com.google.android.material.button.MaterialButton + android:id="@+id/btn_remove_photo" + style="@style/Widget.Material3.Button.IconButton" + android:layout_width="32dp" + android:layout_height="32dp" + android:layout_gravity="top|end" + android:contentDescription="Remove photo" + app:icon="@drawable/ic_close" /> + + </FrameLayout> + <!-- Save / Clear row --> <LinearLayout - android:id="@+id/ll_confirm_buttons" - android:layout_width="wrap_content" + android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" - android:visibility="gone"> + android:gravity="center_vertical" + android:layout_marginBottom="12dp"> - <Button + <com.google.android.material.button.MaterialButton android:id="@+id/btn_save" - android:layout_width="wrap_content" + android:layout_width="0dp" android:layout_height="wrap_content" + android:layout_weight="1" android:text="Save" android:layout_marginEnd="8dp" /> - <Button - android:id="@+id/btn_retry" + <com.google.android.material.button.MaterialButton + android:id="@+id/btn_clear" + style="@style/Widget.Material3.Button.TextButton" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="Retry" /> + android:text="Clear" /> + </LinearLayout> + <!-- Saved confirmation --> <TextView android:id="@+id/tv_saved_confirmation" - android:layout_width="wrap_content" + android:layout_width="match_parent" android:layout_height="wrap_content" android:text="" android:textSize="14sp" - android:layout_marginTop="16dp" /> + android:textColor="?attr/colorPrimary" + android:layout_marginBottom="24dp" /> <View android:layout_width="match_parent" android:layout_height="1dp" - android:background="#DDDDDD" - android:layout_marginTop="32dp" - android:layout_marginBottom="32dp" /> + android:background="?attr/colorOutline" + android:layout_marginBottom="24dp" /> <com.google.android.material.button.MaterialButton android:id="@+id/btn_generate_report" @@ -77,4 +152,5 @@ android:layout_width="match_parent" android:layout_height="60dp" android:text="GENERATE TRIP REPORT" /> + </LinearLayout> |
