Skip to content

Commit

Permalink
feat: cancel button on source
Browse files Browse the repository at this point in the history
  • Loading branch information
motionman committed Aug 2, 2022
1 parent 35d9a83 commit 9af2643
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
17 changes: 17 additions & 0 deletions .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,17 @@ class SourcesFragment : Fragment(R.layout.sources_fragment) {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

setToolbarTitle()
setupToolbar()
initAdapter()

sourceAdapter.submitList(localSourceData)
}

private fun setToolbarTitle() {
binding.sourcesToolbar.toolbarTitleTextView.text = getText(R.string.source_title)
private fun setupToolbar() {
with(binding.sourcesToolbar) {
toolbarTitleTextView.text = getText(R.string.source_title)
toolbarCancelTextView.setOnClickListener { activity?.finish() }
}
}

private fun initAdapter() {
Expand Down
12 changes: 12 additions & 0 deletions filestack/src/main/res/layout/toolbar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,24 @@
android:layout_height="wrap_content"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Toolbar" />

<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/toolbarCancelTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cancel_button"
android:textColor="@color/white"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

</androidx.appcompat.widget.Toolbar>

0 comments on commit 9af2643

Please sign in to comment.