Commit Graph

144 Commits

Author SHA1 Message Date
Sebastiano Barezzi 2b425aad63 Glimpse: Run ./gradlew app:generateBp
Change-Id: I20d6da5ff729d5d005fc6dc08ebaca56e39e63f1
2023-09-14 15:58:53 +02:00
Sebastiano Barezzi 2d0e6d2c6b Glimpse: Use generateBp plugin from maven repo
We share this code within our apps, extract it into a common package and
decommonize whatever might be app-specific.

Change-Id: I403a0d8ce4c78b9a6ed2001e20611926c608ae06
2023-09-14 15:58:53 +02:00
LuK1337 5088e3d9fb Glimpse: Detect uncommitted changes after running app:generateBp
This will make sure that we ran app:generateBp before merging changes.

Change-Id: Ia2b0720ea123f74cb4f1c92854131e000a2bd746
2023-09-11 17:22:04 +02:00
Sebastiano Barezzi 0bc234e8d1
Glimpse: Add okhttp as an explicit dependency
Change-Id: I69894500ad0d039d7199cc9534fe08ce1bf8e777
2023-09-11 01:00:00 +02:00
Luca Stefani 3008f69de4
Glimpse: Order trashed album items by their expire time
Change-Id: I33b459f1b2cf6e4c5fc4bcd11be8003a9ef678a8
2023-09-10 00:56:00 +02:00
Luca Stefani 8cdd98cb1b
Glimpse: Dismiss trashed snackbar on fragment's view detach
The trash/untrash contracts are tied to the fragment but
the snackbar can outlive the fragment itself.

This is problematic if the user exits the media viewer
and only then taps the Undo action as the handler
is now destroyed.

Change-Id: I5318349235f2146c0cc90db2acdfcefe2e8ef36b
2023-09-10 00:41:27 +02:00
Luca Stefani a737665978 Glimpse: Use StateFlow instead of SharedFlow
StateFlows are `distinctUntilChanged` by default,
that means we avoid possibly passing around new data
with no changes.

The downside is that StateFlow requires a "default" value
so we must implement a wrapper class around the actual values
from the query or an empty/default value so that the different
states can be handled properly in app.

Change-Id: Ib6033c36297be5c27e70ace3f1478ea0c22b2c5e
2023-09-08 11:34:15 +02:00
Luca Stefani 70e83a696b Glimpse: Handle query cancellation
This is pretty ugle, the uriFlow works just fine
but our signal to stop a currently running query
is a _new_ event from an Uri, and .map{} processes
each new value independently.

Change-Id: I84d61d76090fb9857739ae21021ed46444c00cf1
2023-09-08 11:33:45 +02:00
Luca Stefani ed52fd7c8a Glimpse: Conflate queryFlow not uriFlow
A client might expect to receive all Uri changes,
while it's okey to drop query if a Uri change was
observed

Change-Id: Iebe1d4cf3c3563e460a6815ae220110d1c8c089d
2023-09-08 10:43:26 +02:00
Luca Stefani c20f503e69 Glimpse: Move flowOn to ViewModel
Change-Id: I30cfa9ba9f668dc96e1e4659d9b1eaffc96af60e
2023-09-07 09:34:42 +02:00
Luca Stefani c028c1faba Glimpse: Use AndroidViewModel
Change-Id: Ifad97f71c39eaae5e2fbc55f152388c8402412a2
2023-09-07 09:32:19 +02:00
Luca Stefani 3addfcb9a2 Glimpse: Use SharedFlow in ViewModels
Since we collect data using the Lifecycle State as
a trigger using a SharedFlow is (one of) the optimal
way to emit updates.

Change-Id: Ib69b6790e52fa5e05181ebce078c72a5a7314598
2023-09-05 21:30:27 +02:00
Luca Stefani 065618e18b Glimpse: Move albums logic to AlbumsViewModel
Change-Id: I07d2dab157358ba42ebe03e83e6e27594e199fbd
2023-09-05 21:30:27 +02:00
Luca Stefani ed99cf3094 Glimpse: Cleanup ViewModels parameters
Change-Id: Ic6408ade38aa0022b8187d0570d7f29535500220
2023-09-05 21:30:27 +02:00
Sebastiano Barezzi 9daf3e196e
Glimpse: Block EXIF editing while in secure mode
Change-Id: I042a65b9583003b195c2c1768d25bc5d7bf2d124
2023-09-05 11:40:36 +02:00
Sebastiano Barezzi 49324a891a
Glimpse: Make bucket ID not null in flows
* Simplifies album ID handling in MediaViewerFragment

