improve markers categories design and add clicks on text and categories

This commit is contained in:
Chumva 2018-04-19 12:34:58 +03:00
parent 1795ddf56c
commit f957bef897
3 changed files with 37 additions and 23 deletions

View file

@ -60,10 +60,11 @@
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginStart="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
android:layout_marginEnd="@dimen/content_padding"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
android:layout_marginStart="@dimen/content_padding"
android:background="?attr/selectableItemBackground"
android:ellipsize="end"
android:maxLines="3"
android:textAppearance="@style/TextAppearance.ContextMenuSubtitle"

View file

@ -29,20 +29,29 @@
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/title"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/bottom_sheet_content_padding_small"
android:layout_marginStart="@dimen/bottom_sheet_content_padding_small"
android:layout_marginBottom="@dimen/context_menu_padding_margin_tiny"
android:layout_marginTop="@dimen/context_menu_padding_margin_tiny"
android:layout_weight="2"
android:background="?attr/selectableItemBackground"
android:ellipsize="end"
android:gravity="center_vertical"
android:letterSpacing="@dimen/text_button_letter_spacing"
android:maxLines="1"
android:paddingBottom="@dimen/context_menu_padding_margin_tiny"
android:paddingEnd="@dimen/list_content_padding"
android:paddingLeft="@dimen/list_content_padding"
android:paddingRight="@dimen/list_content_padding"
android:paddingLeft="@dimen/bottom_sheet_content_padding_small"
android:paddingRight="@dimen/bottom_sheet_content_padding_small"
android:paddingStart="@dimen/list_content_padding"
android:paddingTop="@dimen/context_menu_padding_margin_tiny"
android:textColor="?attr/wikivoyage_active_color"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium"
tools:text="Van Gogh " />
tools:text="Van Gogh "
tools:ignore="UnusedAttribute"/>
<View
android:layout_width="1dp"

View file

@ -443,20 +443,23 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
final TravelArticle article = group.getWikivoyageArticle();
if (article != null && !groupIsDisabled) {
headerViewHolder.articleDescription.setVisibility(View.VISIBLE);
if (article.getContent().isEmpty()) {
headerViewHolder.content.setVisibility(View.GONE);
} else {
headerViewHolder.content.setText(article.getContent());
}
headerViewHolder.button.setText(R.string.shared_string_read);
headerViewHolder.button.setOnClickListener(new View.OnClickListener() {
View.OnClickListener openWikiwoyageArticle = new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mapActivity.getSupportFragmentManager() != null) {
WikivoyageArticleDialogFragment.showInstance(app, mapActivity.getSupportFragmentManager(), article.getCityId(), article.getLang());
}
}
});
};
if (article.getContent().isEmpty()) {
headerViewHolder.content.setVisibility(View.GONE);
} else {
headerViewHolder.content.setText(article.getContent());
headerViewHolder.content.setOnClickListener(openWikiwoyageArticle);
}
headerViewHolder.button.setText(R.string.shared_string_read);
headerViewHolder.button.setOnClickListener(openWikiwoyageArticle);
} else {
headerViewHolder.articleDescription.setVisibility(View.GONE);
}
@ -552,13 +555,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
if (header instanceof MapMarkersHelper.CategoriesSubHeader) {
final MapMarkersHelper.CategoriesSubHeader categoriesSubHeader = (MapMarkersHelper.CategoriesSubHeader) header;
final MapMarkersGroup group = categoriesSubHeader.getGroup();
categoriesViewHolder.title.setText(getGroupWptCategoriesString(group));
categoriesViewHolder.divider.setVisibility(View.VISIBLE);
categoriesViewHolder.button.setCompoundDrawablesWithIntrinsicBounds(
null, null, app.getIconsCache().getIcon(R.drawable.ic_action_filter,
night ? R.color.wikivoyage_active_dark : R.color.wikivoyage_active_light), null);
categoriesViewHolder.button.setOnClickListener(new View.OnClickListener() {
View.OnClickListener openChooseCategoriesDialog = new View.OnClickListener() {
@Override
public void onClick(View view) {
if (!group.getWptCategories().isEmpty()) {
@ -574,7 +571,14 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
mapActivity.getMyApplication().getMapMarkersHelper().addOrEnableGpxGroup(new File(group.getGpxPath()));
}
}
});
};
categoriesViewHolder.title.setText(getGroupWptCategoriesString(group));
categoriesViewHolder.divider.setVisibility(View.VISIBLE);
categoriesViewHolder.button.setCompoundDrawablesWithIntrinsicBounds(
null, null, app.getIconsCache().getIcon(R.drawable.ic_action_filter,
night ? R.color.wikivoyage_active_dark : R.color.wikivoyage_active_light), null);
categoriesViewHolder.button.setOnClickListener(openChooseCategoriesDialog);
categoriesViewHolder.title.setOnClickListener(openChooseCategoriesDialog);
}
}
}