Skip to content

Commit

Permalink
Fixed a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mkulesh committed Dec 19, 2018
1 parent bba9eee commit ac7da47
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
6 changes: 3 additions & 3 deletions app/src/main/java/com/mkulesh/mmd/Experiment.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public Experiment(Context context)
super();
this.context = context;
ViewUtils.Debug(this, "created from scratch");
readParameters();
readParameters(context);
}

/**
Expand Down Expand Up @@ -236,7 +236,7 @@ public void run()
/**
* Procedure reads the atom parameters from shared preferences
*/
public void readParameters()
public void readParameters(Context context)
{
threadControl.pause();
synchronized (atomSet)
Expand All @@ -247,7 +247,7 @@ public void readParameters()
}
catch (Exception ex)
{
ex.printStackTrace();
ViewUtils.Debug(this, "error at reading parameters: " + ex.getLocalizedMessage());
}
}
threadControl.resume(false);
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/mkulesh/mmd/MMDWallpaperService.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void onVisibilityChanged(boolean visible)
{
if (preferenceChanged)
{
exp.readParameters();
exp.readParameters(context);
exp.updateBackgroundMode(true);
preferenceChanged = false;
}
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/java/com/mkulesh/mmd/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -304,4 +304,13 @@ public void updateFragmentInfo(BaseFragment fragment)
}
}
}

public void readExperiment()
{
if (experiment != null)
{
experiment.readParameters(this);
experiment.updateBackgroundMode(true);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,7 @@ public void onActivityResult(int requestCode, int resultCode, Intent data)
{
if (requestCode == SETTINGS_ACTIVITY_REQUEST)
{
activity.getExperiment().readParameters();
activity.getExperiment().updateBackgroundMode(true);
activity.readExperiment();
}
}

Expand Down

0 comments on commit ac7da47

Please sign in to comment.