Add shadow

This commit is contained in:
PavelRatushny 2017-09-13 16:41:31 +03:00
parent e21014a9dc
commit f211b18a6c
4 changed files with 130 additions and 94 deletions

View file

@ -4,10 +4,16 @@
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/bg_color"
android:descendantFocusability="blocksDescendants" android:descendantFocusability="blocksDescendants"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout
android:id="@+id/main_layout"
android:background="?attr/bg_color"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="56dp" android:layout_height="56dp"
@ -121,3 +127,20 @@
android:background="?attr/dashboard_divider"/> android:background="?attr/dashboard_divider"/>
</LinearLayout> </LinearLayout>
<LinearLayout
tools:visibility="visible"
android:visibility="gone"
android:id="@+id/bottom_shadow"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="@layout/card_bottom_divider"/>
<View
android:layout_width="match_parent"
android:layout_height="4dp"/>
</LinearLayout>
</LinearLayout>

View file

@ -10,6 +10,7 @@ import net.osmand.plus.R;
public class MapMarkerItemViewHolder extends RecyclerView.ViewHolder { public class MapMarkerItemViewHolder extends RecyclerView.ViewHolder {
final View mainLayout;
final ImageView iconDirection; final ImageView iconDirection;
final ImageView iconReorder; final ImageView iconReorder;
final ImageView icon; final ImageView icon;
@ -19,9 +20,11 @@ public class MapMarkerItemViewHolder extends RecyclerView.ViewHolder {
final TextView description; final TextView description;
final ImageButton optionsBtn; final ImageButton optionsBtn;
final View divider; final View divider;
final View bottomShadow;
public MapMarkerItemViewHolder(View view) { public MapMarkerItemViewHolder(View view) {
super(view); super(view);
mainLayout = view.findViewById(R.id.main_layout);
iconDirection = (ImageView) view.findViewById(R.id.map_marker_direction_icon); iconDirection = (ImageView) view.findViewById(R.id.map_marker_direction_icon);
iconReorder = (ImageView) view.findViewById(R.id.map_marker_reorder_icon); iconReorder = (ImageView) view.findViewById(R.id.map_marker_reorder_icon);
icon = (ImageView) view.findViewById(R.id.map_marker_icon); icon = (ImageView) view.findViewById(R.id.map_marker_icon);
@ -31,6 +34,7 @@ public class MapMarkerItemViewHolder extends RecyclerView.ViewHolder {
description = (TextView) view.findViewById(R.id.map_marker_description); description = (TextView) view.findViewById(R.id.map_marker_description);
optionsBtn = (ImageButton) view.findViewById(R.id.map_marker_options_button); optionsBtn = (ImageButton) view.findViewById(R.id.map_marker_options_button);
divider = view.findViewById(R.id.divider); divider = view.findViewById(R.id.divider);
bottomShadow = view.findViewById(R.id.bottom_shadow);
} }
public void setOptionsButtonVisibility(int visibility) { public void setOptionsButtonVisibility(int visibility) {
@ -40,4 +44,8 @@ public class MapMarkerItemViewHolder extends RecyclerView.ViewHolder {
public void setIconDirectionVisibility(int visibility) { public void setIconDirectionVisibility(int visibility) {
iconDirection.setVisibility(visibility); iconDirection.setVisibility(visibility);
} }
public void setBottomShadowVisibility(int visibility) {
bottomShadow.setVisibility(visibility);
}
} }

View file

@ -88,7 +88,7 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemV
holder.setIconDirectionVisibility(View.GONE); holder.setIconDirectionVisibility(View.GONE);
holder.icon.setImageDrawable(iconsCache.getIcon(R.drawable.ic_arrow_marker_diretion, markerColor)); holder.icon.setImageDrawable(iconsCache.getIcon(R.drawable.ic_arrow_marker_diretion, markerColor));
holder.itemView.setBackgroundColor(ContextCompat.getColor(mapActivity, R.color.markers_top_bar_background)); holder.mainLayout.setBackgroundColor(ContextCompat.getColor(mapActivity, R.color.markers_top_bar_background));
holder.title.setTextColor(ContextCompat.getColor(mapActivity, R.color.color_white)); holder.title.setTextColor(ContextCompat.getColor(mapActivity, R.color.color_white));
holder.divider.setBackgroundColor(ContextCompat.getColor(mapActivity, R.color.map_markers_on_map_divider_color)); holder.divider.setBackgroundColor(ContextCompat.getColor(mapActivity, R.color.map_markers_on_map_divider_color));
holder.optionsBtn.setBackgroundDrawable(mapActivity.getResources().getDrawable(R.drawable.marker_circle_background_on_map_with_inset)); holder.optionsBtn.setBackgroundDrawable(mapActivity.getResources().getDrawable(R.drawable.marker_circle_background_on_map_with_inset));
@ -102,7 +102,7 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemV
holder.setIconDirectionVisibility(View.VISIBLE); holder.setIconDirectionVisibility(View.VISIBLE);
holder.icon.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_flag_dark, markerColor)); holder.icon.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_flag_dark, markerColor));
holder.itemView.setBackgroundColor(ContextCompat.getColor(mapActivity, night ? R.color.bg_color_dark : R.color.bg_color_light)); holder.mainLayout.setBackgroundColor(ContextCompat.getColor(mapActivity, night ? R.color.bg_color_dark : R.color.bg_color_light));
holder.title.setTextColor(ContextCompat.getColor(mapActivity, night ? R.color.color_white : R.color.color_black)); holder.title.setTextColor(ContextCompat.getColor(mapActivity, night ? R.color.color_white : R.color.color_black));
holder.divider.setBackgroundColor(ContextCompat.getColor(mapActivity, night ? R.color.dashboard_divider_dark : R.color.dashboard_divider_light)); holder.divider.setBackgroundColor(ContextCompat.getColor(mapActivity, night ? R.color.dashboard_divider_dark : R.color.dashboard_divider_light));
holder.optionsBtn.setBackgroundDrawable(mapActivity.getResources().getDrawable(R.drawable.marker_circle_background_light_with_inset)); holder.optionsBtn.setBackgroundDrawable(mapActivity.getResources().getDrawable(R.drawable.marker_circle_background_light_with_inset));

View file

@ -132,6 +132,11 @@ public class MapMarkersHistoryAdapter extends RecyclerView.Adapter<RecyclerView.
notifyItemRemoved(position); notifyItemRemoved(position);
} }
}); });
if (position == getItemCount() - 1) {
((MapMarkerItemViewHolder) holder).setBottomShadowVisibility(View.VISIBLE);
} else {
((MapMarkerItemViewHolder) holder).setBottomShadowVisibility(View.GONE);
}
} else if (holder instanceof MapMarkerDateViewHolder) { } else if (holder instanceof MapMarkerDateViewHolder) {
final MapMarkerDateViewHolder dateViewHolder = (MapMarkerDateViewHolder) holder; final MapMarkerDateViewHolder dateViewHolder = (MapMarkerDateViewHolder) holder;
final Integer dateHeader = (Integer) getItem(position); final Integer dateHeader = (Integer) getItem(position);