diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2014-09-09 19:47:22 +0200 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2014-09-09 19:47:22 +0200 |
| commit | b394678c65193edf09d5717162f5db6d075e2b3b (patch) | |
| tree | 191eb0b9d167509c178d2ced2b813b4874017e75 | |
| parent | 789130734996ee989e534d7b841fc71a23063002 (diff) | |
| download | cgeo-b394678c65193edf09d5717162f5db6d075e2b3b.zip cgeo-b394678c65193edf09d5717162f5db6d075e2b3b.tar.gz cgeo-b394678c65193edf09d5717162f5db6d075e2b3b.tar.bz2 | |
fix #4336: better auto increase of waypoint name
| -rw-r--r-- | main/src/cgeo/geocaching/EditWaypointActivity.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/main/src/cgeo/geocaching/EditWaypointActivity.java b/main/src/cgeo/geocaching/EditWaypointActivity.java index 5dfb1d5..2666cdd 100644 --- a/main/src/cgeo/geocaching/EditWaypointActivity.java +++ b/main/src/cgeo/geocaching/EditWaypointActivity.java @@ -328,12 +328,14 @@ public class EditWaypointActivity extends AbstractActionBarActivity implements C return type.getL10n(); } } - // for other types add an index by default - int index = 1; - while (wpNames.contains(type.getL10n() + " " + index)) { - index++; + // for other types add an index by default, which is highest found index + 1 + int max = 0; + for (int i = 0; i < 30; i++) { + if (wpNames.contains(type.getL10n() + " " + i)) { + max = i; + } } - return type.getL10n() + " " + index; + return type.getL10n() + " " + (max + 1); } private WaypointType getSelectedWaypointType() { |
