Skip to content

Commit ab2c2e6

Browse files
committed
Merge branch 'beta'
2 parents 0f55f10 + f24e9f2 commit ab2c2e6

33 files changed

Lines changed: 1014 additions & 558 deletions

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
OpenSeizureDetector Android App - Change Log
22
============================================
3+
V4.3.1 - Fixed corrupted user interface issues on Android 15 and Android 16.
4+
V4.3.0 - 2025-07-16
5+
- Added support for Android 15 (API 35) to allow publishing on Play Store.
6+
- Improved the data sharing screen to show grouped events to reduce the number of events that need to be edited.
37
V4.2.12 - Fixed crash when pressing 'Install Watch App' button by hiding the button if the Pebble data source is not selected
48
- Added a 'Help' and 'Troubleshooting' button and menu item to draw users' attention to the web site instructions.
59
V4.2.11 - Updated permissions handling to support Android 14 (needed to publish on Play Store)

app/build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
apply plugin: 'com.android.application'
22
apply plugin: 'com.google.gms.google-services'
33
android {
4-
compileSdk 34 // Android 14
4+
compileSdk 36
5+
// Android 14
56
useLibrary 'org.apache.http.legacy'
67

78
defaultConfig {
89
applicationId "uk.org.openseizuredetector"
910
minSdkVersion 23 // Android 6
10-
targetSdkVersion 34 // Android 14 = 34
11+
targetSdkVersion 35 // Android 15 = 35
1112
multiDexEnabled true
1213
}
1314

app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:tools="http://schemas.android.com/tools"
4-
android:versionCode="151"
5-
android:versionName="4.2.12">
4+
android:versionCode="154"
5+
android:versionName="4.3.1">
66
<!-- android:allowBackup="false" -->
77
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
88

app/src/main/java/uk/org/openseizuredetector/EditEventActivity.java

Lines changed: 79 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@
55
import android.os.Handler;
66

77
import androidx.appcompat.app.AppCompatActivity;
8+
import androidx.core.view.ViewCompat;
9+
import androidx.core.view.WindowInsetsCompat;
810

911
import android.util.Log;
1012
import android.view.View;
1113
import android.widget.Button;
14+
import android.widget.LinearLayout;
1215
import android.widget.RadioButton;
1316
import android.widget.RadioGroup;
1417
import android.widget.TextView;
@@ -38,6 +41,7 @@ public class EditEventActivity extends AppCompatActivity {
3841
private String mEventTypeStr = null;
3942
private String mEventSubTypeStr = null;
4043
private String mEventId;
44+
private ArrayList<String> mEventIds; // For group editing
4145
private String mEventNotes = "";
4246
//private Date mEventDateTime;
4347
private RadioGroup mEventTypeRg;
@@ -52,6 +56,22 @@ protected void onCreate(Bundle savedInstanceState) {
5256
Log.v(TAG, "onCreate()");
5357
super.onCreate(savedInstanceState);
5458
setContentView(R.layout.activity_edit_event);
59+
// Handle system window insets for all API levels
60+
View rootView = findViewById(R.id.root_layout_edit_event);
61+
ViewCompat.setOnApplyWindowInsetsListener(rootView, (v, insets) -> {
62+
// Get the system bar insets
63+
int top = insets.getInsets(WindowInsetsCompat.Type.systemBars()).top;
64+
int bottom = insets.getInsets(WindowInsetsCompat.Type.systemBars()).bottom;
65+
66+
// Apply padding to your main content view
67+
LinearLayout content = findViewById(R.id.edit_event_content_layout);
68+
content.setPadding(0, top, 0, bottom);
69+
70+
// Return the insets so they keep propagating
71+
return WindowInsetsCompat.CONSUMED;
72+
});
73+
74+
5575
mUtil = new OsdUtil(getApplicationContext(), serverStatusHandler);
5676
mConnection = new SdServiceConnection(getApplicationContext());
5777

@@ -61,8 +81,15 @@ protected void onCreate(Bundle savedInstanceState) {
6181

6282
Bundle extras = getIntent().getExtras();
6383
if (extras != null) {
64-
String eventId = extras.getString("eventId");
65-
mEventId = eventId;
84+
mEventIds = extras.getStringArrayList("eventIds");
85+
if (mEventIds != null && !mEventIds.isEmpty()) {
86+
Log.v(TAG, "onCreate - Group Edit - eventIds=" + mEventIds.toString());
87+
mEventId = mEventIds.get(0);
88+
} else {
89+
Log.v(TAG, "onCreate - Single Edit - eventId=" + extras.getString("eventId"));
90+
mEventId = extras.getString("eventId");
91+
mEventIds = null;
92+
}
6693
Log.v(TAG, "onCreate - mEventId=" + mEventId);
6794
}
6895

@@ -297,6 +324,7 @@ public void onClick(View view) {
297324
}
298325
Log.v(TAG, "onOK() - eventObj=" + mEventObj.toString());
299326

327+
// First we just save the open event, irrespective of whether it is a group edit or not.
300328
try {
301329
mWac.updateEvent(mEventObj, new WebApiConnection.JSONObjectCallback() {
302330
@Override
@@ -320,9 +348,58 @@ public void accept(JSONObject eventObj) {
320348
mUtil.showToast("Error Updating Event");
321349
updateUi();
322350
}
351+
352+
// If this is a group edit, we need to update the other events in the group.
353+
if (mEventIds != null && mEventIds.size() > 1) {
354+
Log.v(TAG, "onOK() - Group Edit - updating other events in group");
355+
updateGroupEventsSequentially(0);
356+
}
323357
}
358+
324359
};
325360

361+
private void updateGroupEventsSequentially(final int index) {
362+
if (mEventIds == null || index >= mEventIds.size()) {
363+
Log.v(TAG, "updateGroupEventsSequentially - All events updated");
364+
return;
365+
}
366+
final String eventId = mEventIds.get(index);
367+
mWac.getEvent(eventId, new WebApiConnection.JSONObjectCallback() {
368+
@Override
369+
public void accept(JSONObject eventObj) {
370+
if (eventObj == null) {
371+
Log.e(TAG, "updateGroupEventsSequentially - ERROR: could not retrieve event " + eventId);
372+
mUtil.showToast("Error Retrieving Event " + eventId);
373+
updateGroupEventsSequentially(index + 1);
374+
return;
375+
}
376+
try {
377+
eventObj.put("id", eventId);
378+
eventObj.put("type", mEventObj.getString("type"));
379+
eventObj.put("subType", mEventObj.getString("subType"));
380+
eventObj.put("desc", mEventObj.getString("desc"));
381+
} catch (JSONException e) {
382+
Log.e(TAG, "updateGroupEventsSequentially - ERROR: " + e.getMessage());
383+
updateGroupEventsSequentially(index + 1);
384+
return;
385+
}
386+
mWac.updateEvent(eventObj, new WebApiConnection.JSONObjectCallback() {
387+
@Override
388+
public void accept(JSONObject updatedObj) {
389+
if (updatedObj == null) {
390+
Log.e(TAG, "updateGroupEventsSequentially - ERROR: update failed for " + eventId);
391+
mUtil.showToast("Error Updating Event " + eventId);
392+
} else {
393+
Log.v(TAG, "updateGroupEventsSequentially - Updated event " + eventId + " OK");
394+
mUtil.showToast("Event " + eventId + " Updated OK");
395+
}
396+
updateGroupEventsSequentially(index + 1);
397+
}
398+
});
399+
}
400+
});
401+
}
402+
326403

327404
RadioGroup.OnCheckedChangeListener onEventTypeChange =
328405
new RadioGroup.OnCheckedChangeListener() {

app/src/main/java/uk/org/openseizuredetector/ExportDataActivity.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
import android.os.Handler;
1414

1515
import androidx.appcompat.app.AppCompatActivity;
16+
import androidx.core.view.ViewCompat;
17+
import androidx.core.view.WindowInsetsCompat;
1618

1719
import android.os.Bundle;
1820
import android.os.IBinder;
@@ -22,6 +24,7 @@
2224
import android.widget.Button;
2325
import android.widget.DatePicker;
2426
import android.widget.EditText;
27+
import android.widget.LinearLayout;
2528
import android.widget.ProgressBar;
2629
import android.widget.TimePicker;
2730
import android.os.ParcelFileDescriptor;
@@ -83,6 +86,21 @@ public interface BooleanCallback {
8386
protected void onCreate(Bundle savedInstanceState) {
8487
super.onCreate(savedInstanceState);
8588
setContentView(R.layout.activity_dbquery);
89+
// Handle system window insets for all API levels
90+
View rootView = findViewById(R.id.root_layout_export_data);
91+
ViewCompat.setOnApplyWindowInsetsListener(rootView, (v, insets) -> {
92+
// Get the system bar insets
93+
int top = insets.getInsets(WindowInsetsCompat.Type.systemBars()).top;
94+
int bottom = insets.getInsets(WindowInsetsCompat.Type.systemBars()).bottom;
95+
96+
// Apply padding to your main content view
97+
LinearLayout content = findViewById(R.id.export_data_content_layout);
98+
content.setPadding(0, top, 0, bottom);
99+
100+
// Return the insets so they keep propagating
101+
return WindowInsetsCompat.CONSUMED;
102+
});
103+
86104

87105
mHandler = new Handler();
88106
mUtil = new OsdUtil(this, mHandler);

0 commit comments

Comments
 (0)