-
Notifications
You must be signed in to change notification settings - Fork 803
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1933 from fossasia/development
chore: merge development branch into master
- Loading branch information
Showing
43 changed files
with
1,878 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name-template: 'PSLab Version $NEXT_PATCH_VERSION' | ||
tag-template: 'v$NEXT_PATCH_VERSION' | ||
change-template: '- $TITLE (#$NUMBER) - @$AUTHOR' | ||
categories: | ||
- title: ':rocket: Features and Enhancements' | ||
labels: | ||
- 'Feature' | ||
- 'Enhancement' | ||
- title: ':bug: Bug Fixes' | ||
label: 'Fix' | ||
- title: ':wrench: Maintenance' | ||
label: 'Chore' | ||
- title: ':page_facing_up: Documentation' | ||
label: 'Documentation' | ||
template: |- | ||
## Changes | ||
$CHANGES | ||
This release was made possible thanks to $CONTRIBUTORS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
app/src/main/java/io/pslab/activity/GasSensorActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
package io.pslab.activity; | ||
|
||
import android.content.SharedPreferences; | ||
import android.support.v4.app.Fragment; | ||
|
||
import io.pslab.R; | ||
import io.pslab.fragment.GasSensorDataFragment; | ||
import io.pslab.models.GasSensorData; | ||
import io.pslab.models.PSLabSensor; | ||
import io.pslab.models.SensorDataBlock; | ||
import io.pslab.others.LocalDataLog; | ||
import io.realm.RealmObject; | ||
import io.realm.RealmResults; | ||
|
||
public class GasSensorActivity extends PSLabSensor { | ||
|
||
private static final String PREF_NAME = "customDialogPreference"; | ||
public RealmResults<GasSensorData> recordedGasSensorData; | ||
|
||
@Override | ||
public int getMenu() { | ||
return R.menu.sensor_data_log_menu; | ||
} | ||
|
||
@Override | ||
public SharedPreferences getStateSettings() { | ||
return this.getSharedPreferences(PREF_NAME, MODE_PRIVATE); | ||
|
||
} | ||
|
||
@Override | ||
public String getFirstTimeSettingID() { | ||
return "GasSensorFirstTime"; | ||
} | ||
|
||
@Override | ||
public String getSensorName() { | ||
return getResources().getString(R.string.gas_sensor); | ||
} | ||
|
||
@Override | ||
public int getGuideTitle() { | ||
return R.string.gas_sensor; | ||
} | ||
|
||
@Override | ||
public int getGuideAbstract() { | ||
return R.string.gas_sensor; | ||
} | ||
|
||
@Override | ||
public int getGuideSchematics() { | ||
return R.drawable.bmp180_schematic; | ||
} | ||
|
||
@Override | ||
public int getGuideDescription() { | ||
return R.string.gas_sensor; | ||
} | ||
|
||
@Override | ||
public int getGuideExtraContent() { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public void recordSensorDataBlockID(SensorDataBlock block) { | ||
realm.beginTransaction(); | ||
realm.copyToRealm(block); | ||
realm.commitTransaction(); | ||
} | ||
|
||
@Override | ||
public void recordSensorData(RealmObject sensorData) { | ||
realm.beginTransaction(); | ||
realm.copyToRealm((GasSensorData) sensorData); | ||
realm.commitTransaction(); | ||
} | ||
|
||
@Override | ||
public void stopRecordSensorData() { | ||
LocalDataLog.with().refresh(); | ||
} | ||
|
||
@Override | ||
public Fragment getSensorFragment() { | ||
return GasSensorDataFragment.newInstance(); | ||
} | ||
|
||
@Override | ||
public void getDataFromDataLogger() { | ||
if (getIntent().getExtras() != null && getIntent().getExtras().getBoolean(KEY_LOG)) { | ||
viewingData = true; | ||
recordedGasSensorData = LocalDataLog.with() | ||
.getBlockOfGasSensorRecords(getIntent().getExtras().getLong(DATA_BLOCK)); | ||
String title = titleFormat.format(recordedGasSensorData.get(0).getTime()); | ||
getSupportActionBar().setTitle(title); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.