Skip to content

Commit

Permalink
Reanchoring progress data collection progress bar to bottom of buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
justinkimtang committed Jan 3, 2024
1 parent 250f907 commit eb378a3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class DataCollectionFragment : Hilt_DataCollectionFragment(), BackPressListener

private lateinit var binding: DataCollectionFragBinding
private lateinit var progressBar: ProgressBar
private lateinit var guideline: Guideline
private lateinit var viewPager: ViewPager2

override fun onCreateView(
Expand All @@ -58,7 +57,6 @@ class DataCollectionFragment : Hilt_DataCollectionFragment(), BackPressListener
binding = DataCollectionFragBinding.inflate(inflater, container, false)
viewPager = binding.pager
progressBar = binding.progressBar
guideline = binding.progressBarGuideline
getAbstractActivity().setSupportActionBar(binding.dataCollectionToolbar)
return binding.root
}
Expand All @@ -82,9 +80,6 @@ class DataCollectionFragment : Hilt_DataCollectionFragment(), BackPressListener
val buttonContainer = view.findViewById<View>(R.id.action_buttons_container) ?: return
val anchorLocation = IntArray(2)
buttonContainer.getLocationInWindow(anchorLocation)
val guidelineTop =
anchorLocation[1] - buttonContainer.rootWindowInsets.systemWindowInsetTop
guideline.setGuidelineBegin(guidelineTop)
}
}
)
Expand Down
23 changes: 9 additions & 14 deletions ground/src/main/res/layout/data_collection_frag.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,28 +42,23 @@
app:subtitleCentered="true"
app:title="@{viewModel.jobName}" />

<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/progress_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/data_collection_toolbar" />

<androidx.viewpager2.widget.ViewPager2
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/data_collection_toolbar" />
app:layout_constraintTop_toBottomOf="@id/progress_bar" />

<androidx.constraintlayout.widget.Guideline
android:id="@+id/progress_bar_guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" />

<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/progress_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/progress_bar_guideline" />

</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

0 comments on commit eb378a3

Please sign in to comment.