Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide NFC if the device reports it has no hardware #941

Merged
merged 2 commits into from
Sep 16, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.homeassistant.companion.android.settings

import android.content.pm.PackageManager
import android.graphics.Color
import android.os.Build
import android.os.Bundle
Expand Down Expand Up @@ -96,7 +97,11 @@ class SettingsFragment : PreferenceFragmentCompat(), SettingsView {
}

findPreference<Preference>("nfc_tags")?.let {
it.isVisible = presenter.nfcEnabled()
val pm: PackageManager = requireContext().packageManager
if (pm.hasSystemFeature(PackageManager.FEATURE_NFC))
it.isVisible = presenter.nfcEnabled()
else
it.isVisible = false
it.onPreferenceClickListener = Preference.OnPreferenceClickListener {
startActivity(NfcSetupActivity.newInstance(requireActivity()))
true
Expand Down