-
-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #404 from krzyk/362
#362 Added fire hydrant type quest
- Loading branch information
Showing
25 changed files
with
319 additions
and
14 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
app/src/main/java/de/westnordost/streetcomplete/quests/fire_hydrant/AddFireHydrantType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package de.westnordost.streetcomplete.quests.fire_hydrant; | ||
|
||
import android.os.Bundle; | ||
|
||
import java.util.List; | ||
|
||
import javax.inject.Inject; | ||
|
||
import de.westnordost.streetcomplete.data.QuestImportance; | ||
import de.westnordost.streetcomplete.data.osm.SimpleOverpassQuestType; | ||
import de.westnordost.streetcomplete.data.osm.changes.StringMapChangesBuilder; | ||
import de.westnordost.streetcomplete.data.osm.download.OverpassMapDataDao; | ||
import de.westnordost.streetcomplete.quests.AbstractQuestAnswerFragment; | ||
|
||
public class AddFireHydrantType extends SimpleOverpassQuestType | ||
{ | ||
@Inject public AddFireHydrantType(OverpassMapDataDao overpassServer) | ||
{ | ||
super(overpassServer); | ||
} | ||
|
||
@Override | ||
protected String getTagFilters() | ||
{ | ||
return "nodes with emergency=fire_hydrant and !fire_hydrant:type"; | ||
} | ||
|
||
@Override | ||
public int importance() | ||
{ | ||
return QuestImportance.MINOR; | ||
} | ||
|
||
public AbstractQuestAnswerFragment createForm() | ||
{ | ||
return new AddFireHydrantTypeForm(); | ||
} | ||
|
||
public void applyAnswerTo(Bundle answer, StringMapChangesBuilder changes) | ||
{ | ||
List<String> values = answer.getStringArrayList(AddFireHydrantTypeForm.OSM_VALUES); | ||
if(values != null && values.size() == 1) | ||
{ | ||
changes.add("fire_hydrant:type", values.get(0)); | ||
} | ||
} | ||
|
||
@Override public String getCommitMessage() | ||
{ | ||
return "Add fire hydrant type"; | ||
} | ||
|
||
@Override public String getIconName() { | ||
return "fire_hydrant_type"; | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
...c/main/java/de/westnordost/streetcomplete/quests/fire_hydrant/AddFireHydrantTypeForm.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package de.westnordost.streetcomplete.quests.fire_hydrant; | ||
|
||
import android.os.Bundle; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
|
||
import de.westnordost.streetcomplete.R; | ||
import de.westnordost.streetcomplete.quests.ImageListQuestAnswerFragment; | ||
|
||
public class AddFireHydrantTypeForm extends ImageListQuestAnswerFragment | ||
{ | ||
private final OsmItem[] TYPES = new OsmItem[] { | ||
new OsmItem("pillar", R.drawable.fire_hydrant_pillar, R.string.quest_fireHydrant_type_pillar), | ||
new OsmItem("underground", R.drawable.fire_hydrant_underground, R.string.quest_fireHydrant_type_underground), | ||
new OsmItem("wall", R.drawable.fire_hydrant_wall, R.string.quest_fireHydrant_type_wall), | ||
new OsmItem("pond", R.drawable.fire_hydrant_pond, R.string.quest_fireHydrant_type_pond) | ||
}; | ||
|
||
@Override protected OsmItem[] getItems() | ||
{ | ||
return TYPES; | ||
} | ||
|
||
@Override protected int getItemsPerRow() | ||
{ | ||
return 2; | ||
} | ||
|
||
@Override protected int getMaxNumberOfInitiallyShownItems() | ||
{ | ||
return 2; | ||
} | ||
|
||
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, | ||
Bundle savedInstanceState) | ||
{ | ||
View view = super.onCreateView(inflater, container, savedInstanceState); | ||
setTitle(R.string.quest_fireHydrant_type_title); | ||
return view; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.