Ramotion/folding-cell-android

Animation slows down if MapView is added in RecyclerView item

s-ilnar opened this issue · 2 comments

Hello.
When adding org.osmdroid.views.MapViev in RecyclerView item, FoldingCell starts to work inhibited(slowly).
Have you encountered this? How to solve this problem?

<androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/cell_content_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:visibility="gone">

       <org.osmdroid.views.MapView
              android:id="@+id/mapView"
              android:layout_width="match_parent"
              android:layout_height="150dp" />

        <androidx.appcompat.widget.AppCompatTextView/>
        <androidx.appcompat.widget.AppCompatTextView/>
        <androidx.appcompat.widget.AppCompatTextView/>
        <androidx.appcompat.widget.AppCompatTextView/>
        <androidx.appcompat.widget.AppCompatTextView/>
        <androidx.appcompat.widget.AppCompatButton/>

</androidx.constraintlayout.widget.ConstraintLayout>

RecyclerView max item size = 10

Hello, @s-ilnar. Don't use map view inside recycler view as it is heavy component it consumes more memory, instead use lite mode of maps which is specifically design for listing with recycler view/ list view, for more details refer this link https://developers.google.com/maps/documentation/android-sdk/lite

Also google has provided demo on how to use Lite mode map with recycler view, here's the link to GitHub https://github.com/googlemaps/android-samples/blob/master/ApiDemos/java/app/src/main/java/com/example/mapdemo/LiteListDemoActivity.java

@golovin47 This seems like a solution! :) I will look for examples with the OsmDroid map, then I will write the results! Thanks for the answer!