Skip to content

Commit 77588b9

Browse files
committed
Merge branch 'dev'
2 parents f5f577d + f6382b8 commit 77588b9

40 files changed

+856
-187
lines changed

.idea/androidTestResultsUserPreferences.xml

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

.idea/misc.xml

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

app/build.gradle

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@ plugins {
33
}
44

55
android {
6-
compileSdkVersion 32
6+
compileSdkVersion 33
77
buildToolsVersion "30.0.3"
88

99
defaultConfig {
1010
applicationId "de.hauke_stieler.geonotes"
1111
minSdkVersion 16
12-
targetSdkVersion 32
13-
versionCode 1005002
14-
versionName "1.5.2"
12+
targetSdkVersion 33
13+
versionCode 1006000
14+
versionName "1.6.0"
15+
multiDexEnabled true
1516

1617
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1718
}
@@ -31,22 +32,28 @@ android {
3132
unitTests {
3233
includeAndroidResources = true
3334
}
35+
unitTests.all {
36+
jvmArgs '-noverify'
37+
}
3438
}
3539
}
3640

3741
dependencies {
3842
implementation 'org.osmdroid:osmdroid-android:6.1.13'
3943

40-
implementation 'androidx.appcompat:appcompat:1.4.1'
41-
implementation 'com.google.android.material:material:1.5.0'
44+
implementation 'androidx.appcompat:appcompat:1.6.1'
45+
// noinspection GradleDependency: Versions 1.7.0+ caused compile problems
46+
implementation 'com.google.android.material:material:1.6.0'
47+
implementation 'androidx.recyclerview:recyclerview:1.3.0'
4248
implementation 'androidx.preference:preference:1.2.0'
4349
implementation 'org.apache.commons:commons-text:1.9'
4450
implementation 'com.google.code.gson:gson:2.8.8'
4551
implementation 'me.himanshusoni.gpxparser:gpx-parser:1.13'
52+
implementation 'com.android.support:multidex:1.0.3'
4653

4754
testImplementation 'junit:junit:4.13.2'
4855
testImplementation 'org.mockito:mockito-inline:3.8.0'
4956

50-
testImplementation 'androidx.test.ext:junit:1.1.3'
57+
testImplementation 'androidx.test.ext:junit:1.1.5'
5158
testImplementation 'org.robolectric:robolectric:4.5.1'
5259
}

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

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,24 @@
4545
import de.hauke_stieler.geonotes.map.MarkerFragment;
4646
import de.hauke_stieler.geonotes.map.TouchDownListener;
4747
import de.hauke_stieler.geonotes.note_list.NoteListActivity;
48+
import de.hauke_stieler.geonotes.notes.NoteIconProvider;
4849
import de.hauke_stieler.geonotes.photo.ThumbnailUtil;
4950
import de.hauke_stieler.geonotes.settings.SettingsActivity;
5051

