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:id="@+id/recycler_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:clipToPadding="false"
android:paddingBottom="@dimen/map_markers_recycler_view_padding_bottom"
android:scrollbars="vertical"/> android:scrollbars="vertical"/>
</LinearLayout> </LinearLayout>

View file

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

View file

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