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.Button;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.ScrollView;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
@@ -54,6 +55,8 @@ implements SensorEventListener {
|
|||||||
|
|
||||||
private LinearLayout filterPanel;
|
private LinearLayout filterPanel;
|
||||||
|
|
||||||
|
|
||||||
|
private ScrollView filterScroll;
|
||||||
private Spinner categorySpinner;
|
private Spinner categorySpinner;
|
||||||
private Spinner deviceSpinner;
|
private Spinner deviceSpinner;
|
||||||
private Spinner resolutionSpinner;
|
private Spinner resolutionSpinner;
|
||||||
@@ -253,8 +256,6 @@ implements SensorEventListener {
|
|||||||
dp(4)
|
dp(4)
|
||||||
);
|
);
|
||||||
|
|
||||||
filterPanel.setVisibility(View.GONE);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Category.
|
* Category.
|
||||||
*/
|
*/
|
||||||
@@ -321,11 +322,27 @@ implements SensorEventListener {
|
|||||||
/*
|
/*
|
||||||
* Trail resolution (downsampling).
|
* Trail resolution (downsampling).
|
||||||
*/
|
*/
|
||||||
|
LinearLayout resolutionRow =
|
||||||
|
new LinearLayout(this);
|
||||||
|
|
||||||
|
resolutionRow.setOrientation(
|
||||||
|
LinearLayout.HORIZONTAL
|
||||||
|
);
|
||||||
|
|
||||||
|
resolutionRow.setGravity(
|
||||||
|
android.view.Gravity.CENTER_VERTICAL
|
||||||
|
);
|
||||||
|
|
||||||
TextView resolutionLabel =
|
TextView resolutionLabel =
|
||||||
smallLabel("Trail detail");
|
smallLabel("Trail detail");
|
||||||
|
|
||||||
filterPanel.addView(resolutionLabel);
|
resolutionRow.addView(
|
||||||
|
resolutionLabel,
|
||||||
|
new LinearLayout.LayoutParams(
|
||||||
|
LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||||
|
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||||
|
)
|
||||||
|
);
|
||||||
resolutionSpinner = new Spinner(this);
|
resolutionSpinner = new Spinner(this);
|
||||||
|
|
||||||
for (int i = 0;
|
for (int i = 0;
|
||||||
@@ -352,11 +369,16 @@ implements SensorEventListener {
|
|||||||
resolutionAdapter
|
resolutionAdapter
|
||||||
);
|
);
|
||||||
|
|
||||||
filterPanel.addView(
|
resolutionRow.addView(
|
||||||
resolutionSpinner,
|
resolutionSpinner,
|
||||||
compactParams()
|
new LinearLayout.LayoutParams(
|
||||||
|
0,
|
||||||
|
dp(38),
|
||||||
|
1
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
filterPanel.addView(resolutionRow);
|
||||||
/*
|
/*
|
||||||
* Time.
|
* Time.
|
||||||
*/
|
*/
|
||||||
@@ -472,14 +494,30 @@ implements SensorEventListener {
|
|||||||
|
|
||||||
filterPanel.addView(showAll);
|
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,
|
filterPanel,
|
||||||
new LinearLayout.LayoutParams(
|
new android.widget.FrameLayout.LayoutParams(
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
android.widget.FrameLayout.LayoutParams.MATCH_PARENT,
|
||||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
android.widget.FrameLayout.LayoutParams.WRAP_CONTENT
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
root.addView(
|
||||||
|
filterScroll,
|
||||||
|
new LinearLayout.LayoutParams(
|
||||||
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
0,
|
||||||
|
1
|
||||||
|
)
|
||||||
|
);
|
||||||
/*
|
/*
|
||||||
* WebView map.
|
* WebView map.
|
||||||
*/
|
*/
|
||||||
@@ -526,7 +564,7 @@ implements SensorEventListener {
|
|||||||
new LinearLayout.LayoutParams(
|
new LinearLayout.LayoutParams(
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
0,
|
0,
|
||||||
1
|
2
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -561,19 +599,12 @@ implements SensorEventListener {
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
|
||||||
if (filterPanel.getVisibility()
|
filterScroll.setVisibility(
|
||||||
== View.VISIBLE) {
|
filterScroll.getVisibility()
|
||||||
|
== View.VISIBLE
|
||||||
filterPanel.setVisibility(
|
? View.GONE
|
||||||
View.GONE
|
: View.VISIBLE
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
filterPanel.setVisibility(
|
|
||||||
View.VISIBLE
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -775,7 +806,7 @@ implements SensorEventListener {
|
|||||||
/*
|
/*
|
||||||
* Collapse after applying.
|
* Collapse after applying.
|
||||||
*/
|
*/
|
||||||
filterPanel.setVisibility(
|
filterScroll.setVisibility(
|
||||||
View.GONE
|
View.GONE
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user