Skip to content

OGK-Inspector v1.0.7

Choose a tag to compare

@vikulin vikulin released this 19 Apr 12:01
· 35 commits to master since this release

🚀 OGK-Inspector v1.0.7

Features Added

1. 🗂 Dialog for Choosing a Spectrum File

  • Feature Description:
    A DialogFragment has been added to enable users to choose a spectrum file in JSON format. The dialog includes:

    • 🖼 Selected File Name Display: A TextView to show the file name.
    • 🔘 File Chooser Button: An ImageButton to open the file picker dialog.
    • 🛑 Cancel and ✅ Open buttons for file actions.
  • Additional Enhancements:

    • 🧰 Modern File Picker: Leveraging ActivityResultLauncher API for streamlined file selection.
    • ❌ Error Handling: Notifications for parsing failures of invalid JSON files.

2. 📄 Handle File Selection and Parsing

  • Feature Description:
    Added functionality to:
    • 📜 Read File Contents: Converts file content to a string buffer for processing.
    • ✅ JSON Parsing: Utilizes Kotlinx Serialization for parsing spectrum files (decodeFromString).
    • 🛑 Error Notification: Alerts users upon parsing failure.

3. 🔗 SpectrumFragment Navigation

  • Feature Description:
    Allows seamless navigation from DialogFragment to SpectrumFragment when a spectrum file is selected:
    • 🔄 Pass File URI: Sends file URI via a Bundle.
    • 🧭 Controlled Navigation: Ensures proper transitions without leftover dialog interruptions.

4. 📊 Convert Data for Visualization

  • Feature Description:
    Enables conversion of data for numerical visualization.
    • 🧮 Input: Takes a List<Long> of data points.
    • 📈 Output: Produces a float[][] array for use in charting libraries.

5. ⚙️ Settings Feature

  • Feature Description:
    Introduced a settings screen to configure the default measure mode during app boot or device connection:

    • 🔘 Options: <None>, <Counter>, <Spectrum>
    • 🛠 Customizable Settings Layout: Features a dropdown menu and explanation text.
    • 🎯 Persist Settings: Stores preferences using SharedPreferences.
  • Logic for First App Run:

    • 🟡 First-Time Settings Prompt: Automatically shows the settings screen when the app is launched for the first time.
    • 🔒 Settings Memory: Saves default measure mode for subsequent sessions.

6. 🌎 Global App State with Flags

  • Feature Description:
    Introduced a global flag mechanism to manage app state across fragments:
    • 🚨 Persistent State: The flag resets only when the app terminates completely (not on pause).
    • 🧭 Access from Anywhere: The flag is accessible globally via a custom Application class.

7. 🎯 MainActivity Behavior on App Launch

  • Feature Description:
    Added logic to open the corresponding fragment based on selected measure mode and device connection:
    • 🟢 Counter Mode: Opens CounterFragment.
    • 🟣 Spectrum Mode: Opens SpectrumFragment.

8. 🧪 Isotope Database Screen

  • Added support for loading isotope data and display the list
  • Each isotope entry includes:
    • Name
    • Gamma Energies (keV)
    • Half-life, automatically converted from seconds into an appropriate human-readable format (years, months, days, hours, minutes, or seconds).

9. 🧮 Smart Half-life Display

  • Half-life values are shown with precision:
    • Automatically scaled to a readable unit based on duration.
    • Exponential format used for large values (e.g., >999 years).

10. 🧭 UI Improvements

  • Clean, horizontal layout: Each isotope is shown in a single row with its attributes clearly aligned.
  • Sorting support: Users can sort the list by:
    • Name
    • Energy
    • Half-life

🛠 Technical Highlights

  • Kotlin Fragment for UI with recycler view.
  • Smart formatting of half-life via formatHalfLife() function.
  • Sortable table-style list implemented using standard Android components.

Full Changelog: 1.0.6...1.0.7


Thank you for your feedback and contributions!