fix(map): make filter panel compact and scrollable

This commit is contained in:
n0tst3v3
2026-08-19 00:50:25 -06:00
parent d5150ba126
commit dc63fffb67
@@ -22,6 +22,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;
@@ -48,6 +49,8 @@ implements SensorEventListener {
private LinearLayout filterPanel;
private ScrollView filterScroll;
private Spinner categorySpinner;
private Spinner deviceSpinner;
@@ -207,7 +210,6 @@ implements SensorEventListener {
dp(4)
);
filterPanel.setVisibility(View.GONE);
/*
* Category.
@@ -387,13 +389,30 @@ implements SensorEventListener {
filterPanel.addView(showAll);
root.addView(
filterPanel,
new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT
)
);
/*
* Bounded to a third of the screen and scrollable, so every
* control stays reachable on short screens.
*/
filterScroll = new ScrollView(this);
filterScroll.setVisibility(View.GONE);
filterScroll.addView(
filterPanel,
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.
@@ -436,13 +455,13 @@ implements SensorEventListener {
}
);
root.addView(
web,
new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
0,
1
)
root.addView(
web,
new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
0,
2
)
);
setContentView(root);
@@ -476,19 +495,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
);
}
}
);
@@ -646,8 +658,8 @@ implements SensorEventListener {
/*
* Collapse after applying.
*/
filterPanel.setVisibility(
View.GONE
filterScroll.setVisibility(
View.GONE
);
}
}
@@ -696,10 +708,10 @@ implements SensorEventListener {
private LinearLayout.LayoutParams compactParams() {
return new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
dp(42)
);
return new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
dp(38)
);
}
private TextView smallLabel(String text) {