fix(map): make filter panel compact and scrollable
This commit is contained in:
@@ -22,6 +22,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;
|
||||||
|
|
||||||
@@ -48,6 +49,8 @@ implements SensorEventListener {
|
|||||||
|
|
||||||
private LinearLayout filterPanel;
|
private LinearLayout filterPanel;
|
||||||
|
|
||||||
|
private ScrollView filterScroll;
|
||||||
|
|
||||||
private Spinner categorySpinner;
|
private Spinner categorySpinner;
|
||||||
private Spinner deviceSpinner;
|
private Spinner deviceSpinner;
|
||||||
|
|
||||||
@@ -207,7 +210,6 @@ implements SensorEventListener {
|
|||||||
dp(4)
|
dp(4)
|
||||||
);
|
);
|
||||||
|
|
||||||
filterPanel.setVisibility(View.GONE);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Category.
|
* Category.
|
||||||
@@ -387,11 +389,28 @@ implements SensorEventListener {
|
|||||||
|
|
||||||
filterPanel.addView(showAll);
|
filterPanel.addView(showAll);
|
||||||
|
|
||||||
root.addView(
|
/*
|
||||||
|
* 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,
|
filterPanel,
|
||||||
|
new android.widget.FrameLayout.LayoutParams(
|
||||||
|
android.widget.FrameLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
android.widget.FrameLayout.LayoutParams.WRAP_CONTENT
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
root.addView(
|
||||||
|
filterScroll,
|
||||||
new LinearLayout.LayoutParams(
|
new LinearLayout.LayoutParams(
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
0,
|
||||||
|
1
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -441,7 +460,7 @@ implements SensorEventListener {
|
|||||||
new LinearLayout.LayoutParams(
|
new LinearLayout.LayoutParams(
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
0,
|
0,
|
||||||
1
|
2
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -476,19 +495,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
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -646,7 +658,7 @@ implements SensorEventListener {
|
|||||||
/*
|
/*
|
||||||
* Collapse after applying.
|
* Collapse after applying.
|
||||||
*/
|
*/
|
||||||
filterPanel.setVisibility(
|
filterScroll.setVisibility(
|
||||||
View.GONE
|
View.GONE
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -698,7 +710,7 @@ implements SensorEventListener {
|
|||||||
|
|
||||||
return new LinearLayout.LayoutParams(
|
return new LinearLayout.LayoutParams(
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
dp(42)
|
dp(38)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user