Skip to content

Commit

Permalink
Show and animate accordion expand icon
Browse files Browse the repository at this point in the history
  • Loading branch information
kylecorry31 committed Oct 10, 2023
1 parent e0628f1 commit 5346eb6
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,16 @@ class FragmentToolTriangulate : BoundFragment<FragmentToolTriangulateBinding>()

// Handle expansion
binding.location1Expansion.setOnExpandStateChangedListener {
// TODO: Set the dropdown icon
binding.location1DropdownIcon.rotation = if (it) 180f else 0f
}

binding.location2Expansion.setOnExpandStateChangedListener {
// TODO: Set the dropdown icon
binding.location2DropdownIcon.rotation = if (it) 180f else 0f
}

// Expand the first location by default (this will change once it loads the last recorded values)
binding.location1Expansion.expand()

// TODO: Add an status indicator for the location
// TODO: Display the distance to the location in the title
beaconLayer.setOutlineColor(Color.WHITE)
binding.map.setLayers(listOf(pathLayer, beaconLayer))
Expand Down
86 changes: 60 additions & 26 deletions app/src/main/res/layout/fragment_tool_triangulate.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,30 +71,47 @@
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
android:background="@drawable/rounded_rectangle"
android:backgroundTint="?attr/colorSurface"
android:padding="16dp">
android:backgroundTint="?attr/colorSurface">

<TextView
android:id="@+id/location_1_title"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawablePadding="8dp"
android:text="@string/beacon_1"
app:drawableEndCompat="@drawable/ic_drop_down"
app:drawableStartCompat="@drawable/ic_info"
app:drawableTint="?android:textColorSecondary" />
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="16dp">

<TextView
android:id="@+id/location_1_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:drawablePadding="8dp"
android:gravity="center_vertical"
android:text="@string/beacon_1"
app:drawableStartCompat="@drawable/ic_info"
app:drawableTint="?android:textColorSecondary" />

<ImageView
android:id="@+id/location_1_dropdown_icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="end"
android:src="@drawable/ic_drop_down"
app:tint="?android:textColorSecondary" />

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:orientation="vertical"
android:padding="16dp"
android:paddingTop="0dp">

<TextView
android:id="@+id/location_1_instructions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:text="Example instructions" />
android:layout_height="wrap_content" />

<com.kylecorry.trail_sense.shared.views.CoordinateInputView
android:id="@+id/location_1"
Expand All @@ -120,30 +137,47 @@
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
android:background="@drawable/rounded_rectangle"
android:backgroundTint="?attr/colorSurface"
android:padding="16dp">
android:backgroundTint="?attr/colorSurface">

<TextView
android:id="@+id/location_2_title"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawablePadding="8dp"
android:text="@string/beacon_2"
app:drawableEndCompat="@drawable/ic_drop_down"
app:drawableStartCompat="@drawable/ic_info"
app:drawableTint="?android:textColorSecondary" />
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="16dp">

<TextView
android:id="@+id/location_2_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:drawablePadding="8dp"
android:gravity="center_vertical"
android:text="@string/beacon_2"
app:drawableStartCompat="@drawable/ic_info"
app:drawableTint="?android:textColorSecondary" />

<ImageView
android:id="@+id/location_2_dropdown_icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="end"
android:src="@drawable/ic_drop_down"
app:tint="?android:textColorSecondary" />

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:orientation="vertical"
android:padding="16dp"
android:paddingTop="0dp">

<TextView
android:id="@+id/location_2_instructions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:text="Example instructions" />
android:layout_height="wrap_content" />

<com.kylecorry.trail_sense.shared.views.CoordinateInputView
android:id="@+id/location_2"
Expand Down

0 comments on commit 5346eb6

Please sign in to comment.