Create show all button and fix buttons in bottom view
This commit is contained in:
parent
0c5634a2b6
commit
5bcf02dfed
9 changed files with 56 additions and 8 deletions
|
@ -6,7 +6,7 @@
|
|||
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/ctx_menu_controller_button_outline_color_dark_p" />
|
||||
android:color="@color/ctx_menu_controller_button_outline_color_dark_n" />
|
||||
|
||||
<corners android:radius="3dp" />
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/context_menu_controller_bg_dark_show_all_p" android:state_pressed="true"/>
|
||||
<item android:drawable="@drawable/context_menu_controller_bg_dark_show_all_n"/>
|
||||
</selector>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="@color/ctx_menu_controller_button_bg_color_dark_n" />
|
||||
|
||||
<corners android:radius="3dp" />
|
||||
|
||||
</shape>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="@color/ctx_menu_controller_button_bg_color_dark_p" />
|
||||
|
||||
<corners android:radius="3dp" />
|
||||
|
||||
</shape>
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/ctx_menu_controller_button_outline_color_light_p" />
|
||||
android:color="@color/ctx_menu_controller_button_outline_color_light_n" />
|
||||
|
||||
<corners android:radius="3dp" />
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/context_menu_controller_bg_light_show_all_p" android:state_pressed="true"/>
|
||||
<item android:drawable="@drawable/context_menu_controller_bg_light_show_all_n"/>
|
||||
</selector>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="@color/ctx_menu_controller_button_bg_color_light_n" />
|
||||
|
||||
<corners android:radius="3dp" />
|
||||
|
||||
</shape>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="@color/ctx_menu_controller_button_bg_color_light_p" />
|
||||
|
||||
<corners android:radius="3dp" />
|
||||
|
||||
</shape>
|
|
@ -817,7 +817,7 @@ public class MenuBuilder {
|
|||
for (int i = 0; i < points.size() && i < 10; i++) {
|
||||
final FavouritePoint point = points.get(i);
|
||||
boolean selected = selectedPoint != null && selectedPoint.equals(point);
|
||||
TextViewEx button = buildButtonInCollapsableView(context, selected);
|
||||
TextViewEx button = buildButtonInCollapsableView(context, selected, false);
|
||||
String name = point.getName();
|
||||
button.setText(name);
|
||||
|
||||
|
@ -835,7 +835,7 @@ public class MenuBuilder {
|
|||
}
|
||||
|
||||
if (points.size() > 10) {
|
||||
TextViewEx button = buildButtonInCollapsableView(context, false);
|
||||
TextViewEx button = buildButtonInCollapsableView(context, false, true);
|
||||
button.setText(context.getString(R.string.shared_string_show_all));
|
||||
button.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
|
@ -861,7 +861,7 @@ public class MenuBuilder {
|
|||
for (int i = 0; i < points.size() && i < 10; i++) {
|
||||
final WptPt point = points.get(i);
|
||||
boolean selected = selectedPoint != null && selectedPoint.equals(point);
|
||||
TextViewEx button = buildButtonInCollapsableView(context, selected);
|
||||
TextViewEx button = buildButtonInCollapsableView(context, selected, false);
|
||||
button.setText(point.name);
|
||||
|
||||
if (!selected) {
|
||||
|
@ -878,7 +878,7 @@ public class MenuBuilder {
|
|||
}
|
||||
|
||||
if (points.size() > 10) {
|
||||
TextViewEx button = buildButtonInCollapsableView(context, false);
|
||||
TextViewEx button = buildButtonInCollapsableView(context, false, true);
|
||||
button.setText(context.getString(R.string.shared_string_show_all));
|
||||
button.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
|
@ -901,7 +901,7 @@ public class MenuBuilder {
|
|||
LinearLayout view = (LinearLayout) buildCollapsableContentView(context, collapsed, true);
|
||||
|
||||
for (final Amenity wiki : nearestWiki) {
|
||||
TextViewEx button = buildButtonInCollapsableView(context, false);
|
||||
TextViewEx button = buildButtonInCollapsableView(context, false, false);
|
||||
String name = wiki.getName(preferredMapAppLang, transliterateNames);
|
||||
button.setText(name);
|
||||
|
||||
|
@ -931,7 +931,7 @@ public class MenuBuilder {
|
|||
return view;
|
||||
}
|
||||
|
||||
protected TextViewEx buildButtonInCollapsableView(Context context, boolean selected) {
|
||||
protected TextViewEx buildButtonInCollapsableView(Context context, boolean selected, boolean showAll) {
|
||||
TextViewEx button = new TextViewEx(new ContextThemeWrapper(context, light ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme));
|
||||
LinearLayout.LayoutParams llWikiButtonParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int) context.getResources().getDimension(R.dimen.context_menu_controller_height));
|
||||
llWikiButtonParams.setMargins(0, 0, 0, dpToPx(8f));
|
||||
|
@ -940,6 +940,8 @@ public class MenuBuilder {
|
|||
int bg;
|
||||
if (selected) {
|
||||
bg = light ? R.drawable.context_menu_controller_bg_light_selected: R.drawable.context_menu_controller_bg_dark_selected;
|
||||
} else if (showAll) {
|
||||
bg = light ? R.drawable.context_menu_controller_bg_light_show_all : R.drawable.context_menu_controller_bg_dark_show_all;
|
||||
} else {
|
||||
bg = light ? R.drawable.context_menu_controller_bg_light : R.drawable.context_menu_controller_bg_dark;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue