quick actions show/hide poi (use icon of poi) fixed
This commit is contained in:
parent
dd888e73b0
commit
b0e3306de7
5 changed files with 37 additions and 5 deletions
|
@ -194,7 +194,7 @@ public class CreateEditActionDialog extends DialogFragment {
|
||||||
if (savedInstanceState == null) name.setText(action.getName(getContext()));
|
if (savedInstanceState == null) name.setText(action.getName(getContext()));
|
||||||
else action.setName(name.getText().toString());
|
else action.setName(name.getText().toString());
|
||||||
|
|
||||||
image.setImageResource(action.getIconRes());
|
image.setImageResource(action.getIconRes(getApplication()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupFooter(final View root){
|
private void setupFooter(final View root){
|
||||||
|
|
|
@ -68,6 +68,10 @@ public class QuickAction {
|
||||||
return iconRes;
|
return iconRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getIconRes(Context context) {
|
||||||
|
return iconRes;
|
||||||
|
}
|
||||||
|
|
||||||
public long getId() {
|
public long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
|
@ -757,6 +757,35 @@ public class QuickActionFactory {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getIconRes(Context context) {
|
||||||
|
|
||||||
|
if (getParams().get(KEY_FILTERS) == null || getParams().get(KEY_FILTERS).isEmpty()) {
|
||||||
|
|
||||||
|
return super.getIconRes();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
OsmandApplication app = (OsmandApplication) context.getApplicationContext();
|
||||||
|
List<String> filters = new ArrayList<>();
|
||||||
|
|
||||||
|
String filtersId = getParams().get(KEY_FILTERS);
|
||||||
|
Collections.addAll(filters, filtersId.split(","));
|
||||||
|
|
||||||
|
PoiUIFilter filter = app.getPoiFilters().getFilterById(filters.get(0));
|
||||||
|
|
||||||
|
Object res = filter.getIconResource();
|
||||||
|
|
||||||
|
if (filter == null) return super.getIconRes();
|
||||||
|
|
||||||
|
if (res instanceof String && RenderingIcons.containsBigIcon(res.toString())) {
|
||||||
|
|
||||||
|
return RenderingIcons.getBigIconResourceId(res.toString());
|
||||||
|
|
||||||
|
} else return super.getIconRes();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(MapActivity activity) {
|
public void execute(MapActivity activity) {
|
||||||
|
|
||||||
|
@ -1694,7 +1723,6 @@ public class QuickActionFactory {
|
||||||
return filtered;
|
return filtered;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getAddBtnText() {
|
protected int getAddBtnText() {
|
||||||
return R.string.quick_action_map_style_action;
|
return R.string.quick_action_map_style_action;
|
||||||
|
|
|
@ -196,7 +196,7 @@ public class QuickActionListFragment extends BaseOsmAndFragment implements Quick
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(final RecyclerView.ViewHolder holder, int position) {
|
public void onBindViewHolder(final RecyclerView.ViewHolder holder, int position) {
|
||||||
int viewType = getItemViewType(position);
|
int viewType = getItemViewType(position);
|
||||||
final QuickAction item = itemsList.get(position);
|
final QuickAction item = QuickActionFactory.produceAction(itemsList.get(position));
|
||||||
|
|
||||||
if (viewType == SCREEN_ITEM_TYPE) {
|
if (viewType == SCREEN_ITEM_TYPE) {
|
||||||
final QuickActionItemVH itemVH = (QuickActionItemVH) holder;
|
final QuickActionItemVH itemVH = (QuickActionItemVH) holder;
|
||||||
|
@ -204,7 +204,7 @@ public class QuickActionListFragment extends BaseOsmAndFragment implements Quick
|
||||||
itemVH.title.setText(item.getName(getContext()));
|
itemVH.title.setText(item.getName(getContext()));
|
||||||
itemVH.subTitle.setText(getResources().getString(R.string.quick_action_item_action, getActionPosition(position)));
|
itemVH.subTitle.setText(getResources().getString(R.string.quick_action_item_action, getActionPosition(position)));
|
||||||
|
|
||||||
itemVH.icon.setImageDrawable(getMyApplication().getIconsCache().getThemedIcon(item.getIconRes()));
|
itemVH.icon.setImageDrawable(getMyApplication().getIconsCache().getThemedIcon(item.getIconRes(getContext())));
|
||||||
itemVH.handleView.setOnTouchListener(new View.OnTouchListener() {
|
itemVH.handleView.setOnTouchListener(new View.OnTouchListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouch(View v, MotionEvent event) {
|
public boolean onTouch(View v, MotionEvent event) {
|
||||||
|
|
|
@ -209,7 +209,7 @@ public class QuickActionsWidget extends LinearLayout {
|
||||||
actions.get(i + (position * ELEMENT_PER_PAGE)));
|
actions.get(i + (position * ELEMENT_PER_PAGE)));
|
||||||
|
|
||||||
((ImageView) view.findViewById(R.id.imageView))
|
((ImageView) view.findViewById(R.id.imageView))
|
||||||
.setImageResource(action.getIconRes());
|
.setImageResource(action.getIconRes(getContext()));
|
||||||
|
|
||||||
((TextView) view.findViewById(R.id.title))
|
((TextView) view.findViewById(R.id.title))
|
||||||
.setText(action.getActionText(application));
|
.setText(action.getActionText(application));
|
||||||
|
|
Loading…
Reference in a new issue