Skip to content

Commit 0939eef

Browse files
committed
Merge branch 'dev'
2 parents d14b9f7 + 32bbcbb commit 0939eef

File tree

127 files changed

+1924
-520
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+1924
-520
lines changed

.idea/misc.xml

Lines changed: 38 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CONTRIBUTE.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
2+
You want to report a bug, add a feature wish or maybe even add some code?
3+
That's great :D Here's how to do that.
4+
5+
# Report feedback (no GitHub-account needed)
6+
7+
1. Open the GeoNotes app.
8+
2. Go into the settings (upper right menu → "Settings"/gear-icon) and click on the "Feedback" button at the bottom of the screen.
9+
10+
This will open your default E-Mail App on your phone so that you can now write me an E-Mail.
11+
12+
# Report bug / add feature request
13+
14+
1. Search through the [existing issues](https://github.com/hauke96/GeoNotes/issues) if equal/similar requests already exist.
15+
2. If not, open a [new issue](https://github.com/hauke96/GeoNotes/issues/new). If your concern is already discussed in an existing issue, feel free to join the discussion.
16+
3. Describe the bug/feature as clearly as possible. Maybe add some screenshots or drawings to clear things up.
17+
4. Be open for questions and an discussion.
18+
19+
After a possible discussion, the bug will hopefully be fixed or the feature implemented.
20+
Don't be sad if your feature won't make it. This is not my only project and I'm running this in my spare time, my resources are therefore quite limited ;)
21+
22+
# Translate the app
23+
24+
The translations are within simple XML files, so it's kind of like code.
25+
This means you have to **fork and clone this repo** before you can start, so make yourself familiar with git, GitHub, forks and pull-requests.
26+
27+
## Enhance an existing translation
28+
29+
1. Go to `app/src/main/res/values-LANG` (where `LANG` is the language you want to enhance, so e.g. `it` if you want to improve the Italian translation)
30+
2. Open the `strings.xml` file and improve the translations.
31+
* Please make sure that the order of the entries is the same as in the original `values/strings.xml` file:
32+
3. Create a commit, push it and open a pull-request on GitHub.
33+
34+
## Add new language
35+
36+
1. Go to `app/src/main/res/`
37+
2. Create a folder `values-LANG` (where `LANG` has to be replaced with the language code of the language you want to add, so e.g. `it` for Italian)
38+
3. Copy the `strings.xml` from the `values` folder. This is the original English file.
39+
4. Replace each English string by the translated one.
40+
* Example: `<string name="reset">Reset</string>` becomes `<string name="reset">Zurücksetzen</string>` for the German translation:
41+
* Please make sure that the order of the entries is the same as in the original `values/strings.xml` file:
42+
5. Create a commit, push it and open a pull-request on GitHub.
43+
44+
# Contribute code
45+
46+
Please create an issue before adding code (except it's just a spelling mistake or something similarly small).
47+
48+
1. Open a [new issue](https://github.com/hauke96/GeoNotes/issues/new).
49+
2. Describe the changes you want to make as clearly as possible. Maybe add mock-ups/drawings, code snippets, diagrams, etc. to clear things up.
50+
3. Be open for questions and an discussion.
51+
4. When everything is clear, enjoy coding ;)
52+
5. Push your changes and open a pull-request on GitHub
53+
54+
Don't be sad if I don't want your feature idea to be in GeoNotes.
55+
This is my private project and I have a certain idea (s. the [README.md](README.md#use-case-and-philosophy) what this app should be and what not.
56+
But feel free to create a fork and develop your own version of this app :)

README.md

Lines changed: 11 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ A simple and lightweight app to create and manage georeferenced notes (text and
1010
## Download
1111

1212
[<img src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png" alt="Get it on F-Droid" height="60">](https://f-droid.org/packages/de.hauke_stieler.geonotes/)
13+
[<img src="https://gitlab.com/IzzyOnDroid/repo/-/raw/master/assets/IzzyOnDroid.png" alt="Get it on IzzyOnDroid" height="60">](https://apt.izzysoft.de/fdroid/index/apk/de.hauke_stieler.geonotes)
1314
[<img src="https://user-images.githubusercontent.com/663460/26973090-f8fdc986-4d14-11e7-995a-e7c5e79ed925.png" alt="Download APK from GitHub" height="60">](https://github.com/hauke96/geonotes/releases/latest)
1415

1516
GeoNotes runs on Android 4.1 (SDK 16) and newer. There's no version at the Google Play store (yet).
@@ -23,59 +24,30 @@ See the [OSM Wiki page](https://wiki.openstreetmap.org/wiki/GeoNotes) for detail
2324
* Create, move and delete notes
2425
* Attach photos to note
2526
* List of all notes
27+
* Organize your notes with categories
2628
* Export all notes in GeoJson or GPX format
2729
* Show and follow current location
2830

2931
## Contribute to this project
3032

31-
You want to report a bug, add a feature wish or maybe even add some code?
32-
That great :D Here's how to do so.
33-
34-
### Report feedback (no GitHub-account needed)
35-
36-
1. Open the GeoNotes app.
37-
2. Go into the settings (upper right menu → "Settings"/gear-icon) and click on the "Feedback" button at the bottom of the screen.
38-
39-
This will open your default E-Mail App on your phone so that you can now write me an E-Mail.
40-
41-
### Report bug / add feature request
42-
43-
1. Open a [new issue](https://github.com/hauke96/GeoNotes/issues/new).
44-
2. Describe the bug/feature as clearly as possible. Maybe add some screenshots or drawings to clear things up.
45-
3. Be open for questions and an discussion.
46-
47-
After a possible discussion, the bug will hopefully be fixed or the feature implemented.
48-
Don't be sad if your feature won't make it. This is not my only project and I'm running this in my spare time, my resources are therefore quite limited ;)
49-
50-
### Contribute code
51-
52-
Please create an issue before adding code (except it's just a spelling mistake or something similarly small).
53-
54-
1. Open a [new issue](https://github.com/hauke96/GeoNotes/issues/new).
55-
2. Describe the changes you want to make as clearly as possible. Maybe add mock-ups/drawings, code snippets, diagrams, etc. to clear things up.
56-
3. Be open for questions and an discussion.
57-
4. When everything is clear, enjoy coding ;)
58-
59-
Don't be sad if I don't want your feature idea to be in GeoNotes.
60-
This is my private project and I have a certain idea (s. below) what this app should be and what not.
61-
But feel free to create a fork and develop your own version of this app :)
33+
You want to contribute to GeoNotes? Great! Please read the [CONTRIBUTE.md](CONTRIBUTE.md) file for further information.
6234

6335
## Use-case and Philosophy
6436

6537
### Basic idea of this app
6638

67-
Take notes while being outside (maybe even while walking or sitting in a bus) and later add the data to e.g. OSM.
39+
Take notes as fast as possible while being outside (maybe even while walking or sitting in a bus) and later add the data to e.g. OSM.
6840

6941
### Usability principles
7042

7143
To implement the above goal/idea, the app follows some basic principles:
7244

73-
* **Simplicity:** Make creating, editing, moving and deleting of notes as fast/easy as possible
74-
* **No upload** of data and no creation of notes on osm.org
75-
* **General purpose:** No restriction in the content of a note
76-
* **Not a note management tool:** No import, no high level management operations
77-
* **Simple and pragmatic UI:** No unnecessary animations, no overloaded UIs
78-
* **Feature toggles:** The possibility to enable/disable features
45+
* **Simplicity:** Make creating, editing, moving and deleting of notes as fast/easy as possible.
46+
* **No upload** of data and no creation of notes on osm.org.
47+
* **General purpose:** No restriction in the content of a note.
48+
* **Not a note management tool:** No import, no high level management operations.
49+
* **Simple and pragmatic UI:** No unnecessary animations, no overloaded UIs.
50+
* **Feature toggles:** The possibility to enable/disable features.
7951

8052
### Features which will probably *not* be added to GeoNotes
8153

@@ -85,5 +57,5 @@ To implement the above goal/idea, the app follows some basic principles:
8557
* All sorts of features that will only be used by just a few users but require a lot of work to be implemented
8658
* iOS and other non-android support
8759

88-
Try other apps like [StreetComplete](https://github.com/streetcomplete/StreetComplete) if you want to do one of the above things.
60+
Try other apps like [StreetComplete](https://github.com/streetcomplete/StreetComplete) if you want to interact with OSM-data and osm.org notes directly.
8961

app/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ android {
1010
applicationId "de.hauke_stieler.geonotes"
1111
minSdkVersion 16
1212
targetSdkVersion 32
13-
versionCode 1004005
14-
versionName "1.4.5"
13+
versionCode 1005000
14+
versionName "1.5.0"
1515

1616
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1717
}
@@ -35,7 +35,7 @@ android {
3535
}
3636

3737
dependencies {
38-
implementation 'org.osmdroid:osmdroid-android:6.1.8'
38+
implementation 'org.osmdroid:osmdroid-android:6.1.13'
3939

4040
implementation 'androidx.appcompat:appcompat:1.4.1'
4141
implementation 'com.google.android.material:material:1.5.0'

app/src/main/AndroidManifest.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@
2121
android:roundIcon="@mipmap/ic_launcher"
2222
android:supportsRtl="true"
2323
android:theme="@style/Theme.GeoNotes">
24-
<activity android:name=".note_list.NoteListActivity" />
24+
<activity
25+
android:name=".categories.CategoryConfigurationActivity"
26+
android:label="@string/title_activity_categories" />
27+
<activity android:name=".note_list.NoteListActivity"
28+
android:label="@string/title_activity_note_list" />
2529
<activity
2630
android:name=".settings.SettingsActivity"
2731
android:label="@string/title_activity_settings" />
@@ -45,4 +49,5 @@
4549
android:resource="@xml/file_paths" />
4650
</provider>
4751
</application>
52+
4853
</manifest>

app/src/main/java/de/hauke_stieler/geonotes/Injector.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import de.hauke_stieler.geonotes.database.Database;
1313
import de.hauke_stieler.geonotes.export.Exporter;
14+
import de.hauke_stieler.geonotes.notes.NoteIconProvider;
1415

1516
import static android.content.Context.MODE_PRIVATE;
1617

@@ -34,6 +35,7 @@ public class Injector {
3435
classBuilders.put(Exporter.class, () -> buildExporter());
3536
classBuilders.put(SharedPreferences.class, () -> buildSharedPreferences());
3637
classBuilders.put(MapView.class, () -> buildMapView());
38+
classBuilders.put(NoteIconProvider.class, () -> buildNoteIconProvider());
3739
classBuilders.put(de.hauke_stieler.geonotes.map.Map.class, () -> buildMap());
3840
}
3941

@@ -76,8 +78,12 @@ private static MapView buildMapView() {
7678
return activity.findViewById(R.id.map);
7779
}
7880

81+
private static NoteIconProvider buildNoteIconProvider() {
82+
return new NoteIconProvider(context, get(Database.class));
83+
}
84+
7985
private static de.hauke_stieler.geonotes.map.Map buildMap() {
8086
MapView mapView = get(MapView.class);
81-
return new de.hauke_stieler.geonotes.map.Map(context, mapView, get(Database.class), get(SharedPreferences.class));
87+
return new de.hauke_stieler.geonotes.map.Map(context, mapView, get(Database.class), get(SharedPreferences.class), get(NoteIconProvider.class));
8288
}
8389
}

app/src/main/java/de/hauke_stieler/geonotes/MainActivity.java

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import java.util.ArrayList;
3838
import java.util.Date;
3939

40+
import de.hauke_stieler.geonotes.categories.CategoryConfigurationActivity;
4041
import de.hauke_stieler.geonotes.common.FileHelper;
4142
import de.hauke_stieler.geonotes.database.Database;
4243
import de.hauke_stieler.geonotes.export.Exporter;
@@ -84,7 +85,7 @@ protected void onCreate(Bundle savedInstanceState) {
8485

8586
// Set HTML text of copyright label
8687
((TextView) findViewById(R.id.copyright)).setMovementMethod(LinkMovementMethod.getInstance());
87-
((TextView) findViewById(R.id.copyright)).setText(Html.fromHtml("© <a href=\"https://openstreetmap.org/copyright\">OpenStreetMap</a> contributors"));
88+
((TextView) findViewById(R.id.copyright)).setText(Html.fromHtml(getString(R.string.osm_contribution)));
8889

8990
requestPermissionsIfNecessary(new String[]{
9091
Manifest.permission.WRITE_EXTERNAL_STORAGE,
@@ -180,6 +181,9 @@ public boolean onOptionsItemSelected(@NonNull MenuItem item) {
180181
case R.id.toolbar_btn_settings:
181182
startActivity(new Intent(this, SettingsActivity.class));
182183
return true;
184+
case R.id.toolbar_btn_categories:
185+
startActivity(new Intent(this, CategoryConfigurationActivity.class));
186+
return true;
183187
case R.id.toolbar_btn_note_list:
184188
startActivityForResult(new Intent(this, NoteListActivity.class), REQUEST_NOTE_LIST_REQUEST_CODE);
185189
return true;
@@ -304,26 +308,27 @@ private boolean hasPermission(String permission) {
304308
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
305309
super.onActivityResult(requestCode, resultCode, data);
306310

311+
// Maybe some or all notes got deleted via the note list -> reload map
312+
if (requestCode == REQUEST_NOTE_LIST_REQUEST_CODE) {
313+
map.reloadAllNotes();
314+
}
315+
307316
// If Intent was successful
308317
if (resultCode == RESULT_OK) {
309318
switch (requestCode) {
310319
case REQUEST_IMAGE_CAPTURE:
311320
addPhotoToDatabase(lastPhotoNoteId, lastPhotoFile);
312-
map.addImagesToMarkerWindow();
321+
map.addImagesToMarkerFragment();
313322
break;
314323
case REQUEST_NOTE_LIST_REQUEST_CODE:
315324
long selectedNoteId = data.getLongExtra(NoteListActivity.EXTRA_CLICKED_NOTE, -1L);
316325
if (selectedNoteId != -1) {
326+
// Note selected in the note list -> also select on the map
317327
map.selectNote(selectedNoteId);
318328
}
319329
break;
320330
}
321331
}
322-
323-
// Maybe some or all notes got deleted via the note list -> reload map
324-
if (requestCode == REQUEST_NOTE_LIST_REQUEST_CODE) {
325-
map.reloadAllNotes();
326-
}
327332
}
328333

329334
/**
@@ -347,7 +352,7 @@ private void addPhotoToDatabase(Long noteId, File photoFile) {
347352
try {
348353
ThumbnailUtil.writeThumbnail(sizeInPixel, photoFile);
349354
} catch (IOException e) {
350-
Toast.makeText(getApplicationContext(), "Creating thumbnail failed", Toast.LENGTH_SHORT);
355+
Toast.makeText(getApplicationContext(), R.string.create_thumbnail_failed, Toast.LENGTH_SHORT);
351356
}
352357
}
353358

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
package de.hauke_stieler.geonotes.categories;
2+
3+
import android.graphics.Color;
4+
5+
import de.hauke_stieler.geonotes.R;
6+
7+
public class Category {
8+
public final static int NONE_ID = -1;
9+
10+
private final long id;
11+
private String color;
12+
private String name;
13+
private final int drawableId;
14+
15+
public Category(long id, String color, String name) {
16+
this.id = id;
17+
this.color = color;
18+
this.name = name;
19+
this.drawableId = R.drawable.shape_item_cetagory_spinner;
20+
}
21+
22+
public Category(long id, String color, String name, int drawableId) {
23+
this.id = id;
24+
this.color = color;
25+
this.name = name;
26+
this.drawableId = drawableId;
27+
}
28+
29+
public long getId() {
30+
return id;
31+
}
32+
33+
public String getColorString() {
34+
return color;
35+
}
36+
37+
public void setColorString(String newColor) {
38+
this.color = newColor;
39+
}
40+
41+
public int getColor() {
42+
return Color.parseColor(getColorString());
43+
}
44+
45+
public String getName() {
46+
return name;
47+
}
48+
49+
public void setName(String newName) {
50+
this.name = newName;
51+
}
52+
53+
public int getDrawableId() {
54+
return drawableId;
55+
}
56+
57+
@Override
58+
public boolean equals(Object o) {
59+
if (this == o) return true;
60+
if (o == null || getClass() != o.getClass()) return false;
61+
Category category = (Category) o;
62+
return id == category.id;
63+
}
64+
65+
@Override
66+
public int hashCode() {
67+
int hash = 7;
68+
hash = 31 * hash + (int) id;
69+
return hash;
70+
}
71+
}

0 commit comments

Comments
 (0)