Merge pull request #7072 from osmandapp/RoutePreparationUiFixes

Route preparation UI fixes
This commit is contained in:
Alexey 2019-06-21 11:06:24 +03:00 committed by GitHub
commit dc5158ce78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 15 deletions

View file

@ -30,7 +30,6 @@
android:id="@+id/modes_layout" android:id="@+id/modes_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/card_and_list_background_basic"
tools:ignore="UselessParent"> tools:ignore="UselessParent">
<LinearLayout <LinearLayout

View file

@ -36,9 +36,9 @@
android:letterSpacing="@dimen/text_button_letter_spacing" android:letterSpacing="@dimen/text_button_letter_spacing"
android:maxLines="1" android:maxLines="1"
android:paddingBottom="3dp" android:paddingBottom="3dp"
android:paddingEnd="4dp" android:paddingEnd="16dp"
android:paddingLeft="3dp" android:paddingLeft="3dp"
android:paddingRight="4dp" android:paddingRight="16dp"
android:paddingStart="3dp" android:paddingStart="3dp"
android:paddingTop="3dp" android:paddingTop="3dp"
android:text="@string/routing_attr_avoid_motorway_name" android:text="@string/routing_attr_avoid_motorway_name"

View file

@ -165,6 +165,13 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment {
return nightMode; return nightMode;
} }
public void updateNightMode() {
OsmandApplication app = getMyApplication();
if (app != null) {
nightMode = app.getDaynightHelper().isNightModeForMapControls();
}
}
public String getPreferredMapLang() { public String getPreferredMapLang() {
return preferredMapLang; return preferredMapLang;
} }
@ -238,7 +245,7 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment {
MapActivity mapActivity = requireMapActivity(); MapActivity mapActivity = requireMapActivity();
OsmandApplication app = mapActivity.getMyApplication(); OsmandApplication app = mapActivity.getMyApplication();
nightMode = app.getDaynightHelper().isNightModeForMapControls(); updateNightMode();
preferredMapLang = app.getSettings().MAP_PREFERRED_LOCALE.get(); preferredMapLang = app.getSettings().MAP_PREFERRED_LOCALE.get();
transliterateNames = app.getSettings().MAP_TRANSLITERATE_NAMES.get(); transliterateNames = app.getSettings().MAP_TRANSLITERATE_NAMES.get();

View file

@ -425,31 +425,40 @@ public class MapRouteInfoMenuFragment extends ContextMenuFragment {
if (ctx == null || mainView == null || view == null) { if (ctx == null || mainView == null || view == null) {
return; return;
} }
updateNightMode();
boolean nightMode = isNightMode(); AndroidUtils.setBackground(ctx, view.findViewById(R.id.modes_layout_toolbar_container), isNightMode(),
AndroidUtils.setBackground(ctx, view.findViewById(R.id.modes_layout_toolbar_container), nightMode,
R.color.card_and_list_background_light, R.color.card_and_list_background_dark); R.color.card_and_list_background_light, R.color.card_and_list_background_dark);
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerFromDropDown), nightMode, AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerFromDropDown), isNightMode(),
R.color.divider_light, R.color.divider_dark); R.color.divider_light, R.color.divider_dark);
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.viaLayoutDivider), nightMode, AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.viaLayoutDivider), isNightMode(),
R.color.divider_light, R.color.divider_dark); R.color.divider_light, R.color.divider_dark);
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerButtons), nightMode, AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerButtons), isNightMode(),
R.color.divider_light, R.color.divider_dark); R.color.divider_light, R.color.divider_dark);
AndroidUtils.setBackground(ctx, view.findViewById(R.id.controls_divider), nightMode, AndroidUtils.setBackground(ctx, view.findViewById(R.id.controls_divider), isNightMode(),
R.color.divider_light, R.color.divider_dark); R.color.divider_light, R.color.divider_dark);
AndroidUtils.setBackground(ctx, view.findViewById(R.id.app_modes_options_container), nightMode, AndroidUtils.setBackground(ctx, view.findViewById(R.id.app_modes_options_container), isNightMode(),
R.drawable.route_info_trans_gradient_light, R.drawable.route_info_trans_gradient_dark); R.drawable.route_info_trans_gradient_light, R.drawable.route_info_trans_gradient_dark);
AndroidUtils.setBackground(ctx, view.findViewById(R.id.app_modes_fold_container), nightMode, AndroidUtils.setBackground(ctx, view.findViewById(R.id.app_modes_fold_container), isNightMode(),
R.drawable.route_info_trans_gradient_left_light, R.drawable.route_info_trans_gradient_left_dark); R.drawable.route_info_trans_gradient_left_light, R.drawable.route_info_trans_gradient_left_dark);
AndroidUtils.setBackground(ctx, getBottomScrollView(), isNightMode(),
R.color.activity_background_light, R.color.activity_background_dark);
AndroidUtils.setBackground(ctx, getCardsContainer(), isNightMode(),
R.color.activity_background_light, R.color.activity_background_dark);
int activeColor = ContextCompat.getColor(ctx, nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light); if (getTopViewId() != 0) {
View topView = view.findViewById(getTopViewId());
AndroidUtils.setBackground(ctx, topView, isNightMode(), R.color.card_and_list_background_light, R.color.card_and_list_background_dark);
}
int activeColor = ContextCompat.getColor(ctx, isNightMode() ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
((TextView) view.findViewById(R.id.cancel_button_descr)).setTextColor(activeColor); ((TextView) view.findViewById(R.id.cancel_button_descr)).setTextColor(activeColor);
((TextView) mainView.findViewById(R.id.from_button_description)).setTextColor(activeColor); ((TextView) mainView.findViewById(R.id.from_button_description)).setTextColor(activeColor);
((TextView) mainView.findViewById(R.id.via_button_description)).setTextColor(activeColor); ((TextView) mainView.findViewById(R.id.via_button_description)).setTextColor(activeColor);
((TextView) mainView.findViewById(R.id.to_button_description)).setTextColor(activeColor); ((TextView) mainView.findViewById(R.id.to_button_description)).setTextColor(activeColor);
((TextView) mainView.findViewById(R.id.map_options_route_button_title)).setTextColor(activeColor); ((TextView) mainView.findViewById(R.id.map_options_route_button_title)).setTextColor(activeColor);
int mainFontColor = ContextCompat.getColor(ctx, nightMode ? R.color.main_font_dark : R.color.main_font_light); int mainFontColor = ContextCompat.getColor(ctx, isNightMode() ? R.color.main_font_dark : R.color.main_font_light);
((TextView) mainView.findViewById(R.id.fromText)).setTextColor(mainFontColor); ((TextView) mainView.findViewById(R.id.fromText)).setTextColor(mainFontColor);
((TextView) mainView.findViewById(R.id.ViaView)).setTextColor(mainFontColor); ((TextView) mainView.findViewById(R.id.ViaView)).setTextColor(mainFontColor);
((TextView) mainView.findViewById(R.id.toText)).setTextColor(mainFontColor); ((TextView) mainView.findViewById(R.id.toText)).setTextColor(mainFontColor);

View file

@ -173,7 +173,7 @@ public class RouteOptionsBottomSheet extends MenuBottomSheetDialogFragment {
} }
Bundle args = new Bundle(); Bundle args = new Bundle();
ShowAlongTheRouteBottomSheet fragment = new ShowAlongTheRouteBottomSheet(); ShowAlongTheRouteBottomSheet fragment = new ShowAlongTheRouteBottomSheet();
fragment.setUsedOnMap(false); fragment.setUsedOnMap(true);
fragment.setArguments(args); fragment.setArguments(args);
fragment.setTargetFragment(RouteOptionsBottomSheet.this, ShowAlongTheRouteBottomSheet.REQUEST_CODE); fragment.setTargetFragment(RouteOptionsBottomSheet.this, ShowAlongTheRouteBottomSheet.REQUEST_CODE);
fragment.show(fm, ShowAlongTheRouteBottomSheet.TAG); fragment.show(fm, ShowAlongTheRouteBottomSheet.TAG);