/** * Add the picture to the photo gallery. Must be called on all camera images or they will * disappear once taken. */ protected void onTakedPhoto(int requestCode) { if (requestCode != TakePhotoPresenter.REQUEST_IMAGE_CAPTURE) { return; } String imgUri = mTakePhotoPresenter.updateImageToMediaLibrary(); List<String> selectedList = mImageSelectedAdapter.getDataSource(); // 更新媒体库 selectedList.remove(Constants.ADD_IMAGE_PATH_SAMPLE); if (selectedList.size() < 9) { selectedList.add(imgUri); appendAddImageIfLessThanNine(selectedList); } else { ToastMsg.showShortMsgByResName("umeng_comm_image_overflow"); } mImageSelectedAdapter.notifyDataSetChanged(); }
@Override public void restoreFeedItem(FeedItem feedItem) { mEditText.setText(feedItem.text); mLocationTv.setText(feedItem.locationAddr); mImageSelectedAdapter.getDataSource().clear(); int count = feedItem.imageUrls.size(); for (int i = 0; i < count; i++) { // 图片 mImageSelectedAdapter.getDataSource().add(feedItem.imageUrls.get(i).originImageUrl); } // 图片 if (mImageSelectedAdapter.getDataSource().size() < 9) { mImageSelectedAdapter.getDataSource().add(0, Constants.ADD_IMAGE_PATH_SAMPLE); } mImageSelectedAdapter.notifyDataSetChanged(); // 好友 mSelectFriends.addAll(feedItem.atFriends); // 话题 mSelecteTopics.addAll(feedItem.topics); FeedViewRender.parseTopicsAndFriends(mEditText, feedItem); // 设置光标位置 mEditText.setSelection(mEditText.getText().length()); }