Skip to content

Commit

Permalink
Minor UI improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
bubelov committed Jan 24, 2025
1 parent d5aad90 commit fb01403
Show file tree
Hide file tree
Showing 37 changed files with 102 additions and 28 deletions.
34 changes: 24 additions & 10 deletions app/src/main/kotlin/element/ElementFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import android.view.ViewGroup
import android.view.animation.AccelerateInterpolator
import android.widget.LinearLayout
import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.core.net.toUri
import androidx.core.os.bundleOf
import androidx.core.view.ViewCompat
Expand All @@ -27,6 +25,7 @@ import androidx.fragment.app.commit
import androidx.fragment.app.replace
import androidx.recyclerview.widget.LinearLayoutManager
import coil.load
import element_comment.AddElementCommentFragment
import element_comment.ElementCommentRepo
import element_comment.ElementCommentsFragment
import icons.iconTypeface
Expand Down Expand Up @@ -92,7 +91,7 @@ class ElementFragment : Fragment() {
if (arguments != null) {
ViewCompat.setOnApplyWindowInsetsListener(binding.toolbar) { appBar, windowInsets ->
val insets = windowInsets.getInsets(WindowInsetsCompat.Type.statusBars())
appBar.updateLayoutParams<ConstraintLayout.LayoutParams> {
appBar.updateLayoutParams<LinearLayout.LayoutParams> {
topMargin = insets.top
}
val navBarsInsets = windowInsets.getInsets(WindowInsetsCompat.Type.navigationBars())
Expand All @@ -110,16 +109,17 @@ class ElementFragment : Fragment() {
parentFragmentManager.popBackStack()
}

binding.mapContainer.isVisible = true
binding.map.isVisible = true

binding.mapClickHandler.setOnClickListener {
resultModel.element.update { element }
parentFragmentManager.commit {
replace<MapFragment>(R.id.nav_host_fragment)
binding.map.getMapAsync { map ->
map.addOnMapClickListener {
resultModel.element.update { element }
parentFragmentManager.commit {
replace<MapFragment>(R.id.nav_host_fragment)
}
true
}
}

binding.map.getMapAsync { map ->
map.uiSettings.setAllGesturesEnabled(false)
map.setStyle(styleBuilder(requireContext()))
map.cameraPosition =
Expand Down Expand Up @@ -365,6 +365,20 @@ class ElementFragment : Fragment() {
}
}

binding.boost.isEnabled = false

binding.addComment.setOnClickListener {
requireActivity().supportFragmentManager.commit {
setReorderingAllowed(true)
replace<AddElementCommentFragment>(
R.id.nav_host_fragment,
null,
bundleOf("element_id" to elementId)
)
addToBackStack(null)
}
}

val imageUrl = tags.optString("image").toHttpUrlOrNull()

if (imageUrl != null) {
Expand Down
61 changes: 43 additions & 18 deletions app/src/main/res/layout/fragment_element.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,18 @@
android:layout_height="wrap_content"
android:orientation="vertical">

<FrameLayout
android:id="@+id/mapContainer"
<org.maplibre.android.maps.MapView
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="192dp"
android:paddingBottom="4dp"
android:visibility="gone">

<org.maplibre.android.maps.MapView
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent" />

<View
android:id="@+id/mapClickHandler"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true" />
</FrameLayout>
android:layout_marginBottom="4dp"
android:visibility="gone"
app:maplibre_uiAttribution="false"
app:maplibre_uiLogo="false"
app:maplibre_uiRotateGestures="false"
app:maplibre_uiScrollGestures="false"
app:maplibre_uiTiltGestures="false"
app:maplibre_uiZoomGestures="false" />

<ImageView
android:id="@+id/image"
Expand All @@ -64,7 +58,8 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginHorizontal="16dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="8dp"
android:layout_weight="1"
android:text="@string/verify" />

Expand All @@ -74,9 +69,39 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginHorizontal="16dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="16dp"
android:layout_weight="1"
android:text="@string/comments" />

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">

<Button
android:id="@+id/boost"
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="16dp"
android:layout_marginEnd="8dp"
android:layout_weight="1"
android:text="@string/boost" />

<Button
android:id="@+id/add_comment"
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="8dp"
android:layout_marginEnd="16dp"
android:layout_weight="1"
android:text="@string/add_comment" />

</LinearLayout>

<LinearLayout
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-af/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@
<string name="comments">Comments</string>
<string name="add">Add</string>
<string name="issues_d">Issues: %1$d</string>
<string name="boost">Boost</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@
<string name="comments">Comments</string>
<string name="add">Add</string>
<string name="issues_d">Issues: %1$d</string>
<string name="boost">Boost</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-bg/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@
<string name="comments">Comments</string>
<string name="add">Add</string>
<string name="issues_d">Issues: %1$d</string>
<string name="boost">Boost</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-bn/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@
<string name="comments">Comments</string>
<string name="add">Add</string>
<string name="issues_d">Issues: %1$d</string>
<string name="boost">Boost</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-ca/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@
<string name="comments">Comments</string>
<string name="add">Add</string>
<string name="issues_d">Issues: %1$d</string>
<string name="boost">Boost</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-cs/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@
<string name="comments">Comments</string>
<string name="add">Add</string>
<string name="issues_d">Issues: %1$d</string>
<string name="boost">Boost</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-da/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@
<string name="comments">Comments</string>
<string name="add">Add</string>
<string name="issues_d">Issues: %1$d</string>
<string name="boost">Boost</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@
<string name="comments">Comments</string>
<string name="add">Add</string>
<string name="issues_d">Issues: %1$d</string>
<string name="boost">Boost</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-el/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@
<string name="comments">Comments</string>
<string name="add">Add</string>
<string name="issues_d">Issues: %1$d</string>
<string name="boost">Boost</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@
<string name="comments">Comments</string>
<string name="add">Add</string>
<string name="issues_d">Issues: %1$d</string>
<string name="boost">Boost</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-fa/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@
<string name="comments">Comments</string>
<string name="add">Add</string>
<string name="issues_d">Issues: %1$d</string>
<string name="boost">Boost</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-fi/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@
<string name="comments">Comments</string>
<string name="add">Add</string>
<string name="issues_d">Issues: %1$d</string>
<string name="boost">Boost</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@
<string name="comments">Comments</string>
<string name="add">Add</string>
<string name="issues_d">Issues: %1$d</string>
<string name="boost">Boost</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-hi/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@
<string name="comments">Comments</string>
<string name="add">Add</string>
<string name="issues_d">Issues: %1$d</string>
<string name="boost">Boost</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-hu/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@
<string name="comments">Comments</string>
<string name="add">Add</string>
<string name="issues_d">Issues: %1$d</string>
<string name="boost">Boost</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@
<string name="comments">Comments</string>
<string name="add">Add</string>
<string name="issues_d">Issues: %1$d</string>
<string name="boost">Boost</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-iw/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@
<string name="comments">Comments</string>
<string name="add">Add</string>
<string name="issues_d">Issues: %1$d</string>
<string name="boost">Boost</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-ja/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@
<string name="comments">Comments</string>
<string name="add">Add</string>
<string name="issues_d">Issues: %1$d</string>
<string name="boost">Boost</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-ko/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@
<string name="comments">Comments</string>
<string name="add">Add</string>
<string name="issues_d">Issues: %1$d</string>
<string name="boost">Boost</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-nl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@
<string name="comments">Comments</string>
<string name="add">Add</string>
<string name="issues_d">Issues: %1$d</string>
<string name="boost">Boost</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-no/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@
<string name="comments">Comments</string>
<string name="add">Add</string>
<string name="issues_d">Issues: %1$d</string>
<string name="boost">Boost</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-pl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@
<string name="comments">Comments</string>
<string name="add">Add</string>
<string name="issues_d">Issues: %1$d</string>
<string name="boost">Boost</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-pt-rBR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,5 @@
<string name="comments">Comments</string>
<string name="add">Add</string>
<string name="issues_d">Issues: %1$d</string>
<string name="boost">Boost</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-pt/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,5 @@
<string name="comments">Comments</string>
<string name="add">Add</string>
<string name="issues_d">Issues: %1$d</string>
<string name="boost">Boost</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-ro/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@
<string name="comments">Comments</string>
<string name="add">Add</string>
<string name="issues_d">Issues: %1$d</string>
<string name="boost">Boost</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@
<string name="comments">Comments</string>
<string name="add">Add</string>
<string name="issues_d">Issues: %1$d</string>
<string name="boost">Boost</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-sr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@
<string name="comments">Comments</string>
<string name="add">Add</string>
<string name="issues_d">Issues: %1$d</string>
<string name="boost">Boost</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-sv/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@
<string name="comments">Comments</string>
<string name="add">Add</string>
<string name="issues_d">Issues: %1$d</string>
<string name="boost">Boost</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-th/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@
<string name="comments">Comments</string>
<string name="add">Add</string>
<string name="issues_d">Issues: %1$d</string>
<string name="boost">Boost</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-tr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@
<string name="comments">Comments</string>
<string name="add">Add</string>
<string name="issues_d">Issues: %1$d</string>
<string name="boost">Boost</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-uk/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@
<string name="comments">Comments</string>
<string name="add">Add</string>
<string name="issues_d">Issues: %1$d</string>
<string name="boost">Boost</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-ur/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@
<string name="comments">Comments</string>
<string name="add">Add</string>
<string name="issues_d">Issues: %1$d</string>
<string name="boost">Boost</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-vi/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@
<string name="comments">Comments</string>
<string name="add">Add</string>
<string name="issues_d">Issues: %1$d</string>
<string name="boost">Boost</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-zh/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@
<string name="comments">Comments</string>
<string name="add">Add</string>
<string name="issues_d">Issues: %1$d</string>
<string name="boost">Boost</string>
</resources>
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 @@ -76,4 +76,5 @@
<string name="comments">Comments</string>
<string name="add">Add</string>
<string name="issues_d">Issues: %1$d</string>
<string name="boost">Boost</string>
</resources>

0 comments on commit fb01403

Please sign in to comment.