New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to create a new note everywhere #732
Conversation
Not a bad idea to offer both possibilities, too. Also, IMHO, the checkmark should not be displayed in the title bar. (Buttons/things there are usually valid for the complete StreetComplete application) Maybe rather choose a more obvious position, such as at the bottom right – you could also hide the zoom/GPS buttons there – when selecting the note position, they are not really needed. |
I was just using StreetComplete in Bangkok and really missed rhis function! 👍 for taking the initiative here, who knows how much later this would have been implemented by me. Tomorrow is another train ride ahead, so if I have connection, I will roughly look through it. A few comments about what I can see from your screenshots:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall very good code quality! 👍
You need to move that code from the quest-related code however.
f.setArguments(args); | ||
|
||
FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); | ||
ft.add(R.id.map_create_note_container, f, CREATE_NOTE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't the normal bottom sheet container be used? (Not sure right now, just looking at the diff)
values.put(CreateNoteTable.Columns.QUEST_TITLE, note.questTitle); | ||
if (note.questTitle != null) | ||
{ | ||
values.put(CreateNoteTable.Columns.QUEST_TITLE, note.questTitle); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the table allow NULL there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, could questTitle being null cause a NPE someplace else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok nevermind this comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, I meant to write that someplace else, do mind that comment!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(BTW: You can delete comments…)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the table allow NULL there?
I think so... In the StreetCompleteOpenHelper it does not say NOT NULL
Also, could questTitle being null cause a NPE someplace else?
I don't think so... As far as I have seen, there are null-checks everywhere.
Bundle args = new Bundle(); | ||
LatLon pos = mapFragment.getPosition(); | ||
args.putDouble(CreateNoteDialog.ARG_LAT, pos.getLatitude()); | ||
args.putDouble(CreateNoteDialog.ARG_LON, pos.getLongitude()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You use CreateNoteFragment but use the constants from CreateNoteDialog. That looks fishy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind that comment (can't remove it on mobile)
@@ -17,4 +18,7 @@ | |||
|
|||
/** Called when the user chose to skip the quest */ | |||
void onSkippedQuest(long questId, QuestGroup group); | |||
|
|||
/** Called when the user wants to leave a note which is not related to a quest */ | |||
void onLeaveNote(String note, ArrayList<String> imagePaths, LatLon position); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, as the callback doesn't have anything to do with quests (or answering them), the method should be in an own interface and not in this.
{ | ||
return controller.getZoom(); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should perhaps go into MapsFragment as it has nothing to do with quests?
{ | ||
callbackListener.onLeaveNote(text, imagePaths, position); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should also not be here. Has nothing to do with quests.
There is already a restriction. If the zoom level is lower than 15, a toast shows up which will ask you to zoom in further because you can't create a note otherwise.
They are limiting it too: You can only create a new note at a zoom level of 12 or higher.
I like that 👍 I will try to implement this. |
…from quest-related things
…plete, small optimizations
} | ||
} | ||
return note.text; | ||
return "via "+ ApplicationConstants.USER_AGENT+":\n\n" + note.text; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this relevant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just thought it might be useful if somebody wants to review notes created by StreetComplete with https://ent8r.github.io/NotesReview/
But it is totally fine if you think that this should not be added
Okay, thank you. I will take over and refactor some things before I merge it. |
# Conflicts: # app/src/main/java/de/westnordost/streetcomplete/MainActivity.java # app/src/main/res/menu/menu_main.xml # app/src/main/res/values/strings.xml
Refactored to have a common superclass for create note fragment and quest details fragment and many other things. One thing that definitely needs correction is that there is no feedback whatsoever after one created a note. I think the "unsynced quest counter" should also display the to-be-uploaded notes, even if they don't come out as "stars" in the "answered quests counter". |
…Counter counts note changes as well
Okay, I'm done. Anyone wants to review this again? |
This PR adds the ability to create a new note everywhere on the whole earth 🌎
You can either long-press on the map or select it in the menu (Which one do you prefer?) and then a marker will be displayed on the map if the zoom is higher than 15. The next step is to set the exact position of the note and click on ✔️ check if you're done to put in the text of the note. After that, the note will be stored in the database and uploaded the next time you're connected to the internet.
And this is how it looks like:
I hope you like it. 😄
BTW: this PR fixes #47