Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
be517f56a5 | ||
|
|
655b01be50 |
@@ -30,8 +30,9 @@ private float phoneHeading;
|
|||||||
|
|
||||||
private boolean mapReady;
|
private boolean mapReady;
|
||||||
|
|
||||||
private LinearLayout filterPanel;
|
private LinearLayout filterPanel;
|
||||||
private TextView filterHeader;
|
private ScrollView filterScroll;
|
||||||
|
private Button filterButton;
|
||||||
private boolean filtersExpanded = false;
|
private boolean filtersExpanded = false;
|
||||||
|
|
||||||
private Spinner deviceSpinner;
|
private Spinner deviceSpinner;
|
||||||
@@ -170,38 +171,49 @@ 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(
|
filterHeaderRow.setOrientation(
|
||||||
"Map Filters ▼"
|
LinearLayout.HORIZONTAL
|
||||||
);
|
);
|
||||||
|
|
||||||
filterHeader.setTextSize(16);
|
filterHeaderRow.setGravity(
|
||||||
filterHeader.setTextColor(Color.DKGRAY);
|
Gravity.CENTER_VERTICAL
|
||||||
|
);
|
||||||
|
|
||||||
filterHeader.setGravity(
|
filterHeaderRow.setPadding(
|
||||||
Gravity.CENTER_VERTICAL
|
dp(8),
|
||||||
);
|
dp(2),
|
||||||
|
dp(8),
|
||||||
|
dp(2)
|
||||||
|
);
|
||||||
|
|
||||||
filterHeader.setPadding(
|
filterButton =
|
||||||
dp(14),
|
new Button(this);
|
||||||
dp(10),
|
|
||||||
dp(14),
|
|
||||||
dp(10)
|
|
||||||
);
|
|
||||||
|
|
||||||
filterHeader.setBackgroundColor(
|
filterButton.setText("☰ Filters");
|
||||||
Color.rgb(238, 238, 238)
|
filterButton.setTextSize(13);
|
||||||
);
|
|
||||||
|
|
||||||
root.addView(
|
filterHeaderRow.addView(
|
||||||
filterHeader,
|
filterButton,
|
||||||
new LinearLayout.LayoutParams(
|
new LinearLayout.LayoutParams(
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||||
dp(48)
|
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
root.addView(
|
||||||
|
filterHeaderRow,
|
||||||
|
new LinearLayout.LayoutParams(
|
||||||
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
filterPanel =
|
filterPanel =
|
||||||
new LinearLayout(this);
|
new LinearLayout(this);
|
||||||
@@ -210,28 +222,51 @@ protected void onCreate(Bundle state) {
|
|||||||
LinearLayout.VERTICAL
|
LinearLayout.VERTICAL
|
||||||
);
|
);
|
||||||
|
|
||||||
filterPanel.setPadding(
|
filterPanel.setPadding(
|
||||||
dp(10),
|
dp(8),
|
||||||
dp(6),
|
dp(2),
|
||||||
dp(10),
|
dp(8),
|
||||||
dp(8)
|
dp(4)
|
||||||
);
|
);
|
||||||
|
|
||||||
filterPanel.setBackgroundColor(
|
filterPanel.setBackgroundColor(
|
||||||
Color.WHITE
|
Color.WHITE
|
||||||
);
|
);
|
||||||
|
|
||||||
buildFilterPanel();
|
buildFilterPanel();
|
||||||
|
|
||||||
root.addView(
|
/*
|
||||||
filterPanel,
|
* The panel is taller than the screen on a phone, and a LinearLayout
|
||||||
new LinearLayout.LayoutParams(
|
* child with WRAP_CONTENT and no weight simply gets clipped at the
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
* bottom edge -- which is where Apply/Reset and both Export buttons
|
||||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
* 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);
|
||||||
|
|
||||||
filterHeader.setOnClickListener(
|
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
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
filterButton.setOnClickListener(
|
||||||
new View.OnClickListener() {
|
new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
@@ -649,27 +684,27 @@ private void buildFilterPanel() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
filterPanel.addView(
|
filterPanel.addView(
|
||||||
normalizationSeekBar,
|
normalizationSeekBar,
|
||||||
new LinearLayout.LayoutParams(
|
new LinearLayout.LayoutParams(
|
||||||
-1,
|
-1,
|
||||||
dp(42)
|
dp(28)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
normalizationValueText =
|
normalizationValueText =
|
||||||
new TextView(this);
|
new TextView(this);
|
||||||
|
|
||||||
normalizationValueText.setTextSize(13);
|
normalizationValueText.setTextSize(12);
|
||||||
normalizationValueText.setTextColor(
|
normalizationValueText.setTextColor(
|
||||||
Color.DKGRAY
|
Color.DKGRAY
|
||||||
);
|
);
|
||||||
|
|
||||||
normalizationValueText.setPadding(
|
normalizationValueText.setPadding(
|
||||||
dp(4),
|
dp(4),
|
||||||
dp(0),
|
dp(0),
|
||||||
dp(4),
|
dp(4),
|
||||||
dp(6)
|
dp(2)
|
||||||
);
|
);
|
||||||
|
|
||||||
filterPanel.addView(
|
filterPanel.addView(
|
||||||
normalizationValueText
|
normalizationValueText
|
||||||
@@ -683,12 +718,12 @@ private void buildFilterPanel() {
|
|||||||
Color.GRAY
|
Color.GRAY
|
||||||
);
|
);
|
||||||
|
|
||||||
normalizationStatsText.setPadding(
|
normalizationStatsText.setPadding(
|
||||||
dp(4),
|
dp(4),
|
||||||
dp(2),
|
dp(1),
|
||||||
dp(4),
|
dp(4),
|
||||||
dp(8)
|
dp(4)
|
||||||
);
|
);
|
||||||
|
|
||||||
filterPanel.addView(
|
filterPanel.addView(
|
||||||
normalizationStatsText
|
normalizationStatsText
|
||||||
@@ -1002,23 +1037,20 @@ private void updateNormalizationControls() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
normalizationStatsText.setText(
|
normalizationStatsText.setText(
|
||||||
"Current thresholds:\n" +
|
"Max speed " +
|
||||||
"Maximum movement speed: " +
|
|
||||||
MapFormat.number(
|
MapFormat.number(
|
||||||
normalizer.maxSpeedKmh()
|
normalizer.maxSpeedKmh()
|
||||||
) +
|
) +
|
||||||
" km/h\n" +
|
" km/h • duplicate " +
|
||||||
"Duplicate tolerance: " +
|
|
||||||
MapFormat.number(
|
MapFormat.number(
|
||||||
normalizer.duplicateDistance()
|
normalizer.duplicateDistance()
|
||||||
) +
|
) +
|
||||||
" m\n" +
|
" m\n" +
|
||||||
"Same-time tolerance: " +
|
"Same-time " +
|
||||||
MapFormat.number(
|
MapFormat.number(
|
||||||
normalizer.sameTimeDistance()
|
normalizer.sameTimeDistance()
|
||||||
) +
|
) +
|
||||||
" m\n" +
|
" m • accuracy ×" +
|
||||||
"GPS accuracy multiplier: " +
|
|
||||||
MapFormat.number(
|
MapFormat.number(
|
||||||
normalizer.accuracyMultiplier()
|
normalizer.accuracyMultiplier()
|
||||||
)
|
)
|
||||||
@@ -1036,17 +1068,16 @@ private void setFiltersExpanded(
|
|||||||
|
|
||||||
filtersExpanded = expanded;
|
filtersExpanded = expanded;
|
||||||
|
|
||||||
filterPanel.setVisibility(
|
// The ScrollView is the child with the layout weight, so it is the one
|
||||||
expanded
|
// that has to go away -- hiding the panel inside it would leave the
|
||||||
? View.VISIBLE
|
// empty scroller still holding half the screen.
|
||||||
: View.GONE
|
filterScroll.setVisibility(
|
||||||
);
|
expanded
|
||||||
|
? View.VISIBLE
|
||||||
|
: View.GONE
|
||||||
|
);
|
||||||
|
|
||||||
filterHeader.setText(
|
filterButton.setText("☰ Filters");
|
||||||
expanded
|
|
||||||
? "Map Filters ▲"
|
|
||||||
: "Map Filters ▼"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private TextView filterLabel(
|
private TextView filterLabel(
|
||||||
@@ -1055,16 +1086,16 @@ private TextView filterLabel(
|
|||||||
TextView label =
|
TextView label =
|
||||||
new TextView(this);
|
new TextView(this);
|
||||||
|
|
||||||
label.setText(text);
|
label.setText(text);
|
||||||
label.setTextSize(14);
|
label.setTextSize(13);
|
||||||
label.setTextColor(Color.DKGRAY);
|
label.setTextColor(Color.DKGRAY);
|
||||||
|
|
||||||
label.setPadding(
|
label.setPadding(
|
||||||
dp(2),
|
dp(2),
|
||||||
dp(6),
|
dp(3),
|
||||||
dp(2),
|
dp(2),
|
||||||
dp(2)
|
dp(1)
|
||||||
);
|
);
|
||||||
|
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
@@ -1083,11 +1114,11 @@ private Button makeFilterButton(
|
|||||||
|
|
||||||
private LinearLayout.LayoutParams weightParams() {
|
private LinearLayout.LayoutParams weightParams() {
|
||||||
|
|
||||||
return new LinearLayout.LayoutParams(
|
return new LinearLayout.LayoutParams(
|
||||||
0,
|
0,
|
||||||
dp(48),
|
dp(40),
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showDatePicker(
|
private void showDatePicker(
|
||||||
@@ -1362,28 +1393,23 @@ private void updateNormalizationSummary() {
|
|||||||
if (normalizationStatsText == null)
|
if (normalizationStatsText == null)
|
||||||
return;
|
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(
|
normalizationStatsText.setText(
|
||||||
"Level: " +
|
"Kept " +
|
||||||
normalizer.levelName() +
|
normalizer.retainedCount() +
|
||||||
" (" +
|
" of " +
|
||||||
normalizer.getAggressiveness() +
|
normalizer.examinedCount() +
|
||||||
"%)\n" +
|
" points • max " +
|
||||||
"Maximum movement speed: " +
|
|
||||||
MapFormat.number(
|
MapFormat.number(
|
||||||
normalizer.maxSpeedKmh()
|
normalizer.maxSpeedKmh()
|
||||||
) +
|
) +
|
||||||
" km/h\n" +
|
" km/h\n" +
|
||||||
"Raw points examined: " +
|
"Removed " +
|
||||||
normalizer.examinedCount() +
|
|
||||||
"\n" +
|
|
||||||
"Points retained: " +
|
|
||||||
normalizer.retainedCount() +
|
|
||||||
"\n" +
|
|
||||||
"Duplicates suppressed: " +
|
|
||||||
normalizer.duplicateCount() +
|
normalizer.duplicateCount() +
|
||||||
"\n" +
|
" duplicate • " +
|
||||||
"GPS jumps rejected: " +
|
normalizer.rejectedCount() +
|
||||||
normalizer.rejectedCount()
|
" GPS jump"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -549,6 +549,7 @@ public final class MapHtmlBuilder {
|
|||||||
+ "<style>"
|
+ "<style>"
|
||||||
+ "html,body,#map{height:100%;margin:0}"
|
+ "html,body,#map{height:100%;margin:0}"
|
||||||
+ ".leaflet-popup-content{font:14px sans-serif;line-height:1.5}"
|
+ ".leaflet-popup-content{font:14px sans-serif;line-height:1.5}"
|
||||||
|
+ ".leaflet-control-layers{font:13px sans-serif}"
|
||||||
|
|
||||||
+ ".phone-bearing{"
|
+ ".phone-bearing{"
|
||||||
+ "position:relative;"
|
+ "position:relative;"
|
||||||
@@ -600,10 +601,13 @@ public final class MapHtmlBuilder {
|
|||||||
|
|
||||||
+ "map=L.map('map',{layers:[streets]}).setView([20,0],2);"
|
+ "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({"
|
+ "L.control.layers({"
|
||||||
+ "'Streets':streets,"
|
+ "'Streets':streets,"
|
||||||
+ "'Satellite':sat"
|
+ "'Satellite':sat"
|
||||||
+ "},null,{collapsed:false}).addTo(map);"
|
+ "},null,{collapsed:true}).addTo(map);"
|
||||||
|
|
||||||
+ "var phone=null,phoneShown=false,"
|
+ "var phone=null,phoneShown=false,"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user