Use custom TextView for map view copyright.

This commit is contained in:
Onuray Sahin 2022-06-07 15:11:23 +03:00
parent b455bf04aa
commit b284b92464
4 changed files with 16 additions and 4 deletions

View File

@ -85,6 +85,7 @@ abstract class AbsMessageLocationItem<H : AbsMessageLocationItem.Holder> : AbsMe
): Boolean {
holder.staticMapPinImageView.setImageResource(R.drawable.ic_location_pin_failed)
holder.staticMapErrorTextView.isVisible = true
holder.mapCopyrightTextView.isVisible = false
return false
}
@ -100,6 +101,7 @@ abstract class AbsMessageLocationItem<H : AbsMessageLocationItem.Holder> : AbsMe
holder.staticMapPinImageView.setImageDrawable(pinDrawable)
}
holder.staticMapErrorTextView.isVisible = false
holder.mapCopyrightTextView.isVisible = true
return false
}
})
@ -111,5 +113,6 @@ abstract class AbsMessageLocationItem<H : AbsMessageLocationItem.Holder> : AbsMe
val staticMapImageView by bind<ImageView>(R.id.staticMapImageView)
val staticMapPinImageView by bind<ImageView>(R.id.staticMapPinImageView)
val staticMapErrorTextView by bind<TextView>(R.id.staticMapErrorTextView)
val mapCopyrightTextView by bind<TextView>(R.id.mapCopyrightTextView)
}
}

View File

@ -63,10 +63,8 @@ class UrlMapProvider @Inject constructor(
append(height)
append(".png")
append(keyParam)
if (!localeProvider.isRTL()) {
// On LTR languages we want the legal mentions to be displayed on the bottom left of the image
append("&attribution=bottomleft")
}
// Since the default copyright font is too small we put a custom one on map
append("&attribution=0")
}
}
}

View File

@ -62,4 +62,14 @@
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.5" />
<TextView
android:id="@+id/mapCopyrightTextView"
style="@style/Widget.Vector.TextView.Nano.Copyright"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_margin="4dp"
android:text="@string/location_map_view_copyright"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -3036,6 +3036,7 @@
<string name="labs_enable_live_location_summary">Temporary implementation: locations persist in room history</string>
<string name="live_location_bottom_sheet_stop_sharing">Stop sharing</string>
<string name="live_location_bottom_sheet_last_updated_at">Updated %1$s ago</string>
<string name="location_map_view_copyright">© MapTiler © OpenStreetMap contributors</string>
<string name="message_bubbles">Show Message bubbles</string>