Added an (i) icon to the About section in the MerchantsFragment's custom popup menu and improved the menu positioning moving it a bit to the top so that it overlaps the toolbar.
This commit is contained in:
parent
b9497a2db4
commit
52c2cf8211
5 changed files with 18 additions and 5 deletions
|
@ -2,7 +2,6 @@ package cy.agorise.bitsybitshareswallet.fragments
|
||||||
|
|
||||||
import android.Manifest
|
import android.Manifest
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
|
@ -62,7 +61,6 @@ class MerchantsFragment : Fragment(), OnMapReadyCallback {
|
||||||
private var mPopupWindow: PopupWindow? = null
|
private var mPopupWindow: PopupWindow? = null
|
||||||
private var mToolbar: Toolbar? = null
|
private var mToolbar: Toolbar? = null
|
||||||
private var screenWidth: Int = 0
|
private var screenWidth: Int = 0
|
||||||
private var popupWindowWidth: Int = 0
|
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||||
setHasOptionsMenu(true)
|
setHasOptionsMenu(true)
|
||||||
|
@ -94,7 +92,6 @@ class MerchantsFragment : Fragment(), OnMapReadyCallback {
|
||||||
// TODO get references to the popup menu items
|
// TODO get references to the popup menu items
|
||||||
|
|
||||||
mPopupWindow = PopupWindow(popupView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
mPopupWindow = PopupWindow(popupView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||||
popupWindowWidth = mPopupWindow?.width ?: popupWindowWidth
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
||||||
|
@ -104,7 +101,7 @@ class MerchantsFragment : Fragment(), OnMapReadyCallback {
|
||||||
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) {
|
||||||
if (mPopupWindow?.isShowing == false)
|
if (mPopupWindow?.isShowing == false)
|
||||||
mPopupWindow?.showAsDropDown(mToolbar, screenWidth - popupWindowWidth, 0)
|
mPopupWindow?.showAsDropDown(mToolbar, screenWidth, -20)
|
||||||
else
|
else
|
||||||
mPopupWindow?.dismiss()
|
mPopupWindow?.dismiss()
|
||||||
return true
|
return true
|
||||||
|
@ -346,4 +343,11 @@ class MerchantsFragment : Fragment(), OnMapReadyCallback {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onPause() {
|
||||||
|
super.onPause()
|
||||||
|
|
||||||
|
if (mPopupWindow?.isShowing == true)
|
||||||
|
mPopupWindow?.dismiss()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
5
app/src/main/res/drawable/ic_info_merchants.xml
Normal file
5
app/src/main/res/drawable/ic_info_merchants.xml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<vector android:height="24dp" android:tint="?android:textColorPrimary"
|
||||||
|
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||||
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="?android:textColorPrimary" android:pathData="M11,17h2v-6h-2v6zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8zM11,9h2L13,7h-2v2z"/>
|
||||||
|
</vector>
|
|
@ -31,7 +31,9 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:text="About"
|
android:layout_marginEnd="8dp"
|
||||||
|
android:text="@string/title_about"
|
||||||
|
android:drawableEnd="@drawable/ic_info_merchants"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:textAppearance="@style/TextAppearance.Bitsy.Body1"/>
|
android:textAppearance="@style/TextAppearance.Bitsy.Body1"/>
|
||||||
|
|
|
@ -61,6 +61,7 @@
|
||||||
<!-- Merchants & Tellers -->
|
<!-- Merchants & Tellers -->
|
||||||
<string name="title_merchants">Comerciantes</string>
|
<string name="title_merchants">Comerciantes</string>
|
||||||
<string name="title_tellers">Tellers</string>
|
<string name="title_tellers">Tellers</string>
|
||||||
|
<string name="title_about">Acerca de</string>
|
||||||
<string name="msg__location_permission_necessary">El permiso de localización es necesario para mostrar tu ubicación actual en el mapa.</string>
|
<string name="msg__location_permission_necessary">El permiso de localización es necesario para mostrar tu ubicación actual en el mapa.</string>
|
||||||
|
|
||||||
<!-- Send Transaction -->
|
<!-- Send Transaction -->
|
||||||
|
|
|
@ -61,6 +61,7 @@
|
||||||
<!-- Merchants & Tellers -->
|
<!-- Merchants & Tellers -->
|
||||||
<string name="title_merchants">Merchants</string>
|
<string name="title_merchants">Merchants</string>
|
||||||
<string name="title_tellers">Tellers</string>
|
<string name="title_tellers">Tellers</string>
|
||||||
|
<string name="title_about">About</string>
|
||||||
<string name="msg__location_permission_necessary">Location permission is necessary to show your current location on the map.</string>
|
<string name="msg__location_permission_necessary">Location permission is necessary to show your current location on the map.</string>
|
||||||
|
|
||||||
<!-- Send Transaction -->
|
<!-- Send Transaction -->
|
||||||
|
|
Loading…
Reference in a new issue