Legg til haptisk tilbakemelding på knappetrykk og listeval (#11)
Android: HapticFeedbackConstants.VIRTUAL_KEY på alle knappar og listeelement. PWA: navigator.vibrate(10ms) på same interaksjonar. Closes #11 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
c35ccb91bf
commit
3c1da8adec
5 changed files with 17 additions and 1 deletions
|
|
@ -3,6 +3,7 @@ package no.naiv.tilfluktsrom
|
|||
import android.Manifest
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.view.HapticFeedbackConstants
|
||||
import android.content.pm.PackageManager
|
||||
import android.hardware.Sensor
|
||||
import android.hardware.SensorEvent
|
||||
|
|
@ -202,6 +203,7 @@ class MainActivity : AppCompatActivity(), SensorEventListener {
|
|||
|
||||
private fun setupButtons() {
|
||||
binding.toggleViewFab.setOnClickListener {
|
||||
it.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY)
|
||||
isCompassMode = !isCompassMode
|
||||
if (isCompassMode) {
|
||||
binding.mapView.visibility = View.GONE
|
||||
|
|
@ -216,24 +218,29 @@ class MainActivity : AppCompatActivity(), SensorEventListener {
|
|||
|
||||
// Reset to navigation: re-fit map to show user + selected shelter
|
||||
binding.resetNavigationFab.setOnClickListener {
|
||||
it.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY)
|
||||
userHasInteractedWithMap = false
|
||||
binding.resetNavigationFab.visibility = View.GONE
|
||||
selectedShelter?.let { highlightShelterOnMap(it) }
|
||||
}
|
||||
|
||||
binding.infoButton.setOnClickListener {
|
||||
it.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY)
|
||||
CivilDefenseInfoDialog().show(supportFragmentManager, CivilDefenseInfoDialog.TAG)
|
||||
}
|
||||
|
||||
binding.refreshButton.setOnClickListener {
|
||||
it.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY)
|
||||
forceRefresh()
|
||||
}
|
||||
|
||||
binding.shareButton.setOnClickListener {
|
||||
it.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY)
|
||||
shareShelter()
|
||||
}
|
||||
|
||||
binding.cacheRetryButton.setOnClickListener {
|
||||
it.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY)
|
||||
val loc = currentLocation
|
||||
if (loc == null) {
|
||||
Toast.makeText(this, R.string.status_no_location, Toast.LENGTH_SHORT).show()
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package no.naiv.tilfluktsrom.ui
|
||||
|
||||
import android.view.HapticFeedbackConstants
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.DiffUtil
|
||||
|
|
@ -63,6 +64,7 @@ class ShelterListAdapter(
|
|||
binding.root.alpha = if (isSelected) 1.0f else 0.7f
|
||||
|
||||
binding.root.setOnClickListener {
|
||||
it.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY)
|
||||
val pos = adapterPosition
|
||||
if (pos != RecyclerView.NO_POSITION) {
|
||||
selectPosition(pos)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue