Improve merchants' marker info window layout. Added proper padding and nice rounded corners with a 1dp border to improve visibility.

This commit is contained in:
Severiano Jaramillo 2019-01-24 17:02:28 -06:00
parent 69c27d3092
commit 2e07bc512f
4 changed files with 16 additions and 7 deletions

View file

@ -210,7 +210,7 @@ class MerchantsFragment : Fragment(), OnMapReadyCallback {
override fun getInfoWindow(marker: Marker?): View {
val infoWindowLayout: View = LayoutInflater.from(context).inflate(
R.layout.map_pin_info_dialog, null)
R.layout.marker_info_window, null)
val tvName = infoWindowLayout.findViewById<TextView>(R.id.tvName)
val tvAddress = infoWindowLayout.findViewById<TextView>(R.id.tvAddress)
val tvPhone = infoWindowLayout.findViewById<TextView>(R.id.tvPhone)
@ -230,9 +230,10 @@ class MerchantsFragment : Fragment(), OnMapReadyCallback {
else
tvPhone.visibility = View.GONE
if (selectedMerchant?.telegram != null)
tvTelegram.text = selectedMerchant?.telegram
else
if (selectedMerchant?.telegram != null) {
val telegram = "Telegram: ${selectedMerchant?.telegram}"
tvTelegram.text = telegram
} else
tvTelegram.visibility = View.GONE
if (selectedMerchant?.website != null)

View file

@ -29,7 +29,7 @@ fun FloatingActionButton.disable(colorResource: Int) {
/**
* Easily create a toast message with less boilerplate code
*/
fun Context.toast(message: CharSequence, duration: Int = Toast.LENGTH_LONG) {
fun Context.toast(message: CharSequence, duration: Int = Toast.LENGTH_SHORT) {
Toast.makeText(this, message, duration).show()
}

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<corners android:radius="10dp" />
<solid android:color="?android:colorBackground" />
<stroke
android:color="?android:textColorPrimary"
android:width="1dp"/>
</shape>

View file

@ -5,8 +5,8 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="4dp"
android:background="?android:colorBackground">
android:padding="12dp"
android:background="@drawable/marker_info_window_background">
<TextView
android:id="@+id/tvName"