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,120 +4,143 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color"
android:descendantFocusability="blocksDescendants"
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="56dp"
android:background="?attr/selectableItemBackground">
<android.support.v7.widget.AppCompatImageView
android:id="@+id/map_marker_reorder_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingStart="16dp"
android:paddingTop="16dp"
android:tint="?attr/secondary_icon_color"
tools:src="@drawable/ic_action_reorder"/>
<android.support.v7.widget.AppCompatImageView
android:id="@+id/map_marker_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
tools:src="@drawable/ic_action_flag_dark"/>
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical">
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="?attr/selectableItemBackground">
<android.support.v7.widget.AppCompatTextView
android:id="@+id/map_marker_title"
android:layout_width="match_parent"
<android.support.v7.widget.AppCompatImageView
android:id="@+id/map_marker_reorder_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
tools:text="Van Gogh Museum"/>
android:layout_gravity="center_vertical"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingStart="16dp"
android:paddingTop="16dp"
android:tint="?attr/secondary_icon_color"
tools:src="@drawable/ic_action_reorder"/>
<android.support.v7.widget.AppCompatImageView
android:id="@+id/map_marker_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
tools:src="@drawable/ic_action_flag_dark"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/map_marker_direction_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="4dp"
android:layout_marginEnd="4dp"
tools:src="@drawable/ic_direction_arrow"/>
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical">
<android.support.v7.widget.AppCompatTextView
android:id="@+id/map_marker_distance"
android:layout_width="wrap_content"
android:id="@+id/map_marker_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="4dp"
android:layout_marginEnd="4dp"
android:maxLines="1"
android:textSize="@dimen/default_desc_text_size"
tools:text="213 m"/>
<android.support.v7.widget.AppCompatTextView
android:id="@+id/map_marker_point_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="•"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
android:visibility="gone"
tools:visibility="visible"/>
<android.support.v7.widget.AppCompatTextView
android:id="@+id/map_marker_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
tools:text="Amsterdam Weekend"/>
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
tools:text="Van Gogh Museum"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/map_marker_direction_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="4dp"
android:layout_marginEnd="4dp"
tools:src="@drawable/ic_direction_arrow"/>
<android.support.v7.widget.AppCompatTextView
android:id="@+id/map_marker_distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="4dp"
android:layout_marginEnd="4dp"
android:maxLines="1"
android:textSize="@dimen/default_desc_text_size"
tools:text="213 m"/>
<android.support.v7.widget.AppCompatTextView
android:id="@+id/map_marker_point_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="•"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
android:visibility="gone"
tools:visibility="visible"/>
<android.support.v7.widget.AppCompatTextView
android:id="@+id/map_marker_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
tools:text="Amsterdam Weekend"/>
</LinearLayout>
</LinearLayout>
<ImageButton
android:id="@+id/map_marker_options_button"
android:layout_width="56dp"
android:layout_height="56dp"
android:background="@drawable/marker_circle_background_light_with_inset"
android:focusableInTouchMode="true"
tools:src="@drawable/ic_action_marker_passed"/>
</LinearLayout>
<ImageButton
android:id="@+id/map_marker_options_button"
android:layout_width="56dp"
android:layout_height="56dp"
android:background="@drawable/marker_circle_background_light_with_inset"
android:focusableInTouchMode="true"
tools:src="@drawable/ic_action_marker_passed"/>
<View
android:id="@+id/divider"
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_marginLeft="56dp"
android:layout_marginStart="56dp"
android:background="?attr/dashboard_divider"/>
</LinearLayout>
<View
android:id="@+id/divider"
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_marginLeft="56dp"
android:layout_marginStart="56dp"
android:background="?attr/dashboard_divider"/>
<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 {
final View mainLayout;
final ImageView iconDirection;
final ImageView iconReorder;
final ImageView icon;
@ -19,9 +20,11 @@ public class MapMarkerItemViewHolder extends RecyclerView.ViewHolder {
final TextView description;
final ImageButton optionsBtn;
final View divider;
final View bottomShadow;
public MapMarkerItemViewHolder(View view) {
super(view);
mainLayout = view.findViewById(R.id.main_layout);
iconDirection = (ImageView) view.findViewById(R.id.map_marker_direction_icon);
iconReorder = (ImageView) view.findViewById(R.id.map_marker_reorder_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);
optionsBtn = (ImageButton) view.findViewById(R.id.map_marker_options_button);
divider = view.findViewById(R.id.divider);
bottomShadow = view.findViewById(R.id.bottom_shadow);
}
public void setOptionsButtonVisibility(int visibility) {
@ -40,4 +44,8 @@ public class MapMarkerItemViewHolder extends RecyclerView.ViewHolder {
public void setIconDirectionVisibility(int 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.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.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));
@ -102,7 +102,7 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemV
holder.setIconDirectionVisibility(View.VISIBLE);
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.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));

View file

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