Skip to content

Commit

Permalink
fix data log back button, fix fossasia#633
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeWithSouma committed Dec 13, 2020
1 parent 2a1350a commit 676a6bd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import android.view.WindowManager;
import android.widget.Toast;

import io.neurolab.R;
import io.neurolab.fragments.FocusVisualFragment;
Expand All @@ -18,6 +19,9 @@ public class ProgramModeActivity extends AppCompatActivity {
public static final int FOCUS_PROGRAM_MODE = 1;
public static final int RELAX_PROGRAM_MODE = 2;
public static final int MEMORY_GRAPH_MODE = 3;
private static boolean DATA_LOGGER_MODE = false;

public static final String FROM_DATA_LOGGER = "FROM_DATA_LOGGER";

public static final String INTENT_KEY_PROGRAM_MODE = "MODE";
public static final String SETTING_SIMULATION = "SETTING_SIMULATION";
Expand Down Expand Up @@ -53,6 +57,9 @@ else if (modeFlag.equals(MemoryGraphParent.MEMORY_GRAPH_FLAG))
else if (modeFlag.equals(RelaxVisualFragment.RELAX_PROGRAM_FLAG))
mode = RELAX_PROGRAM_MODE;

if (bundle.getBoolean(FROM_DATA_LOGGER))
DATA_LOGGER_MODE = true;

// settingSimulation = bundle.getBoolean(SETTING_SIMULATION);
// settingLoadResourcesFromPhn = bundle.getBoolean(SETTING_LOAD_RESOURCES_FROM_PHN);
// settingAudioFeedback = bundle.getBoolean(SETTING_AUDIO_FEEDBACK);
Expand Down Expand Up @@ -102,7 +109,11 @@ public boolean onSupportNavigateUp(){
@Override
public void onBackPressed() {
super.onBackPressed();
if (mode == FOCUS_PROGRAM_MODE)
if (DATA_LOGGER_MODE) {
DATA_LOGGER_MODE = false;
startActivity(new Intent(this, DataLoggerActivity.class));
}
else if (mode == FOCUS_PROGRAM_MODE)
startActivity(new Intent(this, FocusParentActivity.class));
else if (mode == RELAX_PROGRAM_MODE)
startActivity(new Intent(this, RelaxParentActivity.class));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ public void afterTextChanged(Editable s) {
Bundle bundle = new Bundle();
Intent intent = new Intent(context, ProgramModeActivity.class);
bundle.putString(ProgramModeActivity.INTENT_KEY_PROGRAM_MODE, FocusVisualFragment.FOCUS_FLAG);
bundle.putBoolean(ProgramModeActivity.FROM_DATA_LOGGER,true);
bundle.putString(FocusVisualFragment.FOCUS_FLAG, FocusVisualFragment.FOCUS_FLAG);
bundle.putString(LOG_FILE_KEY, files.get(i).getAbsolutePath());
intent.putExtras(bundle);
Expand All @@ -133,6 +134,7 @@ public void afterTextChanged(Editable s) {
Bundle bundle = new Bundle();
Intent intent = new Intent(context, ProgramModeActivity.class);
bundle.putString(ProgramModeActivity.INTENT_KEY_PROGRAM_MODE, MemoryGraphParent.MEMORY_GRAPH_FLAG);
bundle.putBoolean(ProgramModeActivity.FROM_DATA_LOGGER,true);
bundle.putString(LOG_FILE_KEY, files.get(i).getAbsolutePath());
intent.putExtras(bundle);
context.startActivity(intent);
Expand Down

0 comments on commit 676a6bd

Please sign in to comment.