Skip to content

Commit

Permalink
Tiny improvements on plots (#10)
Browse files Browse the repository at this point in the history
* remove uneeded project files

* libraries upgrade

* removing lower frequencies on the normalization of the alpha signal

* plots fit better the screen
  • Loading branch information
pssuils authored and capitancambio committed Jul 9, 2017
1 parent 0e127da commit e3f4546
Show file tree
Hide file tree
Showing 19 changed files with 113 additions and 210 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
/.idea/
.DS_Store
/build
/captures
1 change: 0 additions & 1 deletion .idea/.name

This file was deleted.

22 changes: 0 additions & 22 deletions .idea/compiler.xml

This file was deleted.

3 changes: 0 additions & 3 deletions .idea/copyright/profiles_settings.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/encodings.xml

This file was deleted.

23 changes: 0 additions & 23 deletions .idea/gradle.xml

This file was deleted.

10 changes: 0 additions & 10 deletions .idea/inspectionProfiles/Project_Default.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/inspectionProfiles/profiles_settings.xml

This file was deleted.

46 changes: 0 additions & 46 deletions .idea/misc.xml

This file was deleted.

9 changes: 0 additions & 9 deletions .idea/modules.xml

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/runConfigurations.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
buildToolsVersion '25.0.2'

defaultConfig {
applicationId "com.neurotechx.smartphonebci"
Expand All @@ -29,6 +29,6 @@ dependencies {

compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.guava:guava:19.0'
compile 'com.androidplot:androidplot-core:0.9.6'
compile 'com.androidplot:androidplot-core:0.9.8'
compile 'com.android.support:support-v4:23.4.0'
}
32 changes: 23 additions & 9 deletions app/src/main/java/com/neurotechx/smartphonebci/AlphaFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,43 +7,57 @@
import android.view.View;
import android.view.ViewGroup;

import com.androidplot.xy.XYPlot;
import com.google.common.base.Optional;
import com.neurotechx.smartphonebci.driver.dsp.BinnedValues;
import com.neurotechx.smartphonebci.plots.AlphaPlot;

import java.text.DecimalFormat;


public class AlphaFragment extends Fragment {
public class AlphaFragment extends Fragment
{

Optional<AlphaPlot> mPlot= Optional.absent();
public AlphaFragment() {
Optional<AlphaPlot> mPlot = Optional.absent();

public AlphaFragment()
{
// Required empty public constructor
}


public static AlphaFragment newInstance() {
public static AlphaFragment newInstance()
{
AlphaFragment fragment = new AlphaFragment();
return fragment;
}

@Override
public void onCreate(Bundle savedInstanceState) {
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
MainActivity.alpha=Optional.of(this);
MainActivity.alpha = Optional.of(this);


}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Bundle savedInstanceState)
{
View view = inflater.inflate(R.layout.fragment_alpha, container, false);
this.mPlot = Optional.of(new AlphaPlot(view));
//setting up the value formats
XYPlot plot = (XYPlot) view.findViewById(R.id.alpha_plot);
plot.setRangeValueFormat(new DecimalFormat("0.00"));
plot.setDomainValueFormat(new DecimalFormat("0.00"));
return view;
}

public void push(BinnedValues values){
if (mPlot.isPresent()){
public void push(BinnedValues values)
{
if (mPlot.isPresent())
{
mPlot.get().push(values);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package com.neurotechx.smartphonebci;

import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.androidplot.xy.XYPlot;
import com.google.common.base.Optional;
import com.neurotechx.smartphonebci.driver.dsp.BinnedValues;
import com.neurotechx.smartphonebci.plots.AlphaPlot;
import com.neurotechx.smartphonebci.plots.SanityCheckPlot;

import java.text.DecimalFormat;


/**
* A simple {@link Fragment} subclass.
Expand All @@ -22,11 +22,13 @@
* Use the {@link SanityCheckFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class SanityCheckFragment extends Fragment {
public class SanityCheckFragment extends Fragment
{

Optional<SanityCheckPlot> mPlot= Optional.absent();
Optional<SanityCheckPlot> mPlot = Optional.absent();

public SanityCheckFragment() {
public SanityCheckFragment()
{
// Required empty public constructor
}

Expand All @@ -39,28 +41,41 @@ public SanityCheckFragment() {
* @return A new instance of fragment SanityCheckFragment.
*/
// TODO: Rename and change types and number of parameters
public static SanityCheckFragment newInstance() {
public static SanityCheckFragment newInstance()
{
SanityCheckFragment fragment = new SanityCheckFragment();
return fragment;
}

@Override
public void onCreate(Bundle savedInstanceState) {
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
MainActivity.sanity= Optional.of(this);
MainActivity.sanity = Optional.of(this);

}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Bundle savedInstanceState)
{
View view = inflater.inflate(R.layout.fragment_sanity_check, container, false);
this.mPlot = Optional.of(new SanityCheckPlot(view));
XYPlot plot = (XYPlot) view.findViewById(R.id.sanity_plot);
plot.getGraphWidget().setDomainLabelOrientation(-45);
plot.getGraphWidget().setPaddingBottom(50);
plot.getGraphWidget().setPaddingLeft(120);
plot.getGraphWidget().setPaddingTop(20);
plot.getGraphWidget().setPaddingRight(20);
plot.setRangeValueFormat(new DecimalFormat("0.00"));
plot.setDomainValueFormat(new DecimalFormat("0.00"));
return view;
}

public void push(BinnedValues values){
if (mPlot.isPresent()){
public void push(BinnedValues values)
{
if (mPlot.isPresent())
{
mPlot.get().push(values);
}
}
Expand Down
Loading

0 comments on commit e3f4546

Please sign in to comment.