From 2e07bc512fc044a36f31e6554d121142492ad844 Mon Sep 17 00:00:00 2001 From: Severiano Jaramillo Date: Thu, 24 Jan 2019 17:02:28 -0600 Subject: [PATCH] Improve merchants' marker info window layout. Added proper padding and nice rounded corners with a 1dp border to improve visibility. --- .../bitsybitshareswallet/fragments/MerchantsFragment.kt | 9 +++++---- .../cy/agorise/bitsybitshareswallet/utils/Extensions.kt | 2 +- .../main/res/drawable/marker_info_window_background.xml | 8 ++++++++ .../{map_pin_info_dialog.xml => marker_info_window.xml} | 4 ++-- 4 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 app/src/main/res/drawable/marker_info_window_background.xml rename app/src/main/res/layout/{map_pin_info_dialog.xml => marker_info_window.xml} (94%) diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/MerchantsFragment.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/MerchantsFragment.kt index 5ce01bd..7c7b9d4 100644 --- a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/MerchantsFragment.kt +++ b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/MerchantsFragment.kt @@ -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(R.id.tvName) val tvAddress = infoWindowLayout.findViewById(R.id.tvAddress) val tvPhone = infoWindowLayout.findViewById(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) diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/utils/Extensions.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/utils/Extensions.kt index 3d80e05..340a2ff 100644 --- a/app/src/main/java/cy/agorise/bitsybitshareswallet/utils/Extensions.kt +++ b/app/src/main/java/cy/agorise/bitsybitshareswallet/utils/Extensions.kt @@ -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() } diff --git a/app/src/main/res/drawable/marker_info_window_background.xml b/app/src/main/res/drawable/marker_info_window_background.xml new file mode 100644 index 0000000..22431b1 --- /dev/null +++ b/app/src/main/res/drawable/marker_info_window_background.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/map_pin_info_dialog.xml b/app/src/main/res/layout/marker_info_window.xml similarity index 94% rename from app/src/main/res/layout/map_pin_info_dialog.xml rename to app/src/main/res/layout/marker_info_window.xml index 5612a03..29afe3b 100644 --- a/app/src/main/res/layout/map_pin_info_dialog.xml +++ b/app/src/main/res/layout/marker_info_window.xml @@ -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">