In the MerchantsFragment's Map InfoWindows allow line wraps for both name and address and if a section has no data do not show a blank line but just hide it.

This commit is contained in:
Severiano Jaramillo 2019-01-31 15:42:36 -06:00
parent fbb66864e5
commit 981a14723e
2 changed files with 11 additions and 15 deletions

View file

@ -519,23 +519,23 @@ class MerchantsFragment : Fragment(), OnMapReadyCallback, SearchView.OnSuggestio
if (selectedMerchant != null) { if (selectedMerchant != null) {
tvName.text = selectedMerchant?.name tvName.text = selectedMerchant?.name
if (selectedMerchant?.address != null) if (!selectedMerchant?.address.equals(""))
tvAddress.text = selectedMerchant?.address tvAddress.text = selectedMerchant?.address
else else
tvAddress.visibility = View.GONE tvAddress.visibility = View.GONE
if (selectedMerchant?.phone != null) if (!selectedMerchant?.phone.equals(""))
tvPhone.text = selectedMerchant?.phone tvPhone.text = selectedMerchant?.phone
else else
tvPhone.visibility = View.GONE tvPhone.visibility = View.GONE
if (selectedMerchant?.telegram != null) { if (!selectedMerchant?.telegram.equals("")) {
val telegram = "Telegram: ${selectedMerchant?.telegram}" val telegram = "Telegram: ${selectedMerchant?.telegram}"
tvTelegram.text = telegram tvTelegram.text = telegram
} else } else
tvTelegram.visibility = View.GONE tvTelegram.visibility = View.GONE
if (selectedMerchant?.website != null) if (!selectedMerchant?.website.equals(""))
tvWebsite.text = selectedMerchant?.website tvWebsite.text = selectedMerchant?.website
?.removePrefix("http://")?.removePrefix("https://") ?.removePrefix("http://")?.removePrefix("https://")
else else
@ -564,23 +564,23 @@ class MerchantsFragment : Fragment(), OnMapReadyCallback, SearchView.OnSuggestio
if (selectedTeller != null) { if (selectedTeller != null) {
tvName.text = selectedTeller?.gt_name tvName.text = selectedTeller?.gt_name
if (selectedTeller?.address != null) if (!selectedTeller?.address.equals(""))
tvAddress.text = selectedTeller?.address tvAddress.text = selectedTeller?.address
else else
tvAddress.visibility = View.GONE tvAddress.visibility = View.GONE
if (selectedTeller?.phone != null) if (!selectedTeller?.phone.equals(""))
tvPhone.text = selectedTeller?.phone tvPhone.text = selectedTeller?.phone
else else
tvPhone.visibility = View.GONE tvPhone.visibility = View.GONE
if (selectedTeller?.telegram != null) { if (!selectedTeller?.telegram.equals("")) {
val telegram = "Telegram: ${selectedTeller?.telegram}" val telegram = "Telegram: ${selectedTeller?.telegram}"
tvTelegram.text = telegram tvTelegram.text = telegram
} else } else
tvTelegram.visibility = View.GONE tvTelegram.visibility = View.GONE
if (selectedTeller?.url != null) if (!selectedTeller?.url.equals(""))
tvWebsite.text = selectedTeller?.url tvWebsite.text = selectedTeller?.url
?.removePrefix("http://")?.removePrefix("https://") ?.removePrefix("http://")?.removePrefix("https://")
else else

View file

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:padding="12dp" android:padding="12dp"
android:background="@drawable/marker_info_window_background"> android:background="@drawable/marker_info_window_background">
@ -13,18 +13,14 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
tools:text="Bambuddha Holistic Center" tools:text="Bambuddha Holistic Center"
android:textAppearance="@style/TextAppearance.Bitsy.Body1" android:textAppearance="@style/TextAppearance.Bitsy.Body1"/>
android:maxLines="1"
android:ellipsize="end"/>
<TextView <TextView
android:id="@+id/tvAddress" android:id="@+id/tvAddress"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="4dp" android:layout_marginTop="4dp"
tools:text="Carretera, Barra Vieja Km 37, 39936 Acapulco, Gro." tools:text="Carretera, Barra Vieja Km 37, 39936 Acapulco, Gro."/>
android:maxLines="1"
android:ellipsize="end"/>
<TextView <TextView
android:id="@+id/tvPhone" android:id="@+id/tvPhone"