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