Small improvements

pull/191/head
M66B 4 years ago
parent eccfdb9bc9
commit 63d8ed6a3c

@ -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) {

Loading…
Cancel
Save