Change-Id: Ia56b92b61274dd861ce78ac224e7aadafdc40b99
2023-09-05 11:19:28 +02:00
Sebastiano Barezzi c2ec106a74
Glimpse: Add support for read-only viewing
* On ACTION_REVIEW_SECURE we aren't supposed to interact with MediaStore
  [1]

[1]:
https://developer.android.com/reference/android/provider/MediaStore#ACTION_REVIEW_SECURE

Change-Id: I957e4d0b795f78a7c4de09b1a0ae876b74736a52
2023-09-05 11:19:28 +02:00
Sebastiano Barezzi 7183bf2315
Glimpse: Handle ACTION_REVIEW_SECURE
Change-Id: I572fd755a726299acfbe4860c531c6380bf4edc2
2023-09-05 11:19:27 +02:00
Sebastiano Barezzi aeab234f32
Glimpse: Don't use singleTop as launch mode
* Every time this activity gets started, we want new instances, even
  when an instance is already in the back stack

Change-Id: Id73df5d41204ebc9cb4d8e78d7c95233acbfcd80
2023-09-05 11:19:27 +02:00
Sebastiano Barezzi ec74b16846
Glimpse: Implement ACTION_REVIEW properly
* With this intent, we're expecting an external content URI, treat it as
  one

Change-Id: I790531850a6bc6be6d946ae3b0dd4f15d97ebceb
2023-09-05 11:19:27 +02:00
Sebastiano Barezzi 6d115e8489
Glimpse: Grant internet permission
* Needed for remote streams

Change-Id: Ied7e4c7d72b1ba9bfe7fc1e16ad09f02ac2fbf89
2023-09-04 18:17:58 +02:00
Sebastiano Barezzi de62998541
Glimpse: Implement ACTION_VIEW and ACTION_REVIEW
Co-authored-by: Luca Stefani <luca.stefani.ge1@gmail.com>

Change-Id: I294954556fdf27810981f85d73c1db5b0068f37a
2023-09-04 18:17:58 +02:00
Sebastiano Barezzi e976b0fa38
Glimpse: Use MediaType as a serializable object in parcels
Change-Id: I84a1c5f9f9e5faf87d1e051de8533f2500463795
2023-09-04 15:52:41 +02:00
Sebastiano Barezzi ba2cfa04b6
Glimpse: Move media position handling to MediaViewerViewModel
Change-Id: I85322f285db8c3f9780aa7b9475c74f2dcd545b7
2023-09-04 15:37:14 +02:00
Sebastiano Barezzi 8e9d2e3bae
Glimpse: Get rid of initial position argument in MediaViewerFragment
Change-Id: Id76a2132e6c28989e9ef4cb523f0971564f02a24
2023-09-04 15:37:14 +02:00
Sebastiano Barezzi ab9176e7a0
Glimpse: Ignore enableOnBackInvokedCallback target API warning
Change-Id: If2b53f85d48993779e4c35ad9300dee61ee67109
2023-09-04 15:37:14 +02:00
Sebastiano Barezzi 3f3449fe59
Glimpse: Reformat manifest
Change-Id: Ic1910aaf103acc7f238c592e6d6a0df37b8cd037
2023-09-04 15:37:14 +02:00
Sebastiano Barezzi 67385e2a20
Glimpse: Let Glimpse be launched as one of the gallery apps
Change-Id: I4f54d330ba158dad31b99e130932e28e3968d5ac
2023-09-04 15:37:14 +02:00
Sebastiano Barezzi 9478ec437a
Glimpse: Set app category as image
* Whatever Gallery2 sets

Change-Id: I1326177a39f89c5942e9e04b2506dba695e43604
2023-09-04 15:37:14 +02:00
Sebastiano Barezzi b0928e2f17
Glimpse: Instance share and edit intents from the extension
Change-Id: Iba3fe9ffc965c15c6763a15e7ec99b4296a48074
2023-09-04 15:33:52 +02:00
Luca Stefani 0e28abaae2
Glimpse: Don't use SEND_MULTIPLE if we have a single Uri
Change-Id: Ia4f99ed8fb7a30355f9910c66c808ba091693ca6
2023-09-04 15:02:52 +02:00
Sebastiano Barezzi ff68784731
Glimpse: Stop using EXIF to get media size
Change-Id: I487ef49e0d39df87a8d269585d8200cd8f8a6312
2023-09-03 19:37:14 +02:00
Sebastiano Barezzi 3d41b82fc7
Glimpse: Add width and height to media
Change-Id: Id953c37950ef647e9f5d56d364eed91328c0d613
2023-09-03 19:36:41 +02:00
Luca Stefani 5b74dfead9
Glimpse: Add date modified and orientation to media
Change-Id: I6326614f160b188e9d1718dc18a0aa9e42b91acb
2023-09-03 18:37:41 +02:00
Sebastiano Barezzi ea0c494321
Glimpse: Remove useless API annotations
Change-Id: Ie3910f2cf3791afd29643605d2c90be0fab1a4a1
2023-09-03 18:20:12 +02:00
Sebastiano Barezzi b2c79ae4f6
Glimpse: Remove unused imports
Change-Id: Ib4d5450099f2e79faa826b08e6556ecdf9ed6249
2023-09-03 18:09:37 +02:00
Sebastiano Barezzi d6a0224ffd
Glimpse: Don't mark MediaViewerAdapter class with Media3's UnstableApi
Change-Id: I9207178981004b4b4a260be4fb927f71ac05cf07
2023-09-03 18:09:37 +02:00
Sebastiano Barezzi 1d72f8a11a
Glimpse: Stop using insets for thumbnails recycler views' padding
* Those are now constrained to bottom navigation bar

Change-Id: I7bfc1166cb532652e0ef23f5392f522389b750a4
2023-09-03 18:07:25 +02:00
Sebastiano Barezzi b75af064c4
Glimpse: Set minimum SDK to 30 (Android 11)
* Oldest supported LineageOS version would be 18.1, which is definitely
  enough for any kind of testing
* While at it fix permissions check for pre-Tiramisu

Change-Id: I9f9ba8fe0c0c8a50436810934b439fd38a2fb445
2023-09-03 17:40:52 +02:00
Luca Stefani f805d0ce4a Glimpse: Cleanup getViewProperty delegate
Change-Id: I2f3cf5df7ddcbc3353b2733c289fd8d155c99385
2023-09-03 16:30:27 +02:00
Luca Stefani 4b0abb7cf4 Glimpse: Use itemView in ThumbnailViewHolder
Also set the click listener only once we have the data binded

Change-Id: Id74c564f5f1a44f4c44b386b3e1ed57d7f3dc676
2023-09-03 16:05:43 +02:00
Luca Stefani cf2046c092 Glimpse: Make un-rexported ListItem fields private
Change-Id: I645780f3a8c2ff4ee52257ffbf123bdc04629320
2023-09-03 16:04:27 +02:00
Luca Stefani 8a51e33291 Glimpse: Remove unused fields/classes
Change-Id: I5ee82e82babd9998675bd65315f65bf8bcb95fa6
2023-09-03 16:03:59 +02:00
Sebastiano Barezzi 39c039e38d
Glimpse: Rework media player
We now have fullscreen mode!

Change-Id: Iad8b93145c79413473d20fa510e28ec608a44e38
2023-09-03 15:58:34 +02:00
Sebastiano Barezzi 74389a9725
Glimpse: Always prepare ExoPlayer when media type is video
* Fixes video loading when a video is selected from reels

Change-Id: I62f5d20e041f83fc0384e7f9e4a7c4f08a75268f
2023-08-21 02:21:59 +02:00
Sebastiano Barezzi 44e74bfdfa
Glimpse: Use DisplayAwareGridLayoutManager for album thumbnails
Change-Id: I252d2d52f947b1bba35c20c9385e05eaf87f70d9
2023-08-20 23:44:07 +02:00
Sebastiano Barezzi a14c9d7015
Glimpse: recyclerview: Extract span count logic in a new class
Change-Id: I0e1bc8ac1cea049401cbfd21e14de8aa8686c281
2023-08-20 23:37:49 +02:00
Sebastiano Barezzi eb9c4cee5b
Glimpse: Unify permissions check code
* Also add it to albums fragment

Change-Id: I8ff91bffbd5c414964e4d34bb1bc80a9fae9103e
2023-08-20 23:13:34 +02:00
Luca Stefani 486f826463
Glimpse: Set android:enableOnBackInvokedCallback
We don't intercept back press events, so we can simply opt-in

Change-Id: I3e6e925239ab8bfe16d3af58563c821a66d8ba75
2023-08-20 15:29:13 +02:00
Sebastiano Barezzi 3632fcffe4
Glimpse: Rename thumbnail package to recyclerview
* We will put there search related adapters

Change-Id: I20b01cafd633878d578b3f896396a366a480b1d5
2023-08-20 15:27:54 +02:00