Fix multi selection menu adapter
This commit is contained in:
parent
f70a37e68a
commit
c032e16218
1 changed files with 8 additions and 9 deletions
|
@ -38,9 +38,8 @@ public class MultiSelectionArrayAdapter extends ArrayAdapter<MapMultiSelectionMe
|
||||||
}
|
}
|
||||||
final MapMultiSelectionMenu.MenuObject item = getItem(position);
|
final MapMultiSelectionMenu.MenuObject item = getItem(position);
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
View contentView = convertView.findViewById(R.id.content);
|
AndroidUtils.setBackground(menu.getMapActivity(), convertView, !menu.isLight(), R.drawable.expandable_list_item_background_light, R.drawable.expandable_list_item_background_dark);
|
||||||
AndroidUtils.setBackground(menu.getMapActivity(), contentView, !menu.isLight(), R.drawable.expandable_list_item_background_light, R.drawable.expandable_list_item_background_dark);
|
convertView.setOnClickListener(new View.OnClickListener() {
|
||||||
contentView.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
|
@ -49,8 +48,8 @@ public class MultiSelectionArrayAdapter extends ArrayAdapter<MapMultiSelectionMe
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
IconsCache iconsCache = menu.getMapActivity().getMyApplication().getIconsCache();
|
IconsCache iconsCache = menu.getMapActivity().getMyApplication().getIconsCache();
|
||||||
final View iconLayout = contentView.findViewById(R.id.context_menu_icon_layout);
|
final View iconLayout = convertView.findViewById(R.id.context_menu_icon_layout);
|
||||||
final ImageView iconView = (ImageView) contentView.findViewById(R.id.context_menu_icon_view);
|
final ImageView iconView = (ImageView) convertView.findViewById(R.id.context_menu_icon_view);
|
||||||
Drawable icon = item.getLeftIcon();
|
Drawable icon = item.getLeftIcon();
|
||||||
int iconId = item.getLeftIconId();
|
int iconId = item.getLeftIconId();
|
||||||
if (icon != null) {
|
if (icon != null) {
|
||||||
|
@ -65,13 +64,13 @@ public class MultiSelectionArrayAdapter extends ArrayAdapter<MapMultiSelectionMe
|
||||||
}
|
}
|
||||||
|
|
||||||
// Text line 1
|
// Text line 1
|
||||||
TextView line1 = (TextView) contentView.findViewById(R.id.context_menu_line1);
|
TextView line1 = (TextView) convertView.findViewById(R.id.context_menu_line1);
|
||||||
((TextView) contentView.findViewById(R.id.context_menu_line1)).setTextColor(ContextCompat.getColor(getContext(),
|
((TextView) convertView.findViewById(R.id.context_menu_line1)).setTextColor(ContextCompat.getColor(getContext(),
|
||||||
!menu.isLight() ? R.color.ctx_menu_title_color_dark : R.color.ctx_menu_title_color_light));
|
!menu.isLight() ? R.color.ctx_menu_title_color_dark : R.color.ctx_menu_title_color_light));
|
||||||
line1.setText(item.getTitleStr());
|
line1.setText(item.getTitleStr());
|
||||||
|
|
||||||
// Text line 2
|
// Text line 2
|
||||||
TextView line2 = (TextView) contentView.findViewById(R.id.context_menu_line2);
|
TextView line2 = (TextView) convertView.findViewById(R.id.context_menu_line2);
|
||||||
((TextView) line2).setTextColor(ContextCompat.getColor(getContext(), R.color.ctx_menu_subtitle_color));
|
((TextView) line2).setTextColor(ContextCompat.getColor(getContext(), R.color.ctx_menu_subtitle_color));
|
||||||
line2.setText(item.getTypeStr());
|
line2.setText(item.getTypeStr());
|
||||||
Drawable slIcon = item.getTypeIcon();
|
Drawable slIcon = item.getTypeIcon();
|
||||||
|
@ -79,7 +78,7 @@ public class MultiSelectionArrayAdapter extends ArrayAdapter<MapMultiSelectionMe
|
||||||
line2.setCompoundDrawablePadding(AndroidUtils.dpToPx(menu.getMapActivity(), 5f));
|
line2.setCompoundDrawablePadding(AndroidUtils.dpToPx(menu.getMapActivity(), 5f));
|
||||||
|
|
||||||
// Divider
|
// Divider
|
||||||
View divider = contentView.findViewById(R.id.divider);
|
View divider = convertView.findViewById(R.id.divider);
|
||||||
divider.setVisibility(position != getCount() - 1 ? View.VISIBLE : View.GONE);
|
divider.setVisibility(position != getCount() - 1 ? View.VISIBLE : View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue