Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
hauke96 committed Oct 18, 2022
2 parents d14b9f7 + 32bbcbb commit 0939eef
Show file tree
Hide file tree
Showing 127 changed files with 1,924 additions and 520 deletions.
38 changes: 38 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 56 additions & 0 deletions CONTRIBUTE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

You want to report a bug, add a feature wish or maybe even add some code?
That's great :D Here's how to do that.

# Report feedback (no GitHub-account needed)

1. Open the GeoNotes app.
2. Go into the settings (upper right menu → "Settings"/gear-icon) and click on the "Feedback" button at the bottom of the screen.

This will open your default E-Mail App on your phone so that you can now write me an E-Mail.

# Report bug / add feature request

1. Search through the [existing issues](https://github.com/hauke96/GeoNotes/issues) if equal/similar requests already exist.
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.
3. Describe the bug/feature as clearly as possible. Maybe add some screenshots or drawings to clear things up.
4. Be open for questions and an discussion.

After a possible discussion, the bug will hopefully be fixed or the feature implemented.
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 ;)

# Translate the app

The translations are within simple XML files, so it's kind of like code.
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.

## Enhance an existing translation

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)
2. Open the `strings.xml` file and improve the translations.
* Please make sure that the order of the entries is the same as in the original `values/strings.xml` file:
3. Create a commit, push it and open a pull-request on GitHub.

## Add new language

1. Go to `app/src/main/res/`
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)
3. Copy the `strings.xml` from the `values` folder. This is the original English file.
4. Replace each English string by the translated one.
* Example: `<string name="reset">Reset</string>` becomes `<string name="reset">Zurücksetzen</string>` for the German translation:
* Please make sure that the order of the entries is the same as in the original `values/strings.xml` file:
5. Create a commit, push it and open a pull-request on GitHub.

# Contribute code

Please create an issue before adding code (except it's just a spelling mistake or something similarly small).

1. Open a [new issue](https://github.com/hauke96/GeoNotes/issues/new).
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.
3. Be open for questions and an discussion.
4. When everything is clear, enjoy coding ;)
5. Push your changes and open a pull-request on GitHub

Don't be sad if I don't want your feature idea to be in GeoNotes.
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.
But feel free to create a fork and develop your own version of this app :)
50 changes: 11 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ A simple and lightweight app to create and manage georeferenced notes (text and
## Download

[<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/)
[<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)
[<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)

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

## Contribute to this project

You want to report a bug, add a feature wish or maybe even add some code?
That great :D Here's how to do so.

### Report feedback (no GitHub-account needed)

1. Open the GeoNotes app.
2. Go into the settings (upper right menu → "Settings"/gear-icon) and click on the "Feedback" button at the bottom of the screen.

This will open your default E-Mail App on your phone so that you can now write me an E-Mail.

### Report bug / add feature request

1. Open a [new issue](https://github.com/hauke96/GeoNotes/issues/new).
2. Describe the bug/feature as clearly as possible. Maybe add some screenshots or drawings to clear things up.
3. Be open for questions and an discussion.

After a possible discussion, the bug will hopefully be fixed or the feature implemented.
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 ;)

### Contribute code

Please create an issue before adding code (except it's just a spelling mistake or something similarly small).

1. Open a [new issue](https://github.com/hauke96/GeoNotes/issues/new).
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.
3. Be open for questions and an discussion.
4. When everything is clear, enjoy coding ;)

Don't be sad if I don't want your feature idea to be in GeoNotes.
This is my private project and I have a certain idea (s. below) what this app should be and what not.
But feel free to create a fork and develop your own version of this app :)
You want to contribute to GeoNotes? Great! Please read the [CONTRIBUTE.md](CONTRIBUTE.md) file for further information.

## Use-case and Philosophy

### Basic idea of this app

Take notes while being outside (maybe even while walking or sitting in a bus) and later add the data to e.g. OSM.
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.

### Usability principles

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

* **Simplicity:** Make creating, editing, moving and deleting of notes as fast/easy as possible
* **No upload** of data and no creation of notes on osm.org
* **General purpose:** No restriction in the content of a note
* **Not a note management tool:** No import, no high level management operations
* **Simple and pragmatic UI:** No unnecessary animations, no overloaded UIs
* **Feature toggles:** The possibility to enable/disable features
* **Simplicity:** Make creating, editing, moving and deleting of notes as fast/easy as possible.
* **No upload** of data and no creation of notes on osm.org.
* **General purpose:** No restriction in the content of a note.
* **Not a note management tool:** No import, no high level management operations.
* **Simple and pragmatic UI:** No unnecessary animations, no overloaded UIs.
* **Feature toggles:** The possibility to enable/disable features.

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

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

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

6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId "de.hauke_stieler.geonotes"
minSdkVersion 16
targetSdkVersion 32
versionCode 1004005
versionName "1.4.5"
versionCode 1005000
versionName "1.5.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand All @@ -35,7 +35,7 @@ android {
}

dependencies {
implementation 'org.osmdroid:osmdroid-android:6.1.8'
implementation 'org.osmdroid:osmdroid-android:6.1.13'

implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
Expand Down
7 changes: 6 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/Theme.GeoNotes">
<activity android:name=".note_list.NoteListActivity" />
<activity
android:name=".categories.CategoryConfigurationActivity"
android:label="@string/title_activity_categories" />
<activity android:name=".note_list.NoteListActivity"
android:label="@string/title_activity_note_list" />
<activity
android:name=".settings.SettingsActivity"
android:label="@string/title_activity_settings" />
Expand All @@ -45,4 +49,5 @@
android:resource="@xml/file_paths" />
</provider>
</application>

</manifest>
8 changes: 7 additions & 1 deletion app/src/main/java/de/hauke_stieler/geonotes/Injector.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import de.hauke_stieler.geonotes.database.Database;
import de.hauke_stieler.geonotes.export.Exporter;
import de.hauke_stieler.geonotes.notes.NoteIconProvider;

import static android.content.Context.MODE_PRIVATE;

Expand All @@ -34,6 +35,7 @@ public class Injector {
classBuilders.put(Exporter.class, () -> buildExporter());
classBuilders.put(SharedPreferences.class, () -> buildSharedPreferences());
classBuilders.put(MapView.class, () -> buildMapView());
classBuilders.put(NoteIconProvider.class, () -> buildNoteIconProvider());
classBuilders.put(de.hauke_stieler.geonotes.map.Map.class, () -> buildMap());
}

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

private static NoteIconProvider buildNoteIconProvider() {
return new NoteIconProvider(context, get(Database.class));
}

private static de.hauke_stieler.geonotes.map.Map buildMap() {
MapView mapView = get(MapView.class);
return new de.hauke_stieler.geonotes.map.Map(context, mapView, get(Database.class), get(SharedPreferences.class));
return new de.hauke_stieler.geonotes.map.Map(context, mapView, get(Database.class), get(SharedPreferences.class), get(NoteIconProvider.class));
}
}
21 changes: 13 additions & 8 deletions app/src/main/java/de/hauke_stieler/geonotes/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import java.util.ArrayList;
import java.util.Date;

import de.hauke_stieler.geonotes.categories.CategoryConfigurationActivity;
import de.hauke_stieler.geonotes.common.FileHelper;
import de.hauke_stieler.geonotes.database.Database;
import de.hauke_stieler.geonotes.export.Exporter;
Expand Down Expand Up @@ -84,7 +85,7 @@ protected void onCreate(Bundle savedInstanceState) {

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

requestPermissionsIfNecessary(new String[]{
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Expand Down Expand Up @@ -180,6 +181,9 @@ public boolean onOptionsItemSelected(@NonNull MenuItem item) {
case R.id.toolbar_btn_settings:
startActivity(new Intent(this, SettingsActivity.class));
return true;
case R.id.toolbar_btn_categories:
startActivity(new Intent(this, CategoryConfigurationActivity.class));
return true;
case R.id.toolbar_btn_note_list:
startActivityForResult(new Intent(this, NoteListActivity.class), REQUEST_NOTE_LIST_REQUEST_CODE);
return true;
Expand Down Expand Up @@ -304,26 +308,27 @@ private boolean hasPermission(String permission) {
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);

// Maybe some or all notes got deleted via the note list -> reload map
if (requestCode == REQUEST_NOTE_LIST_REQUEST_CODE) {
map.reloadAllNotes();
}

// If Intent was successful
if (resultCode == RESULT_OK) {
switch (requestCode) {
case REQUEST_IMAGE_CAPTURE:
addPhotoToDatabase(lastPhotoNoteId, lastPhotoFile);
map.addImagesToMarkerWindow();
map.addImagesToMarkerFragment();
break;
case REQUEST_NOTE_LIST_REQUEST_CODE:
long selectedNoteId = data.getLongExtra(NoteListActivity.EXTRA_CLICKED_NOTE, -1L);
if (selectedNoteId != -1) {
// Note selected in the note list -> also select on the map
map.selectNote(selectedNoteId);
}
break;
}
}

// Maybe some or all notes got deleted via the note list -> reload map
if (requestCode == REQUEST_NOTE_LIST_REQUEST_CODE) {
map.reloadAllNotes();
}
}

/**
Expand All @@ -347,7 +352,7 @@ private void addPhotoToDatabase(Long noteId, File photoFile) {
try {
ThumbnailUtil.writeThumbnail(sizeInPixel, photoFile);
} catch (IOException e) {
Toast.makeText(getApplicationContext(), "Creating thumbnail failed", Toast.LENGTH_SHORT);
Toast.makeText(getApplicationContext(), R.string.create_thumbnail_failed, Toast.LENGTH_SHORT);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package de.hauke_stieler.geonotes.categories;

import android.graphics.Color;

import de.hauke_stieler.geonotes.R;

public class Category {
public final static int NONE_ID = -1;

private final long id;
private String color;
private String name;
private final int drawableId;

public Category(long id, String color, String name) {
this.id = id;
this.color = color;
this.name = name;
this.drawableId = R.drawable.shape_item_cetagory_spinner;
}

public Category(long id, String color, String name, int drawableId) {
this.id = id;
this.color = color;
this.name = name;
this.drawableId = drawableId;
}

public long getId() {
return id;
}

public String getColorString() {
return color;
}

public void setColorString(String newColor) {
this.color = newColor;
}

public int getColor() {
return Color.parseColor(getColorString());
}

public String getName() {
return name;
}

public void setName(String newName) {
this.name = newName;
}

public int getDrawableId() {
return drawableId;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Category category = (Category) o;
return id == category.id;
}

@Override
public int hashCode() {
int hash = 7;
hash = 31 * hash + (int) id;
return hash;
}
}
Loading

0 comments on commit 0939eef

Please sign in to comment.