In MerchantsFragment, change the popup window background to transparent to match the maps theme. Hide the MyLocation button while the popup is open to avoid it making it hard to see the switches in the popup menu. Color the popup menu's switches to use the same green and yellow color as their corresponding pon markers. Move the popup window down to remove the overlapping with the Toolbar.

master
Severiano Jaramillo 2019-01-30 11:15:07 -06:00
parent 4a47b5b637
commit 1505a5642c
6 changed files with 26 additions and 8 deletions

View File

@ -300,10 +300,12 @@ class MerchantsFragment : Fragment(), OnMapReadyCallback, SearchView.OnSuggestio
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
if (item?.itemId == R.id.menu_filter) {
// Try to show or dismiss the custom popup window with the merchants and tellers switches
if (mPopupWindow?.isShowing == false)
mPopupWindow?.showAsDropDown(toolbar, screenWidth, -20)
else
mPopupWindow?.dismiss()
if (mPopupWindow?.isShowing == false) {
mPopupWindow?.showAsDropDown(toolbar, screenWidth, 8)
if (mMap.isMyLocationEnabled)
mMap.uiSettings?.isMyLocationButtonEnabled = false
} else
dismissPopupWindow()
return true
}
return super.onOptionsItemSelected(item)
@ -580,8 +582,11 @@ class MerchantsFragment : Fragment(), OnMapReadyCallback, SearchView.OnSuggestio
}
private fun dismissPopupWindow() {
if (mPopupWindow?.isShowing == true)
if (mPopupWindow?.isShowing == true) {
mPopupWindow?.dismiss()
if (mMap.isMyLocationEnabled)
mMap.uiSettings?.isMyLocationButtonEnabled = true
}
}
override fun onPause() {

View File

@ -1,5 +1,5 @@
<?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" />
<solid android:color="@color/colorMapPopup" />
</shape>

View File

@ -7,7 +7,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp"
android:background="?android:colorBackground">
android:background="#0000">
<ImageView
android:id="@+id/ivMarkerPin"

View File

@ -10,6 +10,7 @@
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/switchMerchants"
android:theme="@style/Widget.Bitsy.Switch.Merchants"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:switchPadding="48dp"
@ -20,6 +21,7 @@
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/switchTellers"
android:theme="@style/Widget.Bitsy.Switch.Tellers"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"

View File

@ -20,5 +20,6 @@
<color name="colorSend">#D32F2F</color>
<color name="colorSendDark">#B71C1C</color>
<color name="semiTransparent">#2888</color>
<color name="colorMapToolbar">#338888aa</color>
<color name="colorMapToolbar">#3999</color>
<color name="colorMapPopup">#6999</color>
</resources>

View File

@ -48,6 +48,16 @@
<item name="android:textColor">?android:attr/colorPrimary</item>
</style>
<style name="Widget.Bitsy.Switch.Merchants" parent="Widget.AppCompat.CompoundButton.Switch">
<item name="colorAccent">#0E9257</item>
<item name="colorControlActivated">#0E9257</item>
</style>
<style name="Widget.Bitsy.Switch.Tellers" parent="Widget.AppCompat.CompoundButton.Switch">
<item name="colorAccent">#FCCF0E</item>
<item name="colorControlActivated">#FCCF0E</item>
</style>
<!-- Text styles -->
<style name="TextAppearance.Bitsy.Headline5" parent="TextAppearance.MaterialComponents.Headline5" />
<style name="TextAppearance.Bitsy.Headline6" parent="TextAppearance.MaterialComponents.Headline6" />