1
0
Fork 0

For #11177 - Load all share targets in the horizontal share menu

This was previously regressed by having the RecyclerViews for "recent" and
"all" items put inside a HorizontalScrollView which would then prevent the
RecyclerViews from actually scrolling, recycling, showing new items.

As a quick solution that would keep the desired behavior the "all" items list
is now a child of a RelativeLayout which will allow it to load all items at
once and so all the share targets will be available to the user but which also
means no recycling.

The RecyclerView for the "recent" items uses a `RECENT_APPS_LIMIT = 6` so this
does not need the same "fix" as all the items would fit the screen without
any issue.
master
Mugurell 2020-06-11 10:15:39 +03:00
parent 4b04a140fc
commit f163861b47
1 changed files with 23 additions and 10 deletions

View File

@ -71,21 +71,34 @@
app:layout_constraintStart_toEndOf="@+id/recentAppsContainer"
app:layout_constraintTop_toTopOf="parent" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/appsList"
<!-- Having the RecyclerView inside a RelativeLayout means
the RecyclerView will load all items at once and never recycle.
This is a conscious choice since we use HorizontalScrollView to scroll all
children horizontally and so prevent scrolling in the RecyclerViews. -->
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/share_all_apps_list_margin"
android:clipToPadding="false"
android:minHeight="@dimen/share_list_min_height"
android:orientation="horizontal"
android:visibility="gone"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/recentAppsContainer"
app:layout_constraintTop_toBottomOf="@id/apps_link_header"
app:spanCount="2" />
app:layout_constraintTop_toBottomOf="@id/apps_link_header">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/appsList"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/share_all_apps_list_margin"
android:clipToPadding="false"
android:minHeight="@dimen/share_list_min_height"
android:orientation="horizontal"
android:visibility="gone"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:spanCount="2" />
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</HorizontalScrollView>