Skip to content

Commit

Permalink
Hide NFC drawer entry if no connection (#1571)
Browse files Browse the repository at this point in the history
Signed-off-by: mueller-ma <mueller-ma@users.noreply.github.com>
  • Loading branch information
mueller-ma committed Oct 2, 2019
1 parent 8aa8320 commit 68fb6a7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mobile/src/main/java/org/openhab/habdroid/ui/MainActivity.kt
Expand Up @@ -642,8 +642,6 @@ class MainActivity : AbstractBaseActivity(), ConnectionFactory.UpdateListener {
}
handled
}

drawerMenu.findItem(R.id.nfc).isVisible = NfcAdapter.getDefaultAdapter(this) != null || Util.isEmulator()
}

private fun updateNotificationDrawerItem() {
Expand All @@ -658,12 +656,15 @@ class MainActivity : AbstractBaseActivity(), ConnectionFactory.UpdateListener {
private fun updateSitemapAndHabPanelDrawerItems() {
val sitemapItem = drawerMenu.findItem(R.id.sitemaps)
val habPanelItem = drawerMenu.findItem(R.id.habpanel)
val nfcItem = drawerMenu.findItem(R.id.nfc)
val props = serverProperties
if (props == null) {
sitemapItem.isVisible = false
habPanelItem.isVisible = false
nfcItem.isVisible = false
} else {
habPanelItem.isVisible = props.hasHabPanelInstalled()
nfcItem.isVisible = NfcAdapter.getDefaultAdapter(this) != null || Util.isEmulator()
manageHabPanelShortcut(props.hasHabPanelInstalled())
val sitemaps = props.sitemaps.sortedWithDefaultName(prefs.getDefaultSitemap())

Expand Down

0 comments on commit 68fb6a7

Please sign in to comment.