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.
This commit is contained in:
parent
4a47b5b637
commit
1505a5642c
6 changed files with 26 additions and 8 deletions
|
@ -300,10 +300,12 @@ class MerchantsFragment : Fragment(), OnMapReadyCallback, SearchView.OnSuggestio
|
||||||
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
|
||||||
if (item?.itemId == R.id.menu_filter) {
|
if (item?.itemId == R.id.menu_filter) {
|
||||||
// Try to show or dismiss the custom popup window with the merchants and tellers switches
|
// Try to show or dismiss the custom popup window with the merchants and tellers switches
|
||||||
if (mPopupWindow?.isShowing == false)
|
if (mPopupWindow?.isShowing == false) {
|
||||||
mPopupWindow?.showAsDropDown(toolbar, screenWidth, -20)
|
mPopupWindow?.showAsDropDown(toolbar, screenWidth, 8)
|
||||||
else
|
if (mMap.isMyLocationEnabled)
|
||||||
mPopupWindow?.dismiss()
|
mMap.uiSettings?.isMyLocationButtonEnabled = false
|
||||||
|
} else
|
||||||
|
dismissPopupWindow()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item)
|
return super.onOptionsItemSelected(item)
|
||||||
|
@ -580,8 +582,11 @@ class MerchantsFragment : Fragment(), OnMapReadyCallback, SearchView.OnSuggestio
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun dismissPopupWindow() {
|
private fun dismissPopupWindow() {
|
||||||
if (mPopupWindow?.isShowing == true)
|
if (mPopupWindow?.isShowing == true) {
|
||||||
mPopupWindow?.dismiss()
|
mPopupWindow?.dismiss()
|
||||||
|
if (mMap.isMyLocationEnabled)
|
||||||
|
mMap.uiSettings?.isMyLocationButtonEnabled = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
|
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||||
<corners android:radius="10dp" />
|
<corners android:radius="10dp" />
|
||||||
<solid android:color="?android:colorBackground" />
|
<solid android:color="@color/colorMapPopup" />
|
||||||
</shape>
|
</shape>
|
|
@ -7,7 +7,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="8dp"
|
android:padding="8dp"
|
||||||
android:background="?android:colorBackground">
|
android:background="#0000">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/ivMarkerPin"
|
android:id="@+id/ivMarkerPin"
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
<androidx.appcompat.widget.SwitchCompat
|
<androidx.appcompat.widget.SwitchCompat
|
||||||
android:id="@+id/switchMerchants"
|
android:id="@+id/switchMerchants"
|
||||||
|
android:theme="@style/Widget.Bitsy.Switch.Merchants"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:switchPadding="48dp"
|
app:switchPadding="48dp"
|
||||||
|
@ -20,6 +21,7 @@
|
||||||
|
|
||||||
<androidx.appcompat.widget.SwitchCompat
|
<androidx.appcompat.widget.SwitchCompat
|
||||||
android:id="@+id/switchTellers"
|
android:id="@+id/switchTellers"
|
||||||
|
android:theme="@style/Widget.Bitsy.Switch.Tellers"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
|
|
|
@ -20,5 +20,6 @@
|
||||||
<color name="colorSend">#D32F2F</color>
|
<color name="colorSend">#D32F2F</color>
|
||||||
<color name="colorSendDark">#B71C1C</color>
|
<color name="colorSendDark">#B71C1C</color>
|
||||||
<color name="semiTransparent">#2888</color>
|
<color name="semiTransparent">#2888</color>
|
||||||
<color name="colorMapToolbar">#338888aa</color>
|
<color name="colorMapToolbar">#3999</color>
|
||||||
|
<color name="colorMapPopup">#6999</color>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -48,6 +48,16 @@
|
||||||
<item name="android:textColor">?android:attr/colorPrimary</item>
|
<item name="android:textColor">?android:attr/colorPrimary</item>
|
||||||
</style>
|
</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 -->
|
<!-- Text styles -->
|
||||||
<style name="TextAppearance.Bitsy.Headline5" parent="TextAppearance.MaterialComponents.Headline5" />
|
<style name="TextAppearance.Bitsy.Headline5" parent="TextAppearance.MaterialComponents.Headline5" />
|
||||||
<style name="TextAppearance.Bitsy.Headline6" parent="TextAppearance.MaterialComponents.Headline6" />
|
<style name="TextAppearance.Bitsy.Headline6" parent="TextAppearance.MaterialComponents.Headline6" />
|
||||||
|
|
Loading…
Reference in a new issue