Fixed bugs with handling camera results in task edit fragment

pull/14/head
Sam Bosley 12 years ago
parent 55bed5b687
commit 2ca7ac227e

@ -91,13 +91,13 @@ public class EditNoteActivity extends LinearLayout implements TimerActionListene
private View commentButton; private View commentButton;
private int commentItems = 10; private int commentItems = 10;
private ImageButton pictureButton; private ImageButton pictureButton;
private Bitmap pendingCommentPicture = null; private static Bitmap pendingCommentPicture = null;
private final Fragment fragment; private final Fragment fragment;
private final ImageDiskCache imageCache; private final ImageDiskCache imageCache;
private final int cameraButton; private final int cameraButton;
private final String linkColor; private final String linkColor;
private boolean respondToPicture; private static boolean respondToPicture = false;
private final List<UpdatesChangedListener> listeners = new LinkedList<UpdatesChangedListener>(); private final List<UpdatesChangedListener> listeners = new LinkedList<UpdatesChangedListener>();
@ -123,6 +123,9 @@ public class EditNoteActivity extends LinearLayout implements TimerActionListene
parentView = parent; parentView = parent;
loadViewForTaskID(t); loadViewForTaskID(t);
if (pendingCommentPicture != null)
pictureButton.setImageBitmap(pendingCommentPicture);
} }
private int getDefaultCameraButton() { private int getDefaultCameraButton() {

@ -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() { private void loadMoreContainer() {
View moreTab = (View) getView().findViewById(R.id.more_container); View moreTab = (View) getView().findViewById(R.id.more_container);
View commentsBar = (View) getView().findViewById(R.id.updatesFooter); View commentsBar = (View) getView().findViewById(R.id.updatesFooter);
@ -397,20 +407,17 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
tabStyle = TAB_STYLE_ACTIVITY; tabStyle = TAB_STYLE_ACTIVITY;
if (editNotes == null) { if (editNotes == null) {
editNotes = new EditNoteActivity(this, getView(), instantiateEditNotes();
idParam);
editNotes.setLayoutParams(new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT));
editNotes.addListener(this);
if (timerAction != null) {
timerAction.addListener(editNotes);
}
} }
else { else {
editNotes.loadViewForTaskID(idParam); editNotes.loadViewForTaskID(idParam);
} }
if (timerAction != null) {
timerAction.removeListener(editNotes);
timerAction.addListener(editNotes);
}
editNotes.addListener(this); editNotes.addListener(this);
Handler refreshHandler = new Handler(); Handler refreshHandler = new Handler();
@ -1197,6 +1204,9 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
@Override @Override
public void onActivityResult(int requestCode, int resultCode, Intent data) { public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (editNotes == null)
instantiateEditNotes();
if (taskRabbitControl != null && taskRabbitControl.activityResult(requestCode, resultCode, data)) { if (taskRabbitControl != null && taskRabbitControl.activityResult(requestCode, resultCode, data)) {
return; return;
} else if (editNotes != null && editNotes.activityResult(requestCode, resultCode, data)) { } else if (editNotes != null && editNotes.activityResult(requestCode, resultCode, data)) {

Loading…
Cancel
Save