Small improvements

This commit is contained in:
M66B 2021-01-05 13:42:43 +01:00
parent eccfdb9bc9
commit 63d8ed6a3c
1 changed files with 2 additions and 6 deletions

View File

@ -276,15 +276,11 @@ public class MessageClassifier {
Helper.writeText(file, toJson().toString(2));
dirty = false;
Log.i("Classifier data saved");
}
private static synchronized void load(Context context) throws IOException, JSONException {
if (loaded)
return;
if (!isEnabled(context))
if (loaded || dirty)
return;
classMessages.clear();
@ -301,10 +297,10 @@ public class MessageClassifier {
}
static synchronized void clear(Context context) {
Log.i("Classifier clear");
classMessages.clear();
wordClassFrequency.clear();
dirty = true;
Log.i("Classifier data cleared");
}
static boolean isEnabled(Context context) {