From 564877e1e7e953267e8b834d08bbfe601901ec28 Mon Sep 17 00:00:00 2001 From: n0tst3v3 Date: Wed, 19 Aug 2026 00:57:05 -0600 Subject: [PATCH] fix(map): make filter panel compact and scrollable --- .../com/wytehat/btlogger/MapActivity.java | 101 ++++++++++++------ 1 file changed, 66 insertions(+), 35 deletions(-) diff --git a/app/src/main/java/com/wytehat/btlogger/MapActivity.java b/app/src/main/java/com/wytehat/btlogger/MapActivity.java index 55be9d6..37f3d90 100644 --- a/app/src/main/java/com/wytehat/btlogger/MapActivity.java +++ b/app/src/main/java/com/wytehat/btlogger/MapActivity.java @@ -26,6 +26,7 @@ import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.CheckBox; import android.widget.LinearLayout; +import android.widget.ScrollView; import android.widget.Spinner; import android.widget.TextView; @@ -54,6 +55,8 @@ implements SensorEventListener { private LinearLayout filterPanel; + + private ScrollView filterScroll; private Spinner categorySpinner; private Spinner deviceSpinner; private Spinner resolutionSpinner; @@ -253,8 +256,6 @@ implements SensorEventListener { dp(4) ); - filterPanel.setVisibility(View.GONE); - /* * Category. */ @@ -321,11 +322,27 @@ implements SensorEventListener { /* * Trail resolution (downsampling). */ + LinearLayout resolutionRow = + new LinearLayout(this); + + resolutionRow.setOrientation( + LinearLayout.HORIZONTAL + ); + + resolutionRow.setGravity( + android.view.Gravity.CENTER_VERTICAL + ); + TextView resolutionLabel = smallLabel("Trail detail"); - filterPanel.addView(resolutionLabel); - + resolutionRow.addView( + resolutionLabel, + new LinearLayout.LayoutParams( + LinearLayout.LayoutParams.WRAP_CONTENT, + LinearLayout.LayoutParams.WRAP_CONTENT + ) + ); resolutionSpinner = new Spinner(this); for (int i = 0; @@ -352,11 +369,16 @@ implements SensorEventListener { resolutionAdapter ); - filterPanel.addView( + resolutionRow.addView( resolutionSpinner, - compactParams() + new LinearLayout.LayoutParams( + 0, + dp(38), + 1 + ) ); + filterPanel.addView(resolutionRow); /* * Time. */ @@ -472,14 +494,30 @@ implements SensorEventListener { filterPanel.addView(showAll); - root.addView( - filterPanel, - new LinearLayout.LayoutParams( - LinearLayout.LayoutParams.MATCH_PARENT, - LinearLayout.LayoutParams.WRAP_CONTENT - ) - ); + /* + * The panel is scrollable and bounded to a third of the + * screen so every control stays reachable on short screens. + */ + filterScroll = new ScrollView(this); + filterScroll.setVisibility(View.GONE); + + filterScroll.addView( + filterPanel, + new android.widget.FrameLayout.LayoutParams( + android.widget.FrameLayout.LayoutParams.MATCH_PARENT, + android.widget.FrameLayout.LayoutParams.WRAP_CONTENT + ) + ); + + root.addView( + filterScroll, + new LinearLayout.LayoutParams( + LinearLayout.LayoutParams.MATCH_PARENT, + 0, + 1 + ) + ); /* * WebView map. */ @@ -521,13 +559,13 @@ implements SensorEventListener { } ); - root.addView( - web, - new LinearLayout.LayoutParams( - LinearLayout.LayoutParams.MATCH_PARENT, - 0, - 1 - ) + root.addView( + web, + new LinearLayout.LayoutParams( + LinearLayout.LayoutParams.MATCH_PARENT, + 0, + 2 + ) ); setContentView(root); @@ -561,19 +599,12 @@ implements SensorEventListener { @Override public void onClick(View view) { - if (filterPanel.getVisibility() - == View.VISIBLE) { - - filterPanel.setVisibility( - View.GONE - ); - - } else { - - filterPanel.setVisibility( - View.VISIBLE - ); - } + filterScroll.setVisibility( + filterScroll.getVisibility() + == View.VISIBLE + ? View.GONE + : View.VISIBLE + ); } } ); @@ -775,8 +806,8 @@ implements SensorEventListener { /* * Collapse after applying. */ - filterPanel.setVisibility( - View.GONE + filterScroll.setVisibility( + View.GONE ); } }