diff --git a/app/src/main/java/com/wytehat/btlogger/MapActivity.java b/app/src/main/java/com/wytehat/btlogger/MapActivity.java index ed005e8..0bbf5a4 100644 --- a/app/src/main/java/com/wytehat/btlogger/MapActivity.java +++ b/app/src/main/java/com/wytehat/btlogger/MapActivity.java @@ -30,8 +30,9 @@ private float phoneHeading; private boolean mapReady; -private LinearLayout filterPanel; -private TextView filterHeader; +private LinearLayout filterPanel; +private ScrollView filterScroll; +private TextView filterHeader; private boolean filtersExpanded = false; private Spinner deviceSpinner; @@ -210,26 +211,49 @@ protected void onCreate(Bundle state) { LinearLayout.VERTICAL ); - filterPanel.setPadding( - dp(10), - dp(6), - dp(10), - dp(8) - ); + filterPanel.setPadding( + dp(8), + dp(2), + dp(8), + dp(4) + ); - filterPanel.setBackgroundColor( - Color.WHITE - ); + filterPanel.setBackgroundColor( + Color.WHITE + ); - buildFilterPanel(); + buildFilterPanel(); - root.addView( - filterPanel, - new LinearLayout.LayoutParams( - LinearLayout.LayoutParams.MATCH_PARENT, - LinearLayout.LayoutParams.WRAP_CONTENT - ) - ); + /* + * The panel is taller than the screen on a phone, and a LinearLayout + * child with WRAP_CONTENT and no weight simply gets clipped at the + * bottom edge -- which is where Apply/Reset and both Export buttons + * were disappearing to. Inside a ScrollView with a weight it shares + * the screen with the map and scrolls to reach the rest. + */ + filterScroll = + new ScrollView(this); + + filterScroll.setBackgroundColor( + Color.WHITE + ); + + filterScroll.addView( + filterPanel, + new ScrollView.LayoutParams( + ScrollView.LayoutParams.MATCH_PARENT, + ScrollView.LayoutParams.WRAP_CONTENT + ) + ); + + root.addView( + filterScroll, + new LinearLayout.LayoutParams( + LinearLayout.LayoutParams.MATCH_PARENT, + 0, + 1 + ) + ); filterHeader.setOnClickListener( new View.OnClickListener() { @@ -649,27 +673,27 @@ private void buildFilterPanel() { ); filterPanel.addView( - normalizationSeekBar, - new LinearLayout.LayoutParams( - -1, - dp(42) - ) + normalizationSeekBar, + new LinearLayout.LayoutParams( + -1, + dp(28) + ) ); normalizationValueText = new TextView(this); - normalizationValueText.setTextSize(13); - normalizationValueText.setTextColor( - Color.DKGRAY - ); + normalizationValueText.setTextSize(12); + normalizationValueText.setTextColor( + Color.DKGRAY + ); - normalizationValueText.setPadding( - dp(4), - dp(0), - dp(4), - dp(6) - ); + normalizationValueText.setPadding( + dp(4), + dp(0), + dp(4), + dp(2) + ); filterPanel.addView( normalizationValueText @@ -683,12 +707,12 @@ private void buildFilterPanel() { Color.GRAY ); - normalizationStatsText.setPadding( - dp(4), - dp(2), - dp(4), - dp(8) - ); + normalizationStatsText.setPadding( + dp(4), + dp(1), + dp(4), + dp(4) + ); filterPanel.addView( normalizationStatsText @@ -1002,23 +1026,20 @@ private void updateNormalizationControls() { ); normalizationStatsText.setText( - "Current thresholds:\n" + - "Maximum movement speed: " + + "Max speed " + MapFormat.number( normalizer.maxSpeedKmh() ) + - " km/h\n" + - "Duplicate tolerance: " + + " km/h • duplicate " + MapFormat.number( normalizer.duplicateDistance() ) + " m\n" + - "Same-time tolerance: " + + "Same-time " + MapFormat.number( normalizer.sameTimeDistance() ) + - " m\n" + - "GPS accuracy multiplier: " + + " m • accuracy ×" + MapFormat.number( normalizer.accuracyMultiplier() ) @@ -1036,11 +1057,14 @@ private void setFiltersExpanded( filtersExpanded = expanded; - filterPanel.setVisibility( - expanded - ? View.VISIBLE - : View.GONE - ); + // The ScrollView is the child with the layout weight, so it is the one + // that has to go away -- hiding the panel inside it would leave the + // empty scroller still holding half the screen. + filterScroll.setVisibility( + expanded + ? View.VISIBLE + : View.GONE + ); filterHeader.setText( expanded @@ -1055,16 +1079,16 @@ private TextView filterLabel( TextView label = new TextView(this); - label.setText(text); - label.setTextSize(14); - label.setTextColor(Color.DKGRAY); + label.setText(text); + label.setTextSize(13); + label.setTextColor(Color.DKGRAY); - label.setPadding( - dp(2), - dp(6), - dp(2), - dp(2) - ); + label.setPadding( + dp(2), + dp(3), + dp(2), + dp(1) + ); return label; } @@ -1083,11 +1107,11 @@ private Button makeFilterButton( private LinearLayout.LayoutParams weightParams() { - return new LinearLayout.LayoutParams( - 0, - dp(48), - 1 - ); + return new LinearLayout.LayoutParams( + 0, + dp(40), + 1 + ); } private void showDatePicker( @@ -1362,28 +1386,23 @@ private void updateNormalizationSummary() { if (normalizationStatsText == null) return; + // The level and the slider percentage are already on the line above + // this one, so the summary only carries what normalization actually did. normalizationStatsText.setText( - "Level: " + - normalizer.levelName() + - " (" + - normalizer.getAggressiveness() + - "%)\n" + - "Maximum movement speed: " + + "Kept " + + normalizer.retainedCount() + + " of " + + normalizer.examinedCount() + + " points • max " + MapFormat.number( normalizer.maxSpeedKmh() ) + " km/h\n" + - "Raw points examined: " + - normalizer.examinedCount() + - "\n" + - "Points retained: " + - normalizer.retainedCount() + - "\n" + - "Duplicates suppressed: " + + "Removed " + normalizer.duplicateCount() + - "\n" + - "GPS jumps rejected: " + - normalizer.rejectedCount() + " duplicate • " + + normalizer.rejectedCount() + + " GPS jump" ); }