talk-android icon indicating copy to clipboard operation
talk-android copied to clipboard

photo/video view: swipe left/right to show next/previous photo/video

Open jakobroehrl opened this issue 4 years ago • 8 comments

jakobroehrl avatar Nov 01 '21 12:11 jakobroehrl

Would like to work on this @AndyScherzinger @mahibi are there any specific ways to work on this ?

Smarshal21 avatar Feb 29 '24 15:02 Smarshal21

None that I am aware of @Smarshal21 Maybe @mahibi you have some opinion/requirements on it?

AndyScherzinger avatar Feb 29 '24 16:02 AndyScherzinger

Thanks for your interest to work on this @Smarshal21 Some first thoughts on this:

A good first step will be to familiarize with the package "shareditems" (SharedItemsRepositoryImpl, ...) to learn where the file list come from. The endpoint to use is https://nextcloud-talk.readthedocs.io/en/latest/chat/#list-items-of-type-shared-in-a-chat As it will be about photos and videos only, the SharedItemType to use is "MEDIA".

Then FullScreenImageActivity/FullScreenMediaActivity have to be modified/replaced. Seems ViewPager2 is recommended to do the swiping. Not sure if it would make sense to combine rendering stuff from FullScreenImageActivity/FullScreenMediaActivity to have only one UI-view which can handle both photo/video.

Anyway it would make sense to create MVVM structure to have the data logic separated from rendering. Also, the viewModel could take care about downloading the next files in advance when the user swipes. See FileViewerUtils#openOrDownloadFile for download/cached handling.

Just let me know if you have any questions.

mahibi avatar Mar 04 '24 14:03 mahibi

Thanks for your interest to work on this @Smarshal21 Some first thoughts on this:

A good first step will be to familiarize with the package "shareditems" (SharedItemsRepositoryImpl, ...) to learn where the file list come from. The endpoint to use is https://nextcloud-talk.readthedocs.io/en/latest/chat/#list-items-of-type-shared-in-a-chat As it will be about photos and videos only, the SharedItemType to use is "MEDIA".

Then FullScreenImageActivity/FullScreenMediaActivity have to be modified/replaced. Seems ViewPager2 is recommended to do the swiping. Not sure if it would make sense to combine rendering stuff from FullScreenImageActivity/FullScreenMediaActivity to have only one UI-view which can handle both photo/video.

Anyway it would make sense to create MVVM structure to have the data logic separated from rendering. Also, the viewModel could take care about downloading the next files in advance when the user swipes. See FileViewerUtils#openOrDownloadFile for download/cached handling.

Just let me know if you have any questions.

Sure will look into it. So the best thing to do would be to let the viewmodel return the shareditems list which can be used to display the next image while swiping right? and combining FullScreenImageActivity && FullScreenMediaActivity to have only one UI-view.

Smarshal21 avatar Mar 10 '24 11:03 Smarshal21

question from @Smarshal21 in chat:

how to access user and roomToken in FullScreenImageActivity in order to initialise repositoryParameters which helps in loading the media or images

mahibi avatar Mar 25 '24 08:03 mahibi

question from @Smarshal21 in chat:

how to access user and roomToken in FullScreenImageActivity in order to initialise repositoryParameters which helps in loading the media or images

  • user:

@Inject lateinit var currentUserProvider: CurrentUserProviderNew

val user = currentUserProvider!!.currentUser.blockingGet()

  • roomToken:

for now, i would say pass the token where needed via methods in FileViewerUtils (in FileViewerUtils you can find the roomToken in the ChatMessage) and then pass to FullScreenImageActivity via intent.

For future (not in this PR), we might think about if it makes sense to store the currentRoom and also access it via injection.

mahibi avatar Mar 25 '24 08:03 mahibi