Fix compilation

This commit is contained in:
Victor Shcherb 2020-03-21 23:29:33 +01:00
parent 716705472e
commit d2fd6a6cc1
2 changed files with 9 additions and 11 deletions

View file

@ -12,6 +12,7 @@ import androidx.annotation.StringRes;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.quickaction.actions.NewAction;
import net.osmand.util.Algorithms;
import java.util.HashMap;
@ -24,15 +25,13 @@ public class QuickAction {
void onActionSelected(QuickAction action);
}
protected int type;
protected long id;
private String name;
private HashMap<String, String> params;
private QuickActionType actionType;
protected QuickAction() {
this.id = System.currentTimeMillis();
this(NewAction.TYPE);
}
public QuickAction(QuickActionType type) {
@ -42,7 +41,6 @@ public class QuickAction {
}
public QuickAction(QuickAction quickAction) {
this.type = quickAction.type;
this.actionType = quickAction.actionType;
this.id = quickAction.id;
this.name = quickAction.name;
@ -66,7 +64,7 @@ public class QuickAction {
}
public int getType() {
return type;
return actionType.getId();
}
public boolean isActionEditable() {
@ -126,9 +124,9 @@ public class QuickAction {
public boolean hasInstanceInList(List<QuickAction> active){
for (QuickAction action: active){
if (action.type == type) return true;
}
for (QuickAction action : active) {
if (action.getType() == getType()) return true;
}
return false;
}
@ -142,7 +140,7 @@ public class QuickAction {
QuickAction action = (QuickAction) o;
if (type != action.type) return false;
if (getType() != action.getType()) return false;
if (id != action.id) return false;
return true;
@ -152,7 +150,7 @@ public class QuickAction {
@Override
public int hashCode() {
int result = type;
int result = getType();
result = 31 * result + (int) (id ^ (id >>> 32));
return result;
}

View file

@ -10,7 +10,7 @@ import net.osmand.plus.quickaction.QuickActionType;
public class NewAction extends QuickAction {
public static final QuickActionType TYPE = new QuickActionType(1, "new",
public static final QuickActionType TYPE = new QuickActionType(0, "new",
NewAction.class).
nonEditable().iconRes(R.drawable.ic_action_plus).nameRes(R.string.quick_action_new_action);