Add footer to wikivoyage search list

This commit is contained in:
Alex Sytnyk 2018-04-02 14:37:31 +03:00
parent 7327976170
commit 8df9966f42
3 changed files with 57 additions and 39 deletions

View file

@ -30,6 +30,8 @@
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:paddingBottom="@dimen/map_markers_recycler_view_padding_bottom"
android:scrollbars="vertical"/>
</LinearLayout>

View file

@ -4,61 +4,74 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/wikivoyage_card_bg_color"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:minHeight="@dimen/bottom_sheet_selected_item_title_height"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding">
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
tools:src="@drawable/ic_action_placeholder_city"/>
android:background="?attr/wikivoyage_card_bg_color"
android:orientation="vertical">
<LinearLayout
android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical">
android:background="?attr/selectableItemBackground"
android:minHeight="@dimen/bottom_sheet_selected_item_title_height"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding">
<TextView
android:id="@+id/title"
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.ListItemTitle"
tools:text="Amsterdam"/>
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
tools:src="@drawable/ic_action_placeholder_city"/>
<TextView
android:id="@+id/description"
android:layout_width="wrap_content"
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:textAppearance="@style/TextAppearance.ContextMenuSubtitle"
tools:text="Amstellend North Holland"/>
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.ListItemTitle"
tools:text="Amsterdam"/>
<TextView
android:id="@+id/description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:textAppearance="@style/TextAppearance.ContextMenuSubtitle"
tools:text="Amstellend North Holland"/>
</LinearLayout>
</LinearLayout>
<View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="@dimen/bottom_sheet_selected_item_title_height"
android:layout_marginStart="@dimen/bottom_sheet_selected_item_title_height"
android:background="?attr/wikivoyage_card_divider_color"
android:focusable="false"/>
</LinearLayout>
<View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="@dimen/bottom_sheet_selected_item_title_height"
android:layout_marginStart="@dimen/bottom_sheet_selected_item_title_height"
android:background="?attr/wikivoyage_card_divider_color"
android:focusable="false"/>
<include
android:id="@+id/shadow"
layout="@layout/card_bottom_divider"
android:visibility="gone"
tools:visibility="visible"/>
</LinearLayout>

View file

@ -51,6 +51,7 @@ public class SearchRecyclerViewAdapter extends RecyclerView.Adapter<SearchRecycl
holder.title.setText(item.getArticleTitle().toString());
holder.description.setText(item.getLang().toString());
holder.divider.setVisibility(lastItem ? View.GONE : View.VISIBLE);
holder.shadow.setVisibility(lastItem ? View.VISIBLE : View.GONE);
}
@Override
@ -77,6 +78,7 @@ public class SearchRecyclerViewAdapter extends RecyclerView.Adapter<SearchRecycl
final TextView title;
final TextView description;
final View divider;
final View shadow;
public ViewHolder(View itemView) {
super(itemView);
@ -84,6 +86,7 @@ public class SearchRecyclerViewAdapter extends RecyclerView.Adapter<SearchRecycl
title = (TextView) itemView.findViewById(R.id.title);
description = (TextView) itemView.findViewById(R.id.description);
divider = itemView.findViewById(R.id.divider);
shadow = itemView.findViewById(R.id.shadow);
}
}
}