diff --git a/CHANGELOG.md b/CHANGELOG.md index 712c6f5..1d28070 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ OpenSeizureDetector Android App - Change Log ============================================ - V4.3.0 - 2024-10-01 + V4.3.1 - Fixed corrupted user interface issues on Android 15 and Android 16. + V4.3.0 - 2025-07-16 - Added support for Android 15 (API 35) to allow publishing on Play Store. - Improved the data sharing screen to show grouped events to reduce the number of events that need to be edited. V4.2.12 - Fixed crash when pressing 'Install Watch App' button by hiding the button if the Pebble data source is not selected diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index e872b83..d430ce7 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="154" + android:versionName="4.3.1"> diff --git a/app/src/main/java/uk/org/openseizuredetector/EditEventActivity.java b/app/src/main/java/uk/org/openseizuredetector/EditEventActivity.java index d0eb881..ff88929 100644 --- a/app/src/main/java/uk/org/openseizuredetector/EditEventActivity.java +++ b/app/src/main/java/uk/org/openseizuredetector/EditEventActivity.java @@ -5,10 +5,13 @@ import android.os.Bundle; import android.os.Handler; import androidx.appcompat.app.AppCompatActivity; +import androidx.core.view.ViewCompat; +import androidx.core.view.WindowInsetsCompat; import android.util.Log; import android.view.View; import android.widget.Button; +import android.widget.LinearLayout; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.TextView; @@ -53,6 +56,22 @@ public class EditEventActivity extends AppCompatActivity { Log.v(TAG, "onCreate()"); super.onCreate(savedInstanceState); setContentView(R.layout.activity_edit_event); + // Handle system window insets for all API levels + View rootView = findViewById(R.id.root_layout_edit_event); + ViewCompat.setOnApplyWindowInsetsListener(rootView, (v, insets) -> { + // Get the system bar insets + int top = insets.getInsets(WindowInsetsCompat.Type.systemBars()).top; + int bottom = insets.getInsets(WindowInsetsCompat.Type.systemBars()).bottom; + + // Apply padding to your main content view + LinearLayout content = findViewById(R.id.edit_event_content_layout); + content.setPadding(0, top, 0, bottom); + + // Return the insets so they keep propagating + return WindowInsetsCompat.CONSUMED; + }); + + mUtil = new OsdUtil(getApplicationContext(), serverStatusHandler); mConnection = new SdServiceConnection(getApplicationContext()); diff --git a/app/src/main/java/uk/org/openseizuredetector/ExportDataActivity.java b/app/src/main/java/uk/org/openseizuredetector/ExportDataActivity.java index afccdc8..cbd858a 100644 --- a/app/src/main/java/uk/org/openseizuredetector/ExportDataActivity.java +++ b/app/src/main/java/uk/org/openseizuredetector/ExportDataActivity.java @@ -13,6 +13,8 @@ import android.os.AsyncTask; import android.os.Handler; import androidx.appcompat.app.AppCompatActivity; +import androidx.core.view.ViewCompat; +import androidx.core.view.WindowInsetsCompat; import android.os.Bundle; import android.os.IBinder; @@ -22,6 +24,7 @@ import android.view.View; import android.widget.Button; import android.widget.DatePicker; import android.widget.EditText; +import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.TimePicker; import android.os.ParcelFileDescriptor; @@ -83,6 +86,21 @@ public class ExportDataActivity extends AppCompatActivity protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_dbquery); + // Handle system window insets for all API levels + View rootView = findViewById(R.id.root_layout_export_data); + ViewCompat.setOnApplyWindowInsetsListener(rootView, (v, insets) -> { + // Get the system bar insets + int top = insets.getInsets(WindowInsetsCompat.Type.systemBars()).top; + int bottom = insets.getInsets(WindowInsetsCompat.Type.systemBars()).bottom; + + // Apply padding to your main content view + LinearLayout content = findViewById(R.id.export_data_content_layout); + content.setPadding(0, top, 0, bottom); + + // Return the insets so they keep propagating + return WindowInsetsCompat.CONSUMED; + }); + mHandler = new Handler(); mUtil = new OsdUtil(this, mHandler); diff --git a/app/src/main/java/uk/org/openseizuredetector/LogManagerControlActivity.java b/app/src/main/java/uk/org/openseizuredetector/LogManagerControlActivity.java index f100f9a..d7c20af 100644 --- a/app/src/main/java/uk/org/openseizuredetector/LogManagerControlActivity.java +++ b/app/src/main/java/uk/org/openseizuredetector/LogManagerControlActivity.java @@ -12,9 +12,12 @@ import android.os.CountDownTimer; import android.os.Handler; import android.os.IBinder; +import androidx.core.graphics.Insets; import androidx.core.view.MenuCompat; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; +import androidx.core.view.ViewCompat; +import androidx.core.view.WindowInsetsCompat; import android.util.Log; import android.view.LayoutInflater; @@ -90,6 +93,20 @@ public class LogManagerControlActivity extends AppCompatActivity { setContentView(R.layout.activity_log_manager_control); + // Handle system window insets for all API levels + View rootView = findViewById(R.id.root_layout_log_manager_control); + ViewCompat.setOnApplyWindowInsetsListener(rootView, (v, insets) -> { + // Get the system bar insets + int top = insets.getInsets(WindowInsetsCompat.Type.systemBars()).top; + int bottom = insets.getInsets(WindowInsetsCompat.Type.systemBars()).bottom; + + // Apply padding to your main content view + LinearLayout content = findViewById(R.id.log_manager_control_content_layout); // Add this ID to your LinearLayout + content.setPadding(0, top, 0, bottom); + + // Return the insets so they keep propagating + return WindowInsetsCompat.CONSUMED; + }); /* Force display of overflow menu - from stackoverflow * "how to force use of..." */ diff --git a/app/src/main/java/uk/org/openseizuredetector/MainActivity2.java b/app/src/main/java/uk/org/openseizuredetector/MainActivity2.java index d6a2d47..291f964 100644 --- a/app/src/main/java/uk/org/openseizuredetector/MainActivity2.java +++ b/app/src/main/java/uk/org/openseizuredetector/MainActivity2.java @@ -26,6 +26,7 @@ import android.view.MenuItem; import android.view.View; import android.view.WindowManager; import android.widget.Button; +import android.widget.LinearLayout; import android.widget.TextView; import com.rohitss.uceh.UCEHandler; @@ -56,23 +57,19 @@ public class MainActivity2 extends AppCompatActivity { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main2); - View root = findViewById(R.id.activity_main2_root_layout); - ViewCompat.setOnApplyWindowInsetsListener(root, (v, insets) -> { - int topInset = 0; - //int topInset = insets.getInsets(WindowInsetsCompat.Type.systemBars()).top; - int actionBarHeight = 0; - TypedValue tv = new TypedValue(); - if (getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) { - actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data,getResources().getDisplayMetrics()); - } - Log.i(TAG, "onCreate() - topInset = " + topInset + ", actionBarHeight = " + actionBarHeight); - v.setPadding( - v.getPaddingLeft(), - actionBarHeight, - v.getPaddingRight(), - v.getPaddingBottom() - ); - return insets; + // Handle system window insets for all API levels + View rootView = findViewById(R.id.activity_main2_root_layout); + ViewCompat.setOnApplyWindowInsetsListener(rootView, (v, insets) -> { + // Get the system bar insets + int top = insets.getInsets(WindowInsetsCompat.Type.systemBars()).top; + int bottom = insets.getInsets(WindowInsetsCompat.Type.systemBars()).bottom; + + // Apply padding to your main content view + LinearLayout content = findViewById(R.id.activity_main2_content_layout); + content.setPadding(0, top, 0, bottom); + + // Return the insets so they keep propagating + return WindowInsetsCompat.CONSUMED; }); diff --git a/app/src/main/java/uk/org/openseizuredetector/ReportSeizureActivity.java b/app/src/main/java/uk/org/openseizuredetector/ReportSeizureActivity.java index 447c23e..c993818 100644 --- a/app/src/main/java/uk/org/openseizuredetector/ReportSeizureActivity.java +++ b/app/src/main/java/uk/org/openseizuredetector/ReportSeizureActivity.java @@ -12,11 +12,14 @@ import android.os.Handler; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; +import androidx.core.view.ViewCompat; +import androidx.core.view.WindowInsetsCompat; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.DatePicker; +import android.widget.LinearLayout; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.TextView; @@ -78,6 +81,21 @@ public class ReportSeizureActivity extends AppCompatActivity { mConnection = new SdServiceConnection(getApplicationContext()); setContentView(R.layout.activity_report_seizure); + // Handle system window insets for all API levels + View rootView = findViewById(R.id.root_layout_report_seizure); + ViewCompat.setOnApplyWindowInsetsListener(rootView, (v, insets) -> { + // Get the system bar insets + int top = insets.getInsets(WindowInsetsCompat.Type.systemBars()).top; + int bottom = insets.getInsets(WindowInsetsCompat.Type.systemBars()).bottom; + + // Apply padding to your main content view + LinearLayout content = findViewById(R.id.report_seizure_content_layout); + content.setPadding(0, top, 0, bottom); + + // Return the insets so they keep propagating + return WindowInsetsCompat.CONSUMED; + }); + mEventTypeRg = findViewById(R.id.eventTypeRg); mEventTypeRg.setOnCheckedChangeListener(onEventTypeChange); diff --git a/app/src/main/res/layout/activity_dbquery.xml b/app/src/main/res/layout/activity_dbquery.xml index 23d97a4..3064451 100644 --- a/app/src/main/res/layout/activity_dbquery.xml +++ b/app/src/main/res/layout/activity_dbquery.xml @@ -1,91 +1,102 @@ - - - - - + android:fitsSystemWindows="true" + tools:context="uk.org.openseizuredetector.LogManager"> + android:layout_height="match_parent" + android:orientation="vertical"> + + + + + + + + + +