diff --git a/astrid/plugin-src/com/todoroo/astrid/notes/EditNoteActivity.java b/astrid/plugin-src/com/todoroo/astrid/notes/EditNoteActivity.java index 0d455f15a..6b7706a7d 100644 --- a/astrid/plugin-src/com/todoroo/astrid/notes/EditNoteActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/notes/EditNoteActivity.java @@ -91,13 +91,13 @@ public class EditNoteActivity extends LinearLayout implements TimerActionListene private View commentButton; private int commentItems = 10; private ImageButton pictureButton; - private Bitmap pendingCommentPicture = null; + private static Bitmap pendingCommentPicture = null; private final Fragment fragment; private final ImageDiskCache imageCache; private final int cameraButton; private final String linkColor; - private boolean respondToPicture; + private static boolean respondToPicture = false; private final List listeners = new LinkedList(); @@ -123,6 +123,9 @@ public class EditNoteActivity extends LinearLayout implements TimerActionListene parentView = parent; loadViewForTaskID(t); + + if (pendingCommentPicture != null) + pictureButton.setImageBitmap(pendingCommentPicture); } private int getDefaultCameraButton() { diff --git a/astrid/src/com/todoroo/astrid/activity/TaskEditFragment.java b/astrid/src/com/todoroo/astrid/activity/TaskEditFragment.java index 27d7ced8a..df8ec285e 100755 --- a/astrid/src/com/todoroo/astrid/activity/TaskEditFragment.java +++ b/astrid/src/com/todoroo/astrid/activity/TaskEditFragment.java @@ -383,6 +383,16 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener { } } + private void instantiateEditNotes() { + long idParam = getActivity().getIntent().getLongExtra(TOKEN_ID, -1L); + editNotes = new EditNoteActivity(this, getView(), + idParam); + editNotes.setLayoutParams(new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT, + LayoutParams.WRAP_CONTENT)); + + editNotes.addListener(this); + } + private void loadMoreContainer() { View moreTab = (View) getView().findViewById(R.id.more_container); View commentsBar = (View) getView().findViewById(R.id.updatesFooter); @@ -397,20 +407,17 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener { tabStyle = TAB_STYLE_ACTIVITY; if (editNotes == null) { - editNotes = new EditNoteActivity(this, getView(), - idParam); - editNotes.setLayoutParams(new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT, - LayoutParams.WRAP_CONTENT)); - - editNotes.addListener(this); - if (timerAction != null) { - timerAction.addListener(editNotes); - } + instantiateEditNotes(); } else { editNotes.loadViewForTaskID(idParam); } + if (timerAction != null) { + timerAction.removeListener(editNotes); + timerAction.addListener(editNotes); + } + editNotes.addListener(this); Handler refreshHandler = new Handler(); @@ -1197,6 +1204,9 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener { @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { + if (editNotes == null) + instantiateEditNotes(); + if (taskRabbitControl != null && taskRabbitControl.activityResult(requestCode, resultCode, data)) { return; } else if (editNotes != null && editNotes.activityResult(requestCode, resultCode, data)) {