Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

MediaPreviewer : clean files and manage bitmap with Glide #2445

Merged
merged 6 commits into from
Jul 19, 2018

Conversation

ganfra
Copy link
Member

@ganfra ganfra commented Jul 18, 2018

Some improvements over the MediaPreviewer classes

@ganfra ganfra requested a review from bmarty July 18, 2018 13:58
@bmarty
Copy link
Member

bmarty commented Jul 18, 2018

Search for forbidden patterns in code...
❌ Error: '.{161}' detected 1 time, in file './vector/src/main/java/im/vector/activity/MediaPreviewerActivity.java'.
Rule: Line length is limited to 160 chars. Please split long lines
1 forbidden pattern detected

Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few remarks

statusBar.setBackgroundColor(color);
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void setStatusBarColor(@ColorRes int statusBarColor) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove then?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooops

*/
public MediaPreviewAdapter(List<RoomMediaMessage> imagePreviewList, ItemPositionChangedListener itemPositionChangedListener) {
public MediaPreviewAdapter(final List<RoomMediaMessage> imagePreviewList, EventListener mEventListener) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

param name convention

super(itemView);
ButterKnife.bind(this, itemView);
}
this.mEventListener = mEventListener;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this.


<TextView
android:id="@+id/file_name"
android:id="@+id/media_previewer_file_name"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for a background here? (I've not run it)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the text is hardly visible, maybe add transparent background

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, added.

void onMediaMessagePreviewClicked(RoomMediaMessage roomMediaMessage);
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove extra new lines pls

@bmarty
Copy link
Member

bmarty commented Jul 18, 2018

no more crashes when selecting a large number of media?
-> Tested with 25 images with success

mPreviewerRecyclerView.setLayoutManager(linearLayoutManager);
final MediaPreviewAdapter mediaPreviewAdapter = new MediaPreviewAdapter(sharedDataItems, this);
mPreviewerRecyclerView.setAdapter(mediaPreviewAdapter);
updatePreview(sharedDataItems.get(0));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's strange, it's working, but I think this line should be outside the else block, no?

Copy link
Member

@bmarty bmarty Jul 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually it's not working if you select "Use native camera" in the settings if if you take a photo. Can you check this case pls?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, just saw that too

final MediaPreviewAdapter mediaPreviewAdapter = new MediaPreviewAdapter(sharedDataItems, this);
mPreviewerRecyclerView.setAdapter(mediaPreviewAdapter);

if (!sharedDataItems.isEmpty()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this cannot be empty, no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup

@ganfra ganfra merged commit cc1d695 into develop Jul 19, 2018
@ganfra ganfra deleted the feature/media_previewer_review branch July 19, 2018 09:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants