Messaging: Further code improvements
* Remove redundant casts * getParcelable(ArrayList|Exra) without class argument is deprecated * ViewPager.setOnPageChangeListener -> addOnPageChangeListener * RecyclerView.setOnScrollListener -> addOnScrollListener * Remove unused initializations * Remove unused code Change-Id: I21beb6c90c675a4f2cfd7e3d5ebbd18b745f5911
This commit is contained in:
@@ -66,7 +66,7 @@ public class AttachmentPreviewFactory {
|
||||
final int viewType, final boolean startImageRequest,
|
||||
@Nullable final OnAttachmentClickListener clickListener) {
|
||||
final String contentType = attachmentData.getContentType();
|
||||
View attachmentView = null;
|
||||
View attachmentView;
|
||||
if (attachmentData instanceof PendingAttachmentData) {
|
||||
attachmentView = createPendingAttachmentPreview(layoutInflater, parent,
|
||||
(PendingAttachmentData) attachmentData);
|
||||
@@ -85,7 +85,7 @@ public class AttachmentPreviewFactory {
|
||||
}
|
||||
|
||||
// Some views have a caption, set the text/visibility if one exists
|
||||
final TextView captionView = (TextView) attachmentView.findViewById(R.id.caption);
|
||||
final TextView captionView = attachmentView.findViewById(R.id.caption);
|
||||
if (captionView != null) {
|
||||
final String caption = attachmentData.getText();
|
||||
captionView.setVisibility(TextUtils.isEmpty(caption) ? View.GONE : View.VISIBLE);
|
||||
@@ -159,8 +159,7 @@ public class AttachmentPreviewFactory {
|
||||
break;
|
||||
}
|
||||
final View view = layoutInflater.inflate(layoutId, parent, false /* attachToRoot */);
|
||||
final AsyncImageView imageView = (AsyncImageView) view.findViewById(
|
||||
R.id.attachment_image_view);
|
||||
final AsyncImageView imageView = view.findViewById(R.id.attachment_image_view);
|
||||
int maxWidth = imageView.getMaxWidth();
|
||||
int maxHeight = imageView.getMaxHeight();
|
||||
if (viewType == TYPE_CHOOSER_GRID) {
|
||||
@@ -187,8 +186,7 @@ public class AttachmentPreviewFactory {
|
||||
final ViewGroup parent, final PendingAttachmentData attachmentData) {
|
||||
final View pendingItemView = layoutInflater.inflate(R.layout.attachment_pending_item,
|
||||
parent, false);
|
||||
final ImageView imageView = (ImageView)
|
||||
pendingItemView.findViewById(R.id.pending_item_view);
|
||||
final ImageView imageView = pendingItemView.findViewById(R.id.pending_item_view);
|
||||
final ViewGroup.LayoutParams layoutParams = imageView.getLayoutParams();
|
||||
final int defaultSize = layoutInflater.getContext().getResources().getDimensionPixelSize(
|
||||
R.dimen.pending_attachment_size);
|
||||
@@ -218,8 +216,7 @@ public class AttachmentPreviewFactory {
|
||||
break;
|
||||
}
|
||||
final View view = layoutInflater.inflate(layoutId, parent, false /* attachToRoot */);
|
||||
final PersonItemView vcardPreview = (PersonItemView) view.findViewById(
|
||||
R.id.vcard_attachment_view);
|
||||
final PersonItemView vcardPreview = view.findViewById(R.id.vcard_attachment_view);
|
||||
vcardPreview.setAvatarOnly(viewType != AttachmentPreviewFactory.TYPE_SINGLE);
|
||||
vcardPreview.bind(DataModel.get().createVCardContactItemData(layoutInflater.getContext(),
|
||||
attachmentData));
|
||||
@@ -261,8 +258,7 @@ public class AttachmentPreviewFactory {
|
||||
break;
|
||||
}
|
||||
final View view = layoutInflater.inflate(layoutId, parent, false /* attachToRoot */);
|
||||
final AudioAttachmentView audioView = (AudioAttachmentView)
|
||||
view.findViewById(R.id.audio_attachment_view);
|
||||
final AudioAttachmentView audioView = view.findViewById(R.id.audio_attachment_view);
|
||||
audioView.bindMessagePartData(
|
||||
attachmentData, false /* incoming */, false /* showAsSelected */);
|
||||
return view;
|
||||
|
||||
Reference in New Issue
Block a user