mapbox-navigation-android icon indicating copy to clipboard operation
mapbox-navigation-android copied to clipboard

Shields loading optimization

Open tomaszrybakiewicz opened this issue 2 years ago • 4 comments

Closes NAVAND-483

Description

After reviewing RoadShiled loading logic, I've noticed that we were caching RoadShield image data in 3 different places.

  1. ShieldResultCache - RouteShield in LruCache
  2. ShieldByteArrayCache - ByteArray in LruCache
  3. Native TileStore - ByteArray on disk

The ShieldResultCache already caches image data together with RouteShield; therefore, ShieldByteArrayCache is redundant.

In this PR, I optimized RoadShield loading by:

  • deleting duplicate image cache
  • separating download from caching logic - introduced local ResourceLoader and CacheResourceLoader decorator
  • renaming ShieldResultCache -> RoadShieldLoader and loosely coupling it with sprites and image loaders
  • loosely coupling RoadShieldContentManagerImpl with the RoadShieldLoader class

(new setup) shield-loader2

tomaszrybakiewicz avatar Jan 12 '23 16:01 tomaszrybakiewicz

Changelog

Features

  • Introduced ViewStyleCustomization.infoPanelGuidelineMaxPosPercent that allows customization of the NavigationView InfoPanel bottom guideline maximum position. Increased default value to 50%. #6792

Bug fixes and improvements

  • Fixed an issue with NavigationView that caused info panel to shrink in landscape mode with a full screen theme. #6780

  • :warning: Updated the NavigationView default navigation puck asset. #6678

    Previous puck can be restored by injecting LocationPuck2D with the bearingImage set to com.mapbox.navigation.ui.maps.R.drawable.mapbox_navigation_puck_icon drawable:

    navigationView.customizeViewStyles {
        locationPuckOptions = LocationPuckOptions.Builder(context)
            .defaultPuck(
                LocationPuck2D(
                    bearingImage = ContextCompat.getDrawable(
                        context,
                        com.mapbox.navigation.ui.maps.R.drawable.mapbox_navigation_puck_icon,
                    )
                )
            )
            .idlePuck(regularPuck(context))
            .build()
    }
    
  • Fixed an issue where the first voice instruction might have been played twice. #6766

  • Added guarantees that route progress with RouteProgress#currentState == OFF_ROUTE arrives earlier than NavigationRerouteController#reroute is called. #6764

  • Introduced NavigationViewListener.onSpeedInfoClicked that would be triggered when MapboxSpeedInfoView is clicked upon. #6770

  • Each newly instantiated MapboxRouteArrowView class will initialize the layers with the provided options on the first render call. Previously this would only be done if the layers hadn't already been initialized. #6466

  • Fixed a rare java.lang.NullPointerException: Attempt to read from field 'SpeechAnnouncement PlayCallback.announcement' on a null object reference crash in PlayCallback.getAnnouncement. #6760

  • Fixed standalone MapboxManeuverView appearance when the app also integrates Drop-In UI. #6774

Known issues :warning:

Other changes

Android Auto Changelog

Features

Bug fixes and improvements

github-actions[bot] avatar Jan 12 '23 16:01 github-actions[bot]

Codecov Report

Merging #6826 (b8a6655) into main (61415ea) will decrease coverage by 0.04%. The diff coverage is 85.29%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #6826      +/-   ##
============================================
- Coverage     72.64%   72.61%   -0.04%     
- Complexity     5569     5600      +31     
============================================
  Files           780      783       +3     
  Lines         30104    30106       +2     
  Branches       3553     3555       +2     
============================================
- Hits          21869    21860       -9     
- Misses         6808     6815       +7     
- Partials       1427     1431       +4     
Impacted Files Coverage Δ
...ion/ui/shield/RoadShieldContentManagerContainer.kt 8.33% <0.00%> (-16.67%) :arrow_down:
...igation/ui/shield/internal/RoadShieldDownloader.kt 64.28% <66.66%> (ø)
...navigation/ui/shield/internal/loader/Downloader.kt 70.00% <70.00%> (ø)
...vigation/ui/shield/RoadShieldContentManagerImpl.kt 91.30% <90.74%> (-2.39%) :arrow_down:
.../shield/internal/loader/ShieldSpritesDownloader.kt 94.11% <94.11%> (ø)
...tion/ui/shield/internal/loader/RoadShieldLoader.kt 96.29% <96.29%> (ø)
...vigation/ui/shield/internal/loader/CachedLoader.kt 100.00% <100.00%> (ø)

codecov[bot] avatar Jan 17 '23 17:01 codecov[bot]

@abhishek1508 Can you review and merge this?

tomaszrybakiewicz avatar Feb 17 '23 21:02 tomaszrybakiewicz

@abhishek1508 Can you review and merge this?

cc @LukasPaczos

abhishek1508 avatar Feb 21 '23 15:02 abhishek1508