5152
public class MainActivity extends AppCompatActivity {
5253

53-
private static final int REQUEST_NOTE_LIST_REQUEST_CODE = 4;
54-
private static final int REQUEST_PERMISSIONS_REQUEST_CODE = 3;
55-
private static final int REQUEST_CAMERA_PERMISSIONS_REQUEST_CODE = 2;
56-
private static final int REQUEST_IMAGE_CAPTURE = 1;
54+
static final int REQUEST_CATEGORIES_REQUEST_CODE = 5;
55+
static final int REQUEST_NOTE_LIST_REQUEST_CODE = 4;
56+
static final int REQUEST_PERMISSIONS_REQUEST_CODE = 3;
57+
static final int REQUEST_CAMERA_PERMISSIONS_REQUEST_CODE = 2;
58+
static final int REQUEST_IMAGE_CAPTURE = 1;
5759

5860
private Map map;
5961
private SharedPreferences preferences;
6062
private Database database;
6163
private Exporter exporter;
6264
private Toolbar toolbar;
65+
private NoteIconProvider noteIconProvider;
6366

6467
// These fields exist to remember the photo data when the photo Intent is started. This is
6568
// because the Intent doesn't return anything and works asynchronously. In the result handler
@@ -79,6 +82,7 @@ protected void onCreate(Bundle savedInstanceState) {
7982
database = Injector.get(Database.class);
8083
preferences = Injector.get(SharedPreferences.class);
8184
exporter = Injector.get(Exporter.class);
85+
noteIconProvider = Injector.get(NoteIconProvider.class);
8286

8387
toolbar = findViewById(R.id.toolbar);
8488
setSupportActionBar(toolbar);
@@ -182,7 +186,7 @@ public boolean onOptionsItemSelected(@NonNull MenuItem item) {
182186
startActivity(new Intent(this, SettingsActivity.class));
183187
return true;
184188
case R.id.toolbar_btn_categories:
185-
startActivity(new Intent(this, CategoryConfigurationActivity.class));
189+
startActivityForResult(new Intent(this, CategoryConfigurationActivity.class), REQUEST_CATEGORIES_REQUEST_CODE);
186190
return true;
187191
case R.id.toolbar_btn_note_list:
188192
startActivityForResult(new Intent(this, NoteListActivity.class), REQUEST_NOTE_LIST_REQUEST_CODE);
@@ -327,6 +331,9 @@ protected void onActivityResult(int requestCode, int resultCode, @Nullable Inten
327331
map.selectNote(selectedNoteId);
328332
}
329333
break;
334+
case REQUEST_CATEGORIES_REQUEST_CODE:
335+
noteIconProvider.updateIcons();
336+
break;
330337
}
331338
}
332339
}
@@ -352,7 +359,7 @@ private void addPhotoToDatabase(Long noteId, File photoFile) {
352359
try {
353360
ThumbnailUtil.writeThumbnail(sizeInPixel, photoFile);
354361
} catch (IOException e) {
355-
Toast.makeText(getApplicationContext(), R.string.create_thumbnail_failed, Toast.LENGTH_SHORT);
362+
Toast.makeText(getApplicationContext(), R.string.note_list_create_thumbnail_failed, Toast.LENGTH_SHORT);
356363
}
357364
}
358365

app/src/main/java/de/hauke_stieler/geonotes/categories/Category.java

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,38 @@
55
import de.hauke_stieler.geonotes.R;
66

77
public class Category {
8-
public final static int NONE_ID = -1;
8+
public final static int NONE_ID = -1; // ID of a dummy category
9+
public final static int UNKNOWN_ID = -2; // ID of a new unsaved category.
910

1011
private final long id;
12+
private final int drawableId;
13+
1114
private String color;
1215
private String name;
13-
private final int drawableId;
16+
private long sortKey;
17+
private boolean hasNotes;
18+
19+
public Category(String color, String name, long sortKey) {
20+
this.id = UNKNOWN_ID;
21+
this.color = color;
22+
this.name = name;
23+
this.sortKey = sortKey;
24+
this.drawableId = R.drawable.shape_item_cetagory_spinner;
25+
}
1426

15-
public Category(long id, String color, String name) {
27+
public Category(long id, String color, String name, long sortKey) {
1628
this.id = id;
1729
this.color = color;
1830
this.name = name;
31+
this.sortKey = sortKey;
1932
this.drawableId = R.drawable.shape_item_cetagory_spinner;
2033
}
2134

22-
public Category(long id, String color, String name, int drawableId) {
35+
public Category(long id, String color, String name, int drawableId, long sortKey) {
2336
this.id = id;
2437
this.color = color;
2538
this.name = name;
39+
this.sortKey = sortKey;
2640
this.drawableId = drawableId;
2741
}
2842

@@ -34,8 +48,8 @@ public String getColorString() {
3448
return color;
3549
}
3650

37-
public void setColorString(String newColor) {
38-
this.color = newColor;
51+
public void setColor(int newColor) {
52+
this.color = String.format("#%06X", (0xFFFFFF & newColor));
3953
}
4054

4155
public int getColor() {
@@ -54,6 +68,22 @@ public int getDrawableId() {
5468
return drawableId;
5569
}
5670

71+
public long getSortKey() {
72+
return sortKey;
73+
}
74+
75+
public void setSortKey(int newKey) {
76+
this.sortKey = newKey;
77+
}
78+
79+
public boolean hasNotes() {
80+
return hasNotes;
81+
}
82+
83+
public void setHasNotes(boolean hasNotes) {
84+
this.hasNotes = hasNotes;
85+
}
86+
5787
@Override
5888
public boolean equals(Object o) {
5989
if (this == o) return true;

0 commit comments

Comments
 (0)