Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
be517f56a5 | ||
|
|
655b01be50 |
@@ -31,7 +31,8 @@ private float phoneHeading;
|
||||
private boolean mapReady;
|
||||
|
||||
private LinearLayout filterPanel;
|
||||
private TextView filterHeader;
|
||||
private ScrollView filterScroll;
|
||||
private Button filterButton;
|
||||
private boolean filtersExpanded = false;
|
||||
|
||||
private Spinner deviceSpinner;
|
||||
@@ -170,36 +171,47 @@ protected void onCreate(Bundle state) {
|
||||
)
|
||||
);
|
||||
|
||||
filterHeader =
|
||||
new TextView(this);
|
||||
/*
|
||||
* Compact filter button -- a small button that sits on its own row,
|
||||
* not a full-width grey bar eating 48dp above the map.
|
||||
*/
|
||||
LinearLayout filterHeaderRow =
|
||||
new LinearLayout(this);
|
||||
|
||||
filterHeader.setText(
|
||||
"Map Filters ▼"
|
||||
filterHeaderRow.setOrientation(
|
||||
LinearLayout.HORIZONTAL
|
||||
);
|
||||
|
||||
filterHeader.setTextSize(16);
|
||||
filterHeader.setTextColor(Color.DKGRAY);
|
||||
|
||||
filterHeader.setGravity(
|
||||
filterHeaderRow.setGravity(
|
||||
Gravity.CENTER_VERTICAL
|
||||
);
|
||||
|
||||
filterHeader.setPadding(
|
||||
dp(14),
|
||||
dp(10),
|
||||
dp(14),
|
||||
dp(10)
|
||||
filterHeaderRow.setPadding(
|
||||
dp(8),
|
||||
dp(2),
|
||||
dp(8),
|
||||
dp(2)
|
||||
);
|
||||
|
||||
filterHeader.setBackgroundColor(
|
||||
Color.rgb(238, 238, 238)
|
||||
filterButton =
|
||||
new Button(this);
|
||||
|
||||
filterButton.setText("☰ Filters");
|
||||
filterButton.setTextSize(13);
|
||||
|
||||
filterHeaderRow.addView(
|
||||
filterButton,
|
||||
new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||
)
|
||||
);
|
||||
|
||||
root.addView(
|
||||
filterHeader,
|
||||
filterHeaderRow,
|
||||
new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
dp(48)
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||
)
|
||||
);
|
||||
|
||||
@@ -211,10 +223,10 @@ protected void onCreate(Bundle state) {
|
||||
);
|
||||
|
||||
filterPanel.setPadding(
|
||||
dp(10),
|
||||
dp(6),
|
||||
dp(10),
|
||||
dp(8)
|
||||
dp(8),
|
||||
dp(2),
|
||||
dp(8),
|
||||
dp(4)
|
||||
);
|
||||
|
||||
filterPanel.setBackgroundColor(
|
||||
@@ -223,15 +235,38 @@ protected void onCreate(Bundle state) {
|
||||
|
||||
buildFilterPanel();
|
||||
|
||||
root.addView(
|
||||
/*
|
||||
* 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 LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||
new ScrollView.LayoutParams(
|
||||
ScrollView.LayoutParams.MATCH_PARENT,
|
||||
ScrollView.LayoutParams.WRAP_CONTENT
|
||||
)
|
||||
);
|
||||
|
||||
filterHeader.setOnClickListener(
|
||||
root.addView(
|
||||
filterScroll,
|
||||
new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
0,
|
||||
1
|
||||
)
|
||||
);
|
||||
|
||||
filterButton.setOnClickListener(
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
@@ -652,14 +687,14 @@ private void buildFilterPanel() {
|
||||
normalizationSeekBar,
|
||||
new LinearLayout.LayoutParams(
|
||||
-1,
|
||||
dp(42)
|
||||
dp(28)
|
||||
)
|
||||
);
|
||||
|
||||
normalizationValueText =
|
||||
new TextView(this);
|
||||
|
||||
normalizationValueText.setTextSize(13);
|
||||
normalizationValueText.setTextSize(12);
|
||||
normalizationValueText.setTextColor(
|
||||
Color.DKGRAY
|
||||
);
|
||||
@@ -668,7 +703,7 @@ private void buildFilterPanel() {
|
||||
dp(4),
|
||||
dp(0),
|
||||
dp(4),
|
||||
dp(6)
|
||||
dp(2)
|
||||
);
|
||||
|
||||
filterPanel.addView(
|
||||
@@ -685,9 +720,9 @@ private void buildFilterPanel() {
|
||||
|
||||
normalizationStatsText.setPadding(
|
||||
dp(4),
|
||||
dp(2),
|
||||
dp(1),
|
||||
dp(4),
|
||||
dp(8)
|
||||
dp(4)
|
||||
);
|
||||
|
||||
filterPanel.addView(
|
||||
@@ -1002,23 +1037,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,17 +1068,16 @@ private void setFiltersExpanded(
|
||||
|
||||
filtersExpanded = expanded;
|
||||
|
||||
filterPanel.setVisibility(
|
||||
// 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
|
||||
? "Map Filters ▲"
|
||||
: "Map Filters ▼"
|
||||
);
|
||||
filterButton.setText("☰ Filters");
|
||||
}
|
||||
|
||||
private TextView filterLabel(
|
||||
@@ -1056,14 +1087,14 @@ private TextView filterLabel(
|
||||
new TextView(this);
|
||||
|
||||
label.setText(text);
|
||||
label.setTextSize(14);
|
||||
label.setTextSize(13);
|
||||
label.setTextColor(Color.DKGRAY);
|
||||
|
||||
label.setPadding(
|
||||
dp(2),
|
||||
dp(6),
|
||||
dp(3),
|
||||
dp(2),
|
||||
dp(2)
|
||||
dp(1)
|
||||
);
|
||||
|
||||
return label;
|
||||
@@ -1085,7 +1116,7 @@ private LinearLayout.LayoutParams weightParams() {
|
||||
|
||||
return new LinearLayout.LayoutParams(
|
||||
0,
|
||||
dp(48),
|
||||
dp(40),
|
||||
1
|
||||
);
|
||||
}
|
||||
@@ -1362,28 +1393,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"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -549,6 +549,7 @@ public final class MapHtmlBuilder {
|
||||
+ "<style>"
|
||||
+ "html,body,#map{height:100%;margin:0}"
|
||||
+ ".leaflet-popup-content{font:14px sans-serif;line-height:1.5}"
|
||||
+ ".leaflet-control-layers{font:13px sans-serif}"
|
||||
|
||||
+ ".phone-bearing{"
|
||||
+ "position:relative;"
|
||||
@@ -600,10 +601,13 @@ public final class MapHtmlBuilder {
|
||||
|
||||
+ "map=L.map('map',{layers:[streets]}).setView([20,0],2);"
|
||||
|
||||
// collapsed:true is what makes this the floating corner button
|
||||
// that opens on tap. collapsed:false pins the whole list open
|
||||
// over the map as a permanent box.
|
||||
+ "L.control.layers({"
|
||||
+ "'Streets':streets,"
|
||||
+ "'Satellite':sat"
|
||||
+ "},null,{collapsed:false}).addTo(map);"
|
||||
+ "},null,{collapsed:true}).addTo(map);"
|
||||
|
||||
+ "var phone=null,phoneShown=false,"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user