diff --git a/app/src/main/java/net/voussoir/trkpt/MapFragment.kt b/app/src/main/java/net/voussoir/trkpt/MapFragment.kt index 04a0215..a176a56 100644 --- a/app/src/main/java/net/voussoir/trkpt/MapFragment.kt +++ b/app/src/main/java/net/voussoir/trkpt/MapFragment.kt @@ -39,7 +39,6 @@ import androidx.core.view.isVisible import androidx.fragment.app.Fragment import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton import com.google.android.material.floatingactionbutton.FloatingActionButton -import com.google.android.material.snackbar.Snackbar import org.osmdroid.events.MapEventsReceiver import org.osmdroid.tileprovider.tilesource.TileSourceFactory import org.osmdroid.util.GeoPoint @@ -77,7 +76,6 @@ class MapFragment : Fragment() private var current_track_overlay: Polyline? = null private var current_position_overlays = ArrayList() private var homepoints_overlays = ArrayList() - private lateinit var locationErrorBar: Snackbar /* Overrides onCreate from Fragment */ override fun onCreate(savedInstanceState: Bundle?) @@ -116,7 +114,6 @@ class MapFragment : Fragment() zoom_out_button = rootView.findViewById(R.id.zoom_out_button) map_current_time = rootView.findViewById(R.id.map_current_time) mainButton = rootView.findViewById(R.id.main_button) - locationErrorBar = Snackbar.make(mapView, String(), Snackbar.LENGTH_INDEFINITE) mapView.setOnLongClickListener{ Log.i("VOUSSOIR", "mapview longpress") @@ -332,7 +329,6 @@ class MapFragment : Fragment() } val gpsProviderActive = if (trackerService == null) false else trackerService!!.gpsProviderActive val networkProviderActive = if (trackerService == null) false else trackerService!!.networkProviderActive - toggleLocationErrorBar(gpsProviderActive, networkProviderActive) } private fun startTracking() @@ -601,26 +597,6 @@ class MapFragment : Fragment() } } - fun toggleLocationErrorBar(gpsProviderActive: Boolean, networkProviderActive: Boolean) - { - if (ContextCompat.checkSelfPermission(requireContext(), Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_DENIED) - { - // CASE: Location permission not granted - locationErrorBar.setText(R.string.snackbar_message_location_permission_denied) - if (!locationErrorBar.isShown) locationErrorBar.show() - } - else if (!gpsProviderActive && !networkProviderActive) - { - // CASE: Location setting is off - locationErrorBar.setText(R.string.snackbar_message_location_offline) - if (!locationErrorBar.isShown) locationErrorBar.show() - } - else - { - if (locationErrorBar.isShown) locationErrorBar.dismiss() - } - } - private val connection = object : ServiceConnection { override fun onServiceConnected(className: ComponentName, service: IBinder) {