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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/src/main/assets/remote
2 changes: 1 addition & 1 deletion app/src/main/java/de/rwth_aachen/phyphox/Analysis.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import java.util.Iterator;
import java.util.Vector;

import de.rwth_aachen.phyphox.Helper.Helper;
import de.rwth_aachen.phyphox.helper.Helper;

// The analysis class is used to to do math operations on dataBuffers

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import java.io.FileOutputStream;
import java.util.zip.CRC32;

import de.rwth_aachen.phyphox.Helper.Helper;
import de.rwth_aachen.phyphox.helper.Helper;
import de.rwth_aachen.phyphox.R;

@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import java.util.Set;
import java.util.UUID;

import de.rwth_aachen.phyphox.Helper.Helper;
import de.rwth_aachen.phyphox.helper.Helper;
import de.rwth_aachen.phyphox.R;

/**
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/java/de/rwth_aachen/phyphox/DataExport.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package de.rwth_aachen.phyphox;

import static de.rwth_aachen.phyphox.Helper.DataExportUtility.MIME_TYPE_CSV_MINI;
import static de.rwth_aachen.phyphox.Helper.DataExportUtility.MIME_TYPE_CSV_ZIP;
import static de.rwth_aachen.phyphox.Helper.DataExportUtility.MIME_TYPE_XLS;
import static de.rwth_aachen.phyphox.helper.DataExportUtility.MIME_TYPE_CSV_MINI;
import static de.rwth_aachen.phyphox.helper.DataExportUtility.MIME_TYPE_CSV_ZIP;
import static de.rwth_aachen.phyphox.helper.DataExportUtility.MIME_TYPE_XLS;

import android.app.Activity;
import android.app.AlertDialog;
Expand Down Expand Up @@ -41,7 +41,7 @@
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

import de.rwth_aachen.phyphox.Helper.DataExportUtility;
import de.rwth_aachen.phyphox.helper.DataExportUtility;

//The DataExport class provides export functionality for a phyphoxExperiment.
//it provides multiple export formats and the dialogs to control them
Expand Down
41 changes: 24 additions & 17 deletions app/src/main/java/de/rwth_aachen/phyphox/ExpView.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import android.text.TextPaint;
import android.text.method.DigitsKeyListener;
import android.text.style.MetricAffectingSpan;
import android.transition.Visibility;
import android.util.Log;
import android.util.TypedValue;
import android.view.ContextThemeWrapper;
Expand Down Expand Up @@ -66,13 +67,13 @@
import java.util.Locale;
import java.util.Vector;

import de.rwth_aachen.phyphox.Helper.Helper;
import de.rwth_aachen.phyphox.helper.Helper;
import de.rwth_aachen.phyphox.camera.CameraPreviewFragment;
import de.rwth_aachen.phyphox.camera.Scrollable;
import de.rwth_aachen.phyphox.camera.depth.DepthInput;
import de.rwth_aachen.phyphox.camera.depth.DepthPreview;
import de.rwth_aachen.phyphox.Helper.DecimalTextWatcher;
import de.rwth_aachen.phyphox.Helper.RGB;
import de.rwth_aachen.phyphox.helper.DecimalTextWatcher;
import de.rwth_aachen.phyphox.helper.RGB;
import de.rwth_aachen.phyphox.NetworkConnection.NetworkConnection;
import de.rwth_aachen.phyphox.NetworkConnection.NetworkService;
import de.rwth_aachen.phyphox.camera.model.CameraSettingLevel;
Expand Down Expand Up @@ -343,17 +344,23 @@ protected void onViewSelected(boolean parentViewIsVisible) {
}

private void updateViewElementVisibility(){
if(visibilityBuffer != null){
if(visibilityBuffer.value <= 0 || visibilityBuffer.size == 0){
if (state == State.maximized) {
//This prevents from leaving the user with an entirely empty UI, when an element might be maximized while it becomes hidden.
restore();
} else {
rootView.setVisibility(GONE);
}
if(rootView == null){
return;
}
if(visibilityBuffer == null){
return;
}

boolean shouldBeVisible = visibilityBuffer.value > 0 && visibilityBuffer.size > 0 && !Double.isNaN(visibilityBuffer.value);

if(shouldBeVisible){
rootView.setVisibility(VISIBLE);
} else {
if (state == State.maximized) {
//This prevents from leaving the user with an entirely empty UI, when an element might be maximized while it becomes hidden.
restore();
} else {
rootView.setVisibility(VISIBLE);
rootView.setVisibility(GONE);
}
}
}
Expand Down Expand Up @@ -574,10 +581,10 @@ protected String createViewHTML(){
@Override
//We just have to send calculated value and the unit to the textView
protected void onMayReadFromBuffers(PhyphoxExperiment experiment) {
super.onMayReadFromBuffers(experiment);
if (!needsUpdate)
return;
needsUpdate = false;
super.onMayReadFromBuffers(experiment);
double x = experiment.getBuffer(inputs.get(0)).value;
if (tv != null) {
String vStr = "";
Expand Down Expand Up @@ -1398,10 +1405,10 @@ else if (!inputs.get(i).isEmpty)

@Override
protected void onMayReadFromBuffers(PhyphoxExperiment experiment) {
super.onMayReadFromBuffers(experiment);
if (!needsUpdate)
return;
needsUpdate = false;
super.onMayReadFromBuffers(experiment);

if(dynamicBuffer == null){
return;
Expand Down Expand Up @@ -1912,10 +1919,10 @@ protected String createViewHTML(){

@Override
protected void onMayReadFromBuffers(PhyphoxExperiment experiment) {
super.onMayReadFromBuffers(experiment);
if (!needsUpdate)
return;
needsUpdate = false;
super.onMayReadFromBuffers(experiment);
for (int i = 0; i < inputs.size(); i+=2) {
if (inputs.size() > i+1) {
DataBuffer x = experiment.getBuffer(inputs.get(i+1));
Expand Down Expand Up @@ -3347,10 +3354,10 @@ protected double getValue() {

@Override
protected void onMayReadFromBuffers(PhyphoxExperiment experiment) {
super.onMayReadFromBuffers(experiment);
if (!needsUpdate || triggered || autoCompleteTextView == null)
return;
needsUpdate = false;
super.onMayReadFromBuffers(experiment);
double x = experiment.getBuffer(inputs.get(0)).value;

int index= -1;
Expand Down Expand Up @@ -3694,10 +3701,10 @@ protected boolean onMayWriteToBuffers(PhyphoxExperiment experiment) {

@Override
protected void onMayReadFromBuffers(PhyphoxExperiment experiment) {
super.onMayReadFromBuffers(experiment);
if (!needsUpdate || triggered)
return;
needsUpdate = false;
super.onMayReadFromBuffers(experiment);
if (inputs.size() == 0)
return;
double value = experiment.getBuffer(inputs.get(0)).value;
Expand Down
14 changes: 14 additions & 0 deletions app/src/main/java/de/rwth_aachen/phyphox/ExpViewFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

import android.animation.LayoutTransition;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
Expand All @@ -12,6 +14,7 @@
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;

public class ExpViewFragment extends Fragment {
Expand Down Expand Up @@ -112,6 +115,11 @@ public void onCreate(Bundle savedInstanceState) {
}
}

@Override
public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}

public void recreateView() {
if (root == null)
return;
Expand Down Expand Up @@ -169,11 +177,17 @@ public void onFocusChange(View v, boolean hasFocus) {
@Override
public void onResume() {
super.onResume();
if(getActivity() == null){
return;
}
recreateView();
}

public void onPause() {
super.onPause();
if(getActivity() == null){
return;
}
if (((Experiment)getActivity()).experiment != null && ((Experiment)getActivity()).experiment.experimentViews.size() > index) {
for (ExpView.expViewElement element : ((Experiment) getActivity()).experiment.experimentViews.elementAt(index).elements) {
element.destroyView();
Expand Down
14 changes: 7 additions & 7 deletions app/src/main/java/de/rwth_aachen/phyphox/Experiment.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import static de.rwth_aachen.phyphox.ExperimentList.model.Const.EXPERIMENT_PRESELECTED_BLUETOOTH_ADDRESS;
import static de.rwth_aachen.phyphox.ExperimentList.model.Const.PREFS_NAME;
import static de.rwth_aachen.phyphox.Helper.DataExportUtility.MIME_TYPE_CSV_ZIP;
import static de.rwth_aachen.phyphox.Helper.DataExportUtility.MIME_TYPE_PHYPHOX;
import static de.rwth_aachen.phyphox.Helper.DataExportUtility.REQUEST_WRITE_EXTERNAL_STORAGE;
import static de.rwth_aachen.phyphox.helper.DataExportUtility.MIME_TYPE_CSV_ZIP;
import static de.rwth_aachen.phyphox.helper.DataExportUtility.MIME_TYPE_PHYPHOX;
import static de.rwth_aachen.phyphox.helper.DataExportUtility.REQUEST_WRITE_EXTERNAL_STORAGE;

import android.annotation.SuppressLint;
import android.app.Activity;
Expand Down Expand Up @@ -105,11 +105,11 @@
import de.rwth_aachen.phyphox.Bluetooth.ConnectedBluetoothDeviceInfoAdapter;
import de.rwth_aachen.phyphox.Bluetooth.ConnectedDeviceInfo;
import de.rwth_aachen.phyphox.Bluetooth.UpdateConnectedDeviceDelegate;
import de.rwth_aachen.phyphox.Helper.DataExportUtility;
import de.rwth_aachen.phyphox.Helper.WindowInsetHelper;
import de.rwth_aachen.phyphox.helper.DataExportUtility;
import de.rwth_aachen.phyphox.helper.WindowInsetHelper;
import de.rwth_aachen.phyphox.camera.depth.DepthInput;
import de.rwth_aachen.phyphox.Helper.DecimalTextWatcher;
import de.rwth_aachen.phyphox.Helper.Helper;
import de.rwth_aachen.phyphox.helper.DecimalTextWatcher;
import de.rwth_aachen.phyphox.helper.Helper;
import de.rwth_aachen.phyphox.NetworkConnection.NetworkConnection;

// Experiments are performed in this activity, which reacts to various intents.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@
import de.rwth_aachen.phyphox.ExperimentList.datasource.ExperimentRepository;
import de.rwth_aachen.phyphox.ExperimentList.model.ExperimentShortInfo;
import de.rwth_aachen.phyphox.ExperimentList.handler.SimpleExperimentCreator;
import de.rwth_aachen.phyphox.Helper.Helper;
import de.rwth_aachen.phyphox.Helper.ReportingScrollView;
import de.rwth_aachen.phyphox.Helper.WindowInsetHelper;
import de.rwth_aachen.phyphox.helper.Helper;
import de.rwth_aachen.phyphox.helper.ReportingScrollView;
import de.rwth_aachen.phyphox.helper.WindowInsetHelper;
import de.rwth_aachen.phyphox.PhyphoxFile;
import de.rwth_aachen.phyphox.R;
import de.rwth_aachen.phyphox.SensorInput;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@
import de.rwth_aachen.phyphox.ExperimentList.model.ExperimentListEnvironment;
import de.rwth_aachen.phyphox.ExperimentList.model.ExperimentLoadInfoData;
import de.rwth_aachen.phyphox.ExperimentList.model.ExperimentShortInfo;
import de.rwth_aachen.phyphox.Helper.baseColorDrawable.BaseColorDrawable;
import de.rwth_aachen.phyphox.Helper.baseColorDrawable.BitmapIcon;
import de.rwth_aachen.phyphox.helper.baseColorDrawable.BaseColorDrawable;
import de.rwth_aachen.phyphox.helper.baseColorDrawable.BitmapIcon;
import de.rwth_aachen.phyphox.Bluetooth.Bluetooth;
import de.rwth_aachen.phyphox.ExperimentList.ui.ExperimentsInCategory;
import de.rwth_aachen.phyphox.GpsInput;
import de.rwth_aachen.phyphox.Helper.Helper;
import de.rwth_aachen.phyphox.Helper.RGB;
import de.rwth_aachen.phyphox.helper.Helper;
import de.rwth_aachen.phyphox.helper.RGB;
import de.rwth_aachen.phyphox.R;
import de.rwth_aachen.phyphox.SensorInput;
import de.rwth_aachen.phyphox.Helper.baseColorDrawable.TextIcon;
import de.rwth_aachen.phyphox.Helper.baseColorDrawable.VectorIcon;
import de.rwth_aachen.phyphox.helper.baseColorDrawable.TextIcon;
import de.rwth_aachen.phyphox.helper.baseColorDrawable.VectorIcon;
import de.rwth_aachen.phyphox.camera.depth.DepthInput;
import de.rwth_aachen.phyphox.camera.helper.CameraHelper;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import de.rwth_aachen.phyphox.ExperimentList.model.ExperimentListEnvironment;
import de.rwth_aachen.phyphox.ExperimentList.model.ExperimentShortInfo;
import de.rwth_aachen.phyphox.ExperimentList.ui.ExperimentsInCategory;
import de.rwth_aachen.phyphox.Helper.Helper;
import de.rwth_aachen.phyphox.helper.Helper;
import de.rwth_aachen.phyphox.R;

public class ExperimentRepository{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import java.util.UUID;
import java.util.Vector;

import de.rwth_aachen.phyphox.Helper.RGB;
import de.rwth_aachen.phyphox.helper.RGB;

public class ExperimentShortInfo {
public RGB color;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
import java.util.Vector;

import de.rwth_aachen.phyphox.BuildConfig;
import de.rwth_aachen.phyphox.Helper.DataExportUtility;
import de.rwth_aachen.phyphox.helper.DataExportUtility;
import de.rwth_aachen.phyphox.Experiment;
import de.rwth_aachen.phyphox.ExperimentList.datasource.ExperimentRepository;
import de.rwth_aachen.phyphox.ExperimentList.model.ExperimentShortInfo;
import de.rwth_aachen.phyphox.Helper.Helper;
import de.rwth_aachen.phyphox.Helper.RGB;
import de.rwth_aachen.phyphox.helper.Helper;
import de.rwth_aachen.phyphox.helper.RGB;
import de.rwth_aachen.phyphox.R;

//This adapter is used to fill the gridView of the categories in the experiment list.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import de.rwth_aachen.phyphox.ExperimentList.datasource.ExperimentRepository;
import de.rwth_aachen.phyphox.ExperimentList.model.ExperimentShortInfo;
import de.rwth_aachen.phyphox.Helper.RGB;
import de.rwth_aachen.phyphox.helper.RGB;
import de.rwth_aachen.phyphox.R;
import de.rwth_aachen.phyphox.camera.helper.CameraHelper;

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/de/rwth_aachen/phyphox/GraphView.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import java.util.TimeZone;
import java.util.Vector;

import de.rwth_aachen.phyphox.Helper.Helper;
import de.rwth_aachen.phyphox.helper.Helper;

//The graphView class implements an Android view which displays a data graph

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.rwth_aachen.phyphox.Helper;
package de.rwth_aachen.phyphox.helper;

import android.app.Activity;
import android.content.ComponentName;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.rwth_aachen.phyphox.Helper;
package de.rwth_aachen.phyphox.helper;

import android.text.Editable;
import android.text.TextWatcher;
Expand Down
19 changes: 18 additions & 1 deletion app/src/main/java/de/rwth_aachen/phyphox/Helper/Helper.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.rwth_aachen.phyphox.Helper;
package de.rwth_aachen.phyphox.helper;

import static android.content.Context.BATTERY_SERVICE;
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
Expand Down Expand Up @@ -30,6 +30,7 @@
import android.util.Base64;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.OrientationEventListener;
import android.view.PixelCopy;
import android.view.Surface;
import android.view.View;
Expand Down Expand Up @@ -72,6 +73,7 @@
import de.rwth_aachen.phyphox.PlotAreaView;
import de.rwth_aachen.phyphox.R;
import de.rwth_aachen.phyphox.SettingsActivity.SettingsFragment;
import de.rwth_aachen.phyphox.camera.DeviceOrientation;

public abstract class Helper {

Expand Down Expand Up @@ -631,5 +633,20 @@ else if (context instanceof ContextWrapper)

return null;
}
public static DeviceOrientation getOrientationFromAngle(int angle) {

if (angle == OrientationEventListener.ORIENTATION_UNKNOWN) {
return DeviceOrientation.PORTRAIT;
}

if (angle >= 315 || angle < 45) {
return DeviceOrientation.PORTRAIT;
} else if (angle >= 45 && angle < 135) {
return DeviceOrientation.LANDSCAPE_REVERSE;
} else if (angle >= 135 && angle < 225) {
return DeviceOrientation.PORTRAIT_REVERSE;
} else { // angle >= 225 && angle < 315
return DeviceOrientation.LANDSCAPE;
}
}
}
2 changes: 1 addition & 1 deletion app/src/main/java/de/rwth_aachen/phyphox/Helper/RGB.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.rwth_aachen.phyphox.Helper;
package de.rwth_aachen.phyphox.helper;

import android.content.res.Resources;
import android.util.Log;
Expand Down
Loading