Separating methods for updating the model to a sepatate class.
Removing static access to model update methods, to allow for better
access control and testing
Change-Id: I9afe004dbf1b2fe50df422fd28bceea9230a4704
diff --git a/src/com/android/launcher3/FolderInfo.java b/src/com/android/launcher3/FolderInfo.java
index 5fff2e7..2c69d0a 100644
--- a/src/com/android/launcher3/FolderInfo.java
+++ b/src/com/android/launcher3/FolderInfo.java
@@ -16,9 +16,9 @@
package com.android.launcher3;
-import android.content.Context;
import android.os.Process;
+import com.android.launcher3.model.ModelWriter;
import com.android.launcher3.util.ContentWriter;
import java.util.ArrayList;
@@ -128,17 +128,17 @@
/**
* @param option flag to set or clear
* @param isEnabled whether to set or clear the flag
- * @param context if not null, save changes to the db.
+ * @param writer if not null, save changes to the db.
*/
- public void setOption(int option, boolean isEnabled, Context context) {
+ public void setOption(int option, boolean isEnabled, ModelWriter writer) {
int oldOptions = options;
if (isEnabled) {
options |= option;
} else {
options &= ~option;
}
- if (context != null && oldOptions != options) {
- LauncherModel.updateItemInDatabase(context, this);
+ if (writer != null && oldOptions != options) {
+ writer.updateItemInDatabase(this);
}
}
}