fix(map): make filter panel compact and scrollable
This commit is contained in:
@@ -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(
|
||||
/*
|
||||
* 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 LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||
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.
|
||||
*/
|
||||
@@ -526,7 +564,7 @@ implements SensorEventListener {
|
||||
new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
0,
|
||||
1
|
||||
2
|
||||
)
|
||||
);
|
||||
|
||||
@@ -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,7 +806,7 @@ implements SensorEventListener {
|
||||
/*
|
||||
* Collapse after applying.
|
||||
*/
|
||||
filterPanel.setVisibility(
|
||||
filterScroll.setVisibility(
|
||||
View.GONE
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user