Skip to content

Commit

Permalink
Merge pull request #897 from PhenoApps/bug_fixes
Browse files Browse the repository at this point in the history
Bug fixes
  • Loading branch information
trife authored Mar 6, 2024
2 parents f61bb0b + d00a331 commit be107fe
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import android.util.Log
import android.view.WindowManager
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.preference.PreferenceManager
import com.fieldbook.tracker.R
import com.fieldbook.tracker.preferences.GeneralKeys
import com.fieldbook.tracker.utilities.SharedPreferenceUtils
Expand All @@ -36,10 +37,7 @@ open class ThemedActivity: AppCompatActivity() {

fun applyTheme(activity: Activity) {

val prefs = activity.getSharedPreferences(
GeneralKeys.SHARED_PREF_FILE_NAME,
Context.MODE_PRIVATE
)
val prefs = PreferenceManager.getDefaultSharedPreferences(activity);

//set the theme
val (themeIndex, textIndex) = with(prefs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class StorageDefinerFragment: PhenoLibStorageDefinerFragment() {
AssetSample("field_import", "field_sample3.csv") to R.string.dir_field_import,
AssetSample("field_import", "rtk_sample.csv") to R.string.dir_field_import,
AssetSample("field_import", "training_sample.csv") to R.string.dir_field_import,
AssetSample("resources", "feekes_sample.jpg") to R.string.dir_resources,
AssetSample("resources", "stem_rust_sample.jpg") to R.string.dir_resources,
AssetSample("trait", "trait_sample.trt") to R.string.dir_trait,
AssetSample("trait", "severity.txt") to R.string.dir_trait,
AssetSample("database", "sample.db") to R.string.dir_database,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ class RangeBoxView : ConstraintLayout {
} else {
if (rangeID.isNotEmpty()) {
//index.setEnabled(true);
// In addtion to advancing the entry, return to the first trait in the trait order if the preference is enabled
// In addition to advancing the entry, return to the first trait in the trait order if the preference is enabled
if (controller.isReturnFirstTrait()) {
traitBox.returnFirst()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ class TraitBoxView : ConstraintLayout {
.toString()
)

// Update last used trait so it is preserved when entry moves
controller.getPreferences().edit().putString(GeneralKeys.LAST_USED_TRAIT,traitTypeTv.text.toString()).apply()
traitTypeTv.text = currentTrait?.name


Expand Down Expand Up @@ -431,8 +433,9 @@ class TraitBoxView : ConstraintLayout {
if (controller.getPreferences().getBoolean(GeneralKeys.CYCLE_TRAITS_SOUND, false)) {
controller.getSoundHelper().playCycle()
}
// traitType.setSelection(0)
setSelection(0)
rangeSuppress?.let { loadLayout(it) }
controller.refreshLock()
controller.getCollectInputView().resetInitialIndex()
}

Expand Down

0 comments on commit be107fe

Please sign in to comment.