Earlier in the Open Event Android app we had built the homescreen with the bookmarks showing up at the top as a horizontal list of cards but it wasn’t very user-friendly in terms of UI. Imagine that a user bookmarks over 20-30 sessions, in order to access them he/she might have to scroll horizontally a lot in order to access his/her bookmarked session. So this kind of UI was deemed counter-intuitive. A new UI was proposed involving the viewholder used in the schedule page i.e DayScheduleViewHolder, where the list would be vertical instead of horizontal. An added bonus was that this viewholder conveyed the same amount of information on lesser white space than the earlier viewholder i.e SessionViewHolder.
Above are two images, one in the initial design, the second in the new design. In the earlier design the number of bookmarks visible to the user at a time was at most 1 or 2 but now with the UI upgrade a user can easily see up-to 5-6 bookmarks at a time. Additionally there is more relevant content visible to the user at the same time.
Additionally this form of design also adheres to Google’s Material Design guidelines.
Code Comparison of the two Iterations
sessionsListAdapter = new SessionsListAdapter(getContext(), mSessions, bookmarkedSessionList); sessionsListAdapter.setBookmarkView(true); bookmarksRecyclerView.setAdapter(sessionsListAdapter); bookmarksRecyclerView.setLayoutManager(new LinearLayoutManager(getContext(),LinearLayoutManager.HORIZONTAL,false));
Here we are using the SessionListAdapter for the bookmarks. This was previously being used to display the list of sessions inside the track and location pages. It is again being used here to display the horizontal list of bookmarks.To do this we are using the function setBookmarkView(). Here mSessions consists the list of bookmarks that would appear in the homescreen.
bookmarksRecyclerView.setVisibility(View.VISIBLE); bookMarksListAdapter = new DayScheduleAdapter(mSessions,getContext()); bookmarksRecyclerView.setAdapter(bookMarksListAdapter); bookmarksRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
Now we are using the DayScheduleAdapter which is the same adapter used in the schedule page of the app. Now we use a vertical layout instead of a horizontal layout but with a new viewholder design. I will be talking about the last line in the code snippet shortly.
ViewHolder Design (Current Design)
<RelativeLayout android:id="@+id/content_frame"> <LinearLayout android:id="@+id/ll_sessionDetails"> <TextView android:id="@+id/slot_title"/> <RelativeLayout> <TextView android:id="@+id/slot_start_time”/> <TextView android:id="@+id/slot_underscore"/> <TextView android:id="@+id/slot_end_time"/> <TextView android:id="@+id/slot_comma"/> <TextView android:id="@+id/slot_location”/> <Button android:id="@+id/slot_track"/> <ImageButton android:id="@+id/slot_bookmark"/> </RelativeLayout> </LinearLayout> <View android:id=”@+id/divider”/> </RelativeLayout>
This layout file is descriptive enough to highlight each element’s location.
In this viewholder we can also access to the track page from the track tag and can also remove bookmarks instantly.
The official widget to make a scroll layout in android is ScrollView. Basically, adding a RecyclerView inside ScrollView can be difficult . The problem was that the scrolling became laggy and weird. Fortunately, with the appearance of Material Design , NestedScrollView was released and this becomes much easier.
With this small snippet of code we are able to insert a RecyclerView inside the NestedScrollView without any scroll lag.
So now we have successfully updated the UI/UX for the homescreen to meet the requirements as given by the Material Design guidelines.
- NestedScrollView : http://www.devexchanges.info/2016/07/nested-scroll-views-in-android.html
- Material Design Guidelines : https://material.io/guidelines/