Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
dd0cb5e
Added toolbar in multimeter activity (#1348)
abhinavraj23 Aug 10, 2018
fd868d7
Removing fossasia logo and other files from the app
yatri1609 Aug 9, 2018
898e461
added record functionality in lux meter (#1305)
Avjeet Aug 11, 2018
f41a341
stored data in realm database and added data logger activity
Avjeet Aug 8, 2018
ae06d5f
added SensorGraphViewActivity to visualize sensor recorded data
Avjeet Aug 9, 2018
016bcea
Merge pull request #1347 from Avjeet/Avi_graphe
cweitat Aug 11, 2018
07f1efe
minor code refractor
Avjeet Aug 12, 2018
4aaa46c
Merge pull request #1358 from Avjeet/Avi_minor
cweitat Aug 12, 2018
f7ff4c1
docs: added maintainers
CloudyPadmal Aug 12, 2018
6c81563
Created alert-box and changed file-name for barometer (#1340)
abhinavraj23 Aug 12, 2018
3ea3810
Merge pull request #1352 from yatri1609/splash_update
cweitat Aug 12, 2018
48b5953
Merge pull request #1360 from CloudyPadmal/updateReadme
cweitat Aug 12, 2018
6b689fa
fix snackbar (#1362)
Avjeet Aug 13, 2018
1a815c3
Solved the issue of active screen while opening bottom sheet guide (#…
harsh-2711 Aug 13, 2018
8fb2218
Solved issue in Shared Preferences of bottom sheet in Oscilloscope in…
harsh-2711 Aug 13, 2018
c21c924
Implemented basic data logging feature in multimeter (#1363)
abhinavraj23 Aug 14, 2018
839f655
Merge pull request #1368 from harsh-2711/oscilloscopeBottomSheet
cweitat Aug 15, 2018
66225e3
chore: upgrade to 2.0.2 (#1377)
CloudyPadmal Aug 18, 2018
e7cc033
Solved bugs in navigation drawer (#1375)
abhinavraj23 Aug 18, 2018
b1ac9bb
Merge branch 'master' into development
CloudyPadmal Aug 18, 2018
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
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# PSLab Android App

<a href="https://play.google.com/store/apps/details?id=io.pslab"><img alt="Get it on Google Play" height="80" src="https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png"></a>
<a href="https://f-droid.org/app/org.fossasia.pslab"><img alt="Get it on F-Droid" height="80" src="https://f-droid.org/badge/get-it-on.png"></a>

[![Build Status](https://travis-ci.org/fossasia/pslab-android.svg?branch=development)](https://travis-ci.org/fossasia/pslab-android)
[![Gitter](https://badges.gitter.im/fossasia/pslab.svg)](https://gitter.im/fossasia/pslab?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/dd728d91bb5743ff916c16c1251f8dd5)](https://www.codacy.com/app/praveenkumar103/pslab-android?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=fossasia/pslab-android&amp;utm_campaign=Badge_Grade)
[![Mailing List](https://img.shields.io/badge/Mailing%20List-FOSSASIA-blue.svg)](mailto:pslab-fossasia@googlegroups.com)

This repository holds the Android App for performing experiments with [PSLab](http://pslab.fossasia.org/). PSLab is a tiny pocket science lab that provides an array of equipment for doing science and engineering experiments. It can function like an oscilloscope, waveform generator, frequency counter, programmable voltage and current source and also as a data logger. Our website is at http://pslab.fossasia.org
This repository holds the Android App for performing experiments with [PSLab](https://pslab.io/). PSLab is a tiny pocket science lab that provides an array of equipment for doing science and engineering experiments. It can function like an oscilloscope, waveform generator, frequency counter, programmable voltage and current source and also as a data logger. Our website is at https://pslab.io

## Communication

Expand Down Expand Up @@ -151,5 +150,8 @@ The project is maintained by
- Praveen Patil ([@wavicles](https://github.com/wavicles))
- Mario Behling ([@mariobehling](http://github.com/mariobehling))
- Lorenz Gerber ([@lorenzgerber](https://github.com/lorenzgerber))
- Wei Tat ([@cweitat](https://github.com/cweitat))
- Wai Gie ([@woshikie](https://github.com/woshikie))
- Jithin ([@jithinbp](https://github.com/jithinbp))
- Akarshan Gandotra ([@akarshan96](https://github.com/akarshan96)), Asitava Sarkar ([@asitava1998](https://github.com/asitava1998)), Padmal ([@CloudyPadmal](https://github.com/CloudyPadmal)), Vivek Singh Bhadauria ([@viveksb007](https://github.com/viveksb007))
- Avjeet ([@Avjeet](https://github.com/Avjeet)), Abhinav ([@abhinavraj23](https://github.com/abhinavraj23)), Harsh ([@harsh-2711](https://github.com/harsh-2711)), Yatri ([@yatri1609](https://github.com/yatri1609))
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 2
versionName "2.0.1"
versionCode 3
versionName "2.0.2"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
Expand Down Expand Up @@ -52,6 +52,8 @@ dependencies {
implementation "com.afollestad.material-dialogs:core:$rootProject.materialDialogsVersion"
implementation "com.jakewharton:butterknife:$rootProject.butterKnifeVersion"
implementation "com.android.support:support-v4:$rootProject.supportLibraryVersion"
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
annotationProcessor "com.jakewharton:butterknife-compiler:$rootProject.butterKnifeVersion"
implementation "com.github.medyo:android-about-page:$rootProject.androidAboutPageVersion"
implementation "com.github.tiagohm.MarkdownView:library:$rootProject.markDownViewVersion"
Expand All @@ -65,6 +67,7 @@ dependencies {
implementation "org.osmdroid:osmdroid-mapsforge:$rootProject.mapsforgeVersion"
implementation "org.osmdroid:osmdroid-geopackage:$rootProject.geoPackageVersion"
implementation "com.android.support:multidex:$rootProject.multiDexVersion"
implementation "io.realm:android-adapters:$rootProject.realmAdapter"

testImplementation "junit:junit:$rootProject.junitVersion"
androidTestImplementation("com.android.support.test:runner:$rootProject.testRunnerRulesVersion") {
Expand Down
19 changes: 8 additions & 11 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@
android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
android:resource="@xml/device_filter" />
</activity>

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

<activity android:name=".activity.SettingsActivity" />
<activity android:name=".activity.ShowLoggedData" />
<activity
android:name=".activity.PerformExperimentActivity"
Expand Down Expand Up @@ -77,14 +75,13 @@
android:name=".activity.LuxMeterActivity"
android:configChanges="orientation|screenSize|keyboardHidden" />
<activity android:name=".activity.AccelerometerActivity" />

<activity android:name=".activity.DataLoggerActivity" />
<activity
android:name=".activity.Barometer_activity"
android:configChanges="keyboardHidden|screenSize|orientation"/>

<activity android:name=".activity.CompassActivity"
android:screenOrientation="portrait"/>

android:name=".activity.BarometerActivity"
android:configChanges="keyboardHidden|screenSize|orientation" />
<activity
android:name=".activity.CompassActivity"
android:screenOrientation="portrait" />
<activity android:name=".activity.MapsActivity" />

<receiver android:name=".receivers.USBDetachReceiver" />
Expand All @@ -97,7 +94,7 @@
<activity android:name=".sensors.SensorSHT21" />
<activity android:name=".sensors.SensorMPU6050" />
<activity android:name=".sensors.SensorTSL2561" />

<activity android:name=".activity.SensorGraphViewActivity"></activity>
</application>

</manifest>
5 changes: 5 additions & 0 deletions app/src/main/java/io/pslab/PSLabApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.app.Application;

import io.realm.Realm;
import io.realm.RealmConfiguration;

/**
* Created by viveksb007 on 4/8/17.
Expand All @@ -14,5 +15,9 @@ public class PSLabApplication extends Application {
public void onCreate() {
super.onCreate();
Realm.init(this);
RealmConfiguration.Builder v = new RealmConfiguration.Builder().name(Realm.DEFAULT_REALM_NAME)
.schemaVersion(0)
.deleteRealmIfMigrationNeeded();
Realm.setDefaultConfiguration(v.build());
}
}
11 changes: 11 additions & 0 deletions app/src/main/java/io/pslab/activity/AccelerometerActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ protected void onCreate(Bundle savedInstanceState) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

setUpBottomSheet();
tvShadow.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(bottomSheetBehavior.getState()==BottomSheetBehavior.STATE_EXPANDED)
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
tvShadow.setVisibility(View.GONE);
}
});
setSupportActionBar(mToolbar);

adapter = new AccelerometerAdapter(new String[]{"X axis", "Y axis", "Z axis"}, getApplicationContext());
Expand Down Expand Up @@ -258,6 +266,7 @@ private void setUpBottomSheet() {

if (isFirstTime) {
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
tvShadow.setVisibility(View.VISIBLE);
tvShadow.setAlpha(0.8f);
arrowUpDown.setRotation(180);
bottomSheetSlideText.setText(R.string.hide_guide_text);
Expand Down Expand Up @@ -292,12 +301,14 @@ public void onStateChanged(@NonNull final View bottomSheet, int newState) {
default:
handler.removeCallbacks(runnable);
bottomSheetSlideText.setText(R.string.show_guide_text);
break;
}
}

@Override
public void onSlide(@NonNull View bottomSheet, float slideOffset) {
Float value = (float) MathUtils.map((double) slideOffset, 0.0, 1.0, 0.0, 0.8);
tvShadow.setVisibility(View.VISIBLE);
tvShadow.setAlpha(value);
arrowUpDown.setRotation(slideOffset * 180);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.pslab.activity;

import android.annotation.SuppressLint;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.hardware.Sensor;
Expand All @@ -11,6 +12,7 @@
import android.os.Handler;
import android.support.annotation.NonNull;
import android.support.design.widget.BottomSheetBehavior;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.GestureDetector;
Expand Down Expand Up @@ -47,15 +49,15 @@
import butterknife.ButterKnife;
import butterknife.Unbinder;

public class Barometer_activity extends AppCompatActivity {
public class BarometerActivity extends AppCompatActivity {
BottomSheetBehavior bottomSheetBehavior;
GestureDetector gestureDetector;
private static final String PREF_NAME = "customDialogPreference";

private static int sensorType = 0;
private static int highLimit = 1000;
private static int updatePeriod = 100;
private Barometer_activity.SensorDataFetch sensorDataFetch;
private BarometerActivity.SensorDataFetch sensorDataFetch;

@BindView(R.id.barometer_max)
TextView statMax;
Expand Down Expand Up @@ -101,8 +103,8 @@ public class Barometer_activity extends AppCompatActivity {
@BindView(R.id.custom_dialog_desc)
TextView bottomSheetDesc;

public static Barometer_activity newInstance() {
return new Barometer_activity();
public static BarometerActivity newInstance() {
return new BarometerActivity();
}

@SuppressLint("ResourceType")
Expand All @@ -112,14 +114,41 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_barometer_main);
ButterKnife.bind(this);
setUpBottomSheet();
Barometer_activity.newInstance();
tvShadow.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(bottomSheetBehavior.getState()==BottomSheetBehavior.STATE_EXPANDED)
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
tvShadow.setVisibility(View.GONE);
}
});
BarometerActivity.newInstance();

currentMin = 10000;
entries = new ArrayList<>();
switch (sensorType) {
case 0:
sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
sensor = sensorManager != null ? sensorManager.getDefaultSensor(Sensor.TYPE_PRESSURE) : null;
if (sensor == null) {
runOnUiThread(new Runnable() {
@Override
public void run() {
if (!isFinishing()) {
new AlertDialog.Builder(BarometerActivity.this)
.setTitle(R.string.barometer_alert_title)
.setMessage(R.string.barometer_alert_description)
.setCancelable(false)
.setPositiveButton("ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
}).show();
}
}
});
}
break;
case 1:
scienceLab = ScienceLabCommon.scienceLab;
Expand Down Expand Up @@ -228,9 +257,9 @@ public void run() {
}

public static void setParameters(int sensorType, int highLimit, int updatePeriod) {
Barometer_activity.sensorType = sensorType;
Barometer_activity.highLimit = highLimit;
Barometer_activity.updatePeriod = updatePeriod;
BarometerActivity.sensorType = sensorType;
BarometerActivity.highLimit = highLimit;
BarometerActivity.updatePeriod = updatePeriod;
}


Expand Down Expand Up @@ -345,6 +374,7 @@ private void setUpBottomSheet() {

if (isFirstTime) {
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
tvShadow.setVisibility(View.VISIBLE);
tvShadow.setAlpha(0.8f);
arrowUpDown.setRotation(180);
bottomSheetSlideText.setText(R.string.hide_guide_text);
Expand Down Expand Up @@ -386,6 +416,7 @@ public void onStateChanged(@NonNull final View bottomSheet, int newState) {
@Override
public void onSlide(@NonNull View bottomSheet, float slideOffset) {
Float value = (float) MathUtils.map((double) slideOffset, 0.0, 1.0, 0.0, 0.8);
tvShadow.setVisibility(View.VISIBLE);
tvShadow.setAlpha(value);
arrowUpDown.setRotation(slideOffset * 180);
}
Expand Down
28 changes: 20 additions & 8 deletions app/src/main/java/io/pslab/activity/CompassActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,15 @@ public void onClick(View v) {
direction = 2;
}
});

tvShadow.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(bottomSheetBehavior.getState()==BottomSheetBehavior.STATE_EXPANDED)
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
tvShadow.setVisibility(View.GONE);
}
});
}

@Override
Expand Down Expand Up @@ -200,13 +209,6 @@ private void setCompassAnimation(float degree) {
compass.startAnimation(ra);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.activity_compass_help_menu, menu);
return true;
}

/**
* Initiates bottom sheet to display guide on how to use Compass instrument
*/
Expand All @@ -217,6 +219,7 @@ private void setUpBottomSheet() {

if (isFirstTime) {
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
tvShadow.setVisibility(View.VISIBLE);
tvShadow.setAlpha(0.8f);
arrowUpDown.setRotation(180);
bottomSheetSlideText.setText(R.string.hide_guide_text);
Expand Down Expand Up @@ -249,19 +252,21 @@ public void onStateChanged(@NonNull final View bottomSheet, int newState) {
break;

case BottomSheetBehavior.STATE_COLLAPSED:
handler.postDelayed(runnable, 1000);
handler.postDelayed(runnable, 2000);
break;

default:
handler.removeCallbacks(runnable);
bottomSheetSlideText.setText(R.string.show_guide_text);
break;
}
}

@Override
public void onSlide(@NonNull View bottomSheet, float slideOffset) {
Float value = (float) MathUtils.map((double) slideOffset, 0.0, 1.0,
0.0, 0.8);
tvShadow.setVisibility(View.VISIBLE);
tvShadow.setAlpha(value);
arrowUpDown.setRotation(slideOffset * 180);
}
Expand All @@ -276,6 +281,13 @@ public boolean onTouchEvent(MotionEvent event) {
return super.onTouchEvent(event);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.activity_compass_help_menu, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
Expand Down
Loading