Commit Graph

82 Commits

Author SHA1 Message Date
Luca Stefani dd81817e66
Glimpse: Increase memory cache size
It's now 5% bigger

Change-Id: Ic1b1d87f0e2adff64fc354ff6207e96243657c5a
2023-08-19 17:09:02 +02:00
Luca Stefani a528b7302b
Glimpse: Specify the memory key for images loaded via Coil
If the Uri matches but sizes don't Coil will re-fetch the image
from disk, that's not optimal.

Change-Id: I2336b851f2b11819845f4bd5815d1ec60b7fccd4
2023-08-19 17:08:19 +02:00
Luca Stefani c45a4cb57b
Glimpse: Include the thumbnail media in album
Change-Id: I5041f0c947d6645447e3c0480ca364fb3552cdf2
2023-08-19 17:06:58 +02:00
Luca Stefani 2178130037
Glimpse: Actually lazy load ExoPlayer
Change-Id: Ic5235fd8b855c4e91a8bdfa60ebe4c398870660a
2023-08-19 16:24:35 +02:00
Luca Stefani 23ae63d0f3
Glimpse: Collect on resume
ContentObservers are tied to the lifecycle of the application
and must be started/stopped onResume to ensure proper callbacks

Change-Id: I63c1a6ebc3e734a84aa729f36296d570801e6c70
2023-08-19 15:58:59 +02:00
Luca Stefani f5b020e292
Glimpse: Conflate any flow from URIs
If we get a lot of new files we want to drop any "old" event

Change-Id: I913672d4b651ca0473edc530e0f57996fd4b6830
2023-08-19 15:58:59 +02:00
Luca Stefani 2790d4977d
Glimpse: Switch AlbumThumbnailAdapter to `var data`
A bit nicer instead of nullable list

Change-Id: If56620b5883c0e3b53a7fa0d62311c2e0999ca66
2023-08-19 15:58:59 +02:00
Luca Stefani d4b1bfd6b2
Glimpse: Don't use CursorLoader
Instead manually invoke the query and listen for updates
on the external media Uri to trigger updates.

Change-Id: I0d86484dfa453cce9910d2bcadee6191de5aed28
2023-08-19 15:58:59 +02:00
Luca Stefani af3e76b1c3 Glimpse: Implement data loading using the Repository/ViewModel pattern
Change-Id: Ia152000673b36e7f690ac5f2665ef1a0204bb339
2023-08-15 20:26:24 +02:00
Luca Stefani 72e7b9b16f Glimpse: Only specify the necessary projections to AlbumsProjection
Change-Id: I6289cc0f35bce8a28fb6cf8de3da725b11a819ab
2023-08-15 18:41:05 +02:00
Luca Stefani f3869838c4 Glimpse: Add bucket ID to Media
Change-Id: I0f94f8444ac11a65a68e7913f29c3208a03c315c
2023-08-15 18:41:00 +02:00
Luca Stefani 5dfb70cebe Glimpse: MEDIA_STORE_REELS_LOADER_ID -> MEDIA_STORE_MEDIA_LOADER_ID
Change-Id: I4c626456b29f841aaa7b4b9cc5df03b6a1bd80c4
2023-08-15 18:40:57 +02:00
Luca Stefani 4a36f5dd5c Glimpse: GlimpseCursorLoader: Enforce non-null queryArgs
Change-Id: I35fa64c8bd03eddc98ed15e728cd8e43d06447c7
2023-08-15 18:40:52 +02:00
Luca Stefani 50b56e82b8 Glimpse: Set extra mime types in shareIntent()
Change-Id: I5b86fbc788dc5fb1da073a500868ac2e3683ad65
2023-08-09 17:48:15 +02:00
Luca Stefani 020ea47a06
Glimpse: Preload 2 pages on either side of current page
Better user experience while scrolling

Change-Id: Ic707c2f37a4cef1954be604e990e3bcab7778f4c
2023-08-09 15:17:08 +02:00
Luca Stefani de55efce60
Glimpse: Specify size of the image to load
It allows Coil to avoid caching the whole image for reel viewing

Change-Id: I0994848364aea8592325570b8dcfd6fe9efd713b
2023-08-09 15:17:08 +02:00
LuK1337 2bfdb7abb3
Glimpse: Improve Album::equals() implementation
Let's just compare all fields instead of just the id.

