Skip to content

Commit

Permalink
Merge pull request #1746 from fossasia/development
Browse files Browse the repository at this point in the history
chore: merge development branch into master
  • Loading branch information
CloudyPadmal authored May 27, 2019
2 parents 20efd5c + 98b8f84 commit 17e383f
Show file tree
Hide file tree
Showing 23 changed files with 880 additions and 83 deletions.
7 changes: 5 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "io.pslab"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 13
versionName "2.0.12"
versionCode 14
versionName "2.0.13"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
Expand Down Expand Up @@ -66,6 +66,9 @@ dependencies {
implementation "org.apache.commons:commons-lang3:$rootProject.commonLangVersion"
implementation "com.squareup.picasso:picasso:$rootProject.picassoVersion"

implementation 'com.github.GoodieBag:ProtractorView:v1.2'
implementation 'com.github.Triggertrap:SeekArc:v1.1'

implementation "com.jakewharton:butterknife:$rootProject.butterKnifeVersion"
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
annotationProcessor "com.jakewharton:butterknife-compiler:$rootProject.butterKnifeVersion"
Expand Down
10 changes: 7 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="io.pslab">

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Expand All @@ -14,13 +15,16 @@
<uses-feature android:name="android.hardware.usb.host" />

<application
tools:replace="android:icon"
android:name=".PSLabApplication"
android:allowBackup="true"
android:icon="@drawable/app_icon"
android:label="@string/app_name"
android:roundIcon="@drawable/app_icon_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".activity.RoboticArmActivity"
android:screenOrientation="landscape"/>
<activity
android:name=".activity.SplashActivity"
android:screenOrientation="portrait"
Expand Down Expand Up @@ -71,8 +75,9 @@
<activity
android:name=".activity.WaveGeneratorActivity"
android:screenOrientation="userLandscape" />
<activity android:name=".activity.AccelerometerActivity"
android:screenOrientation="portrait"/>
<activity
android:name=".activity.AccelerometerActivity"
android:screenOrientation="portrait" />
<activity android:name=".activity.DataLoggerActivity" />
<activity
android:name=".activity.BarometerActivity"
Expand All @@ -84,7 +89,6 @@
<activity
android:name=".activity.GyroscopeActivity"
android:screenOrientation="portrait" />

<activity android:name=".activity.MapsActivity" />

<receiver android:name=".receivers.USBDetachReceiver" />
Expand Down
37 changes: 36 additions & 1 deletion app/src/main/java/io/pslab/activity/DataLoggerActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import butterknife.ButterKnife;
import io.pslab.R;
import io.pslab.adapters.SensorLoggerListAdapter;
import io.pslab.models.AccelerometerData;
import io.pslab.models.BaroData;
import io.pslab.models.CompassData;
import io.pslab.models.GyroData;
Expand Down Expand Up @@ -321,7 +322,7 @@ private void getFileData(File file) {
String[] data = line.split(",");
try {
time += 1000;
CompassData compassData = new CompassData(time, block, data[2].equals("null")?"0":data[2], data[3].equals("null")?"0":data[3], data[4].equals("null")?"0":data[4], data[5], Double.valueOf(data[6]), Double.valueOf(data[7]));
CompassData compassData = new CompassData(time, block, data[2].equals("null") ? "0" : data[2], data[3].equals("null") ? "0" : data[3], data[4].equals("null") ? "0" : data[4], data[5], Double.valueOf(data[6]), Double.valueOf(data[7]));
realm.beginTransaction();
realm.copyToRealm(compassData);
realm.commitTransaction();
Expand Down Expand Up @@ -377,6 +378,40 @@ private void getFileData(File file) {
} catch (IOException e) {
e.printStackTrace();
}
} else if (selectedDevice != null && selectedDevice.equals(getResources().getString(R.string.accelerometer))) {
try {
FileInputStream is = new FileInputStream(file);
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
String line = reader.readLine();
int i = 0;
long block = 0, time = 0;
while (line != null) {
if (i != 0) {
String[] data = line.split(",");
try {
time += 1000;
AccelerometerData accelerometerData = new AccelerometerData(time, block, Float.valueOf(data[2]), Float.valueOf(data[3]), Float.valueOf(data[4]), Double.valueOf(data[5]), Double.valueOf(data[6]));
realm.beginTransaction();
realm.copyToRealm(accelerometerData);
realm.commitTransaction();
} catch (Exception e) {
Toast.makeText(this, getResources().getString(R.string.incorrect_import_format), Toast.LENGTH_SHORT).show();
}
} else {
block = System.currentTimeMillis();
time = block;
realm.beginTransaction();
realm.copyToRealm(new SensorDataBlock(block, getResources().getString(R.string.accelerometer)));
realm.commitTransaction();
}
i++;
line = reader.readLine();
}
fillData();
DataLoggerActivity.this.toolbar.getMenu().findItem(R.id.delete_all).setVisible(true);
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
Loading

0 comments on commit 17e383f

Please sign in to comment.