Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display object note above quest and overlay answers #5889

Merged
merged 12 commits into from
Oct 3, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ abstract class AbstractOsmQuestForm<T> : AbstractQuestForm(), IsShowingQuestDeta

setTitle(getString(osmElementQuestType.getTitle(element.tags)))
setTitleHintLabel(getNameAndLocationSpanned(element, resources, featureDictionary))
val objNote = element.tags["note"]
if (objNote != null) {
setObjNote(objNote)
}
kmpoppe marked this conversation as resolved.
Show resolved Hide resolved
}

override fun onStart() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,13 @@ abstract class AbstractQuestForm :
updateInfoButtonVisibility()
}

protected fun setObjNote(text: CharSequence?) {
binding.titleNoteLabel.isGone = text == null
binding.titleNoteLabel.text = getString(R.string.note_for_object)
binding.noteLabel.isGone = text == null
binding.noteLabel.text = text
decideObjNoteVisible()
}
kmpoppe marked this conversation as resolved.
Show resolved Hide resolved
protected fun setHintImages(images: List<Drawable>) {
binding.infoPictures.isGone = images.isEmpty()
binding.infoPictures.removeAllViews()
Expand All @@ -181,6 +188,10 @@ abstract class AbstractQuestForm :
updateInfoButtonVisibility()
}

private fun decideObjNoteVisible() {
binding.scrollViewNote.isGone = binding.titleNoteLabel.text == null
}

private fun toggleInfoArea() {
infoIsExpanded = !infoIsExpanded
binding.infoButton.setImageResource(
Expand Down
52 changes: 52 additions & 0 deletions app/src/main/res/layout/fragment_quest_answer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,58 @@

</LinearLayout>

<androidx.core.widget.NestedScrollView
kmpoppe marked this conversation as resolved.
Show resolved Hide resolved
android:id="@+id/scrollViewNote"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipChildren="false"
android:clipToPadding="false"
android:visibility="gone"
android:elevation="@dimen/speech_bubble_elevation">

<LinearLayout
android:id="@+id/speechbubbleNoteContainer"
android:background="@drawable/speech_bubble_none"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginStart="@dimen/horizontal_speech_bubble_margin"
android:layout_marginEnd="@dimen/horizontal_speech_bubble_margin"
android:layout_marginBottom="4dp"
android:showDividers="middle"
android:paddingStart="22dp"
android:paddingEnd="22dp"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:divider="@drawable/space_16dp"
android:elevation="@dimen/speech_bubble_elevation">

<LinearLayout
android:id="@+id/noteArea"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:showDividers="middle">

<TextView
android:id="@+id/titleNoteLabel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.TitleLarge.Bold" />

<TextView
android:id="@+id/noteLabel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.TitleLarge.Italic" />

</LinearLayout>


</LinearLayout>

</androidx.core.widget.NestedScrollView>

<!-- Necessary because even if the bottom sheet is already expanded, the content might
be still too large to fit onto the screen without scrolling (it often is) -->
<androidx.core.widget.NestedScrollView
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ The info you enter is directly added to OpenStreetMap in your name, without the
<string name="osm_element_gone_description">"Are you sure that it does not exist, not even at a slightly different location? If you’re not sure, leave a note instead.</string>
<string name="osm_element_gone_confirmation">It does not exist</string>
<string name="leave_note">Leave note</string>
<string name="note_for_object">Another person noted:</string>

<string name="quest_generic_answer_differs_along_the_way">"Differs along the way…"</string>
<string name="quest_split_way_description">If it differs along the way, the first step is to split up the way. After that, the quest can be answered for each part separately.\nSplit it now?</string>
Expand Down
12 changes: 12 additions & 0 deletions app/src/main/res/values/textStyles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@
<item name="android:textStyle">normal</item>
</style>

<style name="TextAppearance.TitleLarge.Bold">
<item name="android:textSize">16sp</item>
<item name="android:textColor">@color/hint_text</item>
<item name="android:textStyle">bold</item>
</style>

<style name="TextAppearance.TitleLarge.Italic">
<item name="android:textSize">16sp</item>
<item name="android:textColor">@color/hint_text</item>
<item name="android:textStyle">italic</item>
</style>

kmpoppe marked this conversation as resolved.
Show resolved Hide resolved
<style name="TextAppearance.Body" parent="TextAppearance.AppCompat.Body1">
<item name="android:textSize">14sp</item>
<item name="android:fontFamily">sans-serif</item>
Expand Down