Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
<application
android:name=".PSLabApplication"
android:allowBackup="true"
android:icon="@drawable/logo"
android:icon="@drawable/app_icon"
android:label="@string/app_name"
android:roundIcon="@drawable/logo"
android:roundIcon="@drawable/app_icon_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
Expand Down Expand Up @@ -68,12 +68,11 @@
android:name=".activity.PowerSourceActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity android:name=".activity.LuxMeterActivity"
android:screenOrientation="portrait" />
<activity
android:name=".activity.WaveGeneratorActivity"
android:screenOrientation="userLandscape" />
<activity
android:name=".activity.LuxMeterActivity"
android:configChanges="orientation|screenSize|keyboardHidden" />
<activity android:name=".activity.AccelerometerActivity" />
<activity android:name=".activity.DataLoggerActivity" />
<activity
Expand All @@ -94,7 +93,7 @@
<activity android:name=".sensors.SensorSHT21" />
<activity android:name=".sensors.SensorMPU6050" />
<activity android:name=".sensors.SensorTSL2561" />
<activity android:name=".activity.SensorGraphViewActivity"></activity>
<activity android:name=".activity.SensorGraphViewActivity" />
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
} else {
checkGpsOnResume = true;
}
gpsLogger.startFetchingLocation();
gpsLogger.startCaptureLocation();
} else {
recordData = true;
CustomSnackBar.showSnackBar(coordinatorLayout, getString(R.string.data_recording_start) + "\n" + getString(R.string.location_disabled), null, null);
Expand All @@ -173,7 +173,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
}
if (locationPref && gpsLogger != null) {
String data;
Location location = gpsLogger.getBestLocation();
Location location = gpsLogger.getDeviceLocation();
if (location != null) {
data = "\nLocation" + "," + String.valueOf(location.getLatitude()) + "," + String.valueOf(location.getLongitude() + "\n");
} else {
Expand Down
43 changes: 20 additions & 23 deletions app/src/main/java/io/pslab/activity/DataLoggerActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@
import butterknife.ButterKnife;
import io.pslab.R;
import io.pslab.adapters.SensorLoggerListAdapter;
import io.pslab.models.SensorLogged;
import io.realm.Realm;
import io.pslab.models.SensorDataBlock;
import io.pslab.others.LocalDataLog;
import io.realm.RealmResults;
import io.realm.Sort;

/**
* Created by Avjeet on 05/08/18.
*/

public class DataLoggerActivity extends AppCompatActivity {

public static final String CALLER_ACTIVITY = "Caller";

@BindView(R.id.recycler_view)
RecyclerView recyclerView;

Expand All @@ -35,33 +36,29 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_data_logger);
ButterKnife.bind(this);
setSupportActionBar(toolbar);
Realm realm = Realm.getDefaultInstance();
String caller = getIntent().getStringExtra(CALLER_ACTIVITY);
if (caller == null)
caller = "";
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
}
if (caller == null) caller = "";

RealmResults<SensorDataBlock> categoryData;

RealmResults<SensorLogged> results;
String title;
switch (caller) {
case "Lux Meter":
results = realm.where(SensorLogged.class).equalTo("sensor", caller)
.findAll()
.sort("dateTimeStart", Sort.DESCENDING);
title = caller + " Data";
getSupportActionBar().setTitle(caller);
categoryData = LocalDataLog.with().getTypeOfSensorBlocks("Lux Meter");
break;
default:
results = realm.where(SensorLogged.class)
.findAll()
.sort("dateTimeStart", Sort.DESCENDING);
title = getString(R.string.logged_data);
}
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setTitle(title);
// TODO: Fetch all
categoryData = LocalDataLog.with().getTypeOfSensorBlocks("Lux Meter");
getSupportActionBar().setTitle(getString(R.string.logged_data));
}
SensorLoggerListAdapter adapter = new SensorLoggerListAdapter(results, this);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);

SensorLoggerListAdapter adapter = new SensorLoggerListAdapter(categoryData, this);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(
this, LinearLayoutManager.VERTICAL, false);
recyclerView.setLayoutManager(linearLayoutManager);

DividerItemDecoration itemDecor = new DividerItemDecoration(this, DividerItemDecoration.HORIZONTAL);
Expand Down
Loading