From a4855199a56beacea258fec7d84f5cf400acc0dc Mon Sep 17 00:00:00 2001 From: Chumva Date: Wed, 7 Aug 2019 18:45:59 +0300 Subject: [PATCH] Profile settings initial commit --- .../java/net/osmand/router/GeneralRouter.java | 2 + OsmAnd/build.gradle | 1 + .../bg_transparent_rounded_profile.xml | 9 + .../res/layout/fragment_selected_profile.xml | 1058 +++++++++-------- OsmAnd/res/layout/fragment_settings_main.xml | 293 +++++ .../res/layout/global_preference_toolbar.xml | 31 + OsmAnd/res/layout/pref_screen.xml | 19 + .../layout/preference_fragment_and_switch.xml | 67 ++ OsmAnd/res/layout/preference_with_descr.xml | 50 + .../res/layout/profile_preference_toolbar.xml | 70 ++ .../layout/profile_preference_toolbar_big.xml | 144 +++ OsmAnd/res/layout/profiles_list_fragment.xml | 102 +- .../res/layout/simple_preference_category.xml | 27 + OsmAnd/res/values/strings.xml | 31 + OsmAnd/res/values/styles.xml | 11 + OsmAnd/res/xml/configure_profile.xml | 36 + OsmAnd/res/xml/general_profile_settings.xml | 65 + OsmAnd/res/xml/map_during_navigation.xml | 29 + OsmAnd/res/xml/navigation_settings.xml | 160 +-- OsmAnd/res/xml/navigation_settings_old.xml | 106 ++ OsmAnd/res/xml/route_parameters.xml | 32 + OsmAnd/res/xml/screen_alerts.xml | 34 + OsmAnd/res/xml/turn_screen_on.xml | 23 + OsmAnd/res/xml/vehicle_parameters.xml | 9 + OsmAnd/res/xml/voice_announces.xml | 77 ++ OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java | 23 +- OsmAnd/src/net/osmand/plus/OsmandPlugin.java | 13 + .../src/net/osmand/plus/OsmandSettings.java | 19 +- .../osmand/plus/activities/MapActivity.java | 44 +- .../plus/activities/MapActivityActions.java | 22 +- .../SettingsNavigationActivity.java | 6 +- .../osmand/plus/base/BaseOsmAndFragment.java | 5 + .../plus/settings/GeneralProfileSettings.java | 104 ++ .../SettingsBaseProfileDependentFragment.java | 419 +++++++ .../SettingsConfigureProfileFragment.java | 126 ++ .../plus/settings/SettingsMainFragment.java | 139 +++ .../SettingsMapDuringNavigationFragment.java | 118 ++ .../settings/SettingsNavigationFragment.java | 103 ++ .../SettingsRouteParametersFragment.java | 179 +++ .../SettingsScreenAlertsFragment.java | 78 ++ .../SettingsTurnScreenOnFragment.java | 71 ++ .../SettingsVehicleParametersFragment.java | 189 +++ .../SettingsVoiceAnnouncesFragment.java | 203 ++++ .../profiles/EditProfileFragment.java | 936 +++++++++++++++ ...electProfileBottomSheetDialogFragment.java | 286 +++++ .../profiles/SettingsProfileFragment.java | 205 ++++ .../plus/views/ListFloatPreference.java | 85 ++ .../osmand/plus/views/ListIntPreference.java | 77 ++ .../plus/views/SwitchFragmentPreference.java | 29 + 49 files changed, 5285 insertions(+), 680 deletions(-) create mode 100644 OsmAnd/res/drawable/bg_transparent_rounded_profile.xml create mode 100644 OsmAnd/res/layout/fragment_settings_main.xml create mode 100644 OsmAnd/res/layout/global_preference_toolbar.xml create mode 100644 OsmAnd/res/layout/pref_screen.xml create mode 100644 OsmAnd/res/layout/preference_fragment_and_switch.xml create mode 100644 OsmAnd/res/layout/preference_with_descr.xml create mode 100644 OsmAnd/res/layout/profile_preference_toolbar.xml create mode 100644 OsmAnd/res/layout/profile_preference_toolbar_big.xml create mode 100644 OsmAnd/res/layout/simple_preference_category.xml create mode 100644 OsmAnd/res/xml/configure_profile.xml create mode 100644 OsmAnd/res/xml/general_profile_settings.xml create mode 100644 OsmAnd/res/xml/map_during_navigation.xml create mode 100644 OsmAnd/res/xml/navigation_settings_old.xml create mode 100644 OsmAnd/res/xml/route_parameters.xml create mode 100644 OsmAnd/res/xml/screen_alerts.xml create mode 100644 OsmAnd/res/xml/turn_screen_on.xml create mode 100644 OsmAnd/res/xml/vehicle_parameters.xml create mode 100644 OsmAnd/res/xml/voice_announces.xml create mode 100644 OsmAnd/src/net/osmand/plus/settings/GeneralProfileSettings.java create mode 100644 OsmAnd/src/net/osmand/plus/settings/SettingsBaseProfileDependentFragment.java create mode 100644 OsmAnd/src/net/osmand/plus/settings/SettingsConfigureProfileFragment.java create mode 100644 OsmAnd/src/net/osmand/plus/settings/SettingsMainFragment.java create mode 100644 OsmAnd/src/net/osmand/plus/settings/SettingsMapDuringNavigationFragment.java create mode 100644 OsmAnd/src/net/osmand/plus/settings/SettingsNavigationFragment.java create mode 100644 OsmAnd/src/net/osmand/plus/settings/SettingsRouteParametersFragment.java create mode 100644 OsmAnd/src/net/osmand/plus/settings/SettingsScreenAlertsFragment.java create mode 100644 OsmAnd/src/net/osmand/plus/settings/SettingsTurnScreenOnFragment.java create mode 100644 OsmAnd/src/net/osmand/plus/settings/SettingsVehicleParametersFragment.java create mode 100644 OsmAnd/src/net/osmand/plus/settings/SettingsVoiceAnnouncesFragment.java create mode 100644 OsmAnd/src/net/osmand/plus/settings/profiles/EditProfileFragment.java create mode 100644 OsmAnd/src/net/osmand/plus/settings/profiles/SelectProfileBottomSheetDialogFragment.java create mode 100644 OsmAnd/src/net/osmand/plus/settings/profiles/SettingsProfileFragment.java create mode 100644 OsmAnd/src/net/osmand/plus/views/ListFloatPreference.java create mode 100644 OsmAnd/src/net/osmand/plus/views/ListIntPreference.java create mode 100644 OsmAnd/src/net/osmand/plus/views/SwitchFragmentPreference.java diff --git a/OsmAnd-java/src/main/java/net/osmand/router/GeneralRouter.java b/OsmAnd-java/src/main/java/net/osmand/router/GeneralRouter.java index 1dfe878df5..2a3a7403a1 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/GeneralRouter.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/GeneralRouter.java @@ -36,6 +36,8 @@ public class GeneralRouter implements VehicleRouter { public static final String DEFAULT_SPEED = "default_speed"; public static final String MIN_SPEED = "min_speed"; public static final String MAX_SPEED = "max_speed"; + public static final String VEHICLE_HEIGHT = "height"; + public static final String VEHICLE_WEIGHT = "weight"; private final RouteAttributeContext[] objectAttributes; public final Map attributes; diff --git a/OsmAnd/build.gradle b/OsmAnd/build.gradle index c661bd9e07..a59ec3b23f 100644 --- a/OsmAnd/build.gradle +++ b/OsmAnd/build.gradle @@ -384,6 +384,7 @@ dependencies { implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com.android.support:design:27.1.1' implementation 'com.android.support:customtabs:27.1.1' + implementation 'com.android.support:preference-v7:27.1.1' implementation fileTree(include: ['gnu-trove-osmand.jar', 'icu4j-49_1_patched.jar'], dir: 'libs') implementation group: 'commons-logging', name: 'commons-logging', version: '1.2' diff --git a/OsmAnd/res/drawable/bg_transparent_rounded_profile.xml b/OsmAnd/res/drawable/bg_transparent_rounded_profile.xml new file mode 100644 index 0000000000..5f8144c422 --- /dev/null +++ b/OsmAnd/res/drawable/bg_transparent_rounded_profile.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/layout/fragment_selected_profile.xml b/OsmAnd/res/layout/fragment_selected_profile.xml index 3cfd869bf6..0518a9ba99 100644 --- a/OsmAnd/res/layout/fragment_selected_profile.xml +++ b/OsmAnd/res/layout/fragment_selected_profile.xml @@ -1,615 +1,635 @@ - - + android:background="?attr/activity_background_color" + android:orientation="vertical"> - + android:layout_height="wrap_content"> - + android:background="?attr/colorPrimary" + android:minHeight="56dp" + app:theme="@style/ThemeOverlay.AppCompat.ActionBar"> + + + + + + + + - - + android:layout_height="wrap_content" + android:background="?attr/bg_color" + android:clickable="true" + android:focusable="true" + android:foreground="?attr/selectableItemBackground" + android:orientation="vertical"> + android:layout_width="match_parent" + android:layout_height="64dp" + android:orientation="horizontal" + android:paddingStart="@dimen/content_padding" + android:paddingLeft="@dimen/content_padding" + android:paddingEnd="@dimen/content_padding_small" + android:paddingRight="@dimen/content_padding_small"> - + android:layout_gravity="center_vertical" + android:layout_marginEnd="@dimen/bottom_sheet_icon_margin" + android:layout_marginRight="@dimen/bottom_sheet_icon_margin" + android:tint="?attr/default_icon_color" + tools:src="@drawable/ic_action_coordinates_latitude" /> - + android:layout_gravity="center_vertical" + android:layout_marginEnd="@dimen/content_padding" + android:layout_marginRight="@dimen/content_padding" + android:layout_weight="1" + android:gravity="center_vertical" + android:orientation="vertical"> + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + android:layout_height="10dp" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + android:layout_height="@dimen/context_menu_action_buttons_h" + android:layout_marginLeft="@dimen/list_content_padding" + android:layout_marginTop="8dp" + android:layout_marginRight="@dimen/list_content_padding" + android:layout_marginBottom="@dimen/list_content_padding" + android:orientation="vertical"> + + + - + android:background="?attr/selectableItemBackground" + android:clickable="true" + android:focusable="true" + android:orientation="horizontal"> - + + + + + + + + + + + + + + + + android:layout_width="match_parent" + android:layout_height="1dp" + android:background="?attr/divider_color" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginStart="24dp" + android:layout_marginLeft="24dp" + android:layout_marginEnd="@dimen/list_content_padding" + android:layout_marginRight="@dimen/list_content_padding" + android:orientation="vertical"> - - + android:text="@string/configure_map" + android:textColor="?android:textColorPrimary" + android:textSize="@dimen/default_list_text_size" /> + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:layout_marginStart="64dp" + android:layout_marginLeft="64dp" + android:background="?attr/divider_color" /> + android:layout_height="64dp" + android:background="?android:attr/selectableItemBackground" + android:gravity="center_vertical" + android:orientation="horizontal"> - + - + android:layout_marginStart="24dp" + android:layout_marginLeft="24dp" + android:layout_marginEnd="@dimen/list_content_padding" + android:layout_marginRight="@dimen/list_content_padding" + android:orientation="vertical"> + + + + + + + + + + + + + + + + + + + + + - + + + + android:layout_height="wrap_content" + android:layout_gravity="bottom" + android:background="?attr/bg_color" + android:orientation="horizontal" + android:visibility="gone"> - + android:layout_marginTop="@dimen/list_content_padding" + android:layout_marginEnd="8dp" + android:layout_marginRight="8dp" + android:layout_marginBottom="@dimen/list_content_padding" + android:layout_weight="1" + android:background="?attr/profile_cancel_btn" + android:text="@string/shared_string_cancel" + android:textAllCaps="false" + android:textColor="@color/map_widget_blue" /> - + android:layout_marginBottom="@dimen/list_content_padding" + android:layout_weight="1" + android:background="?attr/profile_save_btn" + android:text="@string/shared_string_save" + android:textAllCaps="false" + android:textColor="@color/color_white" /> - - - - - - - - - - - - - - - - - - - + - + +