Skip to content

Commit

Permalink
Merge pull request #1015 from PhenoApps/v5_limited_log_on_field_audio
Browse files Browse the repository at this point in the history
Field audio sets geonav and limited log
  • Loading branch information
trife authored Aug 3, 2024
2 parents 10514be + 04a3f33 commit d3a2237
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import android.os.Bundle
import androidx.preference.CheckBoxPreference
import androidx.preference.PreferenceCategory
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.PreferenceManager
import com.fieldbook.tracker.R
import com.fieldbook.tracker.activities.PreferencesActivity
import com.fieldbook.tracker.utilities.GeoNavHelper

class ExperimentalPreferencesFragment : PreferenceFragmentCompat() {

Expand Down Expand Up @@ -39,6 +41,22 @@ class ExperimentalPreferencesFragment : PreferenceFragmentCompat() {
barcode?.setOnPreferenceChangeListener { _, newValue ->
true
}

val fieldAudio = findPreference<CheckBoxPreference>(GeneralKeys.ENABLE_FIELD_AUDIO)
fieldAudio?.setOnPreferenceChangeListener { _, newValue ->
context?.let { ctx ->
if (newValue as? Boolean == true) {
val prefs = PreferenceManager.getDefaultSharedPreferences(ctx)
prefs.edit()
.putBoolean(GeneralKeys.ENABLE_GEONAV, true)
.putString(
GeneralKeys.GEONAV_LOGGING_MODE,
GeoNavHelper.GeoNavLoggingMode.LIMITED.value
).apply()
}
}
true
}
}

private fun hideEmptyPreferenceCategories() {
Expand Down

0 comments on commit d3a2237

Please sign in to comment.