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
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.neurolab.activities;

import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.BottomNavigationView;
import android.support.v4.app.Fragment;
Expand All @@ -16,6 +17,7 @@
public class MemoryGraphParent extends AppCompatActivity {

private String filePath;
private boolean DATA_LOGGER_MODE = false;
public static final String MEMORY_GRAPH_FLAG = "Memory";

@Override
Expand All @@ -27,6 +29,7 @@ protected void onCreate(Bundle savedInstanceState) {

if (getIntent().getExtras() != null) {
filePath = getIntent().getStringExtra(LOG_FILE_KEY);
DATA_LOGGER_MODE = getIntent().getBooleanExtra(ProgramModeActivity.FROM_DATA_LOGGER, false);
}
Bundle bundle = new Bundle();
bundle.putString(LOG_FILE_KEY, filePath);
Expand Down Expand Up @@ -70,6 +73,9 @@ public boolean onSupportNavigateUp(){
public void onBackPressed() {
super.onBackPressed();
StatisticsFragment.parsedData = null;
if (DATA_LOGGER_MODE) {
startActivity(new Intent(this, DataLoggerActivity.class));
}
}

public void setActionBarTitle(String title) {
Expand Down
25 changes: 18 additions & 7 deletions app/src/main/java/io/neurolab/activities/ProgramModeActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ public class ProgramModeActivity extends AppCompatActivity {
public static final int RELAX_PROGRAM_MODE = 2;
public static final int MEMORY_GRAPH_MODE = 3;

public static final String FROM_DATA_LOGGER = "FROM_DATA_LOGGER";
private boolean DATA_LOGGER_MODE = false;

public static final String INTENT_KEY_PROGRAM_MODE = "MODE";
public static final String SETTING_SIMULATION = "SETTING_SIMULATION";
public static final String SETTING_LOAD_RESOURCES_FROM_PHN = "SETTING_LOAD_RESOURCES_FROM_PHN";
Expand Down Expand Up @@ -46,6 +49,9 @@ protected void onCreate(Bundle savedInstanceState) {
Intent intent = getIntent();
Bundle bundle = intent.getExtras();
String modeFlag = bundle.getString(INTENT_KEY_PROGRAM_MODE);
if (bundle.getBoolean(FROM_DATA_LOGGER)) {
DATA_LOGGER_MODE = true;
}
if (modeFlag.equals(FocusVisualFragment.FOCUS_FLAG))
mode = FOCUS_PROGRAM_MODE;
else if (modeFlag.equals(MemoryGraphParent.MEMORY_GRAPH_FLAG))
Expand Down Expand Up @@ -80,6 +86,7 @@ else if (modeFlag.equals(RelaxVisualFragment.RELAX_PROGRAM_FLAG))
setTitle(R.string.mem_graph);
Intent memIntent = new Intent(this, MemoryGraphParent.class);
memIntent.putExtra(LOG_FILE_KEY, bundle.getString(LOG_FILE_KEY));
memIntent.putExtra(FROM_DATA_LOGGER, DATA_LOGGER_MODE);
startActivity(memIntent);
finish();
break;
Expand All @@ -102,12 +109,16 @@ public boolean onSupportNavigateUp(){
@Override
public void onBackPressed() {
super.onBackPressed();
if (mode == FOCUS_PROGRAM_MODE)
startActivity(new Intent(this, FocusParentActivity.class));
else if (mode == RELAX_PROGRAM_MODE)
startActivity(new Intent(this, RelaxParentActivity.class));
else
startActivity(new Intent(this, NeuroLab.class));
finish();
if (!DATA_LOGGER_MODE) {
if (mode == FOCUS_PROGRAM_MODE)
startActivity(new Intent(this, FocusParentActivity.class));
else if (mode == RELAX_PROGRAM_MODE)
startActivity(new Intent(this, RelaxParentActivity.class));
else
startActivity(new Intent(this, NeuroLab.class));
finish();
} else {
startActivity(new Intent(this, DataLoggerActivity.class));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ public void afterTextChanged(Editable s) {
bundle.putString(ProgramModeActivity.INTENT_KEY_PROGRAM_MODE, FocusVisualFragment.FOCUS_FLAG);
bundle.putString(FocusVisualFragment.FOCUS_FLAG, FocusVisualFragment.FOCUS_FLAG);
bundle.putString(LOG_FILE_KEY, files.get(i).getAbsolutePath());
bundle.putBoolean(ProgramModeActivity.FROM_DATA_LOGGER, true);
intent.putExtras(bundle);
context.startActivity(intent);
((Activity) context).finish();
Expand All @@ -134,6 +135,7 @@ public void afterTextChanged(Editable s) {
Intent intent = new Intent(context, ProgramModeActivity.class);
bundle.putString(ProgramModeActivity.INTENT_KEY_PROGRAM_MODE, MemoryGraphParent.MEMORY_GRAPH_FLAG);
bundle.putString(LOG_FILE_KEY, files.get(i).getAbsolutePath());
bundle.putBoolean(ProgramModeActivity.FROM_DATA_LOGGER, true);
intent.putExtras(bundle);
context.startActivity(intent);
((Activity) context).finish();
Expand Down