Test: Go to albums, take a screenshot and notice that "{} items"
      increased by one.
Change-Id: I770bb31ccd02964672280c0dffe393d1d2f005fd
2023-08-09 15:17:08 +02:00
Sebastiano Barezzi b9f7c5d16c
Glimpse: Implement trashed undo button
Change-Id: Ibb39ba3d4525655757e97453ff4f937eeafcd498
2023-08-09 15:17:08 +02:00
Sebastiano Barezzi 6b81f8e0f8
Glimpse: Update favorite button on contract result
Change-Id: I4746412b910da62cc2c10af6d93b02cbc5cba82b
2023-08-09 15:17:08 +02:00
Sebastiano Barezzi d68ca22081
Glimpse: Anchor Snackbars to bottom sheet
* Let's not cover action buttons

Change-Id: Idd78c88c1bc61de05b3cd25cb262d4e66dea01b9
2023-08-09 15:17:08 +02:00
Sebastiano Barezzi f8da706637
Glimpse: Add delete dialogs
* Now that we might have permission to do stuff without the user's
  approval, this is needed

Change-Id: I807d6cd8a11ea24bdd20b737747dfafbfa582624
2023-08-09 15:17:08 +02:00
Sebastiano Barezzi 128c7de377
Glimpse: Add MANAGE_MEDIA permission
Change-Id: I6de0dcff96884d3bbf8e75d32e10a3dc04778a67
2023-08-09 15:17:08 +02:00
LuK1337 e62b2090ca Glimpse: Fix status bar color on light theme
Change-Id: I549025a6c1a4087124c2c85e81a6b3922db40dec
2023-08-08 16:27:00 +02:00
LuK1337 a99d51f75c Glimpse: Move no permissions message to resources
Also sync it with Aperture.

Change-Id: Id0e2cf1e1183079f93f733c5c2710781872bf905
2023-08-08 15:44:55 +02:00
Sebastiano Barezzi 395b012086
Glimpse: Reorder permissions
Change-Id: I16aef1154b244a06e0610899d17f3ec566dc0683
2023-08-08 03:25:41 +02:00
Sebastiano Barezzi 7c701c0125
Glimpse: Don't include trashed medias in albums
Change-Id: Ie447b3770471c53e44d04cfde12e41f295d94b0e
2023-08-08 03:24:44 +02:00
Luca Stefani 79a420286d Glimpse: Share common projections
Change-Id: I362799adb1200c46bcbbaed31fb9d537ef21e565
2023-08-07 23:36:58 +02:00
Luca Stefani 1cb30ec8bb Glimpse: Try to set proper mime type when sharing media
We also have to grant read URI permission in case
the receiving end doesn't have the read media permission.

Change-Id: I28b77b680bdff123a0c737eb41ddcdbe34dba1cb
2023-08-07 23:36:58 +02:00
Luca Stefani 568bd417f2 Glimpse: Hook up adjust button
Change-Id: Id72ec262b0a237b7f07b16f465912eb19cf705e8
2023-08-07 23:36:58 +02:00
Luca Stefani b57d776fc2 Glimpse: Fetch Media mime type
Change-Id: I76dd6b4536e8784fdab4b4a9fd9627a9161e90dd
2023-08-07 23:36:58 +02:00
Luca Stefani dc0aa894df Revert "Glimpse: ThumbnailLayoutManager: Ignore OOB in onLayoutChildren"
Not needed anymore, we don't insert items onLayout.

This reverts commit ad1c6996f5.

Change-Id: Icc482e8f97229c05490786282e00e33da4ad441f
2023-08-07 23:23:17 +02:00
Luca Stefani 336a869299 Glimpse: Always take into account we'll have 1 header in ThumbnailAdapter
Otherwise the recycler view won't call us enough times since we
know we'll always need at least one header.
Once an header item has been added we start using that has the
count of the items.

