Permalink
Browse files

Proper fix for payload editing bug.

  • Loading branch information...
1 parent 00d9994 commit f358651bc0bec89cef457c65bff3eda3900337d4 @hdweiss hdweiss committed Dec 11, 2012
View
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<lint>
+ <issue id="ContentDescription" severity="ignore" />
<issue id="HardcodedText">
<ignore path="res/layout/outline.xml" />
</issue>
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/capture_widget_root"
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -14,7 +14,6 @@
import com.actionbarsherlock.view.MenuItem;
import com.matburt.mobileorg.R;
import com.matburt.mobileorg.Gui.Capture.DateTableRow.DateTableRowListener;
-import com.matburt.mobileorg.OrgData.OrgNode;
import com.matburt.mobileorg.OrgData.OrgNodePayload;
import com.matburt.mobileorg.OrgData.OrgNodeTimeDate;
@@ -30,7 +29,7 @@
DateTableRow deadlineEntry = null;
DateTableRow timestampEntry = null;
- private OrgNode node;
+ private OrgNodePayload payload;
private OnDatesModifiedListener mListener;
@@ -61,7 +60,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
EditActivity editActivity = (EditActivity) getActivity();
- this.node = editActivity.getOrgNode();
+ this.payload = editActivity.getOrgNodePayload();
if(savedInstanceState != null)
restoreInstanceState(savedInstanceState);
@@ -74,7 +73,6 @@ public void onActivityCreated(Bundle savedInstanceState) {
public void setupDates() {
removeDateEntries();
- OrgNodePayload payload = this.node.getOrgNodePayload();
payload.getCleanedPayload(); // Hack
addDateScheduled(payload.getScheduled());
@@ -165,7 +163,6 @@ public void setModifable(boolean enabled) {
}
private void announceDateModified(OrgNodeTimeDate.TYPE type) {
- OrgNodePayload payload = this.node.getOrgNodePayload();
switch (type) {
case Scheduled:
payload.insertOrReplaceDate(type, getScheduled());
@@ -16,6 +16,7 @@
import com.matburt.mobileorg.OrgData.OrgEdit;
import com.matburt.mobileorg.OrgData.OrgFile;
import com.matburt.mobileorg.OrgData.OrgNode;
+import com.matburt.mobileorg.OrgData.OrgNodePayload;
import com.matburt.mobileorg.OrgData.OrgProviderUtils;
import com.matburt.mobileorg.Services.SyncService;
import com.matburt.mobileorg.util.OrgNodeNotFoundException;
@@ -36,9 +37,11 @@
* can't be found on save.
*/
private String nodeOlpPath = "";
- private OrgNode node;
private String actionMode;
+ private OrgNode node;
+ private OrgNodePayload editPayload;
+
private ContentResolver resolver;
@Override
@@ -137,6 +140,13 @@ public OrgNode getOrgNode() {
return this.node;
}
+ public OrgNodePayload getOrgNodePayload() {
+ if (this.editPayload == null)
+ this.editPayload = new OrgNodePayload(node.getPayload());
+
+ return this.editPayload;
+ }
+
public String getActionMode() {
return this.actionMode;
}
@@ -16,7 +16,6 @@
import com.matburt.mobileorg.R;
import com.matburt.mobileorg.Gui.ViewFragment;
import com.matburt.mobileorg.Gui.Theme.DefaultTheme;
-import com.matburt.mobileorg.OrgData.OrgNode;
import com.matburt.mobileorg.OrgData.OrgNodePayload;
public class PayloadFragment extends ViewFragment {
@@ -81,8 +80,7 @@ public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
EditActivity editActivity = (EditActivity) getActivity();
- OrgNode node = editActivity.getOrgNode();
- this.payload = new OrgNodePayload(node.getOrgNodePayload().get());
+ this.payload = editActivity.getOrgNodePayload();
if(savedInstanceState != null)
restoreInstanceState(savedInstanceState);
@@ -456,7 +456,8 @@ public OrgNode getParentSafe(String olpPath, ContentResolver resolver) {
return parent;
}
- public void generateApplyWriteEdits(OrgNode newNode, String olpPath, ContentResolver resolver) {
+ public void generateApplyWriteEdits(OrgNode newNode, String olpPath,
+ ContentResolver resolver) {
ArrayList<OrgEdit> generateEditNodes = generateApplyEditNodes(newNode, olpPath, resolver);
boolean generateEdits = !getFilename(resolver).equals(FileUtils.CAPTURE_FILE);
@@ -469,7 +470,8 @@ public void generateApplyWriteEdits(OrgNode newNode, String olpPath, ContentReso
return generateApplyEditNodes(newNode, "", resolver);
}
- public ArrayList<OrgEdit> generateApplyEditNodes(OrgNode newNode, String olpPath, ContentResolver resolver) {
+ public ArrayList<OrgEdit> generateApplyEditNodes(OrgNode newNode,
+ String olpPath, ContentResolver resolver) {
ArrayList<OrgEdit> edits = new ArrayList<OrgEdit>();
if (!name.equals(newNode.name)) {

0 comments on commit f358651

Please sign in to comment.