Fix #5192
This commit is contained in:
parent
2198b9607e
commit
28c00dd5d6
4 changed files with 49 additions and 22 deletions
|
@ -19,8 +19,7 @@ public class OsmandActionBarActivity extends OsmandInAppPurchaseActivity {
|
||||||
|
|
||||||
//should be called after set content view
|
//should be called after set content view
|
||||||
protected void setupHomeButton(){
|
protected void setupHomeButton(){
|
||||||
Drawable back = ((OsmandApplication)getApplication()).getUIUtilities().getIcon(R.drawable.ic_arrow_back);
|
Drawable back = ((OsmandApplication)getApplication()).getUIUtilities().getIcon(R.drawable.ic_arrow_back, R.color.color_white);
|
||||||
back.setColorFilter(ContextCompat.getColor(this, R.color.color_white), PorterDuff.Mode.MULTIPLY);
|
|
||||||
final ActionBar supportActionBar = getSupportActionBar();
|
final ActionBar supportActionBar = getSupportActionBar();
|
||||||
if (supportActionBar != null) {
|
if (supportActionBar != null) {
|
||||||
supportActionBar.setHomeButtonEnabled(true);
|
supportActionBar.setHomeButtonEnabled(true);
|
||||||
|
|
|
@ -13,6 +13,7 @@ import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
|
import android.support.v4.graphics.drawable.DrawableCompat;
|
||||||
import android.support.v7.view.ContextThemeWrapper;
|
import android.support.v7.view.ContextThemeWrapper;
|
||||||
import android.text.ClipboardManager;
|
import android.text.ClipboardManager;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
@ -752,7 +753,10 @@ public class MenuBuilder {
|
||||||
public Drawable getRowIcon(Context ctx, String fileName) {
|
public Drawable getRowIcon(Context ctx, String fileName) {
|
||||||
Drawable d = RenderingIcons.getBigIcon(ctx, fileName);
|
Drawable d = RenderingIcons.getBigIcon(ctx, fileName);
|
||||||
if (d != null) {
|
if (d != null) {
|
||||||
d.setColorFilter(app.getResources().getColor(light ? R.color.ctx_menu_bottom_view_icon_light : R.color.ctx_menu_bottom_view_icon_dark), PorterDuff.Mode.SRC_IN);
|
d = DrawableCompat.wrap(d);
|
||||||
|
d.mutate();
|
||||||
|
d.setColorFilter(app.getResources().getColor(light
|
||||||
|
? R.color.ctx_menu_bottom_view_icon_light : R.color.ctx_menu_bottom_view_icon_dark), PorterDuff.Mode.SRC_IN);
|
||||||
return d;
|
return d;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -25,6 +25,7 @@ import net.osmand.data.Amenity;
|
||||||
import net.osmand.data.PointDescription;
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.osm.AbstractPoiType;
|
import net.osmand.osm.AbstractPoiType;
|
||||||
import net.osmand.osm.MapPoiTypes;
|
import net.osmand.osm.MapPoiTypes;
|
||||||
|
import net.osmand.osm.PoiCategory;
|
||||||
import net.osmand.osm.PoiType;
|
import net.osmand.osm.PoiType;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
|
@ -49,6 +50,7 @@ import java.util.Calendar;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -344,6 +346,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
|
||||||
|
|
||||||
Map<String, List<PoiType>> poiAdditionalCategories = new HashMap<>();
|
Map<String, List<PoiType>> poiAdditionalCategories = new HashMap<>();
|
||||||
AmenityInfoRow cuisineRow = null;
|
AmenityInfoRow cuisineRow = null;
|
||||||
|
List<PoiType> collectedPoiTypes = new ArrayList<>();
|
||||||
|
|
||||||
for (Map.Entry<String, String> e : amenity.getAdditionalInfo().entrySet()) {
|
for (Map.Entry<String, String> e : amenity.getAdditionalInfo().entrySet()) {
|
||||||
int iconId = 0;
|
int iconId = 0;
|
||||||
|
@ -362,14 +365,15 @@ public class AmenityMenuBuilder extends MenuBuilder {
|
||||||
boolean isWiki = false;
|
boolean isWiki = false;
|
||||||
boolean isText = false;
|
boolean isText = false;
|
||||||
boolean isDescription = false;
|
boolean isDescription = false;
|
||||||
boolean needLinks = !("population".equals(key)
|
boolean needLinks = !("population".equals(key) || "height".equals(key));
|
||||||
|| "height".equals(key));
|
|
||||||
boolean isPhoneNumber = false;
|
boolean isPhoneNumber = false;
|
||||||
boolean isUrl = false;
|
boolean isUrl = false;
|
||||||
boolean isCuisine = false;
|
boolean isCuisine = false;
|
||||||
int poiTypeOrder = 0;
|
int poiTypeOrder = 0;
|
||||||
String poiTypeKeyName = "";
|
String poiTypeKeyName = "";
|
||||||
|
|
||||||
|
PoiType poiType = amenity.getType().getPoiTypeByKeyName(key);
|
||||||
|
|
||||||
AbstractPoiType pt = poiTypes.getAnyPoiAdditionalTypeByKey(key);
|
AbstractPoiType pt = poiTypes.getAnyPoiAdditionalTypeByKey(key);
|
||||||
if (pt == null && !Algorithms.isEmpty(vl) && vl.length() < 50) {
|
if (pt == null && !Algorithms.isEmpty(vl) && vl.length() < 50) {
|
||||||
pt = poiTypes.getAnyPoiAdditionalTypeByKey(key + "_" + vl);
|
pt = poiTypes.getAnyPoiAdditionalTypeByKey(key + "_" + vl);
|
||||||
|
@ -501,6 +505,8 @@ public class AmenityMenuBuilder extends MenuBuilder {
|
||||||
if (icon == null && isText && iconId == 0) {
|
if (icon == null && isText && iconId == 0) {
|
||||||
iconId = R.drawable.ic_action_note_dark;
|
iconId = R.drawable.ic_action_note_dark;
|
||||||
}
|
}
|
||||||
|
} else if (poiType != null) {
|
||||||
|
collectedPoiTypes.add(poiType);
|
||||||
} else {
|
} else {
|
||||||
textPrefix = Algorithms.capitalizeFirstLetterAndLowercase(e.getKey());
|
textPrefix = Algorithms.capitalizeFirstLetterAndLowercase(e.getKey());
|
||||||
vl = amenity.unzipContent(e.getValue());
|
vl = amenity.unzipContent(e.getValue());
|
||||||
|
@ -524,12 +530,10 @@ public class AmenityMenuBuilder extends MenuBuilder {
|
||||||
}
|
}
|
||||||
if (isDescription) {
|
if (isDescription) {
|
||||||
descriptions.add(row);
|
descriptions.add(row);
|
||||||
} else {
|
} else if (isCuisine) {
|
||||||
if (!isCuisine) {
|
|
||||||
infoRows.add(row);
|
|
||||||
} else {
|
|
||||||
cuisineRow = row;
|
cuisineRow = row;
|
||||||
}
|
} else if (poiType == null) {
|
||||||
|
infoRows.add(row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -568,12 +572,27 @@ public class AmenityMenuBuilder extends MenuBuilder {
|
||||||
sb.append(pt.getTranslation());
|
sb.append(pt.getTranslation());
|
||||||
}
|
}
|
||||||
boolean cuisineOrDish = categoryName.equals(Amenity.CUISINE) || categoryName.equals(Amenity.DISH);
|
boolean cuisineOrDish = categoryName.equals(Amenity.CUISINE) || categoryName.equals(Amenity.DISH);
|
||||||
CollapsableView collapsableView = getPoiAdditionalCollapsableView(view.getContext(), true, categoryTypes, cuisineOrDish ? cuisineRow : null);
|
CollapsableView collapsableView = getPoiTypeCollapsableView(view.getContext(), true, categoryTypes, true, cuisineOrDish ? cuisineRow : null);
|
||||||
infoRows.add(new AmenityInfoRow(poiAdditionalCategoryName, icon, pType.getPoiAdditionalCategoryTranslation(), sb.toString(), true, collapsableView,
|
infoRows.add(new AmenityInfoRow(poiAdditionalCategoryName, icon, pType.getPoiAdditionalCategoryTranslation(), sb.toString(), true, collapsableView,
|
||||||
0, false, false, false, pType.getOrder(), pType.getKeyName(), false, false, false, 1));
|
0, false, false, false, pType.getOrder(), pType.getKeyName(), false, false, false, 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (collectedPoiTypes.size() > 0) {
|
||||||
|
CollapsableView collapsableView = getPoiTypeCollapsableView(view.getContext(), true, collectedPoiTypes, false, null);
|
||||||
|
PoiCategory poiCategory = amenity.getType();
|
||||||
|
Drawable icon = getRowIcon(view.getContext(), poiCategory.getIconKeyName());
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (PoiType pt : collectedPoiTypes) {
|
||||||
|
if (sb.length() > 0) {
|
||||||
|
sb.append(" • ");
|
||||||
|
}
|
||||||
|
sb.append(pt.getTranslation());
|
||||||
|
}
|
||||||
|
infoRows.add(new AmenityInfoRow(poiCategory.getKeyName(), icon, poiCategory.getTranslation(), sb.toString(), true, collapsableView,
|
||||||
|
0, false, false, false, 40, poiCategory.getKeyName(), false, false, false, 1));
|
||||||
|
}
|
||||||
|
|
||||||
Collections.sort(infoRows, new Comparator<AmenityInfoRow>() {
|
Collections.sort(infoRows, new Comparator<AmenityInfoRow>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(AmenityInfoRow row1, AmenityInfoRow row2) {
|
public int compare(AmenityInfoRow row1, AmenityInfoRow row2) {
|
||||||
|
@ -664,9 +683,9 @@ public class AmenityMenuBuilder extends MenuBuilder {
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
private CollapsableView getPoiAdditionalCollapsableView(
|
private CollapsableView getPoiTypeCollapsableView(final Context context, boolean collapsed,
|
||||||
final Context context, boolean collapsed,
|
@NonNull final List<PoiType> categoryTypes,
|
||||||
@NonNull final List<PoiType> categoryTypes, AmenityInfoRow textCuisineRow) {
|
final boolean poiAdditional, AmenityInfoRow textRow) {
|
||||||
|
|
||||||
final List<TextViewEx> buttons = new ArrayList<>();
|
final List<TextViewEx> buttons = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -684,9 +703,15 @@ public class AmenityMenuBuilder extends MenuBuilder {
|
||||||
PoiUIFilter filter = app.getPoiFilters().getFilterById(PoiUIFilter.STD_PREFIX + amenity.getType().getKeyName());
|
PoiUIFilter filter = app.getPoiFilters().getFilterById(PoiUIFilter.STD_PREFIX + amenity.getType().getKeyName());
|
||||||
if (filter != null) {
|
if (filter != null) {
|
||||||
filter.clearFilter();
|
filter.clearFilter();
|
||||||
|
if (poiAdditional) {
|
||||||
filter.setTypeToAccept(amenity.getType(), true);
|
filter.setTypeToAccept(amenity.getType(), true);
|
||||||
filter.updateTypesToAccept(pt);
|
filter.updateTypesToAccept(pt);
|
||||||
filter.setFilterByName(pt.getKeyName().replace('_', ':').toLowerCase());
|
filter.setFilterByName(pt.getKeyName().replace('_', ':').toLowerCase());
|
||||||
|
} else {
|
||||||
|
LinkedHashSet<String> accept = new LinkedHashSet<>();
|
||||||
|
accept.add(pt.getKeyName());
|
||||||
|
filter.selectSubTypesToAccept(amenity.getType(), accept);
|
||||||
|
}
|
||||||
getMapActivity().showQuickSearch(filter);
|
getMapActivity().showQuickSearch(filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -699,9 +724,9 @@ public class AmenityMenuBuilder extends MenuBuilder {
|
||||||
view.addView(button);
|
view.addView(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (textCuisineRow != null) {
|
if (textRow != null) {
|
||||||
TextViewEx button = buildButtonInCollapsableView(context, true, false, false);
|
TextViewEx button = buildButtonInCollapsableView(context, true, false, false);
|
||||||
String name = textCuisineRow.textPrefix + ": " + textCuisineRow.text.toLowerCase();
|
String name = textRow.textPrefix + ": " + textRow.text.toLowerCase();
|
||||||
button.setText(name);
|
button.setText(name);
|
||||||
view.addView(button);
|
view.addView(button);
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,8 +109,7 @@ public class QuickActionListFragment extends BaseOsmAndFragment implements Quick
|
||||||
|
|
||||||
private void setUpToolbar(View view) {
|
private void setUpToolbar(View view) {
|
||||||
Toolbar toolbar = (Toolbar) view.findViewById(R.id.custom_toolbar);
|
Toolbar toolbar = (Toolbar) view.findViewById(R.id.custom_toolbar);
|
||||||
Drawable back = getMyApplication().getUIUtilities().getIcon(R.drawable.ic_arrow_back);
|
Drawable back = getMyApplication().getUIUtilities().getIcon(R.drawable.ic_arrow_back, R.color.color_white);
|
||||||
back.setColorFilter(ContextCompat.getColor(getContext(), R.color.color_white), PorterDuff.Mode.MULTIPLY);
|
|
||||||
toolbar.setNavigationIcon(back);
|
toolbar.setNavigationIcon(back);
|
||||||
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
||||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||||
|
|
Loading…
Reference in a new issue