quick action params check
This commit is contained in:
parent
2e486cf9ca
commit
dc31eda502
3 changed files with 43 additions and 27 deletions
|
@ -2519,4 +2519,5 @@ If you need help with OsmAnd application, please contact our support team: suppo
|
|||
<string name="quick_action_sh_poi_discrp">You can add few POI categories to display on the map.</string>
|
||||
<string name="quic_action_map_style_doscrp">Tap on the action button will toggle the map style, from the list order.</string>
|
||||
<string name="quick_action_map_style_action">Add map style</string>
|
||||
<string name="quick_action_empty_param_error">Parameters should not be empty</string>
|
||||
</resources>
|
||||
|
|
|
@ -19,6 +19,7 @@ import android.view.ViewGroup;
|
|||
import android.view.Window;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.data.FavouritePoint;
|
||||
import net.osmand.plus.FavouritesDbHelper;
|
||||
|
@ -191,7 +192,7 @@ public class CreateEditActionDialog extends DialogFragment {
|
|||
@Override
|
||||
public void onClick(View view) {
|
||||
|
||||
action.fillParams(((ViewGroup) root.findViewById(R.id.container)).getChildAt(0), (MapActivity) getActivity());
|
||||
if (action.fillParams(((ViewGroup) root.findViewById(R.id.container)).getChildAt(0), (MapActivity) getActivity())) {
|
||||
|
||||
if (quickActionRegistry.isNameUnique(action, getContext())) {
|
||||
|
||||
|
@ -226,6 +227,10 @@ public class CreateEditActionDialog extends DialogFragment {
|
|||
|
||||
((EditText) root.findViewById(R.id.name)).setText(action.getName(getContext()));
|
||||
}
|
||||
} else {
|
||||
|
||||
Toast.makeText(getContext(), R.string.quick_action_empty_param_error, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -787,6 +787,11 @@ public class QuickActionFactory {
|
|||
builder.setSkipPaintingWithoutColor(true);
|
||||
adapter.addItem(builder.createItem());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean fillParams(View root, MapActivity activity) {
|
||||
return !getParams().isEmpty() && (getParams().get(KEY_FILTERS) != null || !getParams().get(KEY_FILTERS).isEmpty());
|
||||
}
|
||||
}
|
||||
|
||||
public static class GPXAction extends QuickAction {
|
||||
|
@ -1518,5 +1523,10 @@ public class QuickActionFactory {
|
|||
|
||||
return styles;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean fillParams(View root, MapActivity activity) {
|
||||
return !getParams().isEmpty() && (getParams().get(KEY_STYLES) != null || !getParams().get(KEY_STYLES).isEmpty());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue