Fix night button selector in context menu
This commit is contained in:
parent
3268968ec2
commit
11b512b5d3
2 changed files with 19 additions and 5 deletions
|
@ -157,7 +157,7 @@
|
||||||
android:layout_marginLeft="@dimen/context_menu_padding_margin_small"
|
android:layout_marginLeft="@dimen/context_menu_padding_margin_small"
|
||||||
android:layout_marginRight="@dimen/context_menu_padding_margin_small"
|
android:layout_marginRight="@dimen/context_menu_padding_margin_small"
|
||||||
android:id="@+id/title_button_view"
|
android:id="@+id/title_button_view"
|
||||||
android:background="?attr/ctx_menu_controller_bg"
|
tools:background="?attr/ctx_menu_controller_bg"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_height="@dimen/context_menu_controller_height"
|
android:layout_height="@dimen/context_menu_controller_height"
|
||||||
|
@ -192,7 +192,7 @@
|
||||||
android:layout_marginLeft="@dimen/context_menu_padding_margin_small"
|
android:layout_marginLeft="@dimen/context_menu_padding_margin_small"
|
||||||
android:layout_marginRight="@dimen/context_menu_padding_margin_small"
|
android:layout_marginRight="@dimen/context_menu_padding_margin_small"
|
||||||
android:id="@+id/title_button_right_view"
|
android:id="@+id/title_button_right_view"
|
||||||
android:background="?attr/ctx_menu_controller_bg"
|
tools:background="?attr/ctx_menu_controller_bg"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_height="@dimen/context_menu_controller_height"
|
android:layout_height="@dimen/context_menu_controller_height"
|
||||||
|
@ -228,7 +228,7 @@
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/download_button_left_view"
|
android:id="@+id/download_button_left_view"
|
||||||
android:background="?attr/ctx_menu_controller_bg"
|
tools:background="?attr/ctx_menu_controller_bg"
|
||||||
android:layout_marginLeft="@dimen/context_menu_padding_margin_small"
|
android:layout_marginLeft="@dimen/context_menu_padding_margin_small"
|
||||||
android:layout_marginRight="@dimen/context_menu_padding_margin_small"
|
android:layout_marginRight="@dimen/context_menu_padding_margin_small"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -253,7 +253,7 @@
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/download_button_right_view"
|
android:id="@+id/download_button_right_view"
|
||||||
android:background="?attr/ctx_menu_controller_bg"
|
tools:background="?attr/ctx_menu_controller_bg"
|
||||||
android:layout_marginLeft="@dimen/context_menu_padding_margin_small"
|
android:layout_marginLeft="@dimen/context_menu_padding_margin_small"
|
||||||
android:layout_marginRight="@dimen/context_menu_padding_margin_small"
|
android:layout_marginRight="@dimen/context_menu_padding_margin_small"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -295,7 +295,7 @@
|
||||||
android:layout_marginLeft="@dimen/context_menu_padding_margin_small"
|
android:layout_marginLeft="@dimen/context_menu_padding_margin_small"
|
||||||
android:layout_marginRight="@dimen/context_menu_padding_margin_small"
|
android:layout_marginRight="@dimen/context_menu_padding_margin_small"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="?attr/ctx_menu_controller_bg">
|
tools:background="?attr/ctx_menu_controller_bg">
|
||||||
|
|
||||||
<net.osmand.plus.widgets.TextViewEx
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
android:id="@+id/title_button_bottom"
|
android:id="@+id/title_button_bottom"
|
||||||
|
|
|
@ -686,6 +686,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
||||||
|
|
||||||
ColorStateList textColorStateList = ContextCompat.getColorStateList(getContext(),
|
ColorStateList textColorStateList = ContextCompat.getColorStateList(getContext(),
|
||||||
nightMode ? R.color.context_menu_controller_text_color_dark : R.color.context_menu_controller_text_color_light);
|
nightMode ? R.color.context_menu_controller_text_color_dark : R.color.context_menu_controller_text_color_light);
|
||||||
|
int buttonViewBackgroundResId = nightMode ? R.drawable.context_menu_controller_bg_dark : R.drawable.context_menu_controller_bg_light;
|
||||||
|
|
||||||
// Title buttons
|
// Title buttons
|
||||||
boolean showTitleButtonsContainer = (leftTitleButtonController != null || rightTitleButtonController != null);
|
boolean showTitleButtonsContainer = (leftTitleButtonController != null || rightTitleButtonController != null);
|
||||||
|
@ -701,6 +702,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
||||||
leftTitleButton.setTextColor(textColorStateList);
|
leftTitleButton.setTextColor(textColorStateList);
|
||||||
if (leftTitleButtonController.visible) {
|
if (leftTitleButtonController.visible) {
|
||||||
leftTitleButtonView.setVisibility(View.VISIBLE);
|
leftTitleButtonView.setVisibility(View.VISIBLE);
|
||||||
|
leftTitleButtonView.setBackgroundResource(buttonViewBackgroundResId);
|
||||||
Drawable leftIcon = leftTitleButtonController.getLeftIcon();
|
Drawable leftIcon = leftTitleButtonController.getLeftIcon();
|
||||||
if (leftIcon != null) {
|
if (leftIcon != null) {
|
||||||
leftTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null);
|
leftTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null);
|
||||||
|
@ -728,6 +730,9 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
||||||
rightTitleButton.setText(rightTitleButtonController.caption);
|
rightTitleButton.setText(rightTitleButtonController.caption);
|
||||||
rightTitleButton.setTextColor(textColorStateList);
|
rightTitleButton.setTextColor(textColorStateList);
|
||||||
rightTitleButtonView.setVisibility(rightTitleButtonController.visible ? View.VISIBLE : View.INVISIBLE);
|
rightTitleButtonView.setVisibility(rightTitleButtonController.visible ? View.VISIBLE : View.INVISIBLE);
|
||||||
|
if (rightTitleButtonController.visible) {
|
||||||
|
rightTitleButtonView.setBackgroundResource(buttonViewBackgroundResId);
|
||||||
|
}
|
||||||
|
|
||||||
Drawable leftIcon = rightTitleButtonController.getLeftIcon();
|
Drawable leftIcon = rightTitleButtonController.getLeftIcon();
|
||||||
rightTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null);
|
rightTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null);
|
||||||
|
@ -743,6 +748,9 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
||||||
bottomTitleButton.setText(bottomTitleButtonController.caption);
|
bottomTitleButton.setText(bottomTitleButtonController.caption);
|
||||||
bottomTitleButton.setTextColor(textColorStateList);
|
bottomTitleButton.setTextColor(textColorStateList);
|
||||||
bottomTitleButtonView.setVisibility(bottomTitleButtonController.visible ? View.VISIBLE : View.GONE);
|
bottomTitleButtonView.setVisibility(bottomTitleButtonController.visible ? View.VISIBLE : View.GONE);
|
||||||
|
if (bottomTitleButtonController.visible) {
|
||||||
|
bottomTitleButtonView.setBackgroundResource(buttonViewBackgroundResId);
|
||||||
|
}
|
||||||
|
|
||||||
Drawable leftIcon = bottomTitleButtonController.getLeftIcon();
|
Drawable leftIcon = bottomTitleButtonController.getLeftIcon();
|
||||||
bottomTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null);
|
bottomTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null);
|
||||||
|
@ -766,6 +774,9 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
||||||
leftDownloadButton.setText(leftDownloadButtonController.caption);
|
leftDownloadButton.setText(leftDownloadButtonController.caption);
|
||||||
leftDownloadButton.setTextColor(textColorStateList);
|
leftDownloadButton.setTextColor(textColorStateList);
|
||||||
leftDownloadButtonView.setVisibility(leftDownloadButtonController.visible ? View.VISIBLE : View.INVISIBLE);
|
leftDownloadButtonView.setVisibility(leftDownloadButtonController.visible ? View.VISIBLE : View.INVISIBLE);
|
||||||
|
if (leftDownloadButtonController.visible) {
|
||||||
|
leftDownloadButtonView.setBackgroundResource(buttonViewBackgroundResId);
|
||||||
|
}
|
||||||
|
|
||||||
Drawable leftIcon = leftDownloadButtonController.getLeftIcon();
|
Drawable leftIcon = leftDownloadButtonController.getLeftIcon();
|
||||||
if (leftIcon != null) {
|
if (leftIcon != null) {
|
||||||
|
@ -783,6 +794,9 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
||||||
rightDownloadButton.setText(rightDownloadButtonController.caption);
|
rightDownloadButton.setText(rightDownloadButtonController.caption);
|
||||||
rightDownloadButton.setTextColor(textColorStateList);
|
rightDownloadButton.setTextColor(textColorStateList);
|
||||||
rightDownloadButtonView.setVisibility(rightDownloadButtonController.visible ? View.VISIBLE : View.INVISIBLE);
|
rightDownloadButtonView.setVisibility(rightDownloadButtonController.visible ? View.VISIBLE : View.INVISIBLE);
|
||||||
|
if (rightDownloadButtonController.visible) {
|
||||||
|
rightDownloadButtonView.setBackgroundResource(buttonViewBackgroundResId);
|
||||||
|
}
|
||||||
|
|
||||||
Drawable leftIcon = rightDownloadButtonController.getLeftIcon();
|
Drawable leftIcon = rightDownloadButtonController.getLeftIcon();
|
||||||
rightDownloadButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null);
|
rightDownloadButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null);
|
||||||
|
|
Loading…
Reference in a new issue