Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
155b9dc30e
14 changed files with 192 additions and 151 deletions
BIN
OsmAnd/res/drawable-xxhdpi/img_logo_38dp_contour_lines.png
Normal file
BIN
OsmAnd/res/drawable-xxhdpi/img_logo_38dp_contour_lines.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.7 KiB |
BIN
OsmAnd/res/drawable-xxhdpi/img_logo_38dp_osmand.png
Normal file
BIN
OsmAnd/res/drawable-xxhdpi/img_logo_38dp_osmand.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.6 KiB |
BIN
OsmAnd/res/drawable-xxhdpi/img_start_screen_travel_day.webp
Normal file
BIN
OsmAnd/res/drawable-xxhdpi/img_start_screen_travel_day.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
BIN
OsmAnd/res/drawable-xxhdpi/img_start_screen_travel_night.webp
Normal file
BIN
OsmAnd/res/drawable-xxhdpi/img_start_screen_travel_night.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.7 KiB |
|
@ -202,7 +202,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:maxLines="8"
|
||||
android:maxLines="1000"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textColorHint="?android:textColorSecondary"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -46,13 +47,54 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/article_description"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="?attr/bg_color"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
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:background="?attr/selectableItemBackground"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="3"
|
||||
android:textAppearance="@style/TextAppearance.ContextMenuSubtitle"
|
||||
tools:text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard." />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/text_button"
|
||||
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"/>
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/context_menu_padding_margin_tiny"
|
||||
android:layout_marginLeft="@dimen/bottom_sheet_content_padding_small"
|
||||
android:layout_marginStart="@dimen/bottom_sheet_content_padding_small"
|
||||
android:layout_marginTop="@dimen/context_menu_padding_margin_tiny"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:drawablePadding="@dimen/bottom_sheet_content_padding_small"
|
||||
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:paddingLeft="@dimen/bottom_sheet_content_padding_small"
|
||||
android:paddingRight="@dimen/bottom_sheet_content_padding_small"
|
||||
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:ignore="UnusedAttribute"
|
||||
tools:text="Read" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include
|
||||
android:id="@+id/bottom_shadow"
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
android:descendantFocusability="blocksDescendants"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
<View
|
||||
android:id="@+id/top_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="fitXY"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"
|
||||
android:visibility="visible"
|
||||
tools:visibility="visible" />
|
||||
|
||||
|
@ -24,45 +24,66 @@
|
|||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/map_button_shadow_width"
|
||||
android:background="?attr/selectableItemBackground">
|
||||
android:layout_height="@dimen/map_button_shadow_width">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon_left"
|
||||
android:layout_width="@dimen/map_button_shadow_width"
|
||||
android:layout_height="@dimen/map_button_shadow_width"
|
||||
android:visibility="invisible" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.v7.widget.AppCompatTextView
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/context_menu_controller_height"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginBottom="@dimen/context_menu_padding_margin_tiny"
|
||||
android:layout_marginLeft="@dimen/bottom_sheet_content_padding_small"
|
||||
android:layout_marginStart="@dimen/bottom_sheet_content_padding_small"
|
||||
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:textColor="@color/dashboard_blue"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
android:paddingEnd="@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:textColor="?attr/wikivoyage_active_color"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:ignore="UnusedAttribute"
|
||||
tools:text="Van Gogh Museum" />
|
||||
|
||||
</LinearLayout>
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="@dimen/standard_icon_size"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="?attr/dashboard_divider" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon_right"
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/categories_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/map_button_shadow_width"
|
||||
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" />
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginBottom="@dimen/context_menu_padding_margin_tiny"
|
||||
android:layout_marginEnd="@dimen/bottom_sheet_content_padding_small"
|
||||
android:layout_marginLeft="@dimen/bottom_sheet_content_padding_small"
|
||||
android:layout_marginRight="@dimen/bottom_sheet_content_padding_small"
|
||||
android:layout_marginStart="@dimen/bottom_sheet_content_padding_small"
|
||||
android:layout_marginTop="@dimen/context_menu_padding_margin_tiny"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:drawablePadding="@dimen/bottom_sheet_content_padding_small"
|
||||
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:paddingLeft="@dimen/bottom_sheet_content_padding_small"
|
||||
android:paddingRight="@dimen/bottom_sheet_content_padding_small"
|
||||
android:paddingTop="@dimen/context_menu_padding_margin_tiny"
|
||||
android:text="@string/search_categories"
|
||||
android:textColor="?attr/wikivoyage_active_color"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:drawableRight="@drawable/ic_action_filter"
|
||||
tools:ignore="UnusedAttribute" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -70,6 +91,8 @@
|
|||
android:id="@+id/divider"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="@dimen/content_padding"
|
||||
android:layout_marginStart="@dimen/content_padding"
|
||||
android:background="?attr/dashboard_divider" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -214,7 +214,7 @@
|
|||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:inputType="textMultiLine"
|
||||
android:maxLines="8"
|
||||
android:maxLines="1000"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textColorHint="?android:textColorSecondary"/>
|
||||
|
||||
|
|
|
@ -463,7 +463,6 @@ public class MapMarkersHelper {
|
|||
private void createHeadersInGroup(@NonNull MapMarkersGroup group) {
|
||||
GroupHeader header = new GroupHeader();
|
||||
CategoriesSubHeader categoriesSubHeader = new CategoriesSubHeader();
|
||||
WikivoyageArticleSubHeader wikivoyageArticleSubHeader = new WikivoyageArticleSubHeader();
|
||||
int type = group.getType();
|
||||
if (type != -1) {
|
||||
header.iconRes = type == MapMarkersGroup.FAVORITES_TYPE
|
||||
|
@ -472,10 +471,8 @@ public class MapMarkersHelper {
|
|||
}
|
||||
header.group = group;
|
||||
categoriesSubHeader.group = group;
|
||||
wikivoyageArticleSubHeader.group = group;
|
||||
group.header = header;
|
||||
group.categoriesSubHeader = categoriesSubHeader;
|
||||
group.wikivoyageArticleSubHeader = wikivoyageArticleSubHeader;
|
||||
}
|
||||
|
||||
private void removeMarkerFromGroup(MapMarker marker) {
|
||||
|
@ -1226,7 +1223,6 @@ public class MapMarkersHelper {
|
|||
// TODO should be removed from this class:
|
||||
private GroupHeader header;
|
||||
private CategoriesSubHeader categoriesSubHeader;
|
||||
private WikivoyageArticleSubHeader wikivoyageArticleSubHeader;
|
||||
private ShowHideHistoryButton showHideHistoryButton;
|
||||
|
||||
public MapMarkersGroup() {
|
||||
|
@ -1307,10 +1303,6 @@ public class MapMarkersHelper {
|
|||
return categoriesSubHeader;
|
||||
}
|
||||
|
||||
public WikivoyageArticleSubHeader getWikivoyageArticleSubHeader() {
|
||||
return wikivoyageArticleSubHeader;
|
||||
}
|
||||
|
||||
public ShowHideHistoryButton getShowHideHistoryButton() {
|
||||
return showHideHistoryButton;
|
||||
}
|
||||
|
@ -1375,19 +1367,6 @@ public class MapMarkersHelper {
|
|||
}
|
||||
}
|
||||
|
||||
public static class WikivoyageArticleSubHeader {
|
||||
private int iconRes;
|
||||
private MapMarkersGroup group;
|
||||
|
||||
public int getIconRes() {
|
||||
return iconRes;
|
||||
}
|
||||
|
||||
public MapMarkersGroup getGroup() {
|
||||
return group;
|
||||
}
|
||||
}
|
||||
|
||||
public static class MapMarker implements LocationPoint {
|
||||
private static int[] colors;
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ public class SelectWptCategoriesBottomSheetDialogFragment extends MenuBottomShee
|
|||
public static final String TAG = "SelectWptCategoriesBottomSheetDialogFragment";
|
||||
public static final String GPX_FILE_PATH_KEY = "gpx_file_path";
|
||||
public static final String UPDATE_CATEGORIES_KEY = "update_categories";
|
||||
public static final String ACTIVE_CATEGORIES_KEY = "active_categories";
|
||||
|
||||
private GPXFile gpxFile;
|
||||
|
||||
|
@ -48,13 +49,15 @@ public class SelectWptCategoriesBottomSheetDialogFragment extends MenuBottomShee
|
|||
return;
|
||||
}
|
||||
isUpdateMode = getArguments().getBoolean(UPDATE_CATEGORIES_KEY);
|
||||
List<String> categories = getArguments().getStringArrayList(ACTIVE_CATEGORIES_KEY);
|
||||
|
||||
items.add(new TitleItem(getGpxName(gpxFile)));
|
||||
|
||||
items.add(new DescriptionItem(getString(R.string.select_waypoints_category_description)));
|
||||
|
||||
final BottomSheetItemWithCompoundButton[] selectAllItem = new BottomSheetItemWithCompoundButton[1];
|
||||
selectAllItem[0] = (BottomSheetItemWithCompoundButton) new BottomSheetItemWithCompoundButton.Builder()
|
||||
.setChecked(true)
|
||||
.setChecked(!isUpdateMode || categories!=null&&categories.size() == gpxFile.getPointsByCategories().size())
|
||||
.setDescription(getString(R.string.shared_string_total) + ": " + gpxFile.getPoints().size())
|
||||
.setIcon(getContentIcon(R.drawable.ic_action_group_select_all))
|
||||
.setTitle(getString(R.string.shared_string_select_all))
|
||||
|
@ -79,7 +82,7 @@ public class SelectWptCategoriesBottomSheetDialogFragment extends MenuBottomShee
|
|||
for (String category : pointsByCategories.keySet()) {
|
||||
final BottomSheetItemWithCompoundButton[] categoryItem = new BottomSheetItemWithCompoundButton[1];
|
||||
categoryItem[0] = (BottomSheetItemWithCompoundButton) new BottomSheetItemWithCompoundButton.Builder()
|
||||
.setChecked(true)
|
||||
.setChecked(!isUpdateMode || (categories != null && categories.contains(category)))
|
||||
.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
|
@ -105,31 +108,18 @@ public class SelectWptCategoriesBottomSheetDialogFragment extends MenuBottomShee
|
|||
.create();
|
||||
items.add(categoryItem[0]);
|
||||
categoryItems.add(categoryItem[0]);
|
||||
if (!isUpdateMode || categories != null && categories.contains(category)) {
|
||||
selectedCategories.add(category);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getRightBottomButtonTextId() {
|
||||
if (isUpdateMode) {
|
||||
return super.getRightBottomButtonTextId();
|
||||
} else {
|
||||
return R.string.shared_string_add;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getDismissButtonTextId() {
|
||||
if (isUpdateMode) {
|
||||
return R.string.shared_string_update;
|
||||
} else {
|
||||
return super.getDismissButtonTextId();
|
||||
}
|
||||
}
|
||||
|
||||
protected void onDismissButtonClickAction() {
|
||||
if (isUpdateMode) {
|
||||
updateAddOrEnableGroupWptCategories();
|
||||
return R.string.shared_string_add;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,14 +12,14 @@ import net.osmand.plus.R;
|
|||
|
||||
public class MapMarkerCategoriesViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
final ImageView icon;
|
||||
final TextView title;
|
||||
final TextView button;
|
||||
final View divider;
|
||||
|
||||
public MapMarkerCategoriesViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
icon = (ImageView) itemView.findViewById(R.id.icon_right);
|
||||
title = (TextView) itemView.findViewById(R.id.title);
|
||||
button = (TextView) itemView.findViewById(R.id.categories_button);
|
||||
divider = itemView.findViewById(R.id.divider);
|
||||
}
|
||||
}
|
|
@ -14,9 +14,11 @@ public class MapMarkerHeaderViewHolder extends RecyclerView.ViewHolder {
|
|||
final ImageView icon;
|
||||
final View iconSpace;
|
||||
final TextView title;
|
||||
final TextView content;
|
||||
final TextView button;
|
||||
final SwitchCompat disableGroupSwitch;
|
||||
final View bottomShadow;
|
||||
final View divider;
|
||||
final View articleDescription;
|
||||
|
||||
public MapMarkerHeaderViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
|
@ -25,6 +27,8 @@ 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);
|
||||
content = itemView.findViewById(R.id.content);
|
||||
button = itemView.findViewById(R.id.text_button);
|
||||
articleDescription = itemView.findViewById(R.id.article_description);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
package net.osmand.plus.mapmarkers.adapters;
|
||||
|
||||
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.plus.R;
|
||||
|
||||
public class MapMarkerOpenWikivoyageArticleViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
final ImageView icon;
|
||||
final TextView title;
|
||||
final View divider;
|
||||
|
||||
public MapMarkerOpenWikivoyageArticleViewHolder(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);
|
||||
}
|
||||
}
|
|
@ -38,8 +38,11 @@ import java.text.SimpleDateFormat;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
|
@ -47,7 +50,6 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
|
|||
private static final int MARKER_TYPE = 2;
|
||||
private static final int SHOW_HIDE_HISTORY_TYPE = 3;
|
||||
private static final int CATEGORIES_TYPE = 4;
|
||||
private static final int WIKIVOYAGE_ARTICLE_TYPE = 5;
|
||||
|
||||
private static final int TODAY_HEADER = 56;
|
||||
private static final int YESTERDAY_HEADER = 57;
|
||||
|
@ -166,8 +168,6 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
|
|||
String gpxName = travelDbHelper.getGPXName(art);
|
||||
File path = mapActivity.getMyApplication().getAppPath(IndexConstants.GPX_TRAVEL_DIR + gpxName);
|
||||
if (path.getAbsolutePath().equals(group.getGpxPath())) {
|
||||
MapMarkersHelper.WikivoyageArticleSubHeader wikivoyageArticleSubHeader = group.getWikivoyageArticleSubHeader();
|
||||
items.add(wikivoyageArticleSubHeader);
|
||||
group.setWikivoyageArticle(art);
|
||||
}
|
||||
}
|
||||
|
@ -267,9 +267,6 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
|
|||
} else if (viewType == CATEGORIES_TYPE) {
|
||||
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.map_marker_item_subheader, viewGroup, false);
|
||||
return new MapMarkerCategoriesViewHolder(view);
|
||||
}else if (viewType == WIKIVOYAGE_ARTICLE_TYPE) {
|
||||
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.map_marker_item_subheader, viewGroup, false);
|
||||
return new MapMarkerOpenWikivoyageArticleViewHolder(view);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unsupported view type");
|
||||
}
|
||||
|
@ -421,6 +418,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
|
|||
headerString = String.valueOf(dateHeader);
|
||||
}
|
||||
headerViewHolder.disableGroupSwitch.setVisibility(View.GONE);
|
||||
headerViewHolder.articleDescription.setVisibility(View.GONE);
|
||||
} else if (header instanceof GroupHeader) {
|
||||
final GroupHeader groupHeader = (GroupHeader) header;
|
||||
final MapMarkersGroup group = groupHeader.getGroup();
|
||||
|
@ -442,7 +440,29 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
|
|||
headerViewHolder.icon.setImageDrawable(iconsCache.getIcon(groupHeader.getIconRes(), R.color.divider_color));
|
||||
final boolean groupIsDisabled = group.isDisabled();
|
||||
headerViewHolder.disableGroupSwitch.setVisibility(View.VISIBLE);
|
||||
headerViewHolder.divider.setVisibility(group.getWptCategories().isEmpty() ? View.GONE : View.VISIBLE);
|
||||
final TravelArticle article = group.getWikivoyageArticle();
|
||||
if (article != null && !groupIsDisabled) {
|
||||
headerViewHolder.articleDescription.setVisibility(View.VISIBLE);
|
||||
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);
|
||||
}
|
||||
CompoundButton.OnCheckedChangeListener checkedChangeListener = new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean enabled) {
|
||||
|
@ -454,6 +474,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
|
|||
group.setWasShown(true);
|
||||
Bundle args = new Bundle();
|
||||
args.putString(SelectWptCategoriesBottomSheetDialogFragment.GPX_FILE_PATH_KEY, group.getGpxPath());
|
||||
args.putString(SelectWptCategoriesBottomSheetDialogFragment.ACTIVE_CATEGORIES_KEY, group.getWptCategoriesString());
|
||||
args.putBoolean(SelectWptCategoriesBottomSheetDialogFragment.UPDATE_CATEGORIES_KEY, true);
|
||||
|
||||
SelectWptCategoriesBottomSheetDialogFragment fragment = new SelectWptCategoriesBottomSheetDialogFragment();
|
||||
|
@ -534,16 +555,14 @@ 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.icon.setImageDrawable(iconsCache.getIcon(categoriesSubHeader.getIconRes(), R.color.divider_color));
|
||||
categoriesViewHolder.title.setText(group.getWptCategoriesString());
|
||||
categoriesViewHolder.divider.setVisibility(View.VISIBLE);
|
||||
categoriesViewHolder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
View.OnClickListener openChooseCategoriesDialog = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (!group.getWptCategories().isEmpty()) {
|
||||
Bundle args = new Bundle();
|
||||
args.putString(SelectWptCategoriesBottomSheetDialogFragment.GPX_FILE_PATH_KEY, group.getGpxPath());
|
||||
args.putBoolean(SelectWptCategoriesBottomSheetDialogFragment.UPDATE_CATEGORIES_KEY, true);
|
||||
args.putStringArrayList(SelectWptCategoriesBottomSheetDialogFragment.ACTIVE_CATEGORIES_KEY, new ArrayList<String>(group.getWptCategories()));
|
||||
SelectWptCategoriesBottomSheetDialogFragment fragment = new SelectWptCategoriesBottomSheetDialogFragment();
|
||||
fragment.setArguments(args);
|
||||
fragment.setUsedOnMap(false);
|
||||
|
@ -552,25 +571,15 @@ 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);
|
||||
}
|
||||
} else if (holder instanceof MapMarkerOpenWikivoyageArticleViewHolder) {
|
||||
final MapMarkerOpenWikivoyageArticleViewHolder wikivoyageArticleViewHolder = (MapMarkerOpenWikivoyageArticleViewHolder) holder;
|
||||
final Object header = getItem(position);
|
||||
final MapMarkersHelper.WikivoyageArticleSubHeader wikivoyageArticleSubHeader = (MapMarkersHelper.WikivoyageArticleSubHeader) header;
|
||||
final MapMarkersGroup group = wikivoyageArticleSubHeader.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) {
|
||||
TravelArticle article = group.getWikivoyageArticle();
|
||||
if (mapActivity.getSupportFragmentManager() != null && article != null) {
|
||||
WikivoyageArticleDialogFragment.showInstance(app, mapActivity.getSupportFragmentManager(), article.getCityId(), article.getLang());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -585,6 +594,25 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
|
|||
}
|
||||
}
|
||||
|
||||
private String getGroupWptCategoriesString(MapMarkersGroup group) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Set<String> categories = group.getWptCategories();
|
||||
if (categories != null && !categories.isEmpty()) {
|
||||
Iterator<String> it = categories.iterator();
|
||||
while (it.hasNext()) {
|
||||
String category = it.next();
|
||||
if (category.equals("")) {
|
||||
category = app.getResources().getString(R.string.waypoints);
|
||||
}
|
||||
sb.append(category);
|
||||
if (it.hasNext()) {
|
||||
sb.append(", ");
|
||||
}
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
Object item = items.get(position);
|
||||
|
@ -596,8 +624,6 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
|
|||
return SHOW_HIDE_HISTORY_TYPE;
|
||||
} else if (item instanceof MapMarkersHelper.CategoriesSubHeader) {
|
||||
return CATEGORIES_TYPE;
|
||||
}else if (item instanceof MapMarkersHelper.WikivoyageArticleSubHeader) {
|
||||
return WIKIVOYAGE_ARTICLE_TYPE;
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unsupported view type");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue