diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml
index 3ee1ee1b5..ea591cf0c 100644
--- a/.github/release-drafter.yml
+++ b/.github/release-drafter.yml
@@ -1,6 +1,5 @@
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:
@@ -12,6 +11,7 @@ categories:
label: 'Chore'
- title: ':page_facing_up: Documentation'
label: 'Documentation'
+change-template: '- $TITLE (#$NUMBER) - @$AUTHOR'
template: |-
## Changes
$CHANGES
diff --git a/README.md b/README.md
index 9980c9310..d65e94b18 100644
--- a/README.md
+++ b/README.md
@@ -1,25 +1,30 @@
# PSLab Android App
-
-
+Repository for the PSLab Android App for performing experiments with the [Pocket Science Lab](https://pslab.io) open-hardware platform.
[![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&utm_medium=referral&utm_content=fossasia/pslab-android&utm_campaign=Badge_Grade)
[![Mailing List](https://img.shields.io/badge/Mailing%20List-FOSSASIA-blue.svg)](https://groups.google.com/forum/#!forum/pslab-fossasia)
-[![Twitter Follow](https://img.shields.io/twitter/follow/pslabio.svg?style=social&label=Follow&maxAge=2592000?style=flat-square)](https://twitter.com/pslabio)
-
![Minimum API Level](https://img.shields.io/badge/Min%20API%20Level-23-green)
![Maximum API Level](https://img.shields.io/badge/Max%20API%20Level-28-orange)
![GitHub repo size](https://img.shields.io/github/repo-size/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)
+[![Twitter Follow](https://img.shields.io/twitter/follow/pslabio.svg?style=social&label=Follow&maxAge=2592000?style=flat-square)](https://twitter.com/pslabio)
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
+
+
+
+## Buy
+
+* You can get a Pocket Science Lab device from the [FOSSASIA Shop](https://fossasia.com).
+* More resellers are listed on the [PSLab website](https://pslab.io/shop/).
+
## Communication
-Please join us on the following channels:
-* [Pocket Science Channel](https://gitter.im/fossasia/pslab)
-* [Mailing List](https://groups.google.com/forum/#!forum/pslab-fossasia)
+* The PSLab [chat channel is on Gitter](https://gitter.im/fossasia/pslab).
+* Please also join us on the [PSLab Mailing List](https://groups.google.com/forum/#!forum/pslab-fossasia).
## Roadmap
- [x] First we need to get communication between Android App and PSLab working.
@@ -31,9 +36,9 @@ Please join us on the following channels:
-
+
@@ -44,29 +49,24 @@ Please join us on the following channels:
-
-
+
+
-
-
+
+
-
-
-
-
-
-
+
@@ -74,6 +74,7 @@ Please join us on the following channels:
+
@@ -86,8 +87,8 @@ Please join us on the following channels:
-
-
+
+
@@ -107,10 +108,10 @@ Please join us on the following channels:
| Logical Analyzer | Captures and displays signals from digital system | :heavy_check_mark: |
| Wave Generator | Generates arbitrary analog and digital waveforms | :heavy_check_mark: |
| Power Source | Generates programmable voltage and currents | :heavy_check_mark: |
-| Lux Meter | Measures the ambient light intensity | :heavy_check_mark: |
-| Baro Meter | Measures the Pressure | :heavy_check_mark: |
-| AcceleroMeter | Measures the acceleration of the device | :heavy_check_mark: |
-| Gyro Meter | Measures the rate of rotation | :heavy_check_mark: |
+| Luxmeter | Measures the ambient light intensity | :heavy_check_mark: |
+| Barometer | Measures the Pressure | :heavy_check_mark: |
+| Accelerometer | Measures the acceleration of the device | :heavy_check_mark: |
+| Gyrometer | Measures the rate of rotation | :heavy_check_mark: |
| Compass | Measures the absolute rotation relative to earth magnetic poles | :heavy_check_mark: |
| Thermometer | Measures the ambient temperature | :heavy_check_mark: |
| Gas Sensor | Detects gases, including NH3, NOx, alcohol, benzene, smoke and CO2| :heavy_check_mark: |
@@ -249,7 +250,7 @@ The project is maintained by
- Lorenz Gerber ([@lorenzgerber](https://github.com/lorenzgerber))
- Wei Tat ([@cweitat](https://github.com/cweitat))
- Wai Gie ([@woshikie](https://github.com/woshikie))
-
+- Neel Trivedi ([@neel1998](https://github.com/neel1998))
## Alumni
- Praveen Patil ([@wavicles](https://github.com/wavicles))
- Jithin ([@jithinbp](https://github.com/jithinbp))
diff --git a/app/build.gradle b/app/build.gradle
index a23481f1b..4b09aefbe 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -13,8 +13,8 @@ android {
applicationId "io.pslab"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
- versionCode 19
- versionName "2.0.18"
+ versionCode 20
+ versionName "2.0.19"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
@@ -63,9 +63,11 @@ android {
flavorDimensions 'default'
productFlavors {
fdroid {
+ resValue "string", "flavor", "Fdroid version"
dimension = 'default'
}
playstore {
+ resValue "string", "flavor", "Play Store version"
dimension = 'default'
}
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 0a6a4a3c2..00321a931 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -84,7 +84,7 @@
android:screenOrientation="portrait" />
+ android:screenOrientation="portrait" />
diff --git a/app/src/main/java/io/pslab/activity/CreateConfigActivity.java b/app/src/main/java/io/pslab/activity/CreateConfigActivity.java
index a9feceb5d..5e2ec1d37 100644
--- a/app/src/main/java/io/pslab/activity/CreateConfigActivity.java
+++ b/app/src/main/java/io/pslab/activity/CreateConfigActivity.java
@@ -5,14 +5,15 @@
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
-import android.util.SparseBooleanArray;
+import android.view.Gravity;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
+import android.widget.CheckBox;
import android.widget.EditText;
-import android.widget.ListView;
+import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.Toast;
@@ -30,12 +31,12 @@ public class CreateConfigActivity extends AppCompatActivity {
private ArrayList instrumentsList;
private ArrayList instrumentParamsList;
private ArrayList instrumentParamsListTitles;
- private ListView paramsListView;
private int selectedItem = 0;
private String intervalUnit = "sec";
private EditText intervalEditText;
private String interval;
private View rootView;
+ private LinearLayout paramsListContainer;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -43,7 +44,7 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_create_config);
Toolbar toolbar = findViewById(R.id.toolbar);
rootView = findViewById(R.id.create_config_root_view);
- paramsListView = findViewById(R.id.params_list);
+ paramsListContainer = findViewById(R.id.params_list_container);
Spinner selectInstrumentSpinner = findViewById(R.id.select_instrument_spinner);
Spinner intervalUnitSpinner = findViewById(R.id.interval_unit_spinner);
intervalEditText = findViewById(R.id.interval_edit_text);
@@ -95,10 +96,10 @@ public void onClick(View v) {
if (interval.length() == 0) {
Toast.makeText(CreateConfigActivity.this, getResources().getString(R.string.no_interval_message), Toast.LENGTH_SHORT).show();
} else {
- SparseBooleanArray selectedParams = paramsListView.getCheckedItemPositions();
ArrayList selectedParamsList = new ArrayList<>();
- for (int i = 0; i < paramsListView.getCount(); i++) {
- if (selectedParams.get(i)) {
+ for (int i = 0; i < paramsListContainer.getChildCount(); i ++) {
+ CheckBox checkBox = (CheckBox) paramsListContainer.getChildAt(i);
+ if (checkBox.isChecked()) {
selectedParamsList.add(instrumentParamsList.get(selectedItem)[i]);
}
}
@@ -133,8 +134,17 @@ private void createArrayLists() {
}
private void createCheckboxList() {
- paramsListView.setAdapter(new ArrayAdapter(CreateConfigActivity.this, android.R.layout.simple_list_item_multiple_choice, instrumentParamsListTitles.get(selectedItem)));
- paramsListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
+ paramsListContainer.removeAllViews();
+ String[] params = instrumentParamsListTitles.get(selectedItem);
+ for (int i = 0; i < params.length; i++){
+ CheckBox checkBox = new CheckBox(CreateConfigActivity.this);
+ checkBox.setText(params[i]);
+ LinearLayout.LayoutParams checkBoxParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT);
+ checkBoxParams.gravity = Gravity.CENTER_HORIZONTAL;
+ checkBoxParams.setMargins(0,(int)getResources().getDimension(R.dimen.create_config_margin1),0,0);
+ checkBox.setLayoutParams(checkBoxParams);
+ paramsListContainer.addView(checkBox, i);
+ }
}
@Override
diff --git a/app/src/main/java/io/pslab/activity/LogicalAnalyzerActivity.java b/app/src/main/java/io/pslab/activity/LogicalAnalyzerActivity.java
index 31efdc317..bf9cac2c7 100644
--- a/app/src/main/java/io/pslab/activity/LogicalAnalyzerActivity.java
+++ b/app/src/main/java/io/pslab/activity/LogicalAnalyzerActivity.java
@@ -1,5 +1,6 @@
package io.pslab.activity;
+import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
@@ -10,6 +11,7 @@
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.GestureDetector;
+import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
@@ -20,15 +22,11 @@
import android.widget.TextView;
import io.pslab.R;
-import io.pslab.communication.ScienceLab;
import io.pslab.fragment.LALogicLinesFragment;
import io.pslab.models.LogicAnalyzerData;
import io.pslab.others.LocalDataLog;
import io.pslab.others.MathUtils;
-import io.pslab.others.ScienceLabCommon;
-import butterknife.BindView;
-import butterknife.ButterKnife;
import io.pslab.others.SwipeGestureDetector;
import io.realm.RealmResults;
@@ -40,9 +38,6 @@ public class LogicalAnalyzerActivity extends AppCompatActivity {
public static final String PREFS_NAME = "LogicAnalyzerPreference";
- @BindView(R.id.logical_analyzer_toolbar)
- Toolbar toolbar;
- private ScienceLab scienceLab;
private boolean isRunning = false;
//Bottom Sheet
@@ -56,13 +51,11 @@ public class LogicalAnalyzerActivity extends AppCompatActivity {
private TextView bottomSheetDesc;
private BottomSheetBehavior bottomSheetBehavior;
private GestureDetector gestureDetector;
- private TextView showText;
- private boolean btnLongpressed;
private final String KEY_LOG = "has_log";
private final String DATA_BLOCK = "data_block";
public boolean isPlayback = false;
public RealmResults recordedLAData;
-
+ private LALogicLinesFragment laLogicLinesFragment;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
@@ -70,8 +63,6 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_logic_analyzer);
- scienceLab = ScienceLabCommon.scienceLab;
- ButterKnife.bind(this);
// Bottom Sheet guide
bottomSheet = findViewById(R.id.bottom_sheet);
@@ -82,7 +73,6 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
bottomSheetText = findViewById(R.id.custom_dialog_text);
bottomSheetSchematic = findViewById(R.id.custom_dialog_schematic);
bottomSheetDesc = findViewById(R.id.custom_dialog_desc);
- showText = findViewById(R.id.show_guide_logic_analyzer);
// Inflating bottom sheet dialog on how to use Logic Analyzer
setUpBottomSheet();
tvShadow.setOnClickListener(new View.OnClickListener() {
@@ -96,42 +86,16 @@ public void onClick(View v) {
removeStatusBar();
- getSupportFragmentManager().beginTransaction().add(R.id.la_frame_layout, LALogicLinesFragment.newInstance(this)).commit();
+ laLogicLinesFragment = LALogicLinesFragment.newInstance(this);
+ getSupportFragmentManager().beginTransaction().add(R.id.la_frame_layout, laLogicLinesFragment).commit();
+ Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
+ getSupportActionBar().setTitle(R.string.logical_analyzer);
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+ getSupportActionBar().setDisplayShowHomeEnabled(true);
}
- ImageView guideImageView = findViewById(R.id.logic_analyzer_guide_button);
- guideImageView.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- bottomSheetBehavior.setState(bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_HIDDEN ?
- BottomSheetBehavior.STATE_EXPANDED : BottomSheetBehavior.STATE_HIDDEN);
- }
- });
- guideImageView.setOnLongClickListener(new View.OnLongClickListener() {
- @Override
- public boolean onLongClick(View v) {
- showText.setVisibility(View.VISIBLE);
- btnLongpressed = true;
- return true;
- }
- });
- guideImageView.setOnTouchListener(new View.OnTouchListener() {
- @Override
- public boolean onTouch(View v, MotionEvent event) {
- v.onTouchEvent(event);
- if(event.getAction()==MotionEvent.ACTION_UP){
- if(btnLongpressed){
- showText.setVisibility(View.GONE);
- btnLongpressed = false;
- }
- }
- return true;
- }
- });
-
if (getIntent().getExtras() != null && getIntent().getExtras().getBoolean(KEY_LOG)) {
recordedLAData = LocalDataLog.with()
.getBlockOfLARecords(getIntent().getExtras().getLong(DATA_BLOCK));
@@ -161,16 +125,35 @@ private void removeStatusBar() {
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY));
}
}
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.logical_analyzer_menu, menu);
+ return true;
+ }
+
@Override
public boolean onOptionsItemSelected(MenuItem item) {
- int id = item.getItemId();
- if (id == android.R.id.home) {
- onBackPressed();
- return true;
+ switch (item.getItemId()) {
+ case android.R.id.home:
+ finish();
+ break;
+ case R.id.show_logged_data:
+ Intent intent = new Intent(LogicalAnalyzerActivity.this, DataLoggerActivity.class);
+ intent.putExtra(DataLoggerActivity.CALLER_ACTIVITY, getResources().getString(R.string.logical_analyzer));
+ startActivity(intent);
+ break;
+ case R.id.save_graph:
+ laLogicLinesFragment.logData();
+ break;
+ case R.id.show_guide:
+ bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
+ break;
+ default:
+ break;
}
- return super.onOptionsItemSelected(item);
+ return true;
}
-
@Override
public void onBackPressed() {
if (!isRunning)
diff --git a/app/src/main/java/io/pslab/activity/MainActivity.java b/app/src/main/java/io/pslab/activity/MainActivity.java
index ba056b789..8cfe81090 100644
--- a/app/src/main/java/io/pslab/activity/MainActivity.java
+++ b/app/src/main/java/io/pslab/activity/MainActivity.java
@@ -1,11 +1,9 @@
package io.pslab.activity;
-import android.app.AlertDialog;
import android.app.PendingIntent;
import android.app.ProgressDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
-import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.hardware.usb.UsbDevice;
@@ -24,7 +22,6 @@
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
-import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
@@ -41,8 +38,6 @@
import io.pslab.R;
import io.pslab.communication.CommunicationHandler;
import io.pslab.fragment.AboutUsFragment;
-import io.pslab.fragment.BluetoothScanFragment;
-import io.pslab.fragment.ESPFragment;
import io.pslab.fragment.FAQFragment;
import io.pslab.fragment.HomeFragment;
import io.pslab.fragment.InstrumentsFragment;
@@ -187,13 +182,11 @@ public void run() {
private Fragment getHomeFragment() throws IOException {
switch (navItemIndex) {
- case 1:
- return HomeFragment.newInstance(ScienceLabCommon.scienceLab.isConnected(), ScienceLabCommon.scienceLab.isDeviceFound());
case 2:
- return null;
- case 3:
+ return HomeFragment.newInstance(ScienceLabCommon.scienceLab.isConnected(), ScienceLabCommon.scienceLab.isDeviceFound());
+ case 5:
return AboutUsFragment.newInstance();
- case 4:
+ case 7:
return FAQFragment.newInstance();
default:
return InstrumentsFragment.newInstance();
@@ -228,11 +221,11 @@ private void selectNavMenu() {
case 2:
navigationView.getMenu().getItem(navItemIndex).setChecked(true);
break;
- case 3:
- navigationView.getMenu().getItem(size_menu-1).getSubMenu().getItem(1).setChecked(true);
+ case 5:
+ navigationView.getMenu().getItem(navItemIndex).setChecked(true);
break;
- case 4:
- navigationView.getMenu().getItem(size_menu-1).getSubMenu().getItem(0).setChecked(true);
+ case 7:
+ navigationView.getMenu().getItem(navItemIndex).setChecked(true);
break;
default:
navigationView.getMenu().getItem(0).setChecked(true);
@@ -250,7 +243,7 @@ public boolean onNavigationItemSelected(@NonNull MenuItem item) {
CURRENT_TAG = TAG_INSTRUMENTS;
break;
case R.id.nav_device:
- navItemIndex = 1;
+ navItemIndex = 2;
CURRENT_TAG = TAG_DEVICE;
break;
case R.id.nav_settings:
@@ -262,22 +255,19 @@ public boolean onNavigationItemSelected(@NonNull MenuItem item) {
startActivity(intent);
return true;
case R.id.nav_about_us:
- navItemIndex = 3;
+ navItemIndex = 5;
CURRENT_TAG = TAG_ABOUTUS;
break;
case R.id.nav_help_feedback:
- navItemIndex = 4;
+ navItemIndex = 7;
CURRENT_TAG = TAG_FAQ;
break;
- case R.id.nav_report_us:
- customTabService.launchUrl("https://goo.gl/forms/sHlmRAPFmzcGQ27u2");
+ case R.id.nav_buy_pslab:
+ customTabService.launchUrl("https://pslab.io/shop/");
if (drawer != null) {
drawer.closeDrawers();
}
break;
- case R.id.nav_app_version:
- setTitleColor(R.color.gray);
- break;
case R.id.sensor_data_logger:
if (drawer != null) {
drawer.closeDrawers();
@@ -407,53 +397,9 @@ private void attemptToConnectPSLab() {
} else {
initialisationDialog.dismiss();
Toast.makeText(this, getString(R.string.device_not_found), Toast.LENGTH_SHORT).show();
- AlertDialog dialog = new AlertDialog.Builder(MainActivity.this)
- .setMessage(getResources().getString(R.string.bluetooth_wifi_scan_dialog))
- .setPositiveButton(getResources().getString(R.string.bluetooth_scan_text), new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(MainActivity.this);
- LayoutInflater inflater = MainActivity.this.getLayoutInflater();
- View dialogView = inflater.inflate(R.layout.bluetooth_wifi_dialog_layout, null);
- dialogBuilder.setNegativeButton(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialogInterface, int i) {
- dialog.cancel();
- }
- });
-
- dialogView.findViewById(R.id.bluetooth_btn).setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- BluetoothScanFragment bluetoothScanFragment = new BluetoothScanFragment();
- bluetoothScanFragment.show(getSupportFragmentManager(), "bluetooth");
- bluetoothScanFragment.setCancelable(true);
- dialog.cancel();
- }
- });
-
- dialogView.findViewById(R.id.wifi_btn).setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- ESPFragment espFragment = new ESPFragment();
- espFragment.show(getSupportFragmentManager(), "wifi");
- espFragment.setCancelable(true);
- dialog.cancel();
- }
- });
-
- dialogBuilder.setView(dialogView)
- .create()
- .show();
- }
- })
- .setNegativeButton(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- dialog.cancel();
- }
- }).create();
- dialog.show();
+ navItemIndex = 2;
+ CURRENT_TAG = TAG_DEVICE;
+ loadHomeFragment();
}
}
}
diff --git a/app/src/main/java/io/pslab/activity/MultimeterActivity.java b/app/src/main/java/io/pslab/activity/MultimeterActivity.java
index a5250af27..b27408a67 100644
--- a/app/src/main/java/io/pslab/activity/MultimeterActivity.java
+++ b/app/src/main/java/io/pslab/activity/MultimeterActivity.java
@@ -470,7 +470,6 @@ public boolean onPrepareOptionsMenu(Menu menu) {
stopMenu = menu.findItem(R.id.stop_data);
playMenu.setVisible(isPlayingBack);
menu.findItem(R.id.record_pause_data).setVisible(!isPlayingBack);
- menu.findItem(R.id.delete_csv_data).setVisible(!isPlayingBack);
return super.onPrepareOptionsMenu(menu);
}
@@ -526,18 +525,6 @@ public void onClick(View view) {
CustomSnackBar.showSnackBar(coordinatorLayout, getString(R.string.device_not_found), null, null, Snackbar.LENGTH_SHORT);
}
break;
- case R.id.delete_csv_data:
- if (isDataRecorded) {
- MenuItem item1 = menu.findItem(R.id.record_pause_data);
- item1.setIcon(R.drawable.ic_record_white);
- recordData = false;
- isRecordingStarted = false;
- isDataRecorded = false;
- multimeterLogger.deleteFile();
- CustomSnackBar.showSnackBar(coordinatorLayout, getString(R.string.data_deleted), null, null, Snackbar.LENGTH_SHORT);
- } else
- CustomSnackBar.showSnackBar(coordinatorLayout, getString(R.string.nothing_to_delete), null, null, Snackbar.LENGTH_SHORT);
- break;
case R.id.settings:
Intent settingIntent = new Intent(this, SettingsActivity.class);
settingIntent.putExtra("title", getResources().getString(R.string.multimeter_configurations));
diff --git a/app/src/main/java/io/pslab/activity/OscilloscopeActivity.java b/app/src/main/java/io/pslab/activity/OscilloscopeActivity.java
index 87e831f7d..cc2b42066 100644
--- a/app/src/main/java/io/pslab/activity/OscilloscopeActivity.java
+++ b/app/src/main/java/io/pslab/activity/OscilloscopeActivity.java
@@ -20,8 +20,11 @@
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
+import android.support.v7.widget.Toolbar;
import android.view.Display;
import android.view.GestureDetector;
+import android.view.Menu;
+import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
@@ -161,8 +164,6 @@ public class OscilloscopeActivity extends AppCompatActivity implements View.OnCl
private Fragment dataAnalysisFragment;
private Fragment xyPlotFragment;
private Fragment playbackFragment;
- @BindView(R.id.imageView_led_os)
- ImageView ledImageView;
@BindView(R.id.show_guide_oscilloscope)
TextView showText;
private ScienceLab scienceLab;
@@ -179,9 +180,7 @@ public class OscilloscopeActivity extends AppCompatActivity implements View.OnCl
private volatile boolean monitor = true;
private BottomSheetBehavior bottomSheetBehavior;
private GestureDetector gestureDetector;
- private boolean btnLongpressed;
private double maxAmp, maxFreq;
- private ImageView recordButton;
private boolean isRecording = false;
private Realm realm;
public RealmResults recordedOscilloscopeData;
@@ -205,6 +204,9 @@ public class OscilloscopeActivity extends AppCompatActivity implements View.OnCl
private String[] loggingYdata = new String[4];
public String xyPlotAxis1 = "CH1";
public String xyPlotAxis2 = "CH2";
+ private boolean isPlayingback = false;
+ private boolean isPlaying = false;
+ private MenuItem playMenu;
private enum CHANNEL {CH1, CH2, CH3, MIC}
@@ -229,6 +231,14 @@ public void onClick(View v) {
});
mainLayout = findViewById(R.id.oscilloscope_mail_layout);
+ Toolbar toolbar = findViewById(R.id.toolbar);
+ setSupportActionBar(toolbar);
+ getSupportActionBar().setTitle(R.string.oscilloscope);
+ if (getSupportActionBar() != null) {
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+ getSupportActionBar().setDisplayShowHomeEnabled(true);
+ }
+
channelIndexMap = new HashMap<>();
channelIndexMap.put(CHANNEL.CH1.toString(), 1);
channelIndexMap.put(CHANNEL.CH2.toString(), 2);
@@ -240,8 +250,6 @@ public void onClick(View v) {
(LocationManager) getSystemService(Context.LOCATION_SERVICE));
csvLogger = new CSVLogger(getString(R.string.oscilloscope));
- recordButton = findViewById(R.id.oscilloscope_record_button);
-
scienceLab = ScienceLabCommon.scienceLab;
x1 = mChart.getXAxis();
y1 = mChart.getAxisLeft();
@@ -447,18 +455,6 @@ public void run() {
}
}
- if (!isInBuiltMicSelected && (!scienceLab.isConnected() || (!isCH1Selected && !isCH2Selected && !isCH3Selected && !isAudioInputSelected))) {
- if (!String.valueOf(ledImageView.getTag()).equals("red")) {
- runOnUiThread(new Runnable() {
- @Override
- public void run() {
- ledImageView.setImageResource(R.drawable.red_led);
- ledImageView.setTag("red");
- }
- });
- }
- }
-
if (scienceLab.isConnected() && isXYPlotSelected) {
xyPlotTask = new XYPlotTask();
xyPlotTask.execute(xyPlotAxis1, xyPlotAxis2);
@@ -481,42 +477,38 @@ public void run() {
monitorThread = new Thread(runnable);
monitorThread.start();
- ImageView guideImageView = findViewById(R.id.oscilloscope_guide_button);
- guideImageView.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- bottomSheetBehavior.setState(bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_HIDDEN ?
- BottomSheetBehavior.STATE_EXPANDED : BottomSheetBehavior.STATE_HIDDEN);
- }
- });
- guideImageView.setOnLongClickListener(new View.OnLongClickListener() {
- @Override
- public boolean onLongClick(View v) {
- showText.setVisibility(View.VISIBLE);
- btnLongpressed = true;
- return true;
- }
- });
- guideImageView.setOnTouchListener(new View.OnTouchListener() {
- @Override
- public boolean onTouch(View v, MotionEvent event) {
- v.onTouchEvent(event);
- if (event.getAction() == MotionEvent.ACTION_UP) {
- if (btnLongpressed) {
- showText.setVisibility(View.GONE);
- btnLongpressed = false;
- }
- }
- return true;
- }
- });
+ if (getIntent().getExtras() != null && getIntent().getExtras().getBoolean(KEY_LOG)) {
+ recordedOscilloscopeData = LocalDataLog.with()
+ .getBlockOfOscilloscopeRecords(getIntent().getExtras().getLong(DATA_BLOCK));
+ isPlayingback = true;
+ setLayoutForPlayback();
+ }
+ }
- recordButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.activity_landscape_menu, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onPrepareOptionsMenu(Menu menu) {
+ playMenu = menu.findItem(R.id.play_data);
+ menu.findItem(R.id.record_pause_data).setVisible(!isPlayingback);
+ menu.findItem(R.id.play_data).setVisible(isPlayingback);
+ return super.onPrepareOptionsMenu(menu);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case android.R.id.home:
+ finish();
+ break;
+ case R.id.record_pause_data:
if (isRecording) {
isRecording = false;
- recordButton.setImageResource(R.drawable.ic_record_white);
+ item.setIcon(R.drawable.ic_record_white);
CustomSnackBar.showSnackBar(mainLayout,
getString(R.string.csv_store_text) + " " + csvLogger.getCurrentFilePath()
, getString(R.string.open), new View.OnClickListener() {
@@ -529,7 +521,7 @@ public void onClick(View view) {
}, Snackbar.LENGTH_SHORT);
} else {
isRecording = true;
- recordButton.setImageResource(R.drawable.ic_record_stop_white);
+ item.setIcon(R.drawable.ic_record_stop_white);
block = System.currentTimeMillis();
if (gpsLogger.isGPSEnabled()) {
Location location = gpsLogger.getDeviceLocation();
@@ -551,26 +543,42 @@ public void onClick(View view) {
recordSensorDataBlockID(new SensorDataBlock(block, getResources().getString(R.string.oscilloscope)));
CustomSnackBar.showSnackBar(mainLayout, getString(R.string.data_recording_start), null, null, Snackbar.LENGTH_SHORT);
}
- }
- });
-
- if (getIntent().getExtras() != null && getIntent().getExtras().getBoolean(KEY_LOG)) {
- recordedOscilloscopeData = LocalDataLog.with()
- .getBlockOfOscilloscopeRecords(getIntent().getExtras().getLong(DATA_BLOCK));
- setLayoutForPlayback();
+ break;
+ case R.id.show_guide:
+ bottomSheetBehavior.setState(bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_HIDDEN ?
+ BottomSheetBehavior.STATE_EXPANDED : BottomSheetBehavior.STATE_HIDDEN);
+ break;
+ case R.id.show_logged_data:
+ Intent intent = new Intent(OscilloscopeActivity.this, DataLoggerActivity.class);
+ intent.putExtra(DataLoggerActivity.CALLER_ACTIVITY, getResources().getString(R.string.oscilloscope));
+ startActivity(intent);
+ break;
+ case R.id.play_data:
+ if (isPlaying) {
+ isPlaying = false;
+ item.setIcon(R.drawable.ic_play_arrow_white_24dp);
+ pauseData();
+ } else {
+ isPlaying = true;
+ item.setIcon(R.drawable.ic_pause_white_24dp);
+ playRecordedData();
+ }
+ break;
+ default:
+ break;
}
+ return true;
}
private void setLayoutForPlayback() {
findViewById(R.id.layout_dock_os1).setVisibility(View.GONE);
- recordButton.setVisibility(View.GONE);
RelativeLayout.LayoutParams lineChartParams = (RelativeLayout.LayoutParams) mChartLayout.getLayoutParams();
RelativeLayout.LayoutParams frameLayoutParams = (RelativeLayout.LayoutParams) frameLayout.getLayoutParams();
- lineChartParams.height = height * 4 / 5;
- lineChartParams.width = width;
+ lineChartParams.height = height * 3 / 4;
+ lineChartParams.width = RelativeLayout.LayoutParams.MATCH_PARENT;
mChartLayout.setLayoutParams(lineChartParams);
- frameLayoutParams.height = height / 5;
- frameLayoutParams.width = width;
+ frameLayoutParams.height = height / 4;
+ frameLayoutParams.width = RelativeLayout.LayoutParams.MATCH_PARENT;
frameLayout.setLayoutParams(frameLayoutParams);
replaceFragment(R.id.layout_dock_os2, playbackFragment, "Playback Fragment");
}
@@ -643,7 +651,7 @@ public void run() {
} else {
playbackTimer.cancel();
playbackTimer = null;
- ((OscilloscopePlaybackFragment) playbackFragment).resetPlayButton();
+ playMenu.setIcon(R.drawable.ic_play_arrow_white_24dp);
currentPosition = 0;
}
} catch (Exception e) {
@@ -651,7 +659,7 @@ public void run() {
playbackTimer.cancel();
playbackTimer = null;
}
- ((OscilloscopePlaybackFragment) playbackFragment).resetPlayButton();
+ playMenu.setIcon(R.drawable.ic_play_arrow_white_24dp);
currentPosition = 0;
}
}
@@ -662,8 +670,10 @@ public void run() {
}
public void pauseData() {
- playbackTimer.cancel();
- playbackTimer = null;
+ if (playbackTimer != null) {
+ playbackTimer.cancel();
+ playbackTimer = null;
+ }
}
private void logChannelData(String[] channels) {
@@ -754,17 +764,17 @@ public void onWindowFocusChanged() {
RelativeLayout.LayoutParams frameLayoutParams = (RelativeLayout.LayoutParams) frameLayout.getLayoutParams();
if (getResources().getBoolean(R.bool.isTablet)) {
lineChartParams.height = height * 3 / 4;
- lineChartParams.width = width * 7 / 8;
+ lineChartParams.width = width * 9 / 10;
mChartLayout.setLayoutParams(lineChartParams);
frameLayoutParams.height = height / 4;
- frameLayoutParams.width = width * 7 / 8;
+ frameLayoutParams.width = width * 9 / 10;
frameLayout.setLayoutParams(frameLayoutParams);
} else {
- lineChartParams.height = height * 2 / 3;
- lineChartParams.width = width * 5 / 6;
+ lineChartParams.height = height * 3 / 5;
+ lineChartParams.width = width * 7 / 8;
mChartLayout.setLayoutParams(lineChartParams);
- frameLayoutParams.height = height / 3;
- frameLayoutParams.width = width * 5 / 6;
+ frameLayoutParams.height = height * 2 / 5;
+ frameLayoutParams.width = width * 7 / 8;
frameLayout.setLayoutParams(frameLayoutParams);
}
}
@@ -1131,10 +1141,6 @@ public void run() {
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
- if (!String.valueOf(ledImageView.getTag()).equals("green")) {
- ledImageView.setImageResource(R.drawable.green_led);
- ledImageView.setTag("green");
- }
List dataSets = new ArrayList<>();
for (int i = 0; i < Math.min(entries.size(), paramsChannels.length); i++) {
diff --git a/app/src/main/java/io/pslab/activity/RoboticArmActivity.java b/app/src/main/java/io/pslab/activity/RoboticArmActivity.java
index 20c9d9cfb..1bb06e6cb 100644
--- a/app/src/main/java/io/pslab/activity/RoboticArmActivity.java
+++ b/app/src/main/java/io/pslab/activity/RoboticArmActivity.java
@@ -14,16 +14,19 @@
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
+import android.support.v7.widget.Toolbar;
+import android.util.TypedValue;
import android.view.Display;
import android.view.DragEvent;
import android.view.GestureDetector;
import android.view.KeyEvent;
import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManager;
import android.view.inputmethod.EditorInfo;
-import android.widget.Button;
import android.widget.EditText;
import android.widget.HorizontalScrollView;
import android.widget.ImageView;
@@ -62,7 +65,6 @@ public class RoboticArmActivity extends AppCompatActivity {
private LinearLayout servo1TimeLine, servo2TimeLine, servo3TimeLine, servo4TimeLine;
private int degree;
private boolean editEnter = false;
- private Button playPauseButton, stopButton, saveButton;
private HorizontalScrollView scrollView;
private CountDownTimer timeLine;
private boolean isPlaying = false;
@@ -76,6 +78,9 @@ public class RoboticArmActivity extends AppCompatActivity {
private ScienceLab scienceLab;
private BottomSheetBehavior bottomSheetBehavior;
private GestureDetector gestureDetector;
+ private LinearLayout timeIndicatorLayout;
+ private LinearLayout.LayoutParams timeIndicatorParams;
+ private MenuItem playMenu;
@BindView(R.id.sheet_slide_text_robotic_arm)
TextView bottomSheetSlideText;
@BindView(R.id.parent_layout_robotic)
@@ -91,6 +96,13 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_robotic_arm);
ButterKnife.bind(this);
+ Toolbar toolbar = findViewById(R.id.toolbar);
+ setSupportActionBar(toolbar);
+ getSupportActionBar().setTitle(R.string.robotic_arm);
+ if (getSupportActionBar() != null) {
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+ getSupportActionBar().setDisplayShowHomeEnabled(true);
+ }
setUpBottomSheet();
parentLayout.setOnClickListener(new View.OnClickListener() {
@Override
@@ -108,8 +120,13 @@ public void onClick(View v) {
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
+ TypedValue tv = new TypedValue();
+ int actionBarHeight = 0;
+ if (getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
+ actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, getResources().getDisplayMetrics());
+ }
int screen_width = size.x;
- int screen_height = size.y;
+ int screen_height = size.y - actionBarHeight;
realm = LocalDataLog.with().getRealm();
gpsLogger = new GPSLogger(this,
(LocationManager) getSystemService(Context.LOCATION_SERVICE));
@@ -130,14 +147,10 @@ public void onClick(View v) {
servo2TimeLine = findViewById(R.id.servo2_timeline);
servo3TimeLine = findViewById(R.id.servo3_timeline);
servo4TimeLine = findViewById(R.id.servo4_timeline);
- playPauseButton = findViewById(R.id.timeline_play_pause_button);
- stopButton = findViewById(R.id.timeline_stop_button);
- saveButton = findViewById(R.id.timeline_save_button);
scrollView = findViewById(R.id.horizontal_scroll_view);
- LinearLayout timeLineControlsLayout = findViewById(R.id.servo_timeline_controls);
servoCSVLogger = new CSVLogger(getResources().getString(R.string.robotic_arm));
- LinearLayout.LayoutParams servoControllerParams = new LinearLayout.LayoutParams(14 * screen_width / 60 - 4, screen_height / 2 - 4);
+ LinearLayout.LayoutParams servoControllerParams = new LinearLayout.LayoutParams(screen_width / 4 - 4, screen_height / 2 - 4);
servoControllerParams.setMargins(2, 5, 2, 0);
servo1Layout.setLayoutParams(servoControllerParams);
servo2Layout.setLayoutParams(servoControllerParams);
@@ -152,9 +165,6 @@ public void onClick(View v) {
servo3TimeLine.setLayoutParams(servoTimeLineParams);
servo4TimeLine.setLayoutParams(servoTimeLineParams);
- LinearLayout.LayoutParams timeLineControlsParams = new LinearLayout.LayoutParams(screen_width / 15, screen_height / 2);
- timeLineControlsLayout.setLayoutParams(timeLineControlsParams);
-
LinearLayout.LayoutParams servoTimeLineBoxParams = new LinearLayout.LayoutParams(screen_width / 6 - 2, screen_height / 8 - 2);
servoTimeLineBoxParams.setMargins(2, 0, 0, 0);
@@ -444,8 +454,8 @@ public void onClick(View v) {
}
});
- LinearLayout timeIndicatorLayout = findViewById(R.id.time_indicator);
- LinearLayout.LayoutParams timeIndicatorParams = new LinearLayout.LayoutParams(screen_width / 6 - 2, 12);
+ timeIndicatorLayout = findViewById(R.id.time_indicator);
+ timeIndicatorParams = new LinearLayout.LayoutParams(screen_width / 6 - 2, 12);
timeIndicatorParams.setMarginStart(3);
timeIndicatorLayout.setLayoutParams(timeIndicatorParams);
@@ -477,55 +487,12 @@ public void onFinish() {
}
};
- playPauseButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (isPlaying) {
- isPlaying = false;
- playPauseButton.setBackground(getResources().getDrawable(R.drawable.ic_play_arrow_white_24dp));
- timeLine.onFinish();
- } else {
- isPlaying = true;
- playPauseButton.setBackground(getResources().getDrawable(R.drawable.ic_pause_white_24dp));
- timeLine.start();
- }
- }
- });
-
- saveButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- saveTimeline();
- }
- });
-
- stopButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- timeLine.cancel();
- timeIndicatorParams.setMarginStart(3);
- timeIndicatorLayout.setLayoutParams(timeIndicatorParams);
- scrollView.fullScroll(HorizontalScrollView.FOCUS_LEFT);
- isPlaying = false;
- playPauseButton.setBackground(getResources().getDrawable(R.drawable.ic_play_arrow_white_24dp));
- timelinePosition = 0;
- }
- });
-
if (getIntent().getExtras() != null && getIntent().getExtras().getBoolean(KEY_LOG)) {
recordedServoData = LocalDataLog.with()
.getBlockOfServoRecords(getIntent().getExtras().getLong(DATA_BLOCK));
setReceivedData();
}
- Button guideButton = findViewById(R.id.timeline_guide_button);
- guideButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- bottomSheetBehavior.setState(bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_HIDDEN ?
- BottomSheetBehavior.STATE_EXPANDED : BottomSheetBehavior.STATE_HIDDEN);
- }
- });
}
private void setUpBottomSheet() {
@@ -717,6 +684,62 @@ public boolean onDrag(View v, DragEvent event) {
}
};
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.robotic_arm_menu, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onPrepareOptionsMenu(Menu menu) {
+ playMenu = menu.findItem(R.id.play_data);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case android.R.id.home:
+ finish();
+ break;
+ case R.id.play_data:
+ if (isPlaying) {
+ isPlaying = false;
+ item.setIcon(getResources().getDrawable(R.drawable.ic_play_arrow_white_24dp));
+ timeLine.onFinish();
+ } else {
+ isPlaying = true;
+ item.setIcon(getResources().getDrawable(R.drawable.ic_pause_white_24dp));
+ timeLine.start();
+ }
+ break;
+ case R.id.stop_data:
+ timeLine.cancel();
+ timeIndicatorParams.setMarginStart(3);
+ timeIndicatorLayout.setLayoutParams(timeIndicatorParams);
+ scrollView.fullScroll(HorizontalScrollView.FOCUS_LEFT);
+ isPlaying = false;
+ playMenu.setIcon(getResources().getDrawable(R.drawable.ic_play_arrow_white_24dp));
+ timelinePosition = 0;
+ break;
+ case R.id.show_guide:
+ bottomSheetBehavior.setState(bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_HIDDEN ?
+ BottomSheetBehavior.STATE_EXPANDED : BottomSheetBehavior.STATE_HIDDEN);
+ break;
+ case R.id.show_logged_data:
+ Intent intent = new Intent(RoboticArmActivity.this, DataLoggerActivity.class);
+ intent.putExtra(DataLoggerActivity.CALLER_ACTIVITY, getResources().getString(R.string.robotic_arm));
+ startActivity(intent);
+ break;
+ case R.id.save_data:
+ saveTimeline();
+ break;
+ default:
+ break;
+ }
+ return true;
+ }
+
@Override
protected void onResume() {
super.onResume();
diff --git a/app/src/main/java/io/pslab/activity/WaveGeneratorActivity.java b/app/src/main/java/io/pslab/activity/WaveGeneratorActivity.java
index 28c9ad6af..74fb11f88 100644
--- a/app/src/main/java/io/pslab/activity/WaveGeneratorActivity.java
+++ b/app/src/main/java/io/pslab/activity/WaveGeneratorActivity.java
@@ -5,6 +5,7 @@
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
+import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.location.Location;
import android.location.LocationManager;
@@ -23,6 +24,8 @@
import android.util.Log;
import android.view.GestureDetector;
import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
@@ -34,7 +37,9 @@
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
+import android.support.v7.widget.Toolbar;
+import com.github.mikephil.charting.charts.LineChart;
import com.warkiz.widget.IndicatorSeekBar;
import java.util.Date;
@@ -74,10 +79,6 @@ public class WaveGeneratorActivity extends AppCompatActivity {
private final String MODE_SQUARE = "Square";
private final String MODE_PWM = "PWM";
//waveform monitor
- @BindView(R.id.wave_mon_wave1)
- TextView waveMonWave1;
- @BindView(R.id.wave_mon_wave2)
- TextView waveMonWave2;
@BindView(R.id.wave_ic_img)
ImageView selectedWaveImg;
@BindView(R.id.wave_mon_select_wave)
@@ -95,14 +96,6 @@ public class WaveGeneratorActivity extends AppCompatActivity {
ImageView pwmSelectedModeImg;
@BindView(R.id.pwm_mon_mode_select)
TextView pwmMonSelectMode;
- @BindView(R.id.pwm_mon_sq1)
- TextView pwmMonSqr1;
- @BindView(R.id.pwm_mon_sq2)
- TextView pwmMonSqr2;
- @BindView(R.id.pwm_mon_sq3)
- TextView pwmMonSqr3;
- @BindView(R.id.pwm_mon_sq4)
- TextView pwmMonSqr4;
@BindView(R.id.pwm_freq_value)
TextView pwmFreqValue;
@BindView(R.id.pwm_phase_value)
@@ -135,8 +128,10 @@ public class WaveGeneratorActivity extends AppCompatActivity {
Button btnPwmSq3;
@BindView(R.id.pwm_btn_sq4)
Button btnPwmSq4;
- @BindView(R.id.pwm_btn_mode)
- Button btnPwmMode;
+ @BindView(R.id.analog_mode_btn)
+ Button btnAnalogMode;
+ @BindView(R.id.digital_mode_btn)
+ Button btnDigitalMode;
@BindView(R.id.pwm_btn_freq)
Button pwmBtnFreq;
@BindView(R.id.pwm_btn_duty)
@@ -150,8 +145,6 @@ public class WaveGeneratorActivity extends AppCompatActivity {
ImageButton imgBtnDown;
@BindView(R.id.seek_bar_wave_gen)
IndicatorSeekBar seekBar;
- @BindView(R.id.btn_view)
- Button btnView;
//bottomSheet
@BindView(R.id.bottom_sheet)
LinearLayout bottomSheet;
@@ -161,10 +154,10 @@ public class WaveGeneratorActivity extends AppCompatActivity {
ImageView arrowUpDown;
@BindView(R.id.sheet_slide_text)
TextView bottomSheetSlideText;
- @BindView(R.id.show_guide_wave_generator)
- TextView showText;
@BindView(R.id.wave_phase)
TextView wavePhaseTitle;
+ @BindView(R.id.btn_produce_sound)
+ Button btnProduceSound;
ScienceLab scienceLab;
BottomSheetBehavior bottomSheetBehavior;
GestureDetector gestureDetector;
@@ -173,11 +166,9 @@ public class WaveGeneratorActivity extends AppCompatActivity {
private Timer waveGenCounter;
private Handler wavegenHandler = new Handler();
private AlertDialog waveDialog;
- private boolean btnLongpressed;
private CSVLogger csvLogger;
private WaveConst waveBtnActive, pwmBtnActive, prop_active, digital_mode;
private TextView activePropTv = null;
- private TextView activePwmPinTv = null;
private CoordinatorLayout coordinatorLayout;
private Realm realm;
private GPSLogger gpsLogger;
@@ -186,26 +177,30 @@ public class WaveGeneratorActivity extends AppCompatActivity {
private ConstraintLayout squareModeLayout;
private RelativeLayout pwmModeControls;
private RelativeLayout squareModeControls;
+ private LineChart previewChart;
@SuppressLint("ClickableViewAccessibility")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- requestWindowFeature(Window.FEATURE_NO_TITLE);
- getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_wave_generator_main);
ButterKnife.bind(this);
- removeStatusBar();
-
realm = LocalDataLog.with().getRealm();
gpsLogger = new GPSLogger(this,
(LocationManager) getSystemService(Context.LOCATION_SERVICE));
-
+ Toolbar toolbar = findViewById(R.id.toolbar);
+ setSupportActionBar(toolbar);
+ getSupportActionBar().setTitle(getString(R.string.wave_generator));
+ if (getSupportActionBar() != null) {
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+ getSupportActionBar().setDisplayShowHomeEnabled(true);
+ }
coordinatorLayout = findViewById(R.id.wave_generator_coordinator_layout);
squareModeLayout = findViewById(R.id.square_mode_layout);
pwmModeLayout = findViewById(R.id.pwm_mode_layout);
+ previewChart = findViewById(R.id.chart_preview);
squareModeControls = findViewById(R.id.square_mode_controls);
pwmModeControls = findViewById(R.id.pwm_mode_controls);
@@ -238,15 +233,6 @@ public void onClick(View view) {
}
}
});
- waveMonWave1.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (!waveBtnActive.equals(WaveConst.WAVE1)) {
- waveMonSelected = true;
- selectBtn(WaveConst.WAVE1);
- }
- }
- });
btnCtrlWave2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@@ -256,20 +242,11 @@ public void onClick(View view) {
}
}
});
- waveMonWave2.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (!waveBtnActive.equals(WaveConst.WAVE2)) {
- waveMonSelected = true;
- selectBtn(WaveConst.WAVE2);
- }
- }
- });
imgBtnSin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- imgBtnSin.setVisibility(View.GONE);
- imgBtnTri.setVisibility(View.VISIBLE);
+ imgBtnSin.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded));
+ imgBtnTri.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded_light));
WaveGeneratorCommon.wave.get(waveBtnActive).put(WaveConst.WAVETYPE, SIN);
selectWaveform(SIN);
}
@@ -278,8 +255,8 @@ public void onClick(View view) {
imgBtnTri.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- imgBtnSin.setVisibility(View.VISIBLE);
- imgBtnTri.setVisibility(View.GONE);
+ imgBtnSin.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded_light));
+ imgBtnTri.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded));
WaveGeneratorCommon.wave.get(waveBtnActive).put(WaveConst.WAVETYPE, TRIANGULAR);
selectWaveform(TRIANGULAR);
}
@@ -294,6 +271,8 @@ public void onClick(View view) {
activePropTv = waveFreqValue;
waveMonPropSelect.setText(getString(R.string.wave_frequency));
setSeekBar(seekBar);
+ btnCtrlFreq.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded));
+ btnCtrlPhase.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded_light));
}
});
@@ -306,34 +285,40 @@ public void onClick(View view) {
activePropTv = wavePhaseValue;
waveMonPropSelect.setText(getString(R.string.phase_offset));
setSeekBar(seekBar);
+ btnCtrlFreq.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded_light));
+ btnCtrlPhase.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded));
}
});
- //pwm panel
- btnPwmMode.setOnClickListener(new View.OnClickListener() {
+ btnAnalogMode.setOnClickListener(new View.OnClickListener() {
@Override
- public void onClick(View view) {
- WaveGeneratorCommon.intializeDigitalValue();
- if (digital_mode == WaveConst.SQUARE) {
- pwmModeLayout.setVisibility(View.VISIBLE);
- pwmModeControls.setVisibility(View.VISIBLE);
- squareModeLayout.setVisibility(View.GONE);
- squareModeControls.setVisibility(View.GONE);
- toggleDigitalMode(WaveConst.PWM);
- imgBtnSin.setEnabled(false);
- imgBtnTri.setEnabled(false);
- pwmBtnActive = WaveConst.SQR1;
- selectBtn(WaveConst.SQR1);
- Toast.makeText(WaveGeneratorActivity.this, R.string.wave_pin_disable_comment, Toast.LENGTH_SHORT).show();
- } else {
- pwmModeLayout.setVisibility(View.GONE);
- pwmModeControls.setVisibility(View.GONE);
- squareModeLayout.setVisibility(View.VISIBLE);
- squareModeControls.setVisibility(View.VISIBLE);
- imgBtnSin.setEnabled(true);
- imgBtnTri.setEnabled(true);
- toggleDigitalMode(WaveConst.SQUARE);
- }
+ public void onClick(View v) {
+ pwmModeLayout.setVisibility(View.GONE);
+ pwmModeControls.setVisibility(View.GONE);
+ squareModeLayout.setVisibility(View.VISIBLE);
+ squareModeControls.setVisibility(View.VISIBLE);
+ imgBtnSin.setEnabled(true);
+ imgBtnTri.setEnabled(true);
+ toggleDigitalMode(WaveConst.SQUARE);
+ btnDigitalMode.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded_light));
+ btnAnalogMode.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded));
+ }
+ });
+
+ btnDigitalMode.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ pwmModeLayout.setVisibility(View.VISIBLE);
+ pwmModeControls.setVisibility(View.VISIBLE);
+ squareModeLayout.setVisibility(View.GONE);
+ squareModeControls.setVisibility(View.GONE);
+ toggleDigitalMode(WaveConst.PWM);
+ imgBtnSin.setEnabled(false);
+ imgBtnTri.setEnabled(false);
+ pwmBtnActive = WaveConst.SQR1;
+ selectBtn(WaveConst.SQR1);
+ btnDigitalMode.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded));
+ btnAnalogMode.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded_light));
}
});
@@ -386,6 +371,9 @@ public void onClick(View view) {
activePropTv = pwmFreqValue;
pwmMonPropSelect.setText(getString(R.string.frequecy_colon));
setSeekBar(seekBar);
+ pwmBtnFreq.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded));
+ pwmBtnPhase.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded_light));
+ pwmBtnDuty.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded_light));
}
});
@@ -398,6 +386,9 @@ public void onClick(View view) {
activePropTv = pwmPhaseValue;
pwmMonPropSelect.setText(getString(R.string.pwm_phase));
setSeekBar(seekBar);
+ pwmBtnFreq.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded_light));
+ pwmBtnPhase.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded));
+ pwmBtnDuty.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded_light));
}
});
@@ -410,6 +401,9 @@ public void onClick(View view) {
activePropTv = pwmDutyValue;
pwmMonPropSelect.setText(getString(R.string.duty_cycle));
setSeekBar(seekBar);
+ pwmBtnFreq.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded_light));
+ pwmBtnPhase.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded_light));
+ pwmBtnDuty.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded));
}
});
@@ -417,53 +411,10 @@ public void onClick(View view) {
monitorLongClicks(imgBtnUp, imgBtnDown);
- btnView.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- double freq1 = (double) (WaveGeneratorCommon.wave.get(WaveConst.WAVE1).get(WaveConst.FREQUENCY));
- double freq2 = (double) WaveGeneratorCommon.wave.get(WaveConst.WAVE2).get(WaveConst.FREQUENCY);
- double phase = (double) WaveGeneratorCommon.wave.get(WaveConst.WAVE2).get(WaveConst.PHASE);
-
- String waveType1 = WaveGeneratorCommon.wave.get(WaveConst.WAVE1).get(WaveConst.WAVETYPE) == SIN ? "sine" : "tria";
- String waveType2 = WaveGeneratorCommon.wave.get(WaveConst.WAVE2).get(WaveConst.WAVETYPE) == SIN ? "sine" : "tria";
-
- if (scienceLab.isConnected()) {
- if (digital_mode == WaveConst.SQUARE) {
- if (phase == WaveData.PHASE_MIN.getValue()) {
- scienceLab.setW1(freq1, waveType1);
- scienceLab.setW2(freq2, waveType2);
- } else {
- scienceLab.setWaves(freq1, phase, freq2);
- }
- } else {
- double freqSqr1 = (double) WaveGeneratorCommon.wave.get(WaveConst.SQR1).get(WaveConst.FREQUENCY);
- double dutySqr1 = (double) WaveGeneratorCommon.wave.get(WaveConst.SQR1).get(WaveConst.DUTY) / 100;
- double dutySqr2 = ((double) WaveGeneratorCommon.wave.get(WaveConst.SQR2).get(WaveConst.DUTY)) / 100;
- double phaseSqr2 = (double) WaveGeneratorCommon.wave.get(WaveConst.SQR2).get(WaveConst.PHASE) / 360;
- double dutySqr3 = ((double) WaveGeneratorCommon.wave.get(WaveConst.SQR3).get(WaveConst.DUTY)) / 100;
- double phaseSqr3 = (double) WaveGeneratorCommon.wave.get(WaveConst.SQR3).get(WaveConst.PHASE) / 360;
- double dutySqr4 = ((double) WaveGeneratorCommon.wave.get(WaveConst.SQR4).get(WaveConst.DUTY)) / 100;
- double phaseSqr4 = (double) WaveGeneratorCommon.wave.get(WaveConst.SQR4).get(WaveConst.PHASE) / 360;
-
- scienceLab.sqrPWM(freqSqr1, dutySqr1, phaseSqr2, dutySqr2, phaseSqr3, dutySqr3, phaseSqr4, dutySqr4, false);
- }
-
- waveDialog.show();
- Window window = waveDialog.getWindow();
- window.setLayout(dpToPx(350), dpToPx(300));
- waveDialog.getButton(DialogInterface.BUTTON_NEGATIVE)
- .setTextColor(ContextCompat.getColor(WaveGeneratorActivity.this, R.color.colorPrimary));
-
- } else {
- Toast.makeText(WaveGeneratorActivity.this, R.string.device_not_connected, Toast.LENGTH_SHORT).show();
- }
- }
- });
-
seekBar.setOnSeekChangeListener(new IndicatorSeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(IndicatorSeekBar seekBar, int progress, float progressFloat, boolean fromUserTouch) {
- String valueText = DataFormatter.formatDouble((float) progress, DataFormatter.MEDIUM_PRECISION_FORMAT) + " " + unit;
+ String valueText = progress + " " + unit;
if (waveMonSelected) {
waveMonPropValueSelect.setText(valueText);
} else {
@@ -488,44 +439,15 @@ public void onStopTrackingTouch(IndicatorSeekBar seekBar) {
}
});
- ImageView guideImageView = findViewById(R.id.wave_generator_guide_button);
- guideImageView.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- bottomSheetBehavior.setState(bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_HIDDEN ?
- BottomSheetBehavior.STATE_EXPANDED : BottomSheetBehavior.STATE_HIDDEN);
- }
- });
- guideImageView.setOnLongClickListener(new View.OnLongClickListener() {
- @Override
- public boolean onLongClick(View v) {
- showText.setVisibility(View.VISIBLE);
- btnLongpressed = true;
- return true;
- }
- });
- guideImageView.setOnTouchListener(new View.OnTouchListener() {
- @Override
- public boolean onTouch(View v, MotionEvent event) {
- v.onTouchEvent(event);
- if (event.getAction() == MotionEvent.ACTION_UP) {
- if (btnLongpressed) {
- showText.setVisibility(View.GONE);
- btnLongpressed = false;
- }
- }
- return true;
- }
- });
-
if (getIntent().getExtras() != null && getIntent().getExtras().getBoolean(KEY_LOG)) {
recordedWaveData = LocalDataLog.with()
.getBlockOfWaveRecords(getIntent().getExtras().getLong(DATA_BLOCK));
setReceivedData();
}
+ chartInit();
}
- public void saveWaveConfig(View view) {
+ public void saveWaveConfig() {
long block = System.currentTimeMillis();
csvLogger.prepareLogFile();
csvLogger.writeMetaData(getResources().getString(R.string.wave_generator));
@@ -649,27 +571,87 @@ public void setReceivedData() {
}
}
+ private void setWave() {
+ double freq1 = (double) (WaveGeneratorCommon.wave.get(WaveConst.WAVE1).get(WaveConst.FREQUENCY));
+ double freq2 = (double) WaveGeneratorCommon.wave.get(WaveConst.WAVE2).get(WaveConst.FREQUENCY);
+ double phase = (double) WaveGeneratorCommon.wave.get(WaveConst.WAVE2).get(WaveConst.PHASE);
+
+ String waveType1 = WaveGeneratorCommon.wave.get(WaveConst.WAVE1).get(WaveConst.WAVETYPE) == SIN ? "sine" : "tria";
+ String waveType2 = WaveGeneratorCommon.wave.get(WaveConst.WAVE2).get(WaveConst.WAVETYPE) == SIN ? "sine" : "tria";
+
+ if (scienceLab.isConnected()) {
+ if (digital_mode == WaveConst.SQUARE) {
+ if (phase == WaveData.PHASE_MIN.getValue()) {
+ scienceLab.setW1(freq1, waveType1);
+ scienceLab.setW2(freq2, waveType2);
+ } else {
+ scienceLab.setWaves(freq1, phase, freq2);
+ }
+ } else {
+ double freqSqr1 = (double) WaveGeneratorCommon.wave.get(WaveConst.SQR1).get(WaveConst.FREQUENCY);
+ double dutySqr1 = (double) WaveGeneratorCommon.wave.get(WaveConst.SQR1).get(WaveConst.DUTY) / 100;
+ double dutySqr2 = ((double) WaveGeneratorCommon.wave.get(WaveConst.SQR2).get(WaveConst.DUTY)) / 100;
+ double phaseSqr2 = (double) WaveGeneratorCommon.wave.get(WaveConst.SQR2).get(WaveConst.PHASE) / 360;
+ double dutySqr3 = ((double) WaveGeneratorCommon.wave.get(WaveConst.SQR3).get(WaveConst.DUTY)) / 100;
+ double phaseSqr3 = (double) WaveGeneratorCommon.wave.get(WaveConst.SQR3).get(WaveConst.PHASE) / 360;
+ double dutySqr4 = ((double) WaveGeneratorCommon.wave.get(WaveConst.SQR4).get(WaveConst.DUTY)) / 100;
+ double phaseSqr4 = (double) WaveGeneratorCommon.wave.get(WaveConst.SQR4).get(WaveConst.PHASE) / 360;
+
+ scienceLab.sqrPWM(freqSqr1, dutySqr1, phaseSqr2, dutySqr2, phaseSqr3, dutySqr3, phaseSqr4, dutySqr4, false);
+ }
+
+ }
+ }
+
+ private void viewWaveDialog() {
+ waveDialog.show();
+ Window window = waveDialog.getWindow();
+ window.setLayout(dpToPx(350), dpToPx(300));
+ waveDialog.getButton(DialogInterface.BUTTON_NEGATIVE)
+ .setTextColor(ContextCompat.getColor(WaveGeneratorActivity.this, R.color.colorPrimary));
+ }
+
@Override
- protected void onResume() {
- super.onResume();
- removeStatusBar();
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.wave_generator_menu, menu);
+ return true;
}
- private void removeStatusBar() {
- if (Build.VERSION.SDK_INT < 16) {
- getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
- WindowManager.LayoutParams.FLAG_FULLSCREEN);
- } else {
- View decorView = getWindow().getDecorView();
-
- decorView.setSystemUiVisibility((View.SYSTEM_UI_FLAG_LAYOUT_STABLE
- | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
- | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
- | View.SYSTEM_UI_FLAG_FULLSCREEN
- | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
- | View.SYSTEM_UI_FLAG_FULLSCREEN
- | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY));
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case android.R.id.home:
+ finish();
+ break;
+ case R.id.save_data:
+ saveWaveConfig();
+ break;
+ case R.id.play_data:
+ setWave();
+ if (scienceLab.isConnected()) {
+ viewWaveDialog();
+ } else {
+ Toast.makeText(WaveGeneratorActivity.this, R.string.device_not_connected, Toast.LENGTH_SHORT).show();
+ }
+ break;
+ case R.id.show_guide:
+ bottomSheetBehavior.setState(bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_HIDDEN ?
+ BottomSheetBehavior.STATE_EXPANDED : BottomSheetBehavior.STATE_HIDDEN);
+ break;
+ case R.id.show_logged_data:
+ Intent intent = new Intent(WaveGeneratorActivity.this, DataLoggerActivity.class);
+ intent.putExtra(DataLoggerActivity.CALLER_ACTIVITY, getString(R.string.wave_generator));
+ startActivity(intent);
+ break;
+ default:
+ break;
}
+ return true;
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
}
public void selectBtn(WaveConst btn_selected) {
@@ -680,8 +662,8 @@ public void selectBtn(WaveConst btn_selected) {
waveBtnActive = WaveConst.WAVE1;
- waveMonWave1.setTextColor(getResources().getColor(R.color.orange));
- waveMonWave2.setTextColor(getResources().getColor(R.color.dark_grey));
+ btnCtrlWave1.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded));
+ btnCtrlWave2.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded_light));
btnCtrlPhase.setEnabled(false); //disable phase for wave
wavePhaseValue.setText("--");
@@ -696,8 +678,8 @@ public void selectBtn(WaveConst btn_selected) {
waveBtnActive = WaveConst.WAVE2;
- waveMonWave2.setTextColor(getResources().getColor(R.color.orange));
- waveMonWave1.setTextColor(getResources().getColor(R.color.dark_grey));
+ btnCtrlWave2.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded));
+ btnCtrlWave1.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded_light));
btnCtrlPhase.setEnabled(true); // enable phase for wave2
@@ -709,10 +691,11 @@ public void selectBtn(WaveConst btn_selected) {
break;
case SQR1:
- activePwmPinTv.setEnabled(false);
pwmBtnActive = WaveConst.SQR1;
- activePwmPinTv = pwmMonSqr1;
- activePwmPinTv.setEnabled(true);
+ btnPwmSq1.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded));
+ btnPwmSq2.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded_light));
+ btnPwmSq3.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded_light));
+ btnPwmSq4.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded_light));
pwmBtnPhase.setEnabled(false); //phase disabled for sq1
pwmPhaseValue.setText("--");
fetchPropertyValue(pwmBtnActive, WaveConst.FREQUENCY, getString(R.string.unit_hz), pwmFreqValue);
@@ -721,10 +704,11 @@ public void selectBtn(WaveConst btn_selected) {
case SQR2:
- activePwmPinTv.setEnabled(false);
pwmBtnActive = WaveConst.SQR2;
- activePwmPinTv = pwmMonSqr2;
- activePwmPinTv.setEnabled(true);
+ btnPwmSq1.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded_light));
+ btnPwmSq2.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded));
+ btnPwmSq3.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded_light));
+ btnPwmSq4.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded_light));
pwmBtnPhase.setEnabled(true);
fetchPropertyValue(pwmBtnActive, WaveConst.PHASE, getString(R.string.deg_text), pwmPhaseValue);
fetchPropertyValue(pwmBtnActive, WaveConst.DUTY, getString(R.string.unit_percent), pwmDutyValue);
@@ -732,10 +716,11 @@ public void selectBtn(WaveConst btn_selected) {
case SQR3:
- activePwmPinTv.setEnabled(false);
pwmBtnActive = WaveConst.SQR3;
- activePwmPinTv = pwmMonSqr3;
- activePwmPinTv.setEnabled(true);
+ btnPwmSq1.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded_light));
+ btnPwmSq2.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded_light));
+ btnPwmSq3.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded));
+ btnPwmSq4.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded_light));
pwmBtnPhase.setEnabled(true);
fetchPropertyValue(pwmBtnActive, WaveConst.PHASE, getString(R.string.deg_text), pwmPhaseValue);
fetchPropertyValue(pwmBtnActive, WaveConst.DUTY, getString(R.string.unit_percent), pwmDutyValue);
@@ -743,10 +728,11 @@ public void selectBtn(WaveConst btn_selected) {
case SQR4:
- activePwmPinTv.setEnabled(false);
pwmBtnActive = WaveConst.SQR4;
- activePwmPinTv = pwmMonSqr4;
- activePwmPinTv.setEnabled(true);
+ btnPwmSq1.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded_light));
+ btnPwmSq2.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded_light));
+ btnPwmSq3.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded_light));
+ btnPwmSq4.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded));
pwmBtnPhase.setEnabled(true);
fetchPropertyValue(pwmBtnActive, WaveConst.PHASE, getString(R.string.deg_text), pwmPhaseValue);
fetchPropertyValue(pwmBtnActive, WaveConst.DUTY, getString(R.string.unit_percent), pwmDutyValue);
@@ -754,8 +740,8 @@ public void selectBtn(WaveConst btn_selected) {
default:
waveBtnActive = WaveConst.WAVE1;
- waveMonWave1.setTextColor(getResources().getColor(R.color.orange));
- waveMonWave2.setTextColor(getResources().getColor(R.color.dark_grey));
+ btnCtrlWave1.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded));
+ btnCtrlWave2.setBackground(getResources().getDrawable(R.drawable.btn_back_rounded_light));
btnCtrlPhase.setEnabled(false); //disable phase for wave
wavePhaseValue.setText("--");
selectWaveform(WaveGeneratorCommon.wave.get(waveBtnActive).get(WaveConst.WAVETYPE));
@@ -813,16 +799,12 @@ private void toggleDigitalMode(WaveConst mode) {
btnPwmSq3.setEnabled(true);
btnPwmSq4.setEnabled(true);
}
- pwmMonSqr1.setSelected(false);
- pwmMonSqr2.setSelected(false);
- pwmMonSqr3.setSelected(false);
- pwmMonSqr4.setSelected(false);
WaveGeneratorCommon.mode_selected = mode;
}
private void fetchPropertyValue(WaveConst btnActive, WaveConst property, String unit, TextView propTextView) {
Double value = (double) WaveGeneratorCommon.wave.get(btnActive).get(property);
- String valueText = value + " " + unit;
+ String valueText = value.intValue() + " " + unit;
propTextView.setText(valueText);
}
@@ -914,11 +896,29 @@ private void setValue() {
} else {
WaveGeneratorCommon.wave.get(waveBtnActive).put(prop_active, value);
}
-
+ setWave();
Double dValue = (double) value;
- String valueText = DataFormatter.formatDouble(dValue, DataFormatter.MEDIUM_PRECISION_FORMAT) + " " + unit;
+ String valueText = String.valueOf(dValue.intValue()) + " " + unit;
activePropTv.setText(valueText);
+ }
+ private void chartInit() {
+ previewChart.setTouchEnabled(true);
+ previewChart.setHighlightPerDragEnabled(true);
+ previewChart.setDragEnabled(true);
+ previewChart.setScaleEnabled(true);
+ previewChart.setDrawGridBackground(false);
+ previewChart.setPinchZoom(true);
+ previewChart.setScaleYEnabled(false);
+ previewChart.setBackgroundColor(Color.BLACK);
+ previewChart.getDescription().setEnabled(false);
+ previewChart.getXAxis().setAxisMaximum(1000);
+ previewChart.getXAxis().setAxisMinimum(0);
+ previewChart.getXAxis().setTextColor(Color.WHITE);
+ previewChart.getAxisLeft().setAxisMaximum(5);
+ previewChart.getAxisLeft().setAxisMinimum(-5);
+ previewChart.fitScreen();
+ previewChart.invalidate();
}
private void toggleSeekBtns(boolean state) {
@@ -935,13 +935,11 @@ private void toggleSeekBtns(boolean state) {
private void enableInitialState() {
selectBtn(WaveConst.WAVE1);
- activePwmPinTv = pwmMonSqr1;
toggleDigitalMode(WaveConst.SQUARE);
}
private void enableInitialStatePWM() {
selectBtn(WaveConst.SQR2);
- activePwmPinTv = pwmMonSqr2;
toggleDigitalMode(WaveConst.PWM);
}
diff --git a/app/src/main/java/io/pslab/communication/HttpAsyncTask.java b/app/src/main/java/io/pslab/communication/HttpAsyncTask.java
new file mode 100644
index 000000000..4aae41545
--- /dev/null
+++ b/app/src/main/java/io/pslab/communication/HttpAsyncTask.java
@@ -0,0 +1,43 @@
+package io.pslab.communication;
+
+import android.os.AsyncTask;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.IOException;
+
+import io.pslab.interfaces.HttpCallback;
+
+public class HttpAsyncTask extends AsyncTask {
+
+ private HttpHandler mHttpHandler;
+ private HttpCallback mHttpCallback;
+
+ public HttpAsyncTask(String baseIP, HttpCallback httpCallback) {
+ mHttpHandler = new HttpHandler(baseIP);
+ mHttpCallback = httpCallback;
+ }
+
+ @Override
+ protected Void doInBackground(byte[]... data) {
+ int res = 0;
+ try {
+ if (data.length != 0) {
+ res = mHttpHandler.write(data[0]);
+
+ } else {
+ res = mHttpHandler.read();
+ }
+ } catch (IOException | JSONException e) {
+ mHttpCallback.error(e);
+ e.printStackTrace();
+ }
+ if (res == 1) {
+ mHttpCallback.success(mHttpHandler.getReceivedData());
+ } else {
+ mHttpCallback.error(new Exception());
+ }
+ return null;
+ }
+}
diff --git a/app/src/main/java/io/pslab/communication/HttpHandler.java b/app/src/main/java/io/pslab/communication/HttpHandler.java
new file mode 100644
index 000000000..a2f7bed38
--- /dev/null
+++ b/app/src/main/java/io/pslab/communication/HttpHandler.java
@@ -0,0 +1,87 @@
+package io.pslab.communication;
+
+import android.util.Log;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.IOException;
+import java.net.URL;
+
+import okhttp3.MediaType;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.RequestBody;
+import okhttp3.Response;
+
+public class HttpHandler {
+
+ private final String TAG = this.getClass().getSimpleName();
+ private String baseIP;
+ private String sendDataEndPoint = "send";
+ private String getDataEndPoint = "get";
+ private String dataKeyString = "data";
+ private OkHttpClient client;
+ private JSONObject receivedData;
+
+ public HttpHandler(String baseIP) {
+ this.baseIP = baseIP;
+ this.client = new OkHttpClient();
+ }
+
+ /**
+ * Method to send data to ESP
+ *
+ * @param data data to be sent in byte array
+ * @return 1 if response code is "200" 0 otherwise;
+ */
+ public int write(byte[] data) throws IOException, JSONException {
+ int result = 1;
+ URL baseURL = new URL("http://" + baseIP + "/" + sendDataEndPoint);
+ int written = 0;
+ JSONArray responseArray = new JSONArray();
+ while (written < data.length) {
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.put(dataKeyString, data[written]);
+ RequestBody body = RequestBody.create(jsonObject.toString(), MediaType.get("application/json; charset=utf-8"));
+ Request request = new Request.Builder()
+ .url(baseURL)
+ .post(body)
+ .build();
+ Response response = client.newCall(request).execute();
+ responseArray.put(new JSONObject(response.body().string()));
+ if (response.code() != 200) {
+ Log.e(TAG, "Error writing byte:" + written);
+ return 0;
+ }
+ written++;
+ }
+ receivedData = new JSONObject(responseArray.toString());
+ return result;
+ }
+
+ /**
+ * Method to get data from ESP
+ * @return 1 if data was received 0 otherwise
+ */
+ public int read() throws IOException, JSONException {
+ int result = 1;
+ URL baseURL = new URL("http://" + baseIP + "/" + getDataEndPoint);
+ Request request = new Request.Builder()
+ .url(baseURL)
+ .build();
+ Response response = client.newCall(request).execute();
+ if (response.code() != 200) {
+ Log.e(TAG, "Error reading data");
+ return 0;
+ } else {
+ receivedData = new JSONObject(response.body().string());
+ }
+ return result;
+ }
+
+ public JSONObject getReceivedData() {
+ return receivedData;
+ }
+}
diff --git a/app/src/main/java/io/pslab/communication/PacketHandler.java b/app/src/main/java/io/pslab/communication/PacketHandler.java
index 2cfa87b1c..49522aed9 100644
--- a/app/src/main/java/io/pslab/communication/PacketHandler.java
+++ b/app/src/main/java/io/pslab/communication/PacketHandler.java
@@ -2,12 +2,18 @@
import android.util.Log;
+import org.json.JSONException;
+import org.json.JSONObject;
+
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.charset.Charset;
import java.util.Arrays;
+import io.pslab.interfaces.HttpCallback;
+import io.pslab.others.ScienceLabCommon;
+
/**
* Created by viveksb007 on 28/3/17.
*/
@@ -24,6 +30,7 @@ public class PacketHandler {
private CommandsProto mCommandsProto;
private int timeout = 500, VERSION_STRING_LENGTH = 15;
ByteBuffer burstBuffer = ByteBuffer.allocate(2000);
+ private HttpAsyncTask httpAsyncTask;
public PacketHandler(int timeout, CommunicationHandler communicationHandler) {
this.loadBurst = false;
@@ -31,11 +38,11 @@ public PacketHandler(int timeout, CommunicationHandler communicationHandler) {
this.timeout = timeout;
this.mCommandsProto = new CommandsProto();
this.mCommunicationHandler = communicationHandler;
- connected = mCommunicationHandler.isConnected();
+ connected = (mCommunicationHandler.isConnected() || ScienceLabCommon.isWifiConnected());
}
public boolean isConnected() {
- connected = mCommunicationHandler.isConnected();
+ connected = (mCommunicationHandler.isConnected() || ScienceLabCommon.isWifiConnected());
return connected;
}
@@ -44,7 +51,7 @@ public String getVersion() {
sendByte(mCommandsProto.COMMON);
sendByte(mCommandsProto.GET_VERSION);
// Read "\n"
- mCommunicationHandler.read(buffer, VERSION_STRING_LENGTH + 1, timeout);
+ commonRead(VERSION_STRING_LENGTH + 1);
version = new String(Arrays.copyOfRange(buffer, 0, VERSION_STRING_LENGTH), Charset.forName("UTF-8"));
} catch (IOException e) {
Log.e("Error in Communication", e.toString());
@@ -58,7 +65,7 @@ public void sendByte(int val) throws IOException {
}
if (!loadBurst) {
try {
- mCommunicationHandler.write(new byte[]{(byte) (val & 0xff)}, timeout);
+ commonWrite(new byte[]{(byte) (val & 0xff)});
} catch (IOException | NullPointerException e) {
Log.e("Error in sending byte", e.toString());
e.printStackTrace();
@@ -74,7 +81,7 @@ public void sendInt(int val) throws IOException {
}
if (!loadBurst) {
try {
- mCommunicationHandler.write(new byte[]{(byte) (val & 0xff), (byte) ((val >> 8) & 0xff)}, timeout);
+ commonWrite(new byte[]{(byte) (val & 0xff), (byte) ((val >> 8) & 0xff)});
} catch (IOException e) {
Log.e("Error in sending int", e.toString());
e.printStackTrace();
@@ -97,7 +104,7 @@ public int getAcknowledgement() {
return 1;
} else {
try {
- mCommunicationHandler.read(buffer, 1, timeout);
+ commonRead(1);
return buffer[0];
} catch (IOException | NullPointerException e) {
e.printStackTrace();
@@ -108,7 +115,7 @@ public int getAcknowledgement() {
public byte getByte() {
try {
- int numByteRead = mCommunicationHandler.read(buffer, 1, timeout);
+ int numByteRead = commonRead(1);
if (numByteRead == 1) {
return buffer[0];
} else {
@@ -123,7 +130,7 @@ public byte getByte() {
int getVoltageSummation() {
try {
// Note : bytesToBeRead has to be +1 than the requirement
- int numByteRead = mCommunicationHandler.read(buffer, 3, timeout);
+ int numByteRead = commonRead(3);
if (numByteRead == 3) {
return (buffer[0] & 0xff) | ((buffer[1] << 8) & 0xff00);
} else {
@@ -137,7 +144,7 @@ int getVoltageSummation() {
public int getInt() {
try {
- int numByteRead = mCommunicationHandler.read(buffer, 2, timeout);
+ int numByteRead = commonRead(2);
if (numByteRead == 2) {
// LSB is read first
return (buffer[0] & 0xff) | ((buffer[1] << 8) & 0xff00);
@@ -152,7 +159,7 @@ public int getInt() {
public long getLong() {
try {
- int numByteRead = mCommunicationHandler.read(buffer, 4, timeout);
+ int numByteRead = commonRead(4);
if (numByteRead == 4) {
// C++ has long of 4-bytes but in Java int has 4-bytes
// refer "https://stackoverflow.com/questions/7619058/convert-a-byte-array-to-integer-in-java-and-vice-versa" for Endian
@@ -171,7 +178,7 @@ public boolean waitForData() {
}
public int read(byte[] dest, int bytesToRead) throws IOException {
- int numBytesRead = mCommunicationHandler.read(buffer, bytesToRead, timeout);
+ int numBytesRead = commonRead(bytesToRead);
for (int i = 0; i < bytesToRead; i++) {
dest[i] = buffer[i];
}
@@ -185,10 +192,10 @@ public int read(byte[] dest, int bytesToRead) throws IOException {
public byte[] sendBurst() {
try {
- mCommunicationHandler.write(burstBuffer.array(), timeout);
+ commonWrite(burstBuffer.array());
burstBuffer.clear();
loadBurst = false;
- int bytesRead = mCommunicationHandler.read(buffer, inputQueueSize, timeout);
+ int bytesRead = commonRead(inputQueueSize);
inputQueueSize = 0;
return Arrays.copyOfRange(buffer, 0, bytesRead);
} catch (IOException e) {
@@ -197,4 +204,51 @@ public byte[] sendBurst() {
return new byte[]{-1};
}
+ private int commonRead(int bytesToRead) throws IOException {
+ final int[] bytesRead = {0};
+ if (mCommunicationHandler.isConnected()) {
+ bytesRead[0] = mCommunicationHandler.read(buffer, bytesToRead, timeout);
+ } else if (ScienceLabCommon.isWifiConnected()) {
+ httpAsyncTask = new HttpAsyncTask(ScienceLabCommon.getEspIP(), new HttpCallback() {
+ @Override
+ public void success(JSONObject jsonObject) {
+ try {
+ //Server will send byte array
+ buffer = (byte[])jsonObject.get("data");
+ bytesRead[0] = buffer.length;
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void error(Exception e) {
+ Log.e(TAG, "Error reading data over ESP");
+ }
+ });
+ httpAsyncTask.execute(new byte[]{});
+ }
+ return bytesRead[0];
+ }
+
+ private void commonWrite(byte[] data) throws IOException {
+ if (mCommunicationHandler.isConnected()) {
+ mCommunicationHandler.write(data, timeout);
+ } else if (ScienceLabCommon.isWifiConnected()) {
+ httpAsyncTask = new HttpAsyncTask(ScienceLabCommon.getEspIP(), new HttpCallback() {
+ @Override
+ public void success(JSONObject jsonObject) {
+ Log.v(TAG, "write response:" + jsonObject.toString());
+ }
+
+ @Override
+ public void error(Exception e) {
+ Log.e(TAG, "Error writing data over ESP");
+ }
+ });
+
+ httpAsyncTask.execute(data);
+ }
+
+ }
}
diff --git a/app/src/main/java/io/pslab/fragment/AboutUsFragment.java b/app/src/main/java/io/pslab/fragment/AboutUsFragment.java
index 2c4b661f7..9cf812625 100644
--- a/app/src/main/java/io/pslab/fragment/AboutUsFragment.java
+++ b/app/src/main/java/io/pslab/fragment/AboutUsFragment.java
@@ -16,6 +16,7 @@
import butterknife.BindView;
import butterknife.ButterKnife;
import mehdi.sakout.aboutpage.AboutPage;
+import mehdi.sakout.aboutpage.Element;
/**
* Created by Abhinav on 12-05-2018.
@@ -43,6 +44,9 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
View aboutPage = new AboutPage(getActivity())
.isRTL(false)
.setImage(R.drawable.logo200x200)
+ .addWebsite("https://goo.gl/forms/sHlmRAPFmzcGQ27u2", getString(R.string.nav_report))
+ .addItem(new Element(getString(R.string.version), R.drawable.ic_widgets_black_24dp))
+ .addItem(new Element(getString(R.string.flavor), R.drawable.ic_android_black_24dp))
.setDescription(getString(R.string.about_us_description))
.addGroup("Connect with us")
.addEmail("pslab-fossasia@googlegroups.com")
diff --git a/app/src/main/java/io/pslab/fragment/BluetoothScanFragment.java b/app/src/main/java/io/pslab/fragment/BluetoothScanFragment.java
index aedb71c8a..0af19d397 100644
--- a/app/src/main/java/io/pslab/fragment/BluetoothScanFragment.java
+++ b/app/src/main/java/io/pslab/fragment/BluetoothScanFragment.java
@@ -42,10 +42,12 @@ public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (BluetoothDevice.ACTION_FOUND.equals(action)) {
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
- String deviceName = device.getName();
- deviceList.add(deviceName);
- bluetoothDevices.add(device);
- deviceListAdapter.notifyDataSetChanged();
+ if (device != null) {
+ String deviceName = device.getName();
+ deviceList.add(deviceName);
+ bluetoothDevices.add(device);
+ deviceListAdapter.notifyDataSetChanged();
+ }
}
}
};
diff --git a/app/src/main/java/io/pslab/fragment/ChannelParametersFragment.java b/app/src/main/java/io/pslab/fragment/ChannelParametersFragment.java
index 4d629c99f..41f4a9420 100644
--- a/app/src/main/java/io/pslab/fragment/ChannelParametersFragment.java
+++ b/app/src/main/java/io/pslab/fragment/ChannelParametersFragment.java
@@ -21,7 +21,6 @@
import io.pslab.DataFormatter;
import io.pslab.R;
import io.pslab.activity.OscilloscopeActivity;
-import io.pslab.others.NothingSelectedSpinnerAdapter;
public class ChannelParametersFragment extends Fragment {
@@ -30,13 +29,11 @@ public class ChannelParametersFragment extends Fragment {
private CheckBox checkBoxCH1;
private CheckBox checkBoxCH2;
private CheckBox checkBoxCH3;
- private CheckBox checkBoxMIC;
private Spinner spinnerRangeCh1;
private Spinner spinnerRangeCh2;
private Spinner spinnerChannelSelect;
- private Spinner spinnerMICSelect;
- private int micSelectedPosition;
-
+ private CheckBox builtInMicCheckBox;
+ private CheckBox pslabMicCheckBox;
public static ChannelParametersFragment newInstance() {
return new ChannelParametersFragment();
@@ -56,15 +53,15 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
spinnerRangeCh1 = v.findViewById(R.id.spinner_range_ch1_cp);
spinnerRangeCh2 = v.findViewById(R.id.spinner_range_ch2_cp);
spinnerChannelSelect = v.findViewById(R.id.spinner_channel_select_cp);
- spinnerMICSelect = v.findViewById(R.id.spinner_mic_select_cp);
boolean tabletSize = getResources().getBoolean(R.bool.isTablet);
checkBoxCH1 = v.findViewById(R.id.checkBox_ch1_cp);
checkBoxCH2 = v.findViewById(R.id.checkBox_ch2_cp);
checkBoxCH3 = v.findViewById(R.id.checkBox_ch3_cp);
checkBoxCH3.setText(getString(R.string.ch3_value, 3.3));
- checkBoxMIC = v.findViewById(R.id.checkBox_mic_cp);
+ builtInMicCheckBox = v.findViewById(R.id.built_in_mic_cb);
+ pslabMicCheckBox = v.findViewById(R.id.pslab_mic_cb);
ArrayAdapter rangesAdapter;
ArrayAdapter channelsAdapter;
ArrayAdapter micsAdapter;
@@ -88,9 +85,6 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
spinnerRangeCh2.setSelection(rangesAdapter.getPosition("+/-16V"), true);
spinnerChannelSelect.setAdapter(channelsAdapter);
spinnerChannelSelect.setSelection(channelsAdapter.getPosition("CH1"), true);
- spinnerMICSelect.setAdapter(new NothingSelectedSpinnerAdapter(micsAdapter,
- R.layout.nothing_selected_spinner_row,
- getActivity()));
spinnerRangeCh1.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
@@ -220,31 +214,6 @@ public void onNothingSelected(AdapterView> parent) {
}
});
- spinnerMICSelect.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
- @Override
- public void onItemSelected(AdapterView> parent, View view, int position, long id) {
- micSelectedPosition = position;
- if (position == 1) {
- ((OscilloscopeActivity) getActivity()).isInBuiltMicSelected = false;
- if (checkBoxMIC.isChecked()) {
- ((OscilloscopeActivity) getActivity()).isMICSelected = true;
- ((OscilloscopeActivity) getActivity()).isAudioInputSelected = true;
- }
- } else {
- ((OscilloscopeActivity) getActivity()).isMICSelected = false;
- if (checkBoxMIC.isChecked()) {
- ((OscilloscopeActivity) getActivity()).isInBuiltMicSelected = true;
- ((OscilloscopeActivity) getActivity()).isAudioInputSelected = true;
- }
- }
- }
-
- @Override
- public void onNothingSelected(AdapterView> parent) {
-
- }
- });
-
checkBoxCH1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
@@ -265,29 +234,37 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
((OscilloscopeActivity) getActivity()).isCH3Selected = isChecked;
}
});
- checkBoxMIC.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ builtInMicCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
- if (micSelectedPosition == 1) {
- ((OscilloscopeActivity) getActivity()).isAudioInputSelected = isChecked;
- ((OscilloscopeActivity) getActivity()).isMICSelected = isChecked;
- } else if (micSelectedPosition == 2) {
- ((OscilloscopeActivity) getActivity()).isAudioInputSelected = isChecked;
- // check for RECORD_AUDIO permission if has then change boolean
- if (isChecked)
- if (ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) {
- requestPermissions(new String[]{Manifest.permission.RECORD_AUDIO}, RECORD_AUDIO_REQUEST_CODE);
- } else {
- ((OscilloscopeActivity) getActivity()).isInBuiltMicSelected = true;
- }
- else
- ((OscilloscopeActivity) getActivity()).isInBuiltMicSelected = false;
- } else {
- ((OscilloscopeActivity) getActivity()).isAudioInputSelected = false;
+ ((OscilloscopeActivity) getActivity()).isInBuiltMicSelected = isChecked;
+ ((OscilloscopeActivity) getActivity()).isAudioInputSelected = isChecked;
+ ((OscilloscopeActivity) getActivity()).isMICSelected = !isChecked;
+ if (isChecked) {
+ pslabMicCheckBox.setChecked(false);
+ if (ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) {
+ requestPermissions(new String[]{Manifest.permission.RECORD_AUDIO}, RECORD_AUDIO_REQUEST_CODE);
+ ((OscilloscopeActivity) getActivity()).isAudioInputSelected = false;
+ }
}
}
});
+ pslabMicCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ ((OscilloscopeActivity) getActivity()).isMICSelected = isChecked;
+ ((OscilloscopeActivity) getActivity()).isAudioInputSelected = isChecked;
+ ((OscilloscopeActivity) getActivity()).isInBuiltMicSelected = !isChecked;
+ if (isChecked) {
+ builtInMicCheckBox.setChecked(false);
+ if (ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) {
+ requestPermissions(new String[]{Manifest.permission.RECORD_AUDIO}, RECORD_AUDIO_REQUEST_CODE);
+ ((OscilloscopeActivity) getActivity()).isAudioInputSelected = false;
+ }
+ }
+ }
+ });
return v;
}
@@ -298,8 +275,8 @@ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permis
((OscilloscopeActivity) getActivity()).isInBuiltMicSelected = true;
} else {
Toast.makeText(getActivity(), "This feature won't work.", Toast.LENGTH_SHORT).show();
- if (checkBoxMIC.isChecked())
- checkBoxMIC.toggle();
+ if (builtInMicCheckBox.isChecked())
+ builtInMicCheckBox.toggle();
}
}
}
diff --git a/app/src/main/java/io/pslab/fragment/ESPFragment.java b/app/src/main/java/io/pslab/fragment/ESPFragment.java
index 00ac88e71..255a22b7a 100644
--- a/app/src/main/java/io/pslab/fragment/ESPFragment.java
+++ b/app/src/main/java/io/pslab/fragment/ESPFragment.java
@@ -17,6 +17,7 @@
import java.io.IOException;
import io.pslab.R;
+import io.pslab.others.ScienceLabCommon;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
@@ -78,6 +79,10 @@ protected String doInBackground(Void... voids) {
.url("http://" + espIPAddress)
.build();
Response response = client.newCall(request).execute();
+ if (response.code() == 200) {
+ ScienceLabCommon.setIsWifiConnected(true);
+ ScienceLabCommon.setEspBaseIP(espIPAddress);
+ }
result = response.body().string();
} catch (IOException e) {
e.printStackTrace();
diff --git a/app/src/main/java/io/pslab/fragment/FAQFragment.java b/app/src/main/java/io/pslab/fragment/FAQFragment.java
index 176b26616..61b617b1a 100644
--- a/app/src/main/java/io/pslab/fragment/FAQFragment.java
+++ b/app/src/main/java/io/pslab/fragment/FAQFragment.java
@@ -2,6 +2,8 @@
import android.os.Bundle;
import android.support.v4.app.Fragment;
+import android.text.Html;
+import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -23,15 +25,13 @@ public static FAQFragment newInstance() {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- questions = new String[]{getString(R.string.faq_question1), getString(R.string.faq_question2), getString(R.string.faq_question3), getString(R.string.faq_question4), getString(R.string.faq_question5)};
+ questions = getResources().getStringArray(R.array.faq_questions);
- answers = new String[][]{
- {getString(R.string.faq_answer1)},
- {getString(R.string.faq_answer2)},
- {getString(R.string.faq_answer3)},
- {getString(R.string.faq_answer4)},
- {getString(R.string.faq_answer5)}
- };
+ String[] ans = getResources().getStringArray(R.array.faq_answers);
+ answers = new String[ans.length][];
+ for (int i = 0; i < ans.length; i++) {
+ answers[i] = new String[]{ans[i]};
+ }
}
@Override
@@ -114,7 +114,9 @@ public View getChildView(int questionPosition, final int childPosition, boolean
holder = (ViewHolder) v.getTag();
}
- holder.text.setText(getChild(questionPosition, childPosition).toString());
+ holder.text.setClickable(true);
+ holder.text.setMovementMethod(LinkMovementMethod.getInstance());
+ holder.text.setText(Html.fromHtml(getChild(questionPosition, childPosition).toString(), Html.FROM_HTML_MODE_COMPACT));
return v;
}
diff --git a/app/src/main/java/io/pslab/fragment/HomeFragment.java b/app/src/main/java/io/pslab/fragment/HomeFragment.java
index 18a73cd53..150523361 100644
--- a/app/src/main/java/io/pslab/fragment/HomeFragment.java
+++ b/app/src/main/java/io/pslab/fragment/HomeFragment.java
@@ -12,20 +12,21 @@
import android.view.ViewGroup;
import android.webkit.WebView;
import android.webkit.WebViewClient;
+import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.ScrollView;
import android.widget.TextView;
-import io.pslab.R;
-import io.pslab.others.InitializationVariable;
-
import java.io.IOException;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
+import io.pslab.R;
+import io.pslab.others.InitializationVariable;
+import io.pslab.others.ScienceLabCommon;
import static io.pslab.others.ScienceLabCommon.scienceLab;
@@ -55,6 +56,12 @@ public class HomeFragment extends Fragment {
ProgressBar wvProgressBar;
@BindView(R.id.steps_header_text)
TextView stepsHeader;
+ @BindView(R.id.bluetooth_btn)
+ Button bluetoothButton;
+ @BindView(R.id.wifi_btn)
+ Button wifiButton;
+ @BindView(R.id.bluetooth_wifi_option_tv)
+ TextView bluetoothWifiOption;
private boolean deviceFound = false, deviceConnected = false;
private Unbinder unbinder;
@@ -138,7 +145,32 @@ public boolean onKey(View v, int keyCode, KeyEvent event) {
return false;
}
});
+ if (ScienceLabCommon.scienceLab.isConnected()) {
+ bluetoothButton.setVisibility(View.GONE);
+ wifiButton.setVisibility(View.GONE);
+ bluetoothWifiOption.setVisibility(View.GONE);
+ } else {
+ bluetoothButton.setVisibility(View.VISIBLE);
+ wifiButton.setVisibility(View.VISIBLE);
+ bluetoothWifiOption.setVisibility(View.VISIBLE);
+ }
+ bluetoothButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ BluetoothScanFragment bluetoothScanFragment = new BluetoothScanFragment();
+ bluetoothScanFragment.show(getActivity().getSupportFragmentManager(), "bluetooth");
+ bluetoothScanFragment.setCancelable(true);
+ }
+ });
+ wifiButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ ESPFragment espFragment = new ESPFragment();
+ espFragment.show(getActivity().getSupportFragmentManager(), "wifi");
+ espFragment.setCancelable(true);
+ }
+ });
return view;
}
diff --git a/app/src/main/java/io/pslab/fragment/LALogicLinesFragment.java b/app/src/main/java/io/pslab/fragment/LALogicLinesFragment.java
index a59656ac5..e337bb149 100644
--- a/app/src/main/java/io/pslab/fragment/LALogicLinesFragment.java
+++ b/app/src/main/java/io/pslab/fragment/LALogicLinesFragment.java
@@ -21,7 +21,6 @@
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
-import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.Spinner;
@@ -106,10 +105,7 @@ public class LALogicLinesFragment extends Fragment {
private ArrayList channelNames = new ArrayList<>();
private ArrayList edgesNames = new ArrayList<>();
private TextView tvTimeUnit, xCoordinateText;
- private ImageView ledImageView;
- private Runnable logicAnalysis;
private Realm realm;
- private ImageView recordButton;
private GPSLogger gpsLogger;
private CSVLogger csvLogger;
private ArrayList recordXAxis;
@@ -120,6 +116,7 @@ public class LALogicLinesFragment extends Fragment {
private String csvHeader = "Timestamp,DateTime,Channel,ChannelMode,xData,yData,lat,lon";
private ArrayList channelSelectSpinners;
private ArrayList edgeSelectSpinners;
+ private View rootView;
public static LALogicLinesFragment newInstance(Activity activity) {
LALogicLinesFragment laLogicLinesFragment = new LALogicLinesFragment();
@@ -140,112 +137,36 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
recordChannelMode = new ArrayList<>();
channelSelectSpinners = new ArrayList<>();
edgeSelectSpinners = new ArrayList<>();
- logicAnalysis = new Runnable() {
- @Override
- public void run() {
- while (true) {
- if (scienceLab.isConnected()) {
- if (!String.valueOf(ledImageView.getTag()).equals("green")) {
- getActivity().runOnUiThread(new Runnable() {
- @Override
- public void run() {
- ledImageView.setImageResource(R.drawable.green_led);
- ledImageView.setTag("green");
- }
- });
- }
- } else {
- if (!String.valueOf(ledImageView.getTag()).equals("red")) {
- getActivity().runOnUiThread(new Runnable() {
- @Override
- public void run() {
- ledImageView.setImageResource(R.drawable.red_led);
- ledImageView.setTag("red");
- }
- });
- }
- }
- }
- }
- };
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
- View v = inflater.inflate(R.layout.logic_analyzer_logic_lines, container, false);
- // LED Indicator
- ledImageView = v.findViewById(R.id.imageView_led_la);
+ rootView = inflater.inflate(R.layout.logic_analyzer_logic_lines, container, false);
// Heading
- tvTimeUnit = v.findViewById(R.id.la_tv_time_unit);
+ tvTimeUnit = rootView.findViewById(R.id.la_tv_time_unit);
tvTimeUnit.setText(getString(R.string.time_unit_la));
- //recordButton
-
- recordButton = v.findViewById(R.id.la_record_button);
- recordButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- long block = System.currentTimeMillis();
- double lat;
- double lon;
- if (gpsLogger.isGPSEnabled()) {
- Location location = gpsLogger.getDeviceLocation();
- if (location != null) {
- lat = location.getLatitude();
- lon = location.getLongitude();
- } else {
- lat = 0.0;
- lon = 0.0;
- }
- } else {
- lat = 0.0;
- lon = 0.0;
- }
- csvLogger.prepareLogFile();
- csvLogger.writeMetaData(getContext().getResources().getString(R.string.logical_analyzer));
- csvLogger.writeCSVFile(csvHeader);
- recordSensorDataBlockID(new SensorDataBlock(block, getResources().getString(R.string.logical_analyzer)));
- long timestamp = System.currentTimeMillis();
- String timeData = timestamp + "," + CSVLogger.FILE_NAME_FORMAT.format(new Date(timestamp));
- String locationData = lat + "," + lon;
- for (int i = 0; i < recordXAxis.size(); i++) {
- recordSensorData(new LogicAnalyzerData(timestamp + i, block, channels[i], recordChannelMode.get(i), recordXAxis.get(i), recordYAxis.get(i), lat, lon));
- String data = timeData + "," + channels[i] + "," + recordChannelMode.get(i) + "," + recordXAxis.get(i) + "," + recordYAxis.get(i) + "," + locationData;
- csvLogger.writeCSVFile(data);
- }
- CustomSnackBar.showSnackBar(v,
- getString(R.string.csv_store_text) + " " + csvLogger.getCurrentFilePath()
- , getString(R.string.open), new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- Intent intent = new Intent(getContext(), DataLoggerActivity.class);
- intent.putExtra(DataLoggerActivity.CALLER_ACTIVITY, getResources().getString(R.string.logical_analyzer));
- startActivity(intent);
- }
- }, Snackbar.LENGTH_SHORT);
- }
- });
// Carousel View
- carouselPicker = v.findViewById(R.id.carouselPicker);
- llChannel1 = v.findViewById(R.id.ll_chart_channel_1);
+ carouselPicker = rootView.findViewById(R.id.carouselPicker);
+ llChannel1 = rootView.findViewById(R.id.ll_chart_channel_1);
llChannel1.setVisibility(View.VISIBLE);
- llChannel2 = v.findViewById(R.id.ll_chart_channel_2);
+ llChannel2 = rootView.findViewById(R.id.ll_chart_channel_2);
llChannel2.setVisibility(View.GONE);
- llChannel3 = v.findViewById(R.id.ll_chart_channel_3);
+ llChannel3 = rootView.findViewById(R.id.ll_chart_channel_3);
llChannel3.setVisibility(View.GONE);
- llChannel4 = v.findViewById(R.id.ll_chart_channel_4);
+ llChannel4 = rootView.findViewById(R.id.ll_chart_channel_4);
llChannel4.setVisibility(View.GONE);
- channelSelectSpinner1 = v.findViewById(R.id.channel_select_spinner_1);
- channelSelectSpinner2 = v.findViewById(R.id.channel_select_spinner_2);
- channelSelectSpinner3 = v.findViewById(R.id.channel_select_spinner_3);
- channelSelectSpinner4 = v.findViewById(R.id.channel_select_spinner_4);
- edgeSelectSpinner1 = v.findViewById(R.id.edge_select_spinner_1);
- edgeSelectSpinner2 = v.findViewById(R.id.edge_select_spinner_2);
- edgeSelectSpinner3 = v.findViewById(R.id.edge_select_spinner_3);
- edgeSelectSpinner4 = v.findViewById(R.id.edge_select_spinner_4);
- analyze_button = v.findViewById(R.id.analyze_button);
+ channelSelectSpinner1 = rootView.findViewById(R.id.channel_select_spinner_1);
+ channelSelectSpinner2 = rootView.findViewById(R.id.channel_select_spinner_2);
+ channelSelectSpinner3 = rootView.findViewById(R.id.channel_select_spinner_3);
+ channelSelectSpinner4 = rootView.findViewById(R.id.channel_select_spinner_4);
+ edgeSelectSpinner1 = rootView.findViewById(R.id.edge_select_spinner_1);
+ edgeSelectSpinner2 = rootView.findViewById(R.id.edge_select_spinner_2);
+ edgeSelectSpinner3 = rootView.findViewById(R.id.edge_select_spinner_3);
+ edgeSelectSpinner4 = rootView.findViewById(R.id.edge_select_spinner_4);
+ analyze_button = rootView.findViewById(R.id.analyze_button);
channelMode = 1;
channelSelectSpinners.add(channelSelectSpinner1);
channelSelectSpinners.add(channelSelectSpinner2);
@@ -262,9 +183,9 @@ public void onClick(View view) {
channelMap.put(channels[2], 2);
channelMap.put(channels[3], 3);
// Axis Indicator
- xCoordinateText = v.findViewById(R.id.x_coordinate_text);
+ xCoordinateText = rootView.findViewById(R.id.x_coordinate_text);
xCoordinateText.setText("Time: 0.0 mS");
- progressBar = v.findViewById(R.id.la_progressBar);
+ progressBar = rootView.findViewById(R.id.la_progressBar);
progressBar.setVisibility(View.GONE);
((LogicalAnalyzerActivity) getActivity()).setStatus(false);
@@ -273,7 +194,7 @@ public void onClick(View view) {
dataSets = new ArrayList<>();
// Creating base layout for chart
- logicLinesChart = v.findViewById(R.id.chart_la);
+ logicLinesChart = rootView.findViewById(R.id.chart_la);
logicLinesChart.setBorderWidth(2);
Legend legend = logicLinesChart.getLegend();
legend.setTextColor(Color.WHITE);
@@ -283,22 +204,62 @@ public void onClick(View view) {
setCarouselPicker();
setAdapters();
- LogicalAnalyzerActivity laActivity = (LogicalAnalyzerActivity)getActivity();
+ LogicalAnalyzerActivity laActivity = (LogicalAnalyzerActivity) getActivity();
if (laActivity.isPlayback) {
setPlayBackData(laActivity.recordedLAData);
}
- return v;
+ return rootView;
+ }
+
+ public void logData() {
+ long block = System.currentTimeMillis();
+ double lat;
+ double lon;
+ if (gpsLogger.isGPSEnabled()) {
+ Location location = gpsLogger.getDeviceLocation();
+ if (location != null) {
+ lat = location.getLatitude();
+ lon = location.getLongitude();
+ } else {
+ lat = 0.0;
+ lon = 0.0;
+ }
+ } else {
+ lat = 0.0;
+ lon = 0.0;
+ }
+ csvLogger.prepareLogFile();
+ csvLogger.writeMetaData(getContext().getResources().getString(R.string.logical_analyzer));
+ csvLogger.writeCSVFile(csvHeader);
+ recordSensorDataBlockID(new SensorDataBlock(block, getResources().getString(R.string.logical_analyzer)));
+ long timestamp = System.currentTimeMillis();
+ String timeData = timestamp + "," + CSVLogger.FILE_NAME_FORMAT.format(new Date(timestamp));
+ String locationData = lat + "," + lon;
+ for (int i = 0; i < recordXAxis.size(); i++) {
+ recordSensorData(new LogicAnalyzerData(timestamp + i, block, channels[i], recordChannelMode.get(i), recordXAxis.get(i), recordYAxis.get(i), lat, lon));
+ String data = timeData + "," + channels[i] + "," + recordChannelMode.get(i) + "," + recordXAxis.get(i) + "," + recordYAxis.get(i) + "," + locationData;
+ csvLogger.writeCSVFile(data);
+ }
+ CustomSnackBar.showSnackBar(rootView,
+ getString(R.string.csv_store_text) + " " + csvLogger.getCurrentFilePath()
+ , getString(R.string.open), new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ Intent intent = new Intent(getContext(), DataLoggerActivity.class);
+ intent.putExtra(DataLoggerActivity.CALLER_ACTIVITY, getResources().getString(R.string.logical_analyzer));
+ startActivity(intent);
+ }
+ }, Snackbar.LENGTH_SHORT);
}
private void setPlayBackData(RealmResults data) {
analyze_button.setVisibility(View.GONE);
- recordButton.setVisibility(View.GONE);
currentChannel = 0;
setViewVisibility(data.size() - 1);
channelNames.clear();
disableSpinners();
- carouselPicker.setCurrentItem(data.size() -1);
- for (int i = 0; i < data.size(); i ++) {
+ carouselPicker.setCurrentItem(data.size() - 1);
+ for (int i = 0; i < data.size(); i++) {
LogicAnalyzerData laData = data.get(i);
channelNames.add(laData.getChannel());
edgeSelectSpinners.get(i).setSelection(laData.getChannelMode() - 1);
@@ -308,7 +269,7 @@ private void setPlayBackData(RealmResults data) {
int n = Math.min(xPoints.length, yPoints.length);
double[] xaxis = new double[n];
double[] yaxis = new double[n];
- for (int j = 0; j < n; j ++) {
+ for (int j = 0; j < n; j++) {
xaxis[j] = Double.valueOf(xPoints[j]);
yaxis[j] = Double.valueOf(yPoints[j]);
}
@@ -329,7 +290,7 @@ private void setPlayBackData(RealmResults data) {
singleChannelOtherEdges(xaxis, yaxis);
break;
}
- currentChannel ++;
+ currentChannel++;
}
logicLinesChart.setData(new LineData(dataSets));
logicLinesChart.invalidate();
@@ -347,9 +308,6 @@ private void setPlayBackData(RealmResults data) {
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
- if (scienceLab.isConnected()) {
- new Thread(logicAnalysis).start();
- }
carouselPicker.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
@@ -620,6 +578,7 @@ private void setViewVisibility(int mode) {
break;
}
}
+
/**
* Plots every edge of a digital pulse for one channel at a time
*
@@ -899,8 +858,6 @@ private void setCarouselPicker() {
@Override
public void onResume() {
super.onResume();
- if (((AppCompatActivity) getActivity()).getSupportActionBar() != null)
- ((AppCompatActivity) getActivity()).getSupportActionBar().hide();
}
@Override
diff --git a/app/src/main/java/io/pslab/fragment/OscilloscopePlaybackFragment.java b/app/src/main/java/io/pslab/fragment/OscilloscopePlaybackFragment.java
index 1a95a12bc..cafe1b13b 100644
--- a/app/src/main/java/io/pslab/fragment/OscilloscopePlaybackFragment.java
+++ b/app/src/main/java/io/pslab/fragment/OscilloscopePlaybackFragment.java
@@ -19,8 +19,6 @@ public class OscilloscopePlaybackFragment extends Fragment {
private OscilloscopeActivity oscilloscopeActivity;
private TextView timebaseTextView;
- private ImageView playButton;
- private boolean isPlaying = false;
public static OscilloscopePlaybackFragment newInstance() {
return new OscilloscopePlaybackFragment();
@@ -31,24 +29,8 @@ public static OscilloscopePlaybackFragment newInstance() {
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_oscilloscope_playback, container, false);
timebaseTextView = rootView.findViewById(R.id.timebase_data);
- playButton = rootView.findViewById(R.id.play_button);
CheckBox fourierCheckBox = rootView.findViewById(R.id.fourier_checkbox);
- playButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (isPlaying) {
- isPlaying = false;
- playButton.setImageResource(R.drawable.ic_play_button);
- oscilloscopeActivity.pauseData();
- } else {
- isPlaying = true;
- playButton.setImageResource(R.drawable.pause_icon);
- oscilloscopeActivity.playRecordedData();
- }
- }
- });
-
fourierCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
@@ -64,11 +46,6 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
oscilloscopeActivity = (OscilloscopeActivity) getActivity();
}
- public void resetPlayButton() {
- playButton.setImageResource(R.drawable.ic_play_button);
- isPlaying = false;
- }
-
public void setTimeBase(String timeBase) {
timebaseTextView.setText(timeBase);
}
diff --git a/app/src/main/java/io/pslab/interfaces/HttpCallback.java b/app/src/main/java/io/pslab/interfaces/HttpCallback.java
new file mode 100644
index 000000000..3bcdd62e8
--- /dev/null
+++ b/app/src/main/java/io/pslab/interfaces/HttpCallback.java
@@ -0,0 +1,6 @@
+package io.pslab.interfaces;
+
+public interface HttpCallback {
+ void success(T t1);
+ void error(Exception e);
+}
diff --git a/app/src/main/java/io/pslab/others/ScienceLabCommon.java b/app/src/main/java/io/pslab/others/ScienceLabCommon.java
index bae5a80a3..8bd20b962 100644
--- a/app/src/main/java/io/pslab/others/ScienceLabCommon.java
+++ b/app/src/main/java/io/pslab/others/ScienceLabCommon.java
@@ -15,6 +15,8 @@ public class ScienceLabCommon {
private static ScienceLabCommon scienceLabCommon = null;
public static ScienceLab scienceLab;
public boolean connected = false;
+ public static boolean isWifiConnected = false;
+ private static String espBaseIP = "";
private ScienceLabCommon() {
}
@@ -35,4 +37,20 @@ public static ScienceLabCommon getInstance() {
}
return scienceLabCommon;
}
+
+ public static String getEspIP() {
+ return espBaseIP;
+ }
+
+ public static void setEspBaseIP(String espBaseIP) {
+ ScienceLabCommon.espBaseIP = espBaseIP;
+ }
+
+ public static boolean isWifiConnected() {
+ return isWifiConnected;
+ }
+
+ public static void setIsWifiConnected(boolean wifiConnected) {
+ isWifiConnected = wifiConnected;
+ }
}
diff --git a/app/src/main/res/drawable/btn_back_rounded.xml b/app/src/main/res/drawable/btn_back_rounded.xml
index f3b6377f4..35e099f47 100644
--- a/app/src/main/res/drawable/btn_back_rounded.xml
+++ b/app/src/main/res/drawable/btn_back_rounded.xml
@@ -4,13 +4,13 @@
-
+
-
+
diff --git a/app/src/main/res/drawable/btn_back_rounded_light.xml b/app/src/main/res/drawable/btn_back_rounded_light.xml
new file mode 100644
index 000000000..0965b8c5b
--- /dev/null
+++ b/app/src/main/res/drawable/btn_back_rounded_light.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_android_black_24dp.xml b/app/src/main/res/drawable/ic_android_black_24dp.xml
new file mode 100644
index 000000000..401cbf63b
--- /dev/null
+++ b/app/src/main/res/drawable/ic_android_black_24dp.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_arrow_left_24dp.xml b/app/src/main/res/drawable/ic_arrow_left_24dp.xml
new file mode 100644
index 000000000..b79d00f6e
--- /dev/null
+++ b/app/src/main/res/drawable/ic_arrow_left_24dp.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_arrow_right_24dp.xml b/app/src/main/res/drawable/ic_arrow_right_24dp.xml
new file mode 100644
index 000000000..ff5a73fff
--- /dev/null
+++ b/app/src/main/res/drawable/ic_arrow_right_24dp.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_bluetooth.xml b/app/src/main/res/drawable/ic_bluetooth.xml
deleted file mode 100644
index d1432adac..000000000
--- a/app/src/main/res/drawable/ic_bluetooth.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
diff --git a/app/src/main/res/drawable/ic_shopping_cart_black_24dp.xml b/app/src/main/res/drawable/ic_shopping_cart_black_24dp.xml
new file mode 100644
index 000000000..11887e38f
--- /dev/null
+++ b/app/src/main/res/drawable/ic_shopping_cart_black_24dp.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_widgets_black_24dp.xml b/app/src/main/res/drawable/ic_widgets_black_24dp.xml
new file mode 100644
index 000000000..4abb823f8
--- /dev/null
+++ b/app/src/main/res/drawable/ic_widgets_black_24dp.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_wifi.xml b/app/src/main/res/drawable/ic_wifi.xml
deleted file mode 100644
index aff45f329..000000000
--- a/app/src/main/res/drawable/ic_wifi.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
diff --git a/app/src/main/res/drawable/icon_version.xml b/app/src/main/res/drawable/icon_version.xml
deleted file mode 100644
index 595985c9b..000000000
--- a/app/src/main/res/drawable/icon_version.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
diff --git a/app/src/main/res/layout-land/logic_analyzer_logic_lines.xml b/app/src/main/res/layout-land/logic_analyzer_logic_lines.xml
index a371cd2ee..c6d03f7c6 100644
--- a/app/src/main/res/layout-land/logic_analyzer_logic_lines.xml
+++ b/app/src/main/res/layout-land/logic_analyzer_logic_lines.xml
@@ -36,13 +36,6 @@
android:textStyle="bold"
android:layout_weight="1"/>
-
-
-
diff --git a/app/src/main/res/layout-sw600dp/fragment_channel_parameters.xml b/app/src/main/res/layout-sw600dp/fragment_channel_parameters.xml
index 00bc2c7a8..0af5562de 100644
--- a/app/src/main/res/layout-sw600dp/fragment_channel_parameters.xml
+++ b/app/src/main/res/layout-sw600dp/fragment_channel_parameters.xml
@@ -1,7 +1,6 @@
@@ -10,11 +9,10 @@
android:id="@+id/checkBox_ch1_cp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginLeft="16dp"
- android:layout_marginStart="16dp"
- android:layout_marginTop="16dp"
+ android:layout_marginStart="@dimen/osc_cb_margin2"
+ android:layout_marginTop="@dimen/osc_cb_margin2"
android:text="@string/label_ch1"
- android:textSize="18sp"
+ android:textSize="@dimen/osc_text_size_large"
android:textStyle="normal|bold"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@@ -23,11 +21,10 @@
android:id="@+id/checkBox_ch2_cp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginBottom="16dp"
- android:layout_marginLeft="16dp"
- android:layout_marginStart="16dp"
+ android:layout_marginBottom="@dimen/osc_cb_margin2"
+ android:layout_marginStart="@dimen/osc_cb_margin2"
android:text="@string/label_ch2"
- android:textSize="18sp"
+ android:textSize="@dimen/osc_text_size_large"
android:textStyle="normal|bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" />
@@ -36,70 +33,65 @@
android:id="@+id/checkBox_ch3_cp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginEnd="16dp"
- android:layout_marginRight="16dp"
- android:layout_marginTop="16dp"
+ android:layout_marginEnd="@dimen/osc_cb_margin2"
+ android:layout_marginTop="@dimen/osc_cb_margin2"
android:text="@string/ch3_value"
- android:textSize="18sp"
+ android:textSize="@dimen/osc_text_size_large"
android:textStyle="normal|bold"
- app:layout_constraintRight_toRightOf="parent"
+ app:layout_constraintEnd_toStartOf="@id/mic_radio_group"
+ app:layout_constraintStart_toEndOf="@id/spinner_channel_select_cp"
app:layout_constraintTop_toTopOf="parent" />
@@ -107,32 +99,47 @@
android:id="@+id/tv_ch2_cp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginBottom="24dp"
- android:layout_marginLeft="16dp"
- android:layout_marginStart="16dp"
+ android:layout_marginBottom="@dimen/text_elevation"
+ android:layout_marginStart="@dimen/osc_cb_margin2"
android:clickable="true"
android:text="@string/label_ch2"
android:textColor="@android:color/background_dark"
- android:textSize="18sp"
+ android:textSize="@dimen/osc_text_size_large"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@+id/spinner_range_ch2_cp" />
-
-
-
+ android:layout_marginTop="@dimen/osc_cb_margin2"
+ android:layout_marginEnd="@dimen/osc_cb_margin2"
+ android:orientation="vertical"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="parent">
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout-v21/activity_wave_generator.xml b/app/src/main/res/layout-v21/activity_wave_generator.xml
deleted file mode 100644
index 69626dd7e..000000000
--- a/app/src/main/res/layout-v21/activity_wave_generator.xml
+++ /dev/null
@@ -1,1050 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_create_config.xml b/app/src/main/res/layout/activity_create_config.xml
index 389f23e72..ea122dad8 100644
--- a/app/src/main/res/layout/activity_create_config.xml
+++ b/app/src/main/res/layout/activity_create_config.xml
@@ -7,84 +7,91 @@
android:layout_height="match_parent"
tools:context=".activity.CreateConfigActivity">
-
+ android:layout_below="@+id/top_app_bar_layout">
-
+ android:padding="@dimen/home_fragment_padding">
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_oscilloscope.xml b/app/src/main/res/layout/activity_oscilloscope.xml
index 897e1d445..c6a94168e 100644
--- a/app/src/main/res/layout/activity_oscilloscope.xml
+++ b/app/src/main/res/layout/activity_oscilloscope.xml
@@ -1,9 +1,8 @@
-
-
-
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_below="@id/top_app_bar_layout"
+ android:layout_marginTop="@dimen/osc_main_margin"
+ android:layout_marginStart="@dimen/osc_main_margin">
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+ android:gravity="center_vertical"
+ android:orientation="vertical">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+ android:layout_marginTop="@dimen/top_margin_text"
+ android:background="#fff"
+ android:text="@string/show_guide_text"
+ android:textColor="#000"
+ android:visibility="gone" />
+
-
+ android:layout_toEndOf="@+id/layout_chart_os"
+ android:layout_toRightOf="@+id/layout_chart_os"
+ android:background="@drawable/rounded_custom_border_2"
+ android:orientation="vertical"
+ android:layout_marginBottom="@dimen/osc_main_margin"
+ android:layout_marginEnd="@dimen/osc_main_margin">
+
+
+ android:id="@+id/tv_channel_parameters_os"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_margin="@dimen/osc_text_margin"
+ android:background="@color/colorPrimaryDark"
+ android:gravity="center"
+ android:text="@string/channel_parameters"
+ android:textAlignment="center"
+ android:textColor="@color/black"
+ android:textSize="@dimen/osc_text_size"
+ android:textStyle="normal|bold" />
+
+
+
+
-
-
-
-
+ android:layout_margin="@dimen/osc_text_margin"
+ android:gravity="center"
+ android:text="@string/timebase_and_trigger"
+ android:textAlignment="center"
+ android:textColor="@color/black"
+ android:textSize="@dimen/osc_text_size"
+ android:textStyle="normal|bold" />
+
+
+
+
+ android:layout_margin="@dimen/osc_text_margin"
+ android:gravity="center"
+ android:maxLines="1"
+ android:text="@string/data_analysis"
+ android:textAlignment="center"
+ android:textColor="@color/black"
+ android:textSize="@dimen/osc_text_size"
+ android:textStyle="normal|bold" />
+
+
+
+
-
-
-
-
-
-
-
-
+ android:layout_margin="@dimen/osc_text_margin"
+ android:layout_marginBottom="@dimen/osc_divider_line"
+ android:elevation="@dimen/text_elevation"
+ android:gravity="center"
+ android:text="@string/xy_plot"
+ android:textAlignment="center"
+ android:textColor="@color/black"
+ android:textSize="@dimen/osc_text_size"
+ android:textStyle="normal|bold" />
+
+
+
+
+
-
+ android:layout_below="@id/top_app_bar_layout"
+ android:alpha="0"
+ android:background="@color/black" />
-
-
-
-
-
+
-
-
-
-
-
+ android:layout_height="?attr/actionBarSize"
+ android:background="?attr/colorPrimary"
+ app:popupTheme="@style/AppTheme.PopupOverlay" />
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/layout/activity_robotic_arm.xml b/app/src/main/res/layout/activity_robotic_arm.xml
index 3b959d9d1..4ce37ab03 100644
--- a/app/src/main/res/layout/activity_robotic_arm.xml
+++ b/app/src/main/res/layout/activity_robotic_arm.xml
@@ -1,21 +1,37 @@
-
+ android:weightSum="1">
+
+
+
+
+
+
@@ -43,44 +59,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
-
-
-
-
-
-
-
-
-
-
-
+ android:layout_weight="0.9">
-
+
diff --git a/app/src/main/res/layout/activity_wave_generator.xml b/app/src/main/res/layout/activity_wave_generator.xml
index bafb1c567..78d72ebb6 100644
--- a/app/src/main/res/layout/activity_wave_generator.xml
+++ b/app/src/main/res/layout/activity_wave_generator.xml
@@ -1,984 +1,92 @@
-
+ android:padding="5dp">
-
+ android:orientation="horizontal"
+ app:layout_constraintGuide_percent="0.3" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ android:orientation="horizontal"
+ app:layout_constraintGuide_percent="0.5" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_wave_generator_main.xml b/app/src/main/res/layout/activity_wave_generator_main.xml
index c711e6a3f..b29f59e38 100644
--- a/app/src/main/res/layout/activity_wave_generator_main.xml
+++ b/app/src/main/res/layout/activity_wave_generator_main.xml
@@ -1,36 +1,39 @@
-
+ android:layout_height="match_parent"
+ xmlns:app="http://schemas.android.com/apk/res-auto">
+
+
+
+
+
+
-
+
-
-
-
diff --git a/app/src/main/res/layout/bluetooth_wifi_dialog_layout.xml b/app/src/main/res/layout/bluetooth_wifi_dialog_layout.xml
deleted file mode 100644
index 80c3e6263..000000000
--- a/app/src/main/res/layout/bluetooth_wifi_dialog_layout.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/layout/fragment_channel_parameters.xml b/app/src/main/res/layout/fragment_channel_parameters.xml
index ace1c421e..284fa82d8 100644
--- a/app/src/main/res/layout/fragment_channel_parameters.xml
+++ b/app/src/main/res/layout/fragment_channel_parameters.xml
@@ -10,9 +10,8 @@
android:id="@+id/checkBox_ch1_cp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginLeft="8dp"
- android:layout_marginStart="8dp"
- android:layout_marginTop="8dp"
+ android:layout_marginStart="@dimen/osc_cb_margin"
+ android:layout_marginTop="@dimen/osc_cb_margin"
android:text="@string/ch1"
android:textStyle="normal|bold"
app:layout_constraintLeft_toLeftOf="parent"
@@ -22,9 +21,8 @@
android:id="@+id/checkBox_ch2_cp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginBottom="8dp"
- android:layout_marginLeft="8dp"
- android:layout_marginStart="8dp"
+ android:layout_marginBottom="@dimen/osc_cb_margin"
+ android:layout_marginStart="@dimen/osc_cb_margin"
android:text="@string/ch2"
android:textStyle="normal|bold"
app:layout_constraintBottom_toBottomOf="parent"
@@ -34,20 +32,19 @@
android:id="@+id/checkBox_ch3_cp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginEnd="8dp"
- android:layout_marginRight="8dp"
- android:layout_marginTop="8dp"
+ android:layout_marginEnd="@dimen/osc_cb_margin"
+ android:layout_marginTop="@dimen/osc_cb_margin"
android:textStyle="normal|bold"
- app:layout_constraintRight_toRightOf="parent"
+ app:layout_constraintEnd_toStartOf="@id/mic_radio_group"
+ app:layout_constraintStart_toEndOf="@id/spinner_channel_select_cp"
app:layout_constraintTop_toTopOf="parent" />
+ app:layout_constraintTop_toTopOf="parent"
+ android:layout_marginStart="@dimen/osc_cb_margin"/>
-
+ android:layout_marginTop="@dimen/osc_cb_margin"
+ android:layout_marginEnd="@dimen/osc_cb_margin"
+ android:orientation="vertical"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="parent">
-
+
+
+
+
+
diff --git a/app/src/main/res/layout/fragment_data_analysis.xml b/app/src/main/res/layout/fragment_data_analysis.xml
index 5b6132c68..db7eafa5e 100644
--- a/app/src/main/res/layout/fragment_data_analysis.xml
+++ b/app/src/main/res/layout/fragment_data_analysis.xml
@@ -10,20 +10,17 @@
@@ -31,10 +28,8 @@
@@ -42,9 +37,7 @@
android:id="@+id/checkBox_fourier_da"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginBottom="8dp"
- android:layout_marginLeft="8dp"
- android:layout_marginStart="8dp"
+ android:layout_marginBottom="@dimen/osc_cb_margin"
android:text="@string/fourier_transforms"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" />
diff --git a/app/src/main/res/layout/fragment_faq.xml b/app/src/main/res/layout/fragment_faq.xml
index 900f62629..f20080eba 100644
--- a/app/src/main/res/layout/fragment_faq.xml
+++ b/app/src/main/res/layout/fragment_faq.xml
@@ -8,6 +8,7 @@
@@ -24,17 +24,9 @@
android:id="@+id/timebase_data"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_toEndOf="@+id/timebase_title"
- android:layout_centerVertical="true"
- android:layout_marginStart="@dimen/osc_playback_margin"
- />
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_xyplot.xml b/app/src/main/res/layout/fragment_xyplot.xml
index 4177dd942..ed7f55b41 100644
--- a/app/src/main/res/layout/fragment_xyplot.xml
+++ b/app/src/main/res/layout/fragment_xyplot.xml
@@ -11,9 +11,7 @@
android:id="@+id/checkBox_enable_xy_xy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginLeft="8dp"
- android:layout_marginStart="8dp"
- android:layout_marginTop="8dp"
+ android:layout_marginStart="@dimen/osc_cb_margin"
android:text="@string/enable_xy_plot"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@@ -21,11 +19,10 @@
diff --git a/app/src/main/res/layout/home_fragment.xml b/app/src/main/res/layout/home_fragment.xml
index bc83b7d5b..1474c274f 100644
--- a/app/src/main/res/layout/home_fragment.xml
+++ b/app/src/main/res/layout/home_fragment.xml
@@ -69,9 +69,9 @@
+ android:layout_marginBottom="@dimen/inst_margin_bottom">
@@ -91,9 +91,9 @@
+ android:layout_marginBottom="@dimen/inst_margin_bottom">
@@ -113,8 +113,8 @@
+ android:layout_marginStart="@dimen/instruction_ll_margin"
+ android:layout_marginLeft="@dimen/instruction_ll_margin">
@@ -144,12 +144,47 @@
android:textStyle="bold"
android:visibility="gone" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/wave_generator_digital_mode_layout.xml b/app/src/main/res/layout/wave_generator_digital_mode_layout.xml
new file mode 100644
index 000000000..d4bb9d7be
--- /dev/null
+++ b/app/src/main/res/layout/wave_generator_digital_mode_layout.xml
@@ -0,0 +1,194 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/wave_generator_main_controls.xml b/app/src/main/res/layout/wave_generator_main_controls.xml
new file mode 100644
index 000000000..ee9278577
--- /dev/null
+++ b/app/src/main/res/layout/wave_generator_main_controls.xml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/wave_generator_preview.xml b/app/src/main/res/layout/wave_generator_preview.xml
new file mode 100644
index 000000000..cd70a42b5
--- /dev/null
+++ b/app/src/main/res/layout/wave_generator_preview.xml
@@ -0,0 +1,13 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/wave_generator_seekbar.xml b/app/src/main/res/layout/wave_generator_seekbar.xml
new file mode 100644
index 000000000..29b575a5b
--- /dev/null
+++ b/app/src/main/res/layout/wave_generator_seekbar.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/wave_generator_wave_controls.xml b/app/src/main/res/layout/wave_generator_wave_controls.xml
new file mode 100644
index 000000000..a9f1ef5c2
--- /dev/null
+++ b/app/src/main/res/layout/wave_generator_wave_controls.xml
@@ -0,0 +1,399 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/menu/activity_landscape_menu.xml b/app/src/main/res/menu/activity_landscape_menu.xml
new file mode 100644
index 000000000..de5ddc1d7
--- /dev/null
+++ b/app/src/main/res/menu/activity_landscape_menu.xml
@@ -0,0 +1,23 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/activity_main_drawer.xml b/app/src/main/res/menu/activity_main_drawer.xml
index 66ec322ec..01ab5678c 100644
--- a/app/src/main/res/menu/activity_main_drawer.xml
+++ b/app/src/main/res/menu/activity_main_drawer.xml
@@ -1,18 +1,24 @@
\ No newline at end of file
diff --git a/app/src/main/res/menu/logical_analyzer_menu.xml b/app/src/main/res/menu/logical_analyzer_menu.xml
new file mode 100644
index 000000000..41b7097f3
--- /dev/null
+++ b/app/src/main/res/menu/logical_analyzer_menu.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
diff --git a/app/src/main/res/menu/multimeter_log_menu.xml b/app/src/main/res/menu/multimeter_log_menu.xml
index a8727c1da..1625e64ca 100644
--- a/app/src/main/res/menu/multimeter_log_menu.xml
+++ b/app/src/main/res/menu/multimeter_log_menu.xml
@@ -6,16 +6,11 @@
android:icon="@drawable/ic_record_white"
android:title="@string/record_csv_data"
app:showAsAction="always" />
-
+ app:showAsAction="always" />
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/wave_generator_menu.xml b/app/src/main/res/menu/wave_generator_menu.xml
new file mode 100644
index 000000000..5880c1dd0
--- /dev/null
+++ b/app/src/main/res/menu/wave_generator_menu.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
index d90da235d..c2723e602 100644
--- a/app/src/main/res/values/dimens.xml
+++ b/app/src/main/res/values/dimens.xml
@@ -123,25 +123,37 @@
0dp208dp206dp
+ 14sp
+ 5dp10dp
+ 8dp
+ 16dp
+ 32dp
+ 48dp
+ 20dp600dp300dp9sp8dp
+ 10dp4dp9dp16dp
- 12sp
+ 9sp15dp1dp
+ 5dp22dp24dp50dp50dp10dp
+ 13dp
+ 18sp
+ 2dp40dp15sp
@@ -215,7 +227,10 @@
1dp8dp50dp
+ 20dp
+ 10dp
+ 20dp20dp20dp20dp
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 127724456..86995d13b 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -6,19 +6,20 @@
Press again to close PSLab"The sensor required for this instrument is not present in your device"
- Device
+ Connect DeviceInstrumentsSettingsAbout Us
+ Buy PSLabFeedback & Bugs
- FAQs
+ FAQShare AppGenerate Config FilePin LayoutPin Layout FrontPin Layout BackBluetooth Connection
- USB device not found. Do you want to scan for Bluetooth or Wifi connection?
+ Connect using Bluetooth or Wi-FiBluetoothWiFiScan
@@ -51,10 +52,14 @@
Instruments
- Device
+ Logged Data
+ Connect Device
+ Generate Config FileSettingsAbout Us
+ Buy PSLabFAQs
+ Share AppApplication Icon
@@ -671,11 +676,14 @@
AnalogPWMView
+ Produce SoundSave45 deg50 %Open instrument
+ In-Built MIC
+ PSLab MICSineTriangularSquare
@@ -782,8 +790,6 @@
Show GuideHide Guide
- Wave Pins will be disabled
-
The wave generator can be used to generate different types of waves like
Sine wave, Square wave, Saw Tooth wave and allow us to changes their characteristics like frequency, phase, duty.
\nIt also allows us to produce PWM signals having different phase and duty.
@@ -815,18 +821,40 @@
Similarly, to produce four different PWM signalQ:
- How can I use this application?
- What are the experiments I can perform?
- Where can I find the schematic for connections of the instruments?
- How can I design my own experiment and save it?
- Can I submit a change request for a particular instrument? If so, how?
+
+ What is Pocket Science Lab? What can I do with it?
+ Where can I buy a Pocket Science Lab?
+ Where can I download the Android App for Pocket Science Lab?
+ Where can I download the desktop app for Pocket Science Lab for Windows, Linux and Mac?
+ Do you have an iOS app for Apple devices?
+ How can I connect to the device? What kind of USB cable do I need? What is an OTG USB cable?
+ I found a bug in one of your apps or hardware. What to do? Where should I report it?
+ Can I record or save data in the apps and export or import it?
+ My Android phone already has some sensors, can I use them with the PSLab app as well?
+ Which external sensors can I use with a PSLab device and the apps? Which ones are compatible?
+ How can I use the Pocket Science Lab as an independent data logger without the phone or desktop connected?
+ It is cool, that PSLab is Open Hardware! Where can I find the schematics and parts list of Pocket Science Lab?
+ Who develops PSLab? When did you start it? What is the story behind it?
+ I found a mistake on the website, where can I submit the issue?
+ A:
- Each instrument includes a bottomsheet guide which gets open when you slide up from the bottom of your screen. It includes all the necessary details to connect the device along a brief guide to use it.
- The goal of PSLab is to create an Open Source hardware device (open on all layers) that can be used for experiments by teachers, students and citizen scientists. Our tiny pocket lab provides an array of sensors for doing science and engineering experiments. It provides functions of numerous measurement devices including an oscilloscope, a waveform generator, a frequency counter, a programmable voltage, current source and as a data logger. Hence, you can perform all kind of experiments using these devices.
- The bottomsheet guide implemented in each instrument has all the schematics for the connection of the device.
- Right now, we are not having an option to make and save custom experiments. But we will implement it soon.
- You can submit your reviews, feature requests and feedback through our Feedback and Issues page.
+
+ Pocket Science Lab (PSLab) is a small USB powered hardware board that can be used for measurements and experiments. It works as an extension for Android phones or PCs. PSLab comes with a built-in Oscilloscope, Multimeter, Wave Generator, Logic Analyzer, Power Source, and many more instruments. It can also be used as a robotics control app. And, we are constantly adding more digital instruments. PSLab is many devices in one. Simply connect two wires to the relevant pins (description is on the back of the PSLab board) and start measuring. You can use our Open Source Android or desktop app to view and collect the data. You can also plug in hundreds of compatible I²C standard sensors to the PSLab pin slots. It works without the need for programming. So, what experiments you do is just limited to your imagination!
+ There is an overview page for shops where you can buy a Pocket Science Lab device in different regions on the <a href = \"https://pslab.io/shop/\">website at https://pslab.io/shop/</a>.
+ The app can be downloaded from <a href = \"https://f-droid.org/en/packages/io.pslab/\">F-Droid</a> or <a href = \"https://play.google.com/store/apps/details?id=io.pslab\">Play Store</a>. Simply click on the links to be directed over!
+ We are developing a desktop app for Windows, Linux and Mac in <a href = \"https://github.com/fossasia/pslab-desktop/tree/install\">our desktop Git repository. You can find it in the install branch of the project here</a>. The app is still under development. We are using technologies like Electron and Python, that work on all platforms. However, to make the final installer work everywhere requires some tweaks and improvements here and there. So, please expect some glitches. You can use the tracker in the repository to submit issues, bugs and feature requests.
+ Unfortunately Apple has tight restrictions and controls users in a way that prevents them to connect other hardware to their own Apple devices. Many people argue that this is against the freedom of users. The majority of hardware producers are not able to provide options to connect their products with Apple devices. Apple in many cases simply does not permit non-Apple products to be connected with its phones, pads and other hardware. It is only sometimes possible after a long and expensive process, but even if we would try to go through such a process it is not sure, that it would be possible to get Apple’s cooperation to connect a Pocket Science Lab. Due to Apple’s restrictive policies and proprietary approach that restricts the freedom of users of Apple products we are not currently able to provide an iOS app. The community regularly discusses new approaches, but unfortunately we have not found a solution yet. Apple does not have an interest to support users due to its main objective of profit generation instead of allowing users to use their devices in a way that they want. Apple’s behavior is seen by some in a way that it restricts basic human rights and the freedom of people who happen to be users of Apple products.
+ To connect to the device you need an OTG USB cable (<a href = \"https://en.wikipedia.org/wiki/USB_On-The-Go\">OTG = On the go</a>) which is a USB cable that allows connected devices to switch back and forth between the roles of host and device. <u>USB cables that are not OTG compatible will NOT work</u>. It is also possible to extend the PSLab with an ESP WiFi chip or a Bluetooth chip and communicate through these gateways using the Android app. You can refer to the <a href = \"https://github.com/fossasia/pslab-hardware\">hardware developer documentation and code on GitHub for more details here</a>.
+ We have issue trackers in all our projects. They are currently hosted on GitHub. In order to submit a bug or feature request you need to login to the service. <a href = \"https://github.com/fossasia?utf8=%E2%9C%93&q=pslab\">A list of our PSLab repositories is here</a> (scroll down a bit, when you access this page).
+ Yes, we have implemented a record and play function or a way to save and open configurations in the instruments on the Android and desktop app. Data you record can be imported into the apps and viewed. This feature is still under heavy development, but works well in most places. You can find it in the top bar of the apps. There are buttons to record, play, save and open data.
+ Yes, absolutely. You can install the PSLab Android app (<a href = \"https://play.google.com/store/apps/details?id=io.pslab\">Play Store</a>, <a href = \"https://f-droid.org/en/packages/io.pslab/\">Fdroid</a>) on your phone and use it with devices such as Luxmeter or Compass. We are adding support for more built-in sensors step by step.
+ In our apps we use the industry standard I²C (<a href = \"https://en.wikipedia.org/wiki/I%C2%B2C\">Wikipedia</a>). You can get the data from sensors that are connected to the device through the USB port using an OTG USB cable (OTG = On the go) which is a USB cable that allows connected devices to switch back and forth between the roles of host and device. For the transfer we use UART (universal asynchronous receiver-transmitter, <a href = \"https://en.wikipedia.org/wiki/Universal_asynchronous_receiver-transmitter\">Wikipedia</a>). Many sensors can be used with specific instruments, e.g. Barometer, Thermometer, Gyroscope etc. You can access the configuration for sensors in the instrument settings on the top right burger menu of each instrument. All sensors using the I²C standard are compatible with the device. There are connection pins for analogue and digital sensors. You find the description of the pins on the back of the device. Even if there is no specific instrument in one of our apps yet, you can still view and store the raw data using the Oscilloscope instrument component. There is <a href = \"https://pslab.io/sensors/\">a page with a list of recommended sensors on the website</a>.
+ We have already implemented this functionality, however it is still in prototype stage. You can generate a config file in the Android app and transfer it to the PSLab device (you might have to update the firmware that you find on our Github org). You can power the PSLab device with an USB battery and it can collect data independently of the app. Once you connect the app you can download the data collected. Future versions of the device will come with a SD card to store the data locally as well. At the moment there are still limits to using this feature, but we are continuously working on it 🙂
+ The PSLab hardware is developed using <a href = \"http://www.kicad-pcb.org/\">KiCad</a>. The software can generate all kinds of formats and components lists. You can find the schematics and source files in the <a href = \"https://github.com/fossasia/pslab-hardware\">hardware Git repository here</a>.
+ PSLab is developed with a community at <a href = \"https://fossasia.org/\">FOSSASIA</a>. There are over 100 developers who have contributed to the project across different repositories. The project was started after Praveen Kumar, a physics teacher from India, introduced the idea of an open physics lab device inspired by the ExpEYES project at the FOSSASIA Summit in Cambodia 2014. He helped to get the project moving forward and worked with early contributors on the software components. The Open Hardware board was released in 2017 as part of a GSoC project by Jithin B P who used the ExpEYES boards he developed earlier as a basis to create the first version of PSLab. In the following years hardware components were updated, the size and design was adjusted resulting in much lower production costs and many features were added in the firmware. An Android app was developed from scratch and most of the desktop app re-implemented with a new cross-platform Electron frontend. <a href = \"https://twitter.com/Cloudypadmal\">Padmal M</a> from Sri Lanka is leading the tech team since 2018 and defines the roadmap together with <a href = \"https://twitter.com/mariobehling\">Mario Behling</a>, core developers and contributors from the wider community. Since 2019 FOSSASIA produces batches of the boards in large quantities. It is our goal to set an example as an Open Hardware project, to make it commercially sustainable and inspire others to create Open Hardware and Free and Open Source software.
+ We use issue trackers for most of our work. You can submit <a href = \"https://github.com/fossasia/pslab.io/issues\">issues you find regarding the website on our issue tracker here</a>.
+ DATE OF RECORDINGTIME OF RECORDING
diff --git a/docs/images/fdroid_badge.png b/docs/images/fdroid_badge.png
new file mode 100644
index 000000000..afa603cf6
Binary files /dev/null and b/docs/images/fdroid_badge.png differ
diff --git a/docs/images/instrument_accelerometer_view.png b/docs/images/instrument_accelerometer_view.png
index cf7afed5c..a3bf329c9 100755
Binary files a/docs/images/instrument_accelerometer_view.png and b/docs/images/instrument_accelerometer_view.png differ
diff --git a/docs/images/instrument_barometer_view.png b/docs/images/instrument_barometer_view.png
old mode 100644
new mode 100755
index bb34b04af..5d0edf919
Binary files a/docs/images/instrument_barometer_view.png and b/docs/images/instrument_barometer_view.png differ
diff --git a/docs/images/instrument_compass_view.png b/docs/images/instrument_compass_view.png
index ead5ca697..1e1c9a58b 100755
Binary files a/docs/images/instrument_compass_view.png and b/docs/images/instrument_compass_view.png differ
diff --git a/docs/images/instrument_gyro_view.png b/docs/images/instrument_gyro_view.png
index 71d9aa309..8cc7c7a46 100755
Binary files a/docs/images/instrument_gyro_view.png and b/docs/images/instrument_gyro_view.png differ
diff --git a/docs/images/instrument_logic_analyzer_guide.png b/docs/images/instrument_logic_analyzer_guide.png
old mode 100644
new mode 100755
index dc8ee26d9..dc3797521
Binary files a/docs/images/instrument_logic_analyzer_guide.png and b/docs/images/instrument_logic_analyzer_guide.png differ
diff --git a/docs/images/instrument_logic_analyzer_view.png b/docs/images/instrument_logic_analyzer_view.png
deleted file mode 100644
index e183f5aa4..000000000
Binary files a/docs/images/instrument_logic_analyzer_view.png and /dev/null differ
diff --git a/docs/images/instrument_logical_analyzer_view.png b/docs/images/instrument_logical_analyzer_view.png
new file mode 100644
index 000000000..a3138baee
Binary files /dev/null and b/docs/images/instrument_logical_analyzer_view.png differ
diff --git a/docs/images/instrument_luxmeter_guide.png b/docs/images/instrument_luxmeter_guide.png
old mode 100644
new mode 100755
index 7af2d7723..9f6597763
Binary files a/docs/images/instrument_luxmeter_guide.png and b/docs/images/instrument_luxmeter_guide.png differ
diff --git a/docs/images/instrument_multi_meter_view.png b/docs/images/instrument_multi_meter_view.png
new file mode 100755
index 000000000..4c2b3179d
Binary files /dev/null and b/docs/images/instrument_multi_meter_view.png differ
diff --git a/docs/images/instrument_multimeter_view.png b/docs/images/instrument_multimeter_view.png
deleted file mode 100644
index fc3f0afe7..000000000
Binary files a/docs/images/instrument_multimeter_view.png and /dev/null differ
diff --git a/docs/images/instrument_oscilloscope_audiojack.png b/docs/images/instrument_oscilloscope_audiojack.png
deleted file mode 100644
index b7c5b4188..000000000
Binary files a/docs/images/instrument_oscilloscope_audiojack.png and /dev/null differ
diff --git a/docs/images/instrument_oscilloscope_audiojack_view.png b/docs/images/instrument_oscilloscope_audiojack_view.png
new file mode 100755
index 000000000..11a60df86
Binary files /dev/null and b/docs/images/instrument_oscilloscope_audiojack_view.png differ
diff --git a/docs/images/instrument_oscilloscope_channel_view.png b/docs/images/instrument_oscilloscope_channel_view.png
new file mode 100755
index 000000000..b52979446
Binary files /dev/null and b/docs/images/instrument_oscilloscope_channel_view.png differ
diff --git a/docs/images/instrument_oscilloscope_channelparam.png b/docs/images/instrument_oscilloscope_channelparam.png
deleted file mode 100644
index 3a820d74b..000000000
Binary files a/docs/images/instrument_oscilloscope_channelparam.png and /dev/null differ
diff --git a/docs/images/instrument_oscilloscope_guide.png b/docs/images/instrument_oscilloscope_guide.png
old mode 100644
new mode 100755
index d1de2392c..12a5d6e4e
Binary files a/docs/images/instrument_oscilloscope_guide.png and b/docs/images/instrument_oscilloscope_guide.png differ
diff --git a/docs/images/instrument_power_source_view.png b/docs/images/instrument_power_source_view.png
old mode 100644
new mode 100755
index 3b55fe523..cd4f85bc6
Binary files a/docs/images/instrument_power_source_view.png and b/docs/images/instrument_power_source_view.png differ
diff --git a/docs/images/instrument_robotic_arm_controller_view.png b/docs/images/instrument_robotic_arm_controller_view.png
new file mode 100755
index 000000000..00f2b0a74
Binary files /dev/null and b/docs/images/instrument_robotic_arm_controller_view.png differ
diff --git a/docs/images/instrument_robotic_arm_view.png b/docs/images/instrument_robotic_arm_view.png
deleted file mode 100755
index 535cd0915..000000000
Binary files a/docs/images/instrument_robotic_arm_view.png and /dev/null differ
diff --git a/docs/images/instrument_thermo_view.png b/docs/images/instrument_thermo_view.png
index 5e0d8255f..4eda15117 100755
Binary files a/docs/images/instrument_thermo_view.png and b/docs/images/instrument_thermo_view.png differ
diff --git a/docs/images/instrument_wave_generator_analog.png b/docs/images/instrument_wave_generator_analog.png
old mode 100644
new mode 100755
index 3cba1baf2..42aeb7a25
Binary files a/docs/images/instrument_wave_generator_analog.png and b/docs/images/instrument_wave_generator_analog.png differ
diff --git a/docs/images/instrument_wave_generator_digital.png b/docs/images/instrument_wave_generator_digital.png
old mode 100644
new mode 100755
index 9a8a2553b..20199e6a9
Binary files a/docs/images/instrument_wave_generator_digital.png and b/docs/images/instrument_wave_generator_digital.png differ
diff --git a/docs/images/playstore_badge.png b/docs/images/playstore_badge.png
new file mode 100644
index 000000000..c77b7464b
Binary files /dev/null and b/docs/images/playstore_badge.png differ
diff --git a/docs/images/view_about_us.png b/docs/images/view_about_us.png
old mode 100644
new mode 100755
index 268609c0e..d49d957a4
Binary files a/docs/images/view_about_us.png and b/docs/images/view_about_us.png differ
diff --git a/docs/images/view_create_config_file.png b/docs/images/view_create_config_file.png
new file mode 100755
index 000000000..c7bdf7c11
Binary files /dev/null and b/docs/images/view_create_config_file.png differ
diff --git a/docs/images/view_data_logger.png b/docs/images/view_data_logger.png
old mode 100644
new mode 100755
index ad36df3ae..26ca4ba85
Binary files a/docs/images/view_data_logger.png and b/docs/images/view_data_logger.png differ
diff --git a/docs/images/view_device_not_found.png b/docs/images/view_device_not_found.png
old mode 100644
new mode 100755
index edf20c08b..9d5828bde
Binary files a/docs/images/view_device_not_found.png and b/docs/images/view_device_not_found.png differ
diff --git a/docs/images/view_home_screen.png b/docs/images/view_home_screen.png
old mode 100644
new mode 100755
index ccc0fccac..ddc974f75
Binary files a/docs/images/view_home_screen.png and b/docs/images/view_home_screen.png differ
diff --git a/docs/images/view_instrument_panel.png b/docs/images/view_instrument_panel.png
old mode 100644
new mode 100755
index b479f9571..afa823195
Binary files a/docs/images/view_instrument_panel.png and b/docs/images/view_instrument_panel.png differ
diff --git a/docs/images/view_log_map_location.png b/docs/images/view_log_map_location.png
old mode 100644
new mode 100755
index def11f50f..91fca1617
Binary files a/docs/images/view_log_map_location.png and b/docs/images/view_log_map_location.png differ
diff --git a/docs/images/view_navigation_drawer.png b/docs/images/view_navigation_drawer.png
deleted file mode 100644
index 2e7108d48..000000000
Binary files a/docs/images/view_navigation_drawer.png and /dev/null differ
diff --git a/docs/images/view_pin_layout_back.png b/docs/images/view_pin_layout_back.png
old mode 100644
new mode 100755
index 3a5a3a1c5..945ca3f1c
Binary files a/docs/images/view_pin_layout_back.png and b/docs/images/view_pin_layout_back.png differ
diff --git a/docs/images/view_pin_layout_front.png b/docs/images/view_pin_layout_front.png
old mode 100644
new mode 100755
index 6d960c78c..64fc86f92
Binary files a/docs/images/view_pin_layout_front.png and b/docs/images/view_pin_layout_front.png differ
diff --git a/docs/images/view_side_navigation_drawer.png b/docs/images/view_side_navigation_drawer.png
new file mode 100644
index 000000000..9b3b4b5fb
Binary files /dev/null and b/docs/images/view_side_navigation_drawer.png differ
diff --git a/fastlane/metadata/android/en-US/changelogs/19.txt b/fastlane/metadata/android/en-US/changelogs/19.txt
new file mode 100644
index 000000000..f49f9541a
--- /dev/null
+++ b/fastlane/metadata/android/en-US/changelogs/19.txt
@@ -0,0 +1,19 @@
+# Features and Enhancements
+- feat: feature to see altitude from pressure added in Barometer
+- feat: logging added to mq135
+- feat: MQ135 Gas sensor added
+- feat: interface for ESP wifi module added
+- feat: logic analyzer logging/ playback added
+
+# Bug Fixes
+- fix: unstable oscilloscope bug fixed
+- fix: logic analyzer bug fixed
+
+# Maintenance
+- chore: updated release-draft
+- chore: automatic release drafting
+
+# Documentation
+- docs: update readme
+- docs: updated fastlane metadata files
+- docs: read me updated
diff --git a/fastlane/metadata/android/en-US/changelogs/20.txt b/fastlane/metadata/android/en-US/changelogs/20.txt
new file mode 100644
index 000000000..2e34779d0
--- /dev/null
+++ b/fastlane/metadata/android/en-US/changelogs/20.txt
@@ -0,0 +1,27 @@
+# Release notes for PSLab Android app version 2.0.19
+
+## :rocket: Features and Enhancements
+
+- fix: osc main screen ui changes
+- fix: Wave generator UI changes
+- feat: bluetooth wifi connection option moved to Connect device menu
+- feat: new FAQs added
+- feat: new Wave Generator UI
+- fix: Actionbar added to Oscilloscope and Robotic Arm
+- fix: scroll added to create config layout
+- feat: add Httphandler class
+
+## :bug: Bug Fixes
+
+- fix: action bar added to logic analyzer
+- fix: Wave generator active even without pressing view button
+- fix: side navbar rearranged
+- fix: multimeter action bar fixed
+
+## :page_facing_up: Documentation
+
+- docs: readme images changed
+
+## :wrench: Maintenance
+
+- chore: upgrade app version
diff --git a/fastlane/metadata/android/en-US/short_description.txt b/fastlane/metadata/android/en-US/short_description.txt
index 2a61e8956..6f203344c 100644
--- a/fastlane/metadata/android/en-US/short_description.txt
+++ b/fastlane/metadata/android/en-US/short_description.txt
@@ -1 +1 @@
-A tiny Pocket Science Lab that provides an array of equipments for doing science and engineering experiments.
+A tiny Pocket Science Lab for science and engineering experiments.