Show picture popups in task activity feed

pull/14/head
Sam Bosley 14 years ago
parent 6714d4986b
commit b395725fcc

@ -303,7 +303,7 @@ public class EditNoteActivity extends LinearLayout implements TimerActionListene
this.addView(notesView); this.addView(notesView);
} }
if ( items.size() > commentItems) { if (items.size() > commentItems) {
Button loadMore = new Button(getContext()); Button loadMore = new Button(getContext());
loadMore.setText(R.string.TEA_load_more); loadMore.setText(R.string.TEA_load_more);
loadMore.setBackgroundColor(Color.alpha(0)); loadMore.setBackgroundColor(Color.alpha(0));
@ -368,12 +368,7 @@ public class EditNoteActivity extends LinearLayout implements TimerActionListene
// picture // picture
final AsyncImageView commentPictureView = (AsyncImageView)view.findViewById(R.id.comment_picture); { final AsyncImageView commentPictureView = (AsyncImageView)view.findViewById(R.id.comment_picture); {
if(TextUtils.isEmpty(item.commentPicture) || item.commentPicture.equals("null")) //$NON-NLS-1$ UpdateAdapter.setupImagePopupForCommentView(view, commentPictureView, item.commentPicture, item.title.toString(), fragment, imageCache);
commentPictureView.setVisibility(View.GONE);
else {
commentPictureView.setVisibility(View.VISIBLE);
commentPictureView.setUrl(item.commentPicture);
}
} }
} }

@ -405,23 +405,23 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
} }
mAdapter = new TaskEditViewPager(getActivity(), tabStyle); mAdapter = new TaskEditViewPager(getActivity(), tabStyle);
mAdapter.parent = this; mAdapter.parent = this;
mPager = (NestableViewPager) getView().findViewById(R.id.pager); mPager = (NestableViewPager) getView().findViewById(R.id.pager);
mPager.setAdapter(mAdapter); mPager.setAdapter(mAdapter);
mIndicator = (TabPageIndicator) getView().findViewById( mIndicator = (TabPageIndicator) getView().findViewById(
R.id.indicator); R.id.indicator);
mIndicator.setViewPager(mPager); mIndicator.setViewPager(mPager);
mIndicator.setOnPageChangeListener(this); mIndicator.setOnPageChangeListener(this);
if (moreControls.getParent() != null && moreControls.getParent() != mPager) { if (moreControls.getParent() != null && moreControls.getParent() != mPager) {
((ViewGroup) moreControls.getParent()).removeView(moreControls); ((ViewGroup) moreControls.getParent()).removeView(moreControls);
} }
commentsBar.setVisibility(View.VISIBLE); commentsBar.setVisibility(View.VISIBLE);
moreTab.setVisibility(View.VISIBLE); moreTab.setVisibility(View.VISIBLE);
} }
private void setCurrentTab(int position) { private void setCurrentTab(int position) {

@ -143,45 +143,8 @@ public class UpdateAdapter extends CursorAdapter {
final AsyncImageView commentPictureView = (AsyncImageView)view.findViewById(R.id.comment_picture); { final AsyncImageView commentPictureView = (AsyncImageView)view.findViewById(R.id.comment_picture); {
final String updatePicture = update.getValue(Update.PICTURE); final String updatePicture = update.getValue(Update.PICTURE);
if (!TextUtils.isEmpty(updatePicture) && !"null".equals(updatePicture)) { setupImagePopupForCommentView(view, commentPictureView, updatePicture,
commentPictureView.setVisibility(View.VISIBLE); update.getValue(Update.MESSAGE), fragment, imageCache);
commentPictureView.setUrl(updatePicture);
if(imageCache.contains(updatePicture)) {
try {
commentPictureView.setDefaultImageBitmap(imageCache.get(updatePicture));
} catch (IOException e) {
e.printStackTrace();
}
}
else {
commentPictureView.setUrl(updatePicture);
}
final String message = update.getValue(Update.MESSAGE);
view.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog image = new AlertDialog.Builder(fragment.getActivity()).create();
AsyncImageView imageView = new AsyncImageView(fragment.getActivity());
imageView.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
imageView.setDefaultImageResource(android.R.drawable.ic_menu_gallery);
imageView.setUrl(updatePicture);
image.setView(imageView);
image.setMessage(message);
image.setButton(fragment.getString(R.string.DLG_close), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
return;
}
});
image.show();
}
});
} else {
commentPictureView.setVisibility(View.GONE);
}
} }
// name // name
@ -200,6 +163,48 @@ public class UpdateAdapter extends CursorAdapter {
} }
public static void setupImagePopupForCommentView(View view, AsyncImageView commentPictureView, final String updatePicture,
final String message, final Fragment fragment, ImageDiskCache imageCache) {
if (!TextUtils.isEmpty(updatePicture) && !"null".equals(updatePicture)) { //$NON-NLS-1$
commentPictureView.setVisibility(View.VISIBLE);
commentPictureView.setUrl(updatePicture);
if(imageCache.contains(updatePicture)) {
try {
commentPictureView.setDefaultImageBitmap(imageCache.get(updatePicture));
} catch (IOException e) {
e.printStackTrace();
}
}
else {
commentPictureView.setUrl(updatePicture);
}
view.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog image = new AlertDialog.Builder(fragment.getActivity()).create();
AsyncImageView imageView = new AsyncImageView(fragment.getActivity());
imageView.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
imageView.setDefaultImageResource(android.R.drawable.ic_menu_gallery);
imageView.setUrl(updatePicture);
image.setView(imageView);
image.setMessage(message);
image.setButton(fragment.getString(R.string.DLG_close), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
return;
}
});
image.show();
}
});
} else {
commentPictureView.setVisibility(View.GONE);
}
}
public static String linkify (String string, String linkColor) { public static String linkify (String string, String linkColor) {
return String.format("<font color=%s>%s</font>", linkColor, string); //$NON-NLS-1$ return String.format("<font color=%s>%s</font>", linkColor, string); //$NON-NLS-1$
} }

Loading…
Cancel
Save