Skip to content
Snippets Groups Projects

Extensions for merge request !334

Merged Hugh Daschbach requested to merge bottom-sheet-refinement into develop
  1. Nov 07, 2023
    • Hugh Daschbach's avatar
      Fix landscape view induced MainActivity leak. · c1eb9d6b
      Hugh Daschbach authored and Georg Krause's avatar Georg Krause committed
      With landscape view enabled (e.g. e06b2c7d) in the app and auto
      rotation enabled on the phone, switching between portrait and
      landscape orientations leaks instances of MainActivity.  This prevents
      garbage collection of not just the MainActivity object, but fragments
      and other objects referenced by the Activity.
      
      This is caused by repositories, the AppContext instance, the player
      service, and authentication code maintaining a reference to the
      context which with they are initialized.  So rather than initialize
      these with an Activity context, pass them the Application context.
      
      Activities are torn down and rebuilt on screen rotation.  The
      Application context is not.
      
      To enable instantiation of the FavoritedRepository with the
      Application context, delay that repository’s initialization until
      first use.  This ensures the Application context is fully initialized.
      It is not fully initialized until the MainActivity has been fully
      initialized.
      c1eb9d6b
    • Hugh Daschbach's avatar
      Increase player controls touchpoint size. · b9ade479
      Hugh Daschbach authored and Georg Krause's avatar Georg Krause committed
      Adopting AndroidStudio suggestion to help those of us with fat
      fingers.
      b9ade479
    • Hugh Daschbach's avatar
      Prevent BottomSheet tap leaking to nav panels. · 2133d4a4
      Hugh Daschbach authored and Georg Krause's avatar Georg Krause committed
      With the BottomSheet open, while trying to tap one of the
      controls (esp. add to playlist and favorite buttons) it is easy to
      miss the touch point and tap directly on the BottomSheet.
      
      This tap bleeds through to whatever fragment is currently displayed in
      the navigation area (Artist, Album, Playlists, etc.).  That tap
      changes the view in the navigation panel.  For example, if the Artist
      fragment it current, it will open a list of the artists albums.
      
      That change may be surprising when the BottomSheet is toggled closed.
      So, ignore BottomSheet taps outside the active controls.
      2133d4a4
    • Hugh Daschbach's avatar
      Refactor CoverArt.withContext(). · feb86fe9
      Hugh Daschbach authored and Georg Krause's avatar Georg Krause committed
      Having changed the context object in CoverArt from a received function
      parameter to an initialization time derived variable, withContext no
      longer needs a Context parameter.
      
      That leaves the method misnamed.  So rename withContext ->
      requestCreator and drop the first parameter.
      feb86fe9
    • Hugh Daschbach's avatar
      Do not create unnecessary Picasso objects. · f65e29af
      Hugh Daschbach authored and Georg Krause's avatar Georg Krause committed
      Address "java.lang.IllegalStateException: Too many receivers"
      exceptions.  (See Issue #145).  Each new Picasso object registers its
      own NetworkBroadcastReceiver.  Worse, we create a new Picasso object
      each time we transform an AlbumCover image.  So do not create
      unnecessary Picasso objects.
      
      Rather than depend on receiving a Context object when called to load
      an cover art, fetch the Application context as returned from FFA.get()
      at singleton construction time.  The Application context is long
      lived.
      
      This has an additional advantage.  Not generation new Picasso objects
      for each CoverArt image avoids holding a reference to an object that
      cannot, later, be garbage collected.
      f65e29af
Loading