Change colors

This commit is contained in:
PavelRatushny 2017-12-06 18:38:26 +02:00
parent 69c08218da
commit 8f6f447926
9 changed files with 72 additions and 35 deletions

View file

@ -5,7 +5,8 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent">
android:background="@android:color/transparent"
xmlns:osmand="http://schemas.android.com/apk/res-auto">
<LinearLayout
android:id="@+id/context_menu_main"
@ -345,7 +346,7 @@
android:id="@+id/buttons_top_border"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
android:background="?attr/ctx_menu_divider"/>
<LinearLayout
android:paddingLeft="@dimen/context_menu_padding_margin_small"
@ -374,12 +375,15 @@
android:scaleType="center"
android:src="@drawable/map_action_fav_dark"/>
<TextView
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/context_menu_fav_text_view"
android:layout_marginTop="@dimen/context_menu_padding_margin_small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/favourites_context_menu_add"/>
android:text="@string/favourites_context_menu_add"
android:textColor="@color/ctx_menu_buttons_text_color"
android:textSize="@dimen/default_sub_text_size"
osmand:typeface="@string/font_roboto_regular"/>
</LinearLayout>
@ -401,12 +405,15 @@
android:scaleType="center"
android:src="@drawable/map_action_flag_dark"/>
<TextView
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/context_menu_route_text_view"
android:layout_marginTop="@dimen/context_menu_padding_margin_small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/shared_string_marker"/>
android:text="@string/shared_string_marker"
android:textColor="@color/ctx_menu_buttons_text_color"
android:textSize="@dimen/default_sub_text_size"
osmand:typeface="@string/font_roboto_regular"/>
</LinearLayout>
@ -429,12 +436,15 @@
android:scaleType="center"
android:src="@drawable/map_action_gshare_dark"/>
<TextView
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/context_menu_share_text_view"
android:layout_marginTop="@dimen/context_menu_padding_margin_small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/shared_string_share"/>
android:text="@string/shared_string_share"
android:textColor="@color/ctx_menu_buttons_text_color"
android:textSize="@dimen/default_sub_text_size"
osmand:typeface="@string/font_roboto_regular"/>
</LinearLayout>
@ -457,12 +467,15 @@
android:scaleType="center"
android:src="@drawable/map_overflow_menu_white"/>
<TextView
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/context_menu_more_text_view"
android:layout_marginTop="@dimen/context_menu_padding_margin_small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/shared_string_actions"/>
android:text="@string/shared_string_actions"
android:textColor="@color/ctx_menu_buttons_text_color"
android:textSize="@dimen/default_sub_text_size"
osmand:typeface="@string/font_roboto_regular"/>
</LinearLayout>
@ -472,7 +485,7 @@
android:id="@+id/buttons_bottom_border"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
android:background="?attr/ctx_menu_divider"/>
<LinearLayout
android:id="@+id/context_menu_bottom_buttons"
@ -483,30 +496,35 @@
android:paddingTop="@dimen/context_menu_padding_margin_tiny"
android:paddingBottom="@dimen/context_menu_padding_margin_tiny">
<Button
<net.osmand.plus.widgets.TextViewEx
android:textAllCaps="true"
android:background="?attr/selectableItemBackground"
android:id="@+id/context_menu_details_button"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:paddingLeft="@dimen/context_menu_button_padding_x"
android:paddingRight="@dimen/context_menu_button_padding_x"
android:gravity="start|center_vertical"
android:textColor="?attr/contextMenuButtonColor"
android:textSize="@dimen/default_desc_text_size"
android:layout_gravity="center_vertical"
tools:textColor="?attr/contextMenuButtonColor"
android:textSize="@dimen/default_sub_text_size"
osmand:typeface="@string/font_roboto_medium"
android:text="@string/description"/>
<Button
<net.osmand.plus.widgets.TextViewEx
android:textAllCaps="true"
android:background="?attr/selectableItemBackground"
android:id="@+id/context_menu_directions_button"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:paddingLeft="@dimen/context_menu_button_padding_x"
android:paddingRight="@dimen/context_menu_button_padding_x"
android:gravity="end|center_vertical"
android:textColor="?attr/contextMenuButtonColor"
android:textSize="@dimen/default_desc_text_size"
tools:textColor="?attr/contextMenuButtonColor"
android:textSize="@dimen/default_sub_text_size"
osmand:typeface="@string/font_roboto_medium"
android:text="@string/get_directions"/>
</LinearLayout>

