add dividers

This commit is contained in:
Chumva 2018-04-17 15:59:23 +03:00
parent 6357648162
commit 32f7e03e94
6 changed files with 29 additions and 9 deletions

View file

@ -23,9 +23,9 @@
android:orientation="vertical">
<LinearLayout
android:background="?attr/selectableItemBackground"
android:layout_width="match_parent"
android:layout_height="@dimen/map_button_shadow_width">
android:layout_height="@dimen/map_button_shadow_width"
android:background="?attr/selectableItemBackground">
<ImageButton
android:id="@+id/icon_left"
@ -57,12 +57,15 @@
</LinearLayout>
<ImageButton
<ImageView
android:id="@+id/icon_right"
android:layout_width="@dimen/map_button_shadow_width"
android:layout_width="wrap_content"
android:layout_height="@dimen/map_button_shadow_width"
tools:background="@drawable/marker_circle_background_dark_with_inset"
tools:src="@drawable/ic_action_marker_passed" />
android:paddingEnd="@dimen/list_content_padding"
android:paddingLeft="@dimen/list_content_padding"
android:paddingRight="@dimen/list_content_padding"
android:paddingStart="@dimen/list_content_padding"
tools:src="@drawable/ic_action_filter" />
</LinearLayout>
@ -70,7 +73,7 @@
android:id="@+id/divider"
android:layout_width="wrap_content"
android:layout_height="1dp"
tools:background="?attr/dashboard_divider" />
android:background="?attr/dashboard_divider" />
</LinearLayout>

View file

@ -46,6 +46,14 @@
</LinearLayout>
<View
android:id="@+id/divider"
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_marginLeft="@dimen/map_button_shadow_width"
android:layout_marginStart="@dimen/map_button_shadow_width"
tools:background="?attr/dashboard_divider"/>
<include
android:id="@+id/bottom_shadow"
layout="@layout/card_bottom_divider"

View file

@ -14,10 +14,12 @@ public class MapMarkerCategoriesViewHolder extends RecyclerView.ViewHolder {
final ImageView icon;
final TextView title;
final View divider;
public MapMarkerCategoriesViewHolder(View itemView) {
super(itemView);
icon = (ImageView) itemView.findViewById(R.id.icon_right);
title = (TextView) itemView.findViewById(R.id.title);
divider = itemView.findViewById(R.id.divider);
}
}

View file

@ -16,6 +16,7 @@ public class MapMarkerHeaderViewHolder extends RecyclerView.ViewHolder {
final TextView title;
final SwitchCompat disableGroupSwitch;
final View bottomShadow;
final View divider;
public MapMarkerHeaderViewHolder(View itemView) {
super(itemView);
@ -24,5 +25,6 @@ public class MapMarkerHeaderViewHolder extends RecyclerView.ViewHolder {
title = (TextView) itemView.findViewById(R.id.title);
disableGroupSwitch = (SwitchCompat) itemView.findViewById(R.id.disable_group_switch);
bottomShadow = itemView.findViewById(R.id.bottom_shadow);
divider = itemView.findViewById(R.id.divider);
}
}

View file

@ -12,10 +12,12 @@ public class MapMarkerWikivoyageArticleViewHolder extends RecyclerView.ViewHolde
final ImageView icon;
final TextView title;
final View divider;
public MapMarkerWikivoyageArticleViewHolder(View itemView) {
super(itemView);
icon = (ImageView) itemView.findViewById(R.id.icon_right);
title = (TextView) itemView.findViewById(R.id.title);
divider = itemView.findViewById(R.id.divider);
}
}

View file

@ -448,7 +448,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
final MapMarkersHelper mapMarkersHelper = app.getMapMarkersHelper();
final GPXFile[] gpxFile = new GPXFile[1];
boolean disabled = !enabled;
if (groupIsDisabled && !group.wasShown() && group.getWptCategories().size() > 1) {
if (groupIsDisabled && !group.wasShown() && !group.getWptCategories().isEmpty()) {
group.setWasShown(true);
Bundle args = new Bundle();
args.putString(SelectWptCategoriesBottomSheetDialogFragment.GPX_FILE_PATH_KEY, group.getGpxPath());
@ -503,6 +503,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
headerViewHolder.disableGroupSwitch.setOnCheckedChangeListener(null);
headerViewHolder.disableGroupSwitch.setChecked(!groupIsDisabled);
headerViewHolder.disableGroupSwitch.setOnCheckedChangeListener(checkedChangeListener);
headerViewHolder.divider.setVisibility(group.getWptCategories().isEmpty() ? View.GONE : View.VISIBLE);
} else {
throw new IllegalArgumentException("Unsupported header");
}
@ -534,10 +535,11 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
final MapMarkersGroup group = groupHeader.getGroup();
categoriesViewHolder.icon.setImageDrawable(iconsCache.getIcon(groupHeader.getIconRes(), R.color.divider_color));
categoriesViewHolder.title.setText(group.getWptCategoriesString());
categoriesViewHolder.divider.setVisibility(View.VISIBLE);
categoriesViewHolder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (group.getWptCategories().size() > 1) {
if (!group.getWptCategories().isEmpty()) {
Bundle args = new Bundle();
args.putString(SelectWptCategoriesBottomSheetDialogFragment.GPX_FILE_PATH_KEY, group.getGpxPath());
args.putBoolean(SelectWptCategoriesBottomSheetDialogFragment.UPDATE_CATEGORIES_KEY, true);
@ -558,6 +560,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
final MapMarkersGroup group = groupHeader.getGroup();
wikivoyageArticleViewHolder.title.setText(R.string.context_menu_read_article);
wikivoyageArticleViewHolder.icon.setVisibility(View.INVISIBLE);
wikivoyageArticleViewHolder.divider.setVisibility(View.VISIBLE);
wikivoyageArticleViewHolder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {