Skip to content
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

Merged
merged 9 commits into from Jan 17, 2018

Conversation

ENT8R
Copy link
Contributor

@ENT8R ENT8R commented Dec 19, 2017

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

@rugk
Copy link
Contributor

rugk commented Dec 20, 2017

You can either long-press on the map or select it in the menu (Which one do youpref prefer?)

Not a bad idea to offer both possibilities, too.
When choosing the long-press mode, the "selector screen" afterwards could be skipped, as the user likely already tapped at the position where they want to have the mote.

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.

@westnordost
Copy link
Member

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.
Especially the adding-photos function makes this a killer feature.

A few comments about what I can see from your screenshots:

and then a marker will be displayed on the map if the zoom is higher than 15

  1. If that limitation is going to stay, then it should not be possible to create a note from a lower zoom level. I guess a similar functionality as the main openstreetmap.org website would be ok (do they limit it?)

  2. Additionally, I don't like the extra step of placing/moving the note. If when pressing the button, a panel (like for quests) comes up from the bottom and directly offers to input a note, the user can at the same time adjust the note's position by moving the map. Also, the input size is bigger.

  3. I think the description for the create new note screen should be different (and shorter). It should mention that you can select the position of the note by moving the note and otherwise perhaps keep the description similar to what is written on openstreetmap.org when creating a new note.

Copy link
Member

@westnordost westnordost left a 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);
Copy link
Member

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);
Copy link
Member

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?

Copy link
Member

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok nevermind this comment.

Copy link
Member

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!

Copy link
Contributor

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…)

Copy link
Contributor Author

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());
Copy link
Member

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.

Copy link
Member

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);
Copy link
Member

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();
}

Copy link
Member

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);
}

Copy link
Member

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.

@ENT8R
Copy link
Contributor Author

ENT8R commented Dec 30, 2017

If that limitation is going to stay, then it should not be possible to create a note from a lower zoom level.

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.

I guess a similar functionality as the main openstreetmap.org website would be ok (do they limit it?)

They are limiting it too: You can only create a new note at a zoom level of 12 or higher.

If when pressing the button, a panel (like for quests) comes up from the bottom and directly offers to input a note

I like that 👍 I will try to implement this.

@ENT8R
Copy link
Contributor Author

ENT8R commented Jan 5, 2018

With the latest commit, the note creation dialog looks like this:

Is this OK?

The dialog is now loaded into the bottom sheet fragment. The user can also move the map while the note is created. And I followed your proposals to differenciate between the quest-related things and the note creation.

}
}
return note.text;
return "via "+ ApplicationConstants.USER_AGENT+":\n\n" + note.text;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this relevant?

Copy link
Contributor Author

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

@westnordost
Copy link
Member

Okay, thank you. I will take over and refactor some things before I merge it.

@westnordost westnordost self-assigned this Jan 7, 2018
# 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
@westnordost
Copy link
Member

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".

@westnordost
Copy link
Member

Okay, I'm done.

Anyone wants to review this again?

@westnordost westnordost removed their assignment Jan 14, 2018
@westnordost westnordost merged commit b38c108 into streetcomplete:master Jan 17, 2018
@ENT8R ENT8R deleted the notes branch January 17, 2018 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to create private note and/or osm note
3 participants