Skip to content

Conversation

@Avjeet
Copy link
Contributor

@Avjeet Avjeet commented Oct 1, 2018

Fixes #1400

Changes:
Added if-else in lux meter fragment to check for empty data before storing in the realm database in the form of record.

Screenshot/s for the changes:Not a UI change

Checklist: [Please tick following check boxes with [x] if the respective task is completed]

  • I have used resources from strings.xml, dimens.xml and colors.xml without hard-coding them
  • No modifications done at the end of resource files strings.xml, dimens.xml or colors.xml
  • I have reformatted code in every file included in this PR [CTRL+ALT+L]
  • My code does not contain any extra lines or extra spaces
  • I have requested reviews from other members

APK for testing:
emptyfix.zip

editor.putLong("uniqueCount", uniqueRef + 1);
editor.commit();
}else{
CustomSnackBar.showSnackBar(coordinatorLayout, "No Data Fetched", null, null);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add this text to strings.xml and fetch from there

SharedPreferences.Editor editor = realmPreferences.edit();
editor.putLong("uniqueCount", uniqueRef + 1);
editor.commit();
if(selectedFragment.saveDataInRealm(uniqueRef, locationPref, gpsLogger)){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Give this code a reformat

realm.beginTransaction();

SensorLogged sensorLogged = realm.createObject(SensorLogged.class, uniqueRef);
sensorLogged.setSensor("Lux Meter");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Goes to strings.xml


if (includeLocation && gpsLogger != null) {
Location location = gpsLogger.getBestLocation();
if (location != null) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we check location null in the 414 if block and reduce this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried that but then I had to do this to prevent some null pointer exceptions.

@CloudyPadmal CloudyPadmal added the Status: Review Required Requested reviews from peers and maintainers label Oct 1, 2018
@Avjeet Avjeet requested a review from CloudyPadmal October 15, 2018 18:28
@Avjeet Avjeet self-assigned this Oct 15, 2018
@Avjeet Avjeet added Status: Review Required Requested reviews from peers and maintainers and removed Status: Review Required Requested reviews from peers and maintainers labels Oct 15, 2018
@CloudyPadmal CloudyPadmal merged commit 10ac934 into fossasia:development Oct 21, 2018
@CloudyPadmal CloudyPadmal removed the Status: Review Required Requested reviews from peers and maintainers label Oct 21, 2018
neel1998 pushed a commit to neel1998/pslab-android that referenced this pull request Jul 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

empty data is being recorded in lux meter

3 participants