Change-Id: Ibee23f8bc14cacca125647335725e566475985c7
2023-08-07 23:23:17 +02:00
Luca Stefani 75d8906c4a Glimpse: Don't inline sortOrder in CursorLoader init
Change-Id: I92e6bafe56dd2cfe0d12d072fc36f03757205abb
2023-08-07 01:43:25 +02:00
Luca Stefani 270f8099be Glimpse: Abstract away the query builder
Change-Id: I0e58cb4179c0e7852275d74f501d40b27a68dae1
2023-08-07 01:43:25 +02:00
Sebastiano Barezzi db7fdd00de
Glimpse: Add missed SDK check
Change-Id: I3202c71f6047e987fbcdd67041df676b9ab153e9
2023-08-07 01:31:34 +02:00
Sebastiano Barezzi d491334a6d Glimpse: MediaViewerFragment: Reload current page content when cursor changes
Change-Id: I0af966fc9060baf3aabda9d04516d0749e20ebf5
2023-08-06 18:34:11 +02:00
Sebastiano Barezzi e048906a31 Glimpse: Add trash action
Change-Id: Iaf4d5a13cbe0e56d7b6be62fe3dfa9be839aa461
2023-08-06 18:34:11 +02:00
Sebastiano Barezzi 1537848b01 Glimpse: Add isTrashed to Media
Change-Id: I5f196e69275bc15b29d25840529a87c3484097f9
2023-08-06 18:34:11 +02:00
LuK1337 7e1a9b2d9d Glimpse: Add "Trash" album
Change-Id: Id9e089434abe51ae74e9b5e895882535a7bf8e98
2023-08-06 18:34:11 +02:00
LuK1337 5c225960f8 Glimpse: Simplify bucket id check in onCreateLoader()
Change-Id: I5b88c0580413902db502fb4330b35b7d2b120bdf
2023-08-06 09:57:42 +02:00
LuK1337 71b46b0dad Glimpse: Implement "Favorites" album
Change-Id: Ia8fc129f6dfab06ce96fea39d0e3b526e300391c
2023-08-06 09:31:42 +02:00
Sebastiano Barezzi f6b8998442
Glimpse: Cache cursor indexes
Change-Id: I5f7f4bbf5fc5ae987e01fb2bbac43bb9951210a4
2023-08-06 01:22:08 +02:00
Sebastiano Barezzi 4bbb71c891
Glimpse: Media: Add a MediaStore parser function helper
Change-Id: I3e9438b4bc7f92975037fc7182684a9987ff776e
2023-08-06 01:10:22 +02:00
Sebastiano Barezzi da0b39e3bf
Glimpse: Move video loading to MediaViewerFragment
* Fixes black player on fast scrolling
* While at it simplify UI visibility and player view checks in the
  adapter

Change-Id: I841d9852a93230a89b23ac4069c75b621d173c8a
2023-08-06 00:58:27 +02:00
Sebastiano Barezzi 455f341ed0
Glimpse: MediaViewerFragment: Bail out of the fragment before doing anything else
Change-Id: I4424c8d3346d215754df561e5d6761e17a342ef8
2023-08-06 00:39:55 +02:00
Luca Stefani ad1c6996f5
Glimpse: ThumbnailLayoutManager: Ignore OOB in onLayoutChildren
When the underlying data is changed when the we're trying to
layout the children on the RecyclerView we can hit that.

TODO: Add proper syncronization and/or switch to ViewModels
Change-Id: I174e6c7c3cca2980ced19a424fc2e12372791d88
2023-08-06 00:39:26 +02:00
Sebastiano Barezzi 10a5c8ff04 Glimpse: Get rid of CommonNavigationArguments
Change-Id: I0936fc9c1411930081299ff36583b09b71f188e0
2023-08-06 00:34:21 +02:00
LuK1337 d74cd06a79 Glimpse: Handle empty album name gracefully
Change-Id: I31d70f3e1c1943015110e7167ea540b149b90144
2023-08-06 00:34:21 +02:00
Sebastiano Barezzi dfa041bc01 Glimpse: Reinstance ThumbnailLayoutManager on configuration change
Change-Id: I0a4d99fce11d1b88e0f89f885f1857ccb0a25adb
2023-08-06 00:34:21 +02:00
LuK1337 b81db3b9db Glimpse: Set android:configChanges for MainActivity
We don't want to restart activity on config changes.

Test: Play video and rotate the device, notice that it no longer rewinds
      the playback to 0s.
Change-Id: I854edd26eec0a8bef29a706619088d132dc5f4e3
2023-08-06 00:34:21 +02:00