Skip to content

Commit

Permalink
Quest Fragement Layout
Browse files Browse the repository at this point in the history
Removed Nested Scroll View (#5889 (comment)) and TextStyles (#5889 (comment)), made `note` text selectabled (copyable) as web links clickable (as per #5889 (comment)) and
  • Loading branch information
kmpoppe committed Sep 12, 2024
1 parent 138afad commit fa183c2
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package de.westnordost.streetcomplete.quests

import android.graphics.drawable.Drawable
import android.os.Bundle
import android.text.Editable
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
Expand Down Expand Up @@ -189,7 +190,7 @@ abstract class AbstractQuestForm :
}

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

private fun toggleInfoArea() {
Expand Down
84 changes: 40 additions & 44 deletions app/src/main/res/layout/fragment_quest_answer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,57 +120,53 @@

</LinearLayout>

<androidx.core.widget.NestedScrollView
android:id="@+id/scrollViewNote"

<LinearLayout
android:id="@+id/speechbubbleNoteContainer"
android:background="@drawable/speech_bubble_none"
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">
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"
android:visibility="gone">

<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
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.TitleMedium" />

<TextView
android:id="@+id/noteLabel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.Body"
android:textStyle="italic"
android:textColor="@color/hint_text"
android:autoLink="web"
android:textIsSelectable="true" />

</LinearLayout>

</androidx.core.widget.NestedScrollView>

</LinearLayout>


<!-- 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) -->
Expand Down
12 changes: 0 additions & 12 deletions app/src/main/res/values/textStyles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,6 @@
<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>

<style name="TextAppearance.Body" parent="TextAppearance.AppCompat.Body1">
<item name="android:textSize">14sp</item>
<item name="android:fontFamily">sans-serif</item>
Expand Down

0 comments on commit fa183c2

Please sign in to comment.