-
Notifications
You must be signed in to change notification settings - Fork 802
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: fix: state lost on orientation change in sensor activities #2576
base: development
Are you sure you want to change the base?
WIP: fix: state lost on orientation change in sensor activities #2576
Conversation
Reviewer's Guide by SourceryThe changes refactor sensor activity classes by introducing an abstract base class and shared layout to handle common functionality, improving code reuse and fixing state loss on orientation changes. The implementation uses inheritance and layout includes to centralize common sensor control dock UI and behavior. Class diagram for refactored sensor activitiesclassDiagram
class AbstractSensorActivity {
<<abstract>>
+I2C getScienceLab()
+AsyncTask<Void, Void, Void> getSensorDataFetch()
+int getLayoutResId()
+int getTitleResId()
}
class SensorMPU6050 {
+SensorDataFetch sensorDataFetch
+MPU6050 sensorMPU6050
+LineChart mChartAcceleration
+LineChart mChartGyroscope
+List<Entry> entriesAx
+List<Entry> entriesAy
+List<Entry> entriesAz
+List<Entry> entriesGx
+List<Entry> entriesGy
+List<Entry> entriesGz
}
class SensorMLX90614 {
+SensorDataFetch sensorDataFetch
+MLX90614 sensorMLX90614
+LineChart mChartObjectTemperature
+LineChart mChartAmbientTemperature
+List<Entry> entriesObjectTemperature
+List<Entry> entriesAmbientTemperature
}
class SensorMPU925X {
+SensorDataFetch sensorDataFetch
+MPU925x sensorMPU925X
+LineChart mChartAcceleration
+LineChart mChartGyroscope
+List<Entry> entriesax
+List<Entry> entriesay
+List<Entry> entriesaz
+List<Entry> entriesgx
+List<Entry> entriesgy
+List<Entry> entriesgz
}
AbstractSensorActivity <|-- SensorMPU6050
AbstractSensorActivity <|-- SensorMLX90614
AbstractSensorActivity <|-- SensorMPU925X
note for AbstractSensorActivity "Base class for sensor activities"
note for SensorMPU6050 "Refactored to extend AbstractSensorActivity"
note for SensorMLX90614 "Refactored to extend AbstractSensorActivity"
note for SensorMPU925X "Refactored to extend AbstractSensorActivity"
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Build successful. APKs to test: https://github.com/fossasia/pslab-android/actions/runs/11941929158/artifacts/2215570249 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @marcnause - I've reviewed your changes - here's some feedback:
Overall Comments:
- Please remove the WIP tag from the title if these changes are ready for review and merge.
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
@sourcery-ai review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @marcnause - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
c8639ec
to
89f41f3
Compare
Fixes #2528
Changes
Screenshots / Recordings
Checklist:
strings.xml
,dimens.xml
andcolors.xml
without hard coding any value.strings.xml
,dimens.xml
orcolors.xml
.Summary by Sourcery
Refactor sensor activity classes to extend a new AbstractSensorActivity base class, addressing state loss on orientation change and reducing code duplication.
Bug Fixes:
Enhancements:
Summary by Sourcery
Refactor sensor activities to extend a new AbstractSensorActivity base class, addressing state loss on orientation change and reducing code duplication. Move duplicate layout components to a new layout file and replace them with in existing layout files.
Bug Fixes:
Enhancements:
Summary by Sourcery
Refactor sensor activities to extend a new AbstractSensorActivity base class, addressing state loss on orientation change and reducing code duplication. Introduce a new feature to save and restore the state of the sensor dock on orientation change. Enhance layout management by moving duplicate components to a new layout file and using tags.
New Features:
Bug Fixes:
Enhancements: