Commit Graph

34 Commits

Author SHA1 Message Date
Jorge Martin Espinosa
a8b85fb4e6 Extract compound tokens and theming to compound-android library (#1888)
* Replace tokens & icons with the external Compound ones

---------

Co-authored-by: ElementBot <benoitm+elementbot@element.io>
2023-11-27 10:30:07 +01:00
Benoit Marty
a6d108a5aa Upgrade lint to version 8.3.0-alpha11 and suppress false positive. 2023-11-06 16:03:16 +01:00
Benoit Marty
84594caad3 Use existing BooleanProvider 2023-10-12 15:03:50 +02:00
Benoit Marty
99caa031e8 Replace mutableStateOf by mutableIntStateOf and mutableFloatStateOf. Use intValue and floatValue to avoid unboxing. 2023-09-26 18:07:53 +02:00
Benoit Marty
d2ca528679 Detekt: Rename DayNightPreviews to PreviewsDayNight to follow naming convention.
MultiPreview annotations should start with `Previews` as prefix
2023-09-21 08:30:36 +02:00
Benoit Marty
54ca7c1ea5 More cleanup 2023-09-20 17:32:32 +02:00
Benoit Marty
eb4c2fba77 Fix issue detected by detekt 2023-08-16 15:24:18 +02:00
Benoit Marty
996574f2c6 Enable detekt rule PreviewPublic and fix existing issues. 2023-07-26 10:08:39 +02:00
Benoit Marty
45954b4723 Fix code quality check failures after new rules from #935 has been merged on develop. 2023-07-21 16:04:55 +02:00
Benoit Marty
f09996cb30 Merge pull request #935 from vector-im/feature/bma/noWarnings
Code quality: warnings are errors and enable more Detekt rules.
2023-07-21 15:52:05 +02:00
Marco Romano
71676c3faf Static images improvements (#933)
1. On devices less than xhdpi request a 1x image from MapTiler (such devices are generally old, slower and with little memory so avoiding to get the 2x image only to have to shrink it later could help).
2. Coerce too big width/height combos within the API limits keeping the aspect ratio (this will allow requests on big horizontal displays to succeed).
3. Don't crash when given weird width/height combos (i.e. zero or negative).
4. Introduce interfaces to hide this whole logic and make it easier for forks to implement their own.

Related to:
- https://github.com/vector-im/element-meta/issues/1678
2023-07-21 13:37:08 +00:00
Benoit Marty
c72f1a09a7 Enable detekt rules UnnecessaryParentheses and cleanup the code. 2023-07-20 18:08:08 +02:00
Marco Romano
8648e8ba53 Extract maptiler's map ids (#926)
Maptiler custom map ids are only useable by the account that create them. So if we hardcode them forkers won't be able to use the maps even if the bring in their own api key (because they can't access our maps with their api key).

Requires to set our map ids in `local.properties` for local development:
```
services.maptiler.lightMapId=9bc819c8-e627-474a-a348-ec144fe3d810
services.maptiler.darkMapId=dea61faf-292b-4774-9660-58fcef89a7f3
```
2023-07-20 14:29:06 +02:00
Marco Romano
025d8781a7 Refactor a custom alignment to its own modifier for readability. (#924) 2023-07-19 16:58:04 +02:00
Marco Romano
278f8ae4c6 Send My Location (#770)
- https://github.com/vector-im/element-meta/issues/1682
2023-07-19 09:58:13 +00:00
Chris Smith
8c3cda836e Merge pull request #886 from vector-im/feature/cjs/location-api-key 2023-07-18 15:32:54 +01:00
Benoit Marty
2ffdf4483a No need to use trick for night resource when using DayNightPreviews annotation. 2023-07-18 11:19:46 +02:00
Chris Smith
b7bd08b210 Location sharing: don't hardcode API key
In an effort to make it easier for forks to (a) use their own
API keys (b) change map styles or maybe even providers, move
the MapTiler key out of the source code and pass it in via
env var or property.

Also refactor the utility classes slightly to keep all the URL
related functions together, to reduce the chance of collisions
when maintaining such forks.
2023-07-17 16:09:53 +01:00
Marco Romano
026296eb43 Use @DayNightPreviews for static map (#832)
* Use @DayNightPreviews for static map

To properly screenshot the dark pin.

* Update screenshots

---------

Co-authored-by: ElementBot <benoitm+elementbot@element.io>
2023-07-10 10:45:11 +02:00
Marco Romano
f33561c25d Revert "Auto generate dark mode previews and screenshots (#776)" (#784)
This reverts commit 79b529193c.
2023-07-05 15:47:53 +02:00
Marco Romano
79b529193c Auto generate dark mode previews and screenshots (#776)
With this change, composable previews and screenshots should be created with just:
```
@ElementPreviews
@Composable
fun MyViewPreview() {
    ElementPreview { 
        MyView()
    }
}
```

- Adds `@ElementPreviews` which is a shorthand for:
```
@Preview(name = "D")
@Preview(name = "N", uiMode = Configuration.UI_MODE_NIGHT_YES)
```
Should be used in connection with the now public `fun ElementPreview()` composable.

- Adds ElementPreviews to previewAnnotations in dangerfile
- Screenshots of night mode previews are now rendered with night mode
- Replaces `ElementPreviewLight` and `ElementThemedPreview` with `ElementPreview`
- Deprecates `ElementPreviewDark` which should be removed.
- Remaining usages of `ElementPreviewDark` are now ignored during screenshot tests
2023-07-05 13:58:24 +02:00
Chris Smith
87853b467f s/view/show/ 2023-07-05 10:19:07 +01:00
Chris Smith
7a2cc5df0a Tap on locations in timeline to see a larger map
Show a fully-featured MapView, centered on the dropped pin,
which allows panning/zooming. Share button allows opening
in a map application.

Supports showing a description at the top of the screen,
if one is supplied with the event.

Out of scope: showing the local user's location (being
done as a separate story).

Includes some minor tidying: remove duplicate Location,
and make GeoURI parsing a method on that class; fix the
pointer location in MapView (I broke it earlier, whoops!)
2023-07-04 16:19:24 +01:00
Chris Smith
330e786d0d Move pin graphic/component to design system 2023-07-03 11:51:50 +01:00
Chris Smith
bd0e24598a Show location replies per the designs 2023-06-30 16:14:44 +01:00
Chris Smith
45ed840e83 Fix missing data class after merge 2023-06-30 09:48:59 +01:00
Chris Smith
6b61a6eaf5 Merge remote-tracking branch 'origin/develop' into feature/cjs/view-location-in-timeline 2023-06-30 09:30:31 +01:00
Marco Romano
0858cfb272 Send pin-drop location (#636)
Share pindrop location

This feature allows the user to share any location by just selecting it from the map.

Closes: https://github.com/vector-im/element-x-android/issues/690
2023-06-29 22:07:47 +00:00
Chris Smith
fe322d072e Show location events in timeline
Not in scope: interacting with the timeline items,
reply formatting. These will be implemented separately.

Closes #689
2023-06-29 16:37:15 +01:00
Jorge Martin Espinosa
c5a5810c05 Link Compound's TypographyTokens to ElementTheme. (#700)
* Link Compound's `TypographyTokens` to `ElementTheme`.

Also add some docs about when we should use each set of tokens.

* Renamed `LocalColors` to `LocalLegacyColors`.

Made both `LocalLegacyColors` and `LocalCompoundColors` internal. This means it will need to always be used through `ElementTheme.`

Also, removed any usages of `LocalColors.current` accross the project, they're now used through `ElementTheme.legacyColors`.
2023-06-28 08:53:20 +00:00
Jorge Martin Espinosa
02dc447624 [Compound] Integrate compound tokens (#586)
* Added tokens.

* Apply color to MaterialTheme, also add typography.

* Map colors to the right ones in the themes.

* Create and improve previews of some components

* More preview improvements

* Add `tertiary` and `onTertiary` colors, remove some unused ones.

* Fix usage of deleted color token

* Fix bug in Switch previews

* Create a separate `:libraries:theme` module to keep everything related to colors, typography and Compound in general.

* Fix `DatePickerPreview`

* Add missing Compound generated files by fixing their package name

* Move `ElementTheme` to the `:libraries:theme` module, make some variables internal.

---------

Co-authored-by: ElementBot <benoitm+elementbot@element.io>
2023-06-27 16:15:40 +00:00
Benoit Marty
6eb02e8c97 Fix compilation issue. 2023-06-27 11:29:45 +02:00
Benoit Marty
287328f7df More cleanup 2023-06-27 09:51:33 +02:00
Marco Romano
3eb6a4bc5a Set up SDK & reusable map view component (#476)
Adds `libraries/map` which contains some initial building blocks that will be used by the location sharing feature.

Ref: https://github.com/vector-im/element-meta/issues/1684
2023-06-27 07:23:00 +00:00