Merge branch 'sasha_pasha_branch' of ssh://github.com/osmandapp/Osmand into sasha_pasha_branch

This commit is contained in:
PavelRatushnyi 2017-09-20 13:13:53 +03:00
commit 689c661496
8 changed files with 54 additions and 14 deletions

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/color_dialog_buttons_dark" android:state_checked="true"/>
<item android:color="@color/ctx_menu_info_text_dark" android:state_checked="false"/>
</selector>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/dashboard_blue" android:state_checked="true"/>
<item android:color="@color/icon_color" android:state_checked="false"/>
</selector>

View file

@ -98,7 +98,7 @@
android:layout_height="wrap_content"
android:background="?attr/bg_color"
app:itemBackground="?attr/bg_color"
app:itemIconTint="@drawable/bottom_navigation_color_selector"
app:itemTextColor="@drawable/bottom_navigation_color_selector"
app:itemIconTint="@color/bottom_navigation_color_selector_light"
app:itemTextColor="@color/bottom_navigation_color_selector_light"
app:menu="@menu/map_markers_bottom_navigation"/>
</LinearLayout>

View file

@ -24,9 +24,9 @@ import net.osmand.plus.OsmandSettings.MapMarkersOrderByMode;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.dashboard.DashboardOnMap;
import net.osmand.plus.mapmarkers.ShowDirectionBottomSheetDialogFragment.ShowDirectionFragmentListener;
import net.osmand.plus.mapmarkers.OptionsBottomSheetDialogFragment.MarkerOptionsFragmentListener;
import net.osmand.plus.mapmarkers.OrderByBottomSheetDialogFragment.OrderByFragmentListener;
import net.osmand.plus.mapmarkers.ShowDirectionBottomSheetDialogFragment.ShowDirectionFragmentListener;
import java.util.ArrayList;
import java.util.Arrays;
@ -44,12 +44,14 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm
private LockableViewPager viewPager;
private TextView orderByModeTitle;
private boolean lightTheme;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
OsmandApplication app = getMyApplication();
boolean isLightTheme = app.getSettings().OSMAND_THEME.get() == OsmandSettings.OSMAND_LIGHT_THEME;
int themeId = isLightTheme ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme;
lightTheme = app.getSettings().OSMAND_THEME.get() == OsmandSettings.OSMAND_LIGHT_THEME;
int themeId = lightTheme ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme;
setStyle(STYLE_NO_FRAME, themeId);
}
@ -95,6 +97,9 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm
View mainView = inflater.inflate(R.layout.fragment_map_markers_dialog, container);
Toolbar toolbar = (Toolbar) mainView.findViewById(R.id.map_markers_toolbar);
if (!lightTheme) {
toolbar.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.actionbar_dark_color));
}
orderByModeTitle = toolbar.findViewById(R.id.order_by_mode_text);
setOrderByMode(getMyApplication().getSettings().MAP_MARKERS_ORDER_BY_MODE.get());
@ -121,6 +126,10 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm
viewPager.setAdapter(adapter);
BottomNavigationView bottomNav = mainView.findViewById(R.id.map_markers_bottom_navigation);
if (!lightTheme) {
bottomNav.setItemIconTintList(ContextCompat.getColorStateList(getContext(), R.color.bottom_navigation_color_selector_dark));
bottomNav.setItemTextColor(ContextCompat.getColorStateList(getContext(), R.color.bottom_navigation_color_selector_dark));
}
bottomNav.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {

View file

@ -1,7 +1,9 @@
package net.osmand.plus.mapmarkers;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.DrawableRes;
import android.support.annotation.Nullable;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
@ -43,7 +45,7 @@ public class OptionsBottomSheetDialogFragment extends BottomSheetDialogFragment
}
((ImageView) mainView.findViewById(R.id.sort_by_icon))
.setImageDrawable(getIcon(R.drawable.ic_sort_waypoint_dark, R.color.on_map_icon_color));
.setImageDrawable(getContentIcon(R.drawable.ic_sort_waypoint_dark));
OsmandSettings.MapMarkersMode mode = getMyApplication().getSettings().MAP_MARKERS_MODE.get();
ImageView showDirectionIcon = (ImageView) mainView.findViewById(R.id.show_direction_icon);
int imageResId = 0;
@ -55,16 +57,16 @@ public class OptionsBottomSheetDialogFragment extends BottomSheetDialogFragment
imageResId = R.drawable.ic_action_device_widget;
break;
}
showDirectionIcon.setBackgroundDrawable(getIcon(R.drawable.ic_action_device_top, R.color.on_map_icon_color));
showDirectionIcon.setBackgroundDrawable(getContentIcon(R.drawable.ic_action_device_top));
if (imageResId != 0) {
showDirectionIcon.setImageDrawable(getIcon(imageResId, R.color.dashboard_blue));
}
((ImageView) mainView.findViewById(R.id.build_route_icon))
.setImageDrawable(getIcon(R.drawable.map_directions, R.color.on_map_icon_color));
.setImageDrawable(getContentIcon(R.drawable.map_directions));
((ImageView) mainView.findViewById(R.id.save_as_new_track_icon))
.setImageDrawable(getIcon(R.drawable.ic_action_polygom_dark, R.color.on_map_icon_color));
.setImageDrawable(getContentIcon(R.drawable.ic_action_polygom_dark));
((ImageView) mainView.findViewById(R.id.move_all_to_history_icon))
.setImageDrawable(getIcon(R.drawable.ic_action_history2, R.color.on_map_icon_color));
.setImageDrawable(getContentIcon(R.drawable.ic_action_history2));
((TextView) mainView.findViewById(R.id.show_direction_text_view)).setText(getMyApplication().getSettings().MAP_MARKERS_MODE.get().toHumanString(getActivity()));
@ -171,6 +173,11 @@ public class OptionsBottomSheetDialogFragment extends BottomSheetDialogFragment
}
}
@Override
protected Drawable getContentIcon(@DrawableRes int id) {
return getIcon(id, getMyApplication().getSettings().isLightContent() ? R.color.on_map_icon_color : R.color.ctx_menu_info_text_dark);
}
interface MarkerOptionsFragmentListener {
void sortByOnClick();

View file

@ -1,7 +1,9 @@
package net.osmand.plus.mapmarkers;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.DrawableRes;
import android.support.annotation.Nullable;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
@ -121,6 +123,11 @@ public class OrderByBottomSheetDialogFragment extends BottomSheetDialogFragment
}
}
@Override
protected Drawable getContentIcon(@DrawableRes int id) {
return getIcon(id, settings.isLightContent() ? R.color.on_map_icon_color : R.color.ctx_menu_info_text_dark);
}
private View.OnClickListener orderByModeOnClickListener = new View.OnClickListener() {
@Override

View file

@ -1,8 +1,10 @@
package net.osmand.plus.mapmarkers;
import android.app.Activity;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.DrawableRes;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.view.ContextThemeWrapper;
@ -116,14 +118,14 @@ public class ShowDirectionBottomSheetDialogFragment extends BottomSheetDialogFra
ImageView topBarIcon = (ImageView) mainView.findViewById(R.id.top_bar_icon);
topBarIcon.setBackgroundDrawable(getIcon(R.drawable.ic_action_device_top, R.color.on_map_icon_color));
topBarIcon.setImageDrawable(getIcon(R.drawable.ic_action_device_topbar, R.color.dashboard_blue));
topBarIcon.setImageDrawable(getContentIcon(R.drawable.ic_action_device_topbar));
ImageView widgetIcon = (ImageView) mainView.findViewById(R.id.widget_icon);
widgetIcon.setBackgroundDrawable(getIcon(R.drawable.ic_action_device_top, R.color.on_map_icon_color));
widgetIcon.setImageDrawable(getIcon(R.drawable.ic_action_device_widget, R.color.dashboard_blue));
widgetIcon.setImageDrawable(getContentIcon(R.drawable.ic_action_device_widget));
ImageView noneIcon = (ImageView) mainView.findViewById(R.id.none_icon);
noneIcon.setBackgroundDrawable(getIcon(R.drawable.ic_action_device_top, R.color.on_map_icon_color));
noneIcon.setBackgroundDrawable(getContentIcon(R.drawable.ic_action_device_top));
mainView.findViewById(R.id.top_bar_row).setOnClickListener(showDirectionOnClickListener);
mainView.findViewById(R.id.widget_row).setOnClickListener(showDirectionOnClickListener);
@ -187,6 +189,11 @@ public class ShowDirectionBottomSheetDialogFragment extends BottomSheetDialogFra
}
}
@Override
protected Drawable getContentIcon(@DrawableRes int id) {
return getIcon(id, night ? R.color.ctx_menu_info_text_dark : R.color.on_map_icon_color);
}
private MapActivity getMapActivity() {
Activity activity = getActivity();
if (activity != null) {

View file

@ -96,7 +96,7 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemV
holder.iconDirection.setVisibility(View.GONE);
holder.icon.setImageDrawable(iconsCache.getIcon(R.drawable.ic_arrow_marker_diretion, markerColor));
holder.mainLayout.setBackgroundColor(ContextCompat.getColor(mapActivity, R.color.markers_top_bar_background));
holder.mainLayout.setBackgroundColor(ContextCompat.getColor(mapActivity, night ? R.color.list_divider_dark : R.color.markers_top_bar_background));
holder.title.setTextColor(ContextCompat.getColor(mapActivity, R.color.color_white));
holder.divider.setBackgroundColor(ContextCompat.getColor(mapActivity, R.color.map_markers_on_map_divider_color));
holder.optionsBtn.setBackgroundDrawable(mapActivity.getResources().getDrawable(R.drawable.marker_circle_background_on_map_with_inset));