Skip to content

Commit

Permalink
For mozilla-mobile#11177 - Load all share targets in the horizontal s…
Browse files Browse the repository at this point in the history
…hare 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.
  • Loading branch information
Mugurell committed Jun 11, 2020
1 parent 4b04a14 commit f163861
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions app/src/main/res/layout/share_to_apps.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>

0 comments on commit f163861

Please sign in to comment.