View file

@ -26,6 +26,7 @@
<attr name="ctx_menu_info_view_bg" format="reference" />
<attr name="ctx_menu_controller_bg" format="reference" />
<attr name="ctx_menu_controller_text_color" format="reference" />
<attr name="ctx_menu_divider" format="reference" />
<attr name="bottom_menu_view_bg" format="reference" />
<attr name="left_menu_view_bg" format="reference" />

View file

@ -330,5 +330,13 @@
<color name="ctx_menu_controller_button_bg_color_light_p">#6d82fc</color>
<color name="ctx_menu_controller_button_bg_color_dark_n">#222526</color>
<color name="ctx_menu_controller_button_bg_color_dark_p">#d28521</color>
<color name="ctx_menu_buttons_bg_light">#f2f2f2</color>
<color name="ctx_menu_buttons_bg_dark">#222526</color>
<color name="ctx_menu_buttons_divider_light">#e6e6e6</color>
<color name="ctx_menu_buttons_divider_dark">#2d3133</color>
<color name="ctx_menu_buttons_text_color">#727272</color>
<color name="ctx_menu_buttons_icon_color">#727272</color>
<color name="ctx_menu_bottom_buttons_text_color_light">#536dfe</color>
<color name="ctx_menu_bottom_buttons_text_color_dark">#e69122</color>
</resources>

View file

@ -133,6 +133,7 @@
<item name="ctx_menu_info_view_bg">@color/ctx_menu_info_view_bg_light</item>
<item name="ctx_menu_controller_bg">@drawable/context_menu_controller_bg_light</item>
<item name="ctx_menu_controller_text_color">@drawable/context_menu_controller_text_color_light</item>
<item name="ctx_menu_divider">@color/ctx_menu_buttons_divider_light</item>
<item name="search_background">@color/search_background_dark</item>
<item name="actionModeCloseDrawable">@drawable/ic_action_mode_back</item>
<item name="actionModeStyle">@style/WhiteActionMode</item>
@ -320,6 +321,7 @@
<item name="ctx_menu_info_view_bg">@color/ctx_menu_info_view_bg_dark</item>
<item name="ctx_menu_controller_bg">@drawable/context_menu_controller_bg_dark</item>
<item name="ctx_menu_controller_text_color">@drawable/context_menu_controller_text_color_dark</item>
<item name="ctx_menu_divider">@color/ctx_menu_buttons_divider_dark</item>
<item name="search_background">@color/color_white</item>
<item name="switch_ex_background">@drawable/switch_ex_background_dark</item>
<item name="switch_ex_text_color">@color/switch_ex_button_text_dark</item>

View file

@ -1092,8 +1092,8 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
return menuController == null || menuController.supportZoomIn();
}
public boolean fabVisible() {
return menuController == null || menuController.fabVisible();
public boolean bottomButtonsVisible() {
return menuController == null || menuController.bottomButtonsVisible();
}
public boolean zoomButtonsVisible() {

View file

@ -21,7 +21,6 @@ import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.ViewTreeObserver;
import android.view.animation.DecelerateInterpolator;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.ImageView;
@ -382,19 +381,25 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
zoomButtonsView.setVisibility(View.GONE);
}
View buttonsBottomBorder = view.findViewById(R.id.buttons_bottom_border);
View buttonsTopBorder = view.findViewById(R.id.buttons_top_border);
AndroidUtils.setBackground(getMapActivity(), buttonsTopBorder, nightMode,
R.color.dashboard_divider_light, R.color.dashboard_divider_dark);
View buttons = view.findViewById(R.id.context_menu_buttons);
buttons.setBackgroundColor(ContextCompat.getColor(getContext(), nightMode ? R.color.ctx_menu_buttons_bg_dark : R.color.ctx_menu_buttons_bg_light));
if (!menu.buttonsVisible()) {
View buttons = view.findViewById(R.id.context_menu_buttons);
buttonsTopBorder.setVisibility(View.GONE);
buttons.setVisibility(View.GONE);
}
View bottomButtons = view.findViewById(R.id.context_menu_bottom_buttons);
bottomButtons.setBackgroundColor(ContextCompat.getColor(getContext(), nightMode ? R.color.ctx_menu_buttons_bg_dark : R.color.ctx_menu_buttons_bg_light));
if (!menu.bottomButtonsVisible()) {
buttonsBottomBorder.setVisibility(View.GONE);
bottomButtons.setVisibility(View.GONE);
}
// Action buttons
final ImageView imageFavorite = (ImageView) view.findViewById(R.id.context_menu_fav_image_view);
imageFavorite.setImageDrawable(getIcon(menu.getFavActionIconId(),
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
R.color.ctx_menu_buttons_icon_color));
imageFavorite.setContentDescription(getString(menu.getFavActionStringId()));
View favView = view.findViewById(R.id.context_menu_fav_view);
AndroidUtils.setDashButtonBackground(getMapActivity(), favView, nightMode);
@ -407,7 +412,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
final ImageView imageWaypoint = (ImageView) view.findViewById(R.id.context_menu_route_image_view);
imageWaypoint.setImageDrawable(getIcon(menu.getWaypointActionIconId(),
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
R.color.ctx_menu_buttons_icon_color));
imageWaypoint.setContentDescription(getString(menu.getWaypointActionStringId()));
View waypointView = view.findViewById(R.id.context_menu_route_view);
AndroidUtils.setDashButtonBackground(getMapActivity(), waypointView, nightMode);
@ -424,7 +429,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
final ImageView imageShare = (ImageView) view.findViewById(R.id.context_menu_share_image_view);
imageShare.setImageDrawable(getIcon(R.drawable.map_action_gshare_dark,
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
R.color.ctx_menu_buttons_icon_color));
View shareView = view.findViewById(R.id.context_menu_share_view);
AndroidUtils.setDashButtonBackground(getMapActivity(), shareView, nightMode);
shareView.setOnClickListener(new View.OnClickListener() {
@ -436,7 +441,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
final ImageView imageMore = (ImageView) view.findViewById(R.id.context_menu_more_image_view);
imageMore.setImageDrawable(getIcon(R.drawable.map_overflow_menu_white,
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
R.color.ctx_menu_buttons_icon_color));
View moreView = view.findViewById(R.id.context_menu_more_view);
AndroidUtils.setDashButtonBackground(getMapActivity(), moreView, nightMode);
moreView.setOnClickListener(new View.OnClickListener() {
@ -447,15 +452,18 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
});
//Bottom buttons
Button detailsButton = (Button) view.findViewById(R.id.context_menu_details_button);
int bottomButtonsColor = nightMode ? R.color.ctx_menu_controller_button_text_color_dark_n : R.color.ctx_menu_controller_button_text_color_light_n;
TextView detailsButton = (TextView) view.findViewById(R.id.context_menu_details_button);
detailsButton.setTextColor(ContextCompat.getColor(getContext(), bottomButtonsColor));
detailsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
}
});
Button directionsButton = (Button) view.findViewById(R.id.context_menu_directions_button);
Drawable drawable = getIcon(R.drawable.map_directions, nightMode ? R.color.osmand_orange : R.color.map_widget_blue);
TextView directionsButton = (TextView) view.findViewById(R.id.context_menu_directions_button);
Drawable drawable = getIcon(R.drawable.map_directions, bottomButtonsColor);
directionsButton.setTextColor(ContextCompat.getColor(getContext(), bottomButtonsColor));
directionsButton.setCompoundDrawablesWithIntrinsicBounds(null, null, drawable, null);
directionsButton.setCompoundDrawablePadding(dpToPx(8));
directionsButton.setOnClickListener(new View.OnClickListener() {

View file

@ -350,7 +350,7 @@ public abstract class MenuController extends BaseMenuController {
return true;
}
public boolean fabVisible() {
public boolean bottomButtonsVisible() {
return true;
}

View file

@ -300,7 +300,7 @@ public class MapDataMenuController extends MenuController {
}
@Override
public boolean fabVisible() {
public boolean bottomButtonsVisible() {
return false;
}

View file

@ -78,7 +78,7 @@ public class TransportRouteController extends MenuController {
}
@Override
public boolean fabVisible() {
public boolean bottomButtonsVisible() {
